1 |
mojays |
2 |
package skrueger.geotools; |
2 |
|
|
|
3 |
|
|
import java.net.URL; |
4 |
|
|
|
5 |
|
|
import javax.swing.ImageIcon; |
6 |
|
|
|
7 |
mojays |
127 |
import org.geotools.feature.FeatureCollection; |
8 |
mojays |
2 |
import org.geotools.styling.Style; |
9 |
|
|
import org.opengis.referencing.crs.CoordinateReferenceSystem; |
10 |
|
|
|
11 |
mojays |
127 |
import skrueger.AttributeMetaData; |
12 |
|
|
import skrueger.RasterLegendData; |
13 |
mojays |
2 |
import skrueger.i8n.Translation; |
14 |
|
|
|
15 |
|
|
import com.vividsolutions.jts.geom.Envelope; |
16 |
|
|
|
17 |
|
|
/** |
18 |
|
|
* This class is the top interface for styled objects to be managed in |
19 |
|
|
* {@link MapContextManagerInterface}. The (rough) classe structure is the |
20 |
|
|
* following: |
21 |
|
|
* <ul> |
22 |
|
|
* <li><b>{@link StyledMapInterface StyledMapInterface<E>}</b> |
23 |
|
|
* <ul> |
24 |
|
|
* <li>{@link #getId()} -> String</li> |
25 |
|
|
* <li>{@link #getKeywords() get/setKeywords()} -> {@link Translation}</li> |
26 |
|
|
* <li>{@link #getTitle() set/getTitle()} -> {@link Translation} (short |
27 |
|
|
* description for layer list)</li> |
28 |
alfonx |
39 |
* <li>{@link #getDesc() set/getDesc()} -> {@link Translation} (long description |
29 |
|
|
* for details)</li> |
30 |
mojays |
2 |
* <li>{@link #getCrs()} -> {@link CoordinateReferenceSystem}</li> |
31 |
|
|
* <li>{@link #getCRSString()} -> String (readable description of CRS)</li> |
32 |
|
|
* <li>{@link #getEnvelope()} -> {@link Envelope} (JTS-Envelope)</li> |
33 |
|
|
* <li>{@link #getGeoObject()} -> E (GridCoverage/FeatureCollection/...)</li> |
34 |
|
|
* <li>{@link #getStyle() set/getStyle()} -> {@link Style}</li> |
35 |
|
|
* <li>{@link #uncache()}</li> |
36 |
|
|
* <li>{@link #dispose()}</li> |
37 |
|
|
* </ul> |
38 |
|
|
* </li> |
39 |
|
|
* <li><b>{@link StyledFeatureCollectionInterface} extends |
40 |
|
|
* {@link StyledMapInterface StyledMapInterface<FeatureCollection>}</b> |
41 |
|
|
* <ul> |
42 |
|
|
* <li>{@link StyledFeatureCollectionInterface#getAttributeMetaDataMap()} -> |
43 |
|
|
* Map<Integer,AttributeMetaData></li> |
44 |
|
|
* </ul> |
45 |
|
|
* </li> |
46 |
alfonx |
39 |
* <li><b>{@link StyledRasterInterface} extends {@link StyledMapInterface |
47 |
|
|
* StyledMapInterface<GridCoverage2D>}</b> |
48 |
mojays |
2 |
* <ul> |
49 |
|
|
* <li>{@link StyledRasterInterface#getLegendMetaData()} -> |
50 |
|
|
* {@link RasterLegendData}</li> |
51 |
|
|
* </ul> |
52 |
|
|
* </li> |
53 |
|
|
* </ul> |
54 |
|
|
* <br> |
55 |
|
|
* <b>Restrictions:</b> |
56 |
|
|
* <ul> |
57 |
|
|
* <li>layer list only depends on {@link StyledMapInterface}</li> |
58 |
|
|
* <li>methods returning {@link Translation} must not return {@code null}</li> |
59 |
alfonx |
39 |
* <li>methods returning {@link AttributeMetaData}-Map must not return {@code |
60 |
|
|
* null}</li> |
61 |
|
|
* <li>static helper method to get a new {@link AttributeMetaData}-map withe the |
62 |
|
|
* visible attributes only</li> |
63 |
mojays |
2 |
* <li>static helper method to create a "default" {@link AttributeMetaData}-map |
64 |
|
|
* for a {@link FeatureCollection} with all attributes visible and without real |
65 |
|
|
* translations, but the attribute name as description.</li> |
66 |
|
|
* </ul> |
67 |
|
|
*/ |
68 |
|
|
public interface StyledMapInterface<E> { |
69 |
|
|
public String getId(); |
70 |
|
|
|
71 |
|
|
public Translation getTitle(); |
72 |
|
|
|
73 |
|
|
public void setTitle(Translation title); |
74 |
|
|
|
75 |
|
|
public Translation getDesc(); |
76 |
|
|
|
77 |
|
|
public void setDesc(Translation dec); |
78 |
|
|
|
79 |
|
|
public Translation getKeywords(); |
80 |
|
|
|
81 |
|
|
public void setKeywords(Translation keywords); |
82 |
|
|
|
83 |
|
|
public CoordinateReferenceSystem getCrs(); |
84 |
|
|
|
85 |
|
|
public String getCRSString(); |
86 |
|
|
|
87 |
|
|
public Envelope getEnvelope(); |
88 |
|
|
|
89 |
|
|
/** |
90 |
alfonx |
39 |
* @return return an ImageIcon - <code>null</code> is valid and no icon or a |
91 |
|
|
* default icon will then be shown |
92 |
mojays |
2 |
*/ |
93 |
|
|
public ImageIcon getImageIcon(); |
94 |
|
|
|
95 |
|
|
public void setImageIcon(ImageIcon icon); |
96 |
|
|
|
97 |
|
|
/** |
98 |
|
|
* Returns the underlying GeoTools Object |
99 |
|
|
* |
100 |
|
|
* @throws RuntimeException |
101 |
|
|
*/ |
102 |
|
|
public E getGeoObject() throws Exception; |
103 |
|
|
|
104 |
|
|
public Style getStyle(); |
105 |
|
|
|
106 |
|
|
public void setStyle(Style style); |
107 |
|
|
|
108 |
|
|
/** |
109 |
|
|
* Returns the {@link URL} to a (HTML) file that provides more information |
110 |
|
|
* about this layer. If no HTML if associated with this |
111 |
|
|
* {@link StyledMapInterface}, then <code>null</code> will be returned. |
112 |
|
|
* |
113 |
|
|
* @return null or an {@link URL} |
114 |
|
|
*/ |
115 |
|
|
public URL getInfoURL(); |
116 |
|
|
|
117 |
|
|
/** |
118 |
|
|
* Should be called when this Object is not needed anymore. |
119 |
|
|
*/ |
120 |
|
|
public void dispose(); |
121 |
|
|
|
122 |
|
|
/** Is the object already disposed? * */ |
123 |
|
|
public boolean isDisposed(); |
124 |
|
|
|
125 |
|
|
/** |
126 |
|
|
* Clears any caches. For example the GeoObject could be released, and |
127 |
|
|
* reread on next call of getGeoObject() |
128 |
|
|
*/ |
129 |
|
|
public void uncache(); |
130 |
|
|
|
131 |
|
|
/** |
132 |
|
|
* If true, this layer will not be shown in the legend. Default = false |
133 |
|
|
*/ |
134 |
alfonx |
39 |
/** |
135 |
|
|
* |
136 |
alfonx |
40 |
* Killed by SK: 6. April 09: Ein Layer soll nicht generell auf |
137 |
alfonx |
39 |
* verstecken/nicht verstecken gestellt werden können. Das sind |
138 |
alfonx |
40 |
* Eigenschaften der Karte/MapContext, ebenso wie die Reihenfolge der Layer. |
139 |
|
|
* Im Atlas verwaltet deshalb nun die Klasse skrueger.atlas.Map welche Layer |
140 |
|
|
* nicht in der Legende auftauchen sollen. Meines Wissens hat keiner bisher |
141 |
|
|
* die Funktion genutzt. |
142 |
alfonx |
39 |
* |
143 |
|
|
* public boolean isHideInLegend(); |
144 |
|
|
*/ |
145 |
alfonx |
40 |
|
146 |
mojays |
2 |
} |