/[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 464 - (show annotations)
Tue Oct 13 13:22:31 2009 UTC (15 years, 4 months ago) by alfonx
Original Path: branches/1.0-gt2-2.6/src/skrueger/geotools/StyledLayerInterface.java
File size: 5355 byte(s)
* Changed AttributeMetadata and AttributeMetadataMap. It's not based on the attributes colIdx any more, but on the geotools.feature.type.Name. All the XML read/write methods have been adapted. 
This change was needed, as some users tend to change the DBF structure after the shapefile has been imported. Now columns can be moved, inserted and deleted. Just click "reload atlas" in Geopublisher after you changed the table schema. Geopublisher doesn't have to be closed.
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. Krüger - 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.styling.Style;
38 import org.opengis.referencing.crs.CoordinateReferenceSystem;
39
40 import skrueger.AttributeMetadata;
41 import skrueger.RasterLegendData;
42 import skrueger.i8n.Translation;
43
44 import com.vividsolutions.jts.geom.Envelope;
45
46 /**
47 * This class is the top interface for styled objects to be managed in
48 * {@link MapContextManagerInterface}. The (rough) classe structure is the
49 * following:
50 * <ul>
51 * <li><b>{@link StyledLayerInterface StyledLayerInterface<E>}</b>
52 * <ul>
53 * <li>{@link #getId()} -> String</li>
54 * <li>{@link #getKeywords() get/setKeywords()} -> {@link Translation}</li>
55 * <li>{@link #getTitle() set/getTitle()} -> {@link Translation} (short
56 * description for layer list)</li>
57 * <li>{@link #getDesc() set/getDesc()} -> {@link Translation} (long description
58 * for details)</li>
59 * <li>{@link #getCrs()} -> {@link CoordinateReferenceSystem}</li>
60 * <li>{@link #getCRSString()} -> String (readable description of CRS)</li>
61 * <li>{@link #getEnvelope()} -> {@link Envelope} (JTS-Envelope)</li>
62 * <li>{@link #getGeoObject()} -> E (GridCoverage/FeatureCollection/...)</li>
63 * <li>{@link #getStyle() set/getStyle()} -> {@link Style}</li>
64 * <li>{@link #uncache()}</li>
65 * <li>{@link #dispose()}</li>
66 * </ul>
67 * </li>
68 * <li><b>{@link StyledFeatureCollectionInterface} extends
69 * {@link StyledLayerInterface StyledLayerInterface<FeatureCollection>}</b>
70 * <ul>
71 * <li>{@link StyledFeatureCollectionInterface#getAttributeMetaDataMap()} ->
72 * Map<Integer,AttributeMetaData></li>
73 * </ul>
74 * </li>
75 * <li><b>{@link StyledRasterInterface} extends {@link StyledLayerInterface
76 * StyledLayerInterface<GridCoverage2D>}</b>
77 * <ul>
78 * <li>{@link StyledRasterInterface#getLegendMetaData()} ->
79 * {@link RasterLegendData}</li>
80 * </ul>
81 * </li>
82 * </ul>
83 * <br>
84 * <b>Restrictions:</b>
85 * <ul>
86 * <li>layer list only depends on {@link StyledLayerInterface}</li>
87 * <li>methods returning {@link Translation} must not return {@code null}</li>
88 * <li>methods returning {@link AttributeMetadata}-Map must not return {@code
89 * null}</li>
90 * <li>static helper method to get a new {@link AttributeMetadata}-map withe the
91 * visible attributes only</li>
92 * <li>static helper method to create a "default" {@link AttributeMetadata}-map
93 * for a {@link FeatureCollection} with all attributes visible and without real
94 * translations, but the attribute name as description.</li>
95 * </ul>
96 */
97 public interface StyledLayerInterface<E> {
98 public String getId();
99
100 public Translation getTitle();
101
102 public void setTitle(Translation title);
103
104 public Translation getDesc();
105
106 public void setDesc(Translation dec);
107
108 public Translation getKeywords();
109
110 public void setKeywords(Translation keywords);
111
112 public CoordinateReferenceSystem getCrs();
113
114 public String getCRSString();
115
116 public Envelope getEnvelope();
117
118 /**
119 * @return return an ImageIcon - <code>null</code> is valid and no icon or a
120 * default icon will then be shown
121 */
122 public ImageIcon getImageIcon();
123
124 public void setImageIcon(ImageIcon icon);
125
126 /**
127 * Returns the underlying GeoTools Object
128 *
129 * @throws RuntimeException
130 */
131 public E getGeoObject();
132
133 public Style getStyle();
134
135 public void setStyle(Style style);
136
137 /**
138 * Returns the {@link URL} to a (HTML) file that provides more information
139 * about this layer. If no HTML if associated with this
140 * {@link StyledLayerInterface}, then <code>null</code> will be returned.
141 *
142 * @return null or an {@link URL}
143 */
144 public URL getInfoURL();
145
146 /**
147 * Should be called when this Object is not needed anymore.
148 */
149 public void dispose();
150
151 /** Is the object already disposed? * */
152 public boolean isDisposed();
153
154 /**
155 * Clears any caches. For example the GeoObject could be released, and
156 * reread on next call of getGeoObject()
157 */
158 public void uncache();
159
160
161 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26