/[schmitzm]/trunk/src/skrueger/geotools/StyledLayerInterface.java
ViewVC logotype

Contents of /trunk/src/skrueger/geotools/StyledLayerInterface.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1228 - (show annotations)
Wed Nov 3 20:44:16 2010 UTC (14 years, 3 months ago) by alfonx
File size: 5622 byte(s)
c
1 /*******************************************************************************
2 * Copyright (c) 2009 Martin O. J. Schmitz.
3 *
4 * This file is part of the SCHMITZM library - a collection of utility
5 * classes based on Java 1.6, focusing (not only) on Java Swing
6 * and the Geotools library.
7 *
8 * The SCHMITZM project is hosted at:
9 * http://wald.intevation.org/projects/schmitzm/
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation; either version 3
14 * of the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License (license.txt)
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 * or try this link: http://www.gnu.org/licenses/lgpl.html
25 *
26 * Contributors:
27 * Martin O. J. Schmitz - initial API and implementation
28 * Stefan A. Tzeggai - additional utility classes
29 ******************************************************************************/
30 package skrueger.geotools;
31
32 import java.net.URL;
33
34 import javax.swing.ImageIcon;
35
36 import org.geotools.feature.FeatureCollection;
37 import org.geotools.geometry.jts.ReferencedEnvelope;
38 import org.geotools.styling.Style;
39 import org.opengis.referencing.crs.CoordinateReferenceSystem;
40
41 import skrueger.AttributeMetadataImpl;
42 import skrueger.AttributeMetadataInterface;
43 import skrueger.RasterLegendData;
44 import skrueger.i8n.Translation;
45
46 import com.vividsolutions.jts.geom.Envelope;
47
48 /**
49 * This class is the top interface for styled objects to be managed in
50 * {@link MapContextManagerInterface}. The (rough) classe structure is the
51 * following:
52 * <ul>
53 * <li><b>{@link StyledLayerInterface StyledLayerInterface<E>}</b>
54 * <ul>
55 * <li>{@link #getId()} -> String</li>
56 * <li>{@link #getKeywords() get/setKeywords()} -> {@link Translation}</li>
57 * <li>{@link #getTitle() set/getTitle()} -> {@link Translation} (short
58 * description for layer list)</li>
59 * <li>{@link #getDesc() set/getDesc()} -> {@link Translation} (long description
60 * for details)</li>
61 * <li>{@link #getCrs()} -> {@link CoordinateReferenceSystem}</li>
62 * <li>{@link #getCRSString()} -> String (readable description of CRS)</li>
63 * <li>{@link #getEnvelope()} -> {@link Envelope} (JTS-Envelope)</li>
64 * <li>{@link #getGeoObject()} -> E (GridCoverage/FeatureCollection/...)</li>
65 * <li>{@link #getStyle() set/getStyle()} -> {@link Style}</li>
66 * <li>{@link #uncache()}</li>
67 * <li>{@link #dispose()}</li>
68 * </ul>
69 * </li>
70 * <li><b>{@link StyledFeatureCollectionInterface} extends
71 * {@link StyledLayerInterface StyledLayerInterface<FeatureCollection>}</b>
72 * <ul>
73 * <li>{@link StyledFeatureCollectionInterface#getAttributeMetaDataMap()} ->
74 * Map<Integer,AttributeMetaData></li>
75 * </ul>
76 * </li>
77 * <li><b>{@link StyledRasterInterface} extends {@link StyledLayerInterface
78 * StyledLayerInterface<GridCoverage2D>}</b>
79 * <ul>
80 * <li>{@link StyledRasterInterface#getLegendMetaData()} ->
81 * {@link RasterLegendData}</li>
82 * </ul>
83 * </li>
84 * </ul>
85 * <br>
86 * <b>Restrictions:</b>
87 * <ul>
88 * <li>layer list only depends on {@link StyledLayerInterface}</li>
89 * <li>methods returning {@link Translation} must not return {@code null}</li>
90 * <li>methods returning {@link AttributeMetadataInterface}-Map must not return {@code
91 * null}</li>
92 * <li>static helper method to get a new {@link AttributeMetadataImpl}-map with the
93 * visible attributes only</li>
94 * <li>static helper method to create a "default" {@link AttributeMetadataImpl}-map
95 * for a {@link FeatureCollection} with all attributes visible and without real
96 * translations, but the attribute name as description.</li>
97 * </ul>
98 */
99 public interface StyledLayerInterface<E> {
100 public String getId();
101
102 public Translation getTitle();
103
104 public void setTitle(Translation title);
105
106 public Translation getDesc();
107
108 public void setDesc(Translation dec);
109
110 public Translation getKeywords();
111
112 public void setKeywords(Translation keywords);
113
114 public CoordinateReferenceSystem getCrs();
115
116 public String getCRSString();
117
118 public Envelope getEnvelope();
119
120 /**
121 * @return <code>null</code> is no CRS is available
122 */
123 public ReferencedEnvelope getReferencedEnvelope();
124
125
126 /**
127 * @return return an ImageIcon - <code>null</code> is valid and no icon or a
128 * default icon will then be shown
129 */
130 public ImageIcon getImageIcon();
131
132 public void setImageIcon(ImageIcon icon);
133
134 /**
135 * Returns the underlying GeoTools Object
136 *
137 * @throws RuntimeException
138 */
139 public E getGeoObject();
140
141 public Style getStyle();
142
143 public void setStyle(Style style);
144
145 /**
146 * Returns the {@link URL} to a (HTML) file that provides more information
147 * about this layer. If no HTML if associated with this
148 * {@link StyledLayerInterface}, then <code>null</code> will be returned.
149 *
150 * @return null or an {@link URL}
151 */
152 public URL getInfoURL();
153
154 /**
155 * Should be called when this Object is not needed anymore.
156 */
157 public void dispose();
158
159 /** Is the object already disposed? * */
160 public boolean isDisposed();
161
162 /**
163 * Clears any caches. For example the GeoObject could be released, and
164 * reread on next call of getGeoObject()
165 */
166 public void uncache();
167 // public String getLegendHtml();
168 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26