4 |
|
|
5 |
import javax.swing.ImageIcon; |
import javax.swing.ImageIcon; |
6 |
|
|
|
import org.geotools.styling.Style; |
|
7 |
import org.geotools.coverage.grid.GridCoverage2D; |
import org.geotools.coverage.grid.GridCoverage2D; |
8 |
|
import org.geotools.styling.Style; |
9 |
|
|
10 |
import schmitzm.geotools.JTSUtil; |
import schmitzm.geotools.JTSUtil; |
11 |
import schmitzm.geotools.grid.GridUtil; |
import schmitzm.geotools.grid.GridUtil; |
|
|
|
|
import skrueger.i8n.Translation; |
|
12 |
import skrueger.RasterLegendData; |
import skrueger.RasterLegendData; |
13 |
|
import skrueger.i8n.Translation; |
14 |
|
|
15 |
/** |
/** |
16 |
* This class provides a simple implementation of {@link StyledMapInterface} |
* This class provides a simple implementation of {@link StyledLayerInterface} |
17 |
* for {@link GridCoverage2D}. The uncache functionality is not supported, |
* for {@link GridCoverage2D}. The uncache functionality is not supported, |
18 |
* because this class bases on an existing {@link GridCoverage2D} object in |
* because this class bases on an existing {@link GridCoverage2D} object in |
19 |
* memory. |
* memory. |
20 |
* @author <a href="mailto:[email protected]">Martin Schmitz</a> (University of Bonn/Germany) |
* @author <a href="mailto:[email protected]">Martin Schmitz</a> (University of Bonn/Germany) |
21 |
* @version 1.0 |
* @version 1.0 |
22 |
*/ |
*/ |
23 |
public class StyledGridCoverage extends AbstractStyledMap<GridCoverage2D> implements StyledGridCoverageInterface { |
public class StyledGridCoverage extends AbstractStyledLayer<GridCoverage2D> implements StyledGridCoverageInterface { |
24 |
|
|
25 |
/** Holds the meta data for displaying a legend. */ |
/** Holds the meta data for displaying a legend. */ |
26 |
protected RasterLegendData legendData = null; |
protected RasterLegendData legendData = null; |
53 |
* @param icon an icon for the object (can be {@code null}) |
* @param icon an icon for the object (can be {@code null}) |
54 |
* @exception IllegalArgumentException if {@code null} is given as ID or geo object |
* @exception IllegalArgumentException if {@code null} is given as ID or geo object |
55 |
*/ |
*/ |
56 |
public StyledGridCoverage(GridCoverage2D gc, String id, Translation title, Translation desc, Translation keywords, StyledMapStyle<RasterLegendData> style, ImageIcon icon) { |
public StyledGridCoverage(GridCoverage2D gc, String id, Translation title, Translation desc, Translation keywords, StyledLayerStyle<RasterLegendData> style, ImageIcon icon) { |
57 |
super(gc, JTSUtil.createEnvelope(gc.getEnvelope()), gc.getCoordinateReferenceSystem(), id, title, desc, keywords, style != null ? style.getGeoObjectStyle() : null, icon); |
super(gc, JTSUtil.createEnvelope(gc.getEnvelope()), gc.getCoordinateReferenceSystem(), id, title, desc, keywords, style != null ? style.getGeoObjectStyle() : null, icon); |
58 |
setLegendMetaData( style != null ? style.getMetaData() : null ); |
setLegendMetaData( style != null ? style.getMetaData() : null ); |
59 |
} |
} |
102 |
* @param icon an icon for the object (can be {@code null}) |
* @param icon an icon for the object (can be {@code null}) |
103 |
* @exception IllegalArgumentException if {@code null} is given as ID or geo object |
* @exception IllegalArgumentException if {@code null} is given as ID or geo object |
104 |
*/ |
*/ |
105 |
public StyledGridCoverage(GridCoverage2D gc, String id, String title, String desc, String keywords, StyledMapStyle<RasterLegendData> style, ImageIcon icon) { |
public StyledGridCoverage(GridCoverage2D gc, String id, String title, String desc, String keywords, StyledLayerStyle<RasterLegendData> style, ImageIcon icon) { |
106 |
this(gc, |
this(gc, |
107 |
id, |
id, |
108 |
title, |
title, |
136 |
* @param style a display style with legend information |
* @param style a display style with legend information |
137 |
* @exception IllegalArgumentException if {@code null} is given as ID or geo object |
* @exception IllegalArgumentException if {@code null} is given as ID or geo object |
138 |
*/ |
*/ |
139 |
public StyledGridCoverage(GridCoverage2D gc, String id, String title, StyledMapStyle<RasterLegendData> style) { |
public StyledGridCoverage(GridCoverage2D gc, String id, String title, StyledLayerStyle<RasterLegendData> style) { |
140 |
this(gc, |
this(gc, |
141 |
id, |
id, |
142 |
title, |
title, |
193 |
} |
} |
194 |
|
|
195 |
/** |
/** |
196 |
* Does nothing, because the {@link AbstractStyledMap} bases on existing |
* Does nothing, because the {@link AbstractStyledLayer} bases on existing |
197 |
* objects (in memory) which can not be uncached and reloaded. |
* objects (in memory) which can not be uncached and reloaded. |
198 |
*/ |
*/ |
199 |
public void uncache() { |
public void uncache() { |
202 |
|
|
203 |
/* |
/* |
204 |
* (non-Javadoc) |
* (non-Javadoc) |
205 |
* @see skrueger.geotools.StyledMapInterface#getInfoURL() |
* @see skrueger.geotools.StyledLayerInterface#getInfoURL() |
206 |
*/ |
*/ |
207 |
public URL getInfoURL() { |
public URL getInfoURL() { |
208 |
return null; |
return null; |
209 |
} |
} |
210 |
|
|
211 |
|
/** |
212 |
|
* If true, this layer will not be shown in the legend. Default = false |
213 |
|
*/ |
214 |
|
/** |
215 |
|
* |
216 |
|
* Killed by SK: 6. April 09: Ein Layer soll nicht generell auf |
217 |
|
* verstecken/nicht verstecken gestellt werden können. Das sind |
218 |
|
* Eigenschaften der Karte/MapContext, ebenso wie die Reihenfolge der Layer. |
219 |
|
* Im Atlas verwaltet deshalb nun die Klasse skrueger.atlas.Map welche Layer |
220 |
|
* nicht in der Legende auftauchen sollen. Meines Wissens hat keiner bisher |
221 |
|
* die Funktion genutzt. |
222 |
|
* |
223 |
public boolean isHideInLegend() { |
public boolean isHideInLegend() { |
224 |
return false; |
return false; |
225 |
} |
} |
226 |
|
*/ |
227 |
|
|
228 |
} |
} |