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