1 |
mojays |
2 |
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 |
33 |
|
|
* description 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 #isHideInLegend()} -> Boolean</li> * |
40 |
|
|
* <li>{@link #uncache()}</li> |
41 |
|
|
* <li>{@link #dispose()}</li> |
42 |
|
|
* </ul> |
43 |
|
|
* </li> |
44 |
|
|
* <li><b>{@link StyledFeatureCollectionInterface} extends |
45 |
|
|
* {@link StyledMapInterface StyledMapInterface<FeatureCollection>}</b> |
46 |
|
|
* <ul> |
47 |
|
|
* <li>{@link StyledFeatureCollectionInterface#getAttributeMetaDataMap()} -> |
48 |
|
|
* Map<Integer,AttributeMetaData></li> |
49 |
|
|
* </ul> |
50 |
|
|
* </li> |
51 |
|
|
* <li><b>{@link StyledRasterInterface} extends |
52 |
|
|
* {@link StyledMapInterface StyledMapInterface<GridCoverage2D>}</b> |
53 |
|
|
* <ul> |
54 |
|
|
* <li>{@link StyledRasterInterface#getLegendMetaData()} -> |
55 |
|
|
* {@link RasterLegendData}</li> |
56 |
|
|
* </ul> |
57 |
|
|
* </li> |
58 |
|
|
* </ul> |
59 |
|
|
* <br> |
60 |
|
|
* <b>Restrictions:</b> |
61 |
|
|
* <ul> |
62 |
|
|
* <li>layer list only depends on {@link StyledMapInterface}</li> |
63 |
|
|
* <li>methods returning {@link Translation} must not return {@code null}</li> |
64 |
|
|
* <li>methods returning {@link AttributeMetaData}-Map must not return |
65 |
|
|
* {@code null}</li> |
66 |
|
|
* <li>static helper method to get a new {@link AttributeMetaData}-map withe |
67 |
|
|
* the visible attributes only</li> |
68 |
|
|
* <li>static helper method to create a "default" {@link AttributeMetaData}-map |
69 |
|
|
* for a {@link FeatureCollection} with all attributes visible and without real |
70 |
|
|
* translations, but the attribute name as description.</li> |
71 |
|
|
* </ul> |
72 |
|
|
*/ |
73 |
|
|
public interface StyledMapInterface<E> { |
74 |
|
|
public String getId(); |
75 |
|
|
|
76 |
|
|
public Translation getTitle(); |
77 |
|
|
|
78 |
|
|
public void setTitle(Translation title); |
79 |
|
|
|
80 |
|
|
public Translation getDesc(); |
81 |
|
|
|
82 |
|
|
public void setDesc(Translation dec); |
83 |
|
|
|
84 |
|
|
public Translation getKeywords(); |
85 |
|
|
|
86 |
|
|
public void setKeywords(Translation keywords); |
87 |
|
|
|
88 |
|
|
public CoordinateReferenceSystem getCrs(); |
89 |
|
|
|
90 |
|
|
public String getCRSString(); |
91 |
|
|
|
92 |
|
|
public Envelope getEnvelope(); |
93 |
|
|
|
94 |
|
|
/** |
95 |
|
|
* @return return an ImageIcon - <code>null</code> is valid and no icon or |
96 |
|
|
* a default icon will then be shown |
97 |
|
|
*/ |
98 |
|
|
public ImageIcon getImageIcon(); |
99 |
|
|
|
100 |
|
|
public void setImageIcon(ImageIcon icon); |
101 |
|
|
|
102 |
|
|
/** |
103 |
|
|
* Returns the underlying GeoTools Object |
104 |
|
|
* |
105 |
|
|
* @throws RuntimeException |
106 |
|
|
*/ |
107 |
|
|
public E getGeoObject() throws Exception; |
108 |
|
|
|
109 |
|
|
public Style getStyle(); |
110 |
|
|
|
111 |
|
|
public void setStyle(Style style); |
112 |
|
|
|
113 |
|
|
/** |
114 |
|
|
* Returns the {@link URL} to a (HTML) file that provides more information |
115 |
|
|
* about this layer. If no HTML if associated with this |
116 |
|
|
* {@link StyledMapInterface}, then <code>null</code> will be returned. |
117 |
|
|
* |
118 |
|
|
* @return null or an {@link URL} |
119 |
|
|
*/ |
120 |
|
|
public URL getInfoURL(); |
121 |
|
|
|
122 |
|
|
/** |
123 |
|
|
* Should be called when this Object is not needed anymore. |
124 |
|
|
*/ |
125 |
|
|
public void dispose(); |
126 |
|
|
|
127 |
|
|
/** Is the object already disposed? * */ |
128 |
|
|
public boolean isDisposed(); |
129 |
|
|
|
130 |
|
|
/** |
131 |
|
|
* Clears any caches. For example the GeoObject could be released, and |
132 |
|
|
* reread on next call of getGeoObject() |
133 |
|
|
*/ |
134 |
|
|
public void uncache(); |
135 |
|
|
|
136 |
|
|
/** |
137 |
|
|
* If true, this layer will not be shown in the legend. Default = false |
138 |
|
|
*/ |
139 |
|
|
public boolean isHideInLegend(); |
140 |
|
|
} |