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