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

Diff of /trunk/src/skrueger/geotools/StyledFeatureCollection.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 40 by alfonx, Mon Apr 6 19:31:02 2009 UTC revision 1203 by alfonx, Tue Nov 2 22:53:55 2010 UTC
# Line 1  Line 1 
1  package skrueger.geotools;  /*******************************************************************************
2     * Copyright (c) 2009 Martin O. J. Schmitz.
3  import java.net.URL;   *
4  import java.util.Map;   * This file is part of the SCHMITZM library - a collection of utility
5  import java.util.HashMap;   * classes based on Java 1.6, focusing (not only) on Java Swing
6  import javax.swing.ImageIcon;   * and the Geotools library.
7     *
8  import org.geotools.styling.Style;   * The SCHMITZM project is hosted at:
9  import org.geotools.feature.FeatureCollection;   * http://wald.intevation.org/projects/schmitzm/
10  import org.geotools.feature.FeatureType;   *
11  import org.geotools.feature.AttributeType;   * 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  import schmitzm.geotools.feature.FeatureUtil;   * as published by the Free Software Foundation; either version 3
14     * of the License, or (at your option) any later version.
15  import skrueger.i8n.Translation;   *
16  import skrueger.AttributeMetaData;   * 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   * This class provides a simple implementation of {@link StyledMapInterface}   *
21   * for {@link FeatureCollection}. The uncache functionality is not supported,   * You should have received a copy of the GNU Lesser General Public License (license.txt)
22   * because this class bases on an existing {@link FeatureCollection} object in   * along with this program; if not, write to the Free Software
23   * memory.   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
24   * @author <a href="mailto:[email protected]">Martin Schmitz</a> (University of Bonn/Germany)   * or try this link: http://www.gnu.org/licenses/lgpl.html
25   * @version 1.0   *
26   */   * Contributors:
27  public class StyledFeatureCollection extends AbstractStyledMap<FeatureCollection> implements StyledFeatureCollectionInterface {   *     Martin O. J. Schmitz - initial API and implementation
28     *     Stefan A. Tzeggai - additional utility classes
29    /** Holds the meta data for displaying a legend. */   ******************************************************************************/
30    protected Map<Integer,AttributeMetaData> attrMetaData = null;  package skrueger.geotools;
31    
32    /**  import java.io.IOException;
33     * Creates a styled {@link FeatureCollection} with language-specific informations.  import java.net.URL;
34     * @param fc the {@link FeatureCollection}  
35     * @param id a unique ID for the object  import javax.swing.ImageIcon;
36     * @param title a (language-specific) short description  
37     * @param desc a (language-specific) long description  import org.geotools.data.FeatureSource;
38     * @param keywords (language-specific) keywords for the geo objects  import org.geotools.data.collection.CollectionDataStore;
39     * @param style a display style (if {@code null}, a default style is created)  import org.geotools.data.store.EmptyFeatureCollection;
40     * @param attrMetaData meta data for displaying a legend  import org.geotools.feature.FeatureCollection;
41     * @param icon an icon for the object (can be {@code null})  import org.geotools.feature.NameImpl;
42     * @exception IllegalArgumentException if {@code null} is given as ID or geo object  import org.geotools.feature.collection.SubFeatureCollection;
43     */  import org.geotools.geometry.jts.ReferencedEnvelope;
44    public StyledFeatureCollection(FeatureCollection fc, String id, Translation title, Translation desc, Translation keywords, Style style, Map<Integer,AttributeMetaData> attrMetaData, ImageIcon icon) {  import org.geotools.styling.Style;
45      super(fc, fc.getBounds(), fc.getSchema().getDefaultGeometry().getCoordinateSystem(), id, title, desc, keywords, style, icon);  import org.opengis.feature.simple.SimpleFeature;
46      setAttributeMetaData( attrMetaData );  import org.opengis.feature.simple.SimpleFeatureType;
47    }  import org.opengis.feature.type.AttributeDescriptor;
48    import org.opengis.filter.Filter;
49    /**  
50     * Creates a styled {@link FeatureCollection} with language-specific informations.  import schmitzm.geotools.feature.FeatureUtil;
51     * @param fc the {@link FeatureCollection}  import skrueger.AttributeMetadataImpl;
52     * @param id a unique ID for the object  import skrueger.i8n.Translation;
53     * @param title a (language-specific) short description  
54     * @param desc a (language-specific) long description  /**
55     * @param keywords (language-specific) keywords for the geo objects   * This class provides a simple implementation of {@link StyledLayerInterface}
56     * @param style a display style with attribute meta data information   * for {@link FeatureCollection}. The uncache functionality is not supported,
57     * @param icon an icon for the object (can be {@code null})   * because this class bases on an existing {@link FeatureCollection} object in
58     * @exception IllegalArgumentException if {@code null} is given as ID or geo object   * memory.
59     */   *
60    public StyledFeatureCollection(FeatureCollection fc, String id, Translation title, Translation desc, Translation keywords, StyledMapStyle<Map<Integer,AttributeMetaData>> style, ImageIcon icon) {   * @author <a href="mailto:[email protected]">Martin Schmitz</a>
61      super(fc, fc.getBounds(), fc.getSchema().getDefaultGeometry().getCoordinateSystem(), id, title, desc, keywords, style != null ? style.getGeoObjectStyle() : null, icon);   *         (University of Bonn/Germany)
62      setAttributeMetaData( style != null ? style.getMetaData() : null );   * @version 1.0
63    }   */
64    public class StyledFeatureCollection
65    /**                  extends
66     * Creates a styled {@link FeatureCollection} with a language-specific title,                  AbstractStyledLayer<FeatureCollection<SimpleFeatureType, SimpleFeature>>
67     * no long description, no keywords, default attribute meta data and no icon.                  implements StyledFeatureCollectionInterface {
68     * @param fc the {@link FeatureCollection}  
69     * @param id a unique ID for the object          /** Holds the meta data for displaying a legend. */
70     * @param title a short description          protected AttributeMetadataMap<AttributeMetadataImpl> attrMetaData = null;
71     * @param style a display style (if {@code null}, a default style is created)  
72     * @exception IllegalArgumentException if {@code null} is given as ID or geo object          /**
73     * @see #createDefaultAttributeMetaDataMap(FeatureCollection)           * We be filled with a "virtual" {@link FeatureSource} on demand.
74     */           */
75    public StyledFeatureCollection(FeatureCollection fc, String id, Translation title, Style style) {          private FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = null;
76      this(fc, id, title, null, null, style, null, null);  
77    }          /**
78             * A Filter that will be applied internally applied to this
79    /**           * FeatureCollection
80     * Creates a styled {@link FeatureCollection} with non-translated informations.           **/
81     * @param fc the {@link FeatureCollection}          private Filter filter = Filter.INCLUDE;
82     * @param id a unique ID for the object  
83     * @param title a short description          /**
84     * @param desc a long description           * Creates a styled {@link FeatureCollection} with language-specific
85     * @param keywords keywords for the geo objects           * informations.
86     * @param style a display style (if {@code null}, a default style is created)           *
87     * @param attrMetaData meta data for displaying a legend           * @param fc
88     * @param icon an icon for the object (can be {@code null})           *            the {@link FeatureCollection}
89     * @exception IllegalArgumentException if {@code null} is given as ID or geo object           * @param id
90     */           *            a unique ID for the object
91    public StyledFeatureCollection(FeatureCollection fc, String id, String title, String desc, String keywords, Style style, Map<Integer,AttributeMetaData> attrMetaData, ImageIcon icon) {           * @param title
92      this(fc, id, (Translation)null, null, null, style, attrMetaData, icon);           *            a (language-specific) short description
93      setTitle(title);           * @param desc
94      setDesc(desc);           *            a (language-specific) long description
95      setKeywords(keywords);           * @param keywords
96    }           *            (language-specific) keywords for the geo objects
97             * @param style
98    /**           *            a display style (if {@code null}, a default style is created)
99     * Creates a styled {@link FeatureCollection} with non-translated informations.           * @param attrMetaData
100     * @param fc the {@link FeatureCollection}           *            meta data for displaying a legend
101     * @param id a unique ID for the object           * @param icon
102     * @param title a short description           *            an icon for the object (can be {@code null})
103     * @param desc a long description           * @exception IllegalArgumentException
104     * @param keywords keywords for the geo objects           *                if {@code null} is given as ID or geo object
105     * @param style a display style with attribute meta data information           */
106     * @param icon an icon for the object (can be {@code null})          public StyledFeatureCollection(
107     * @exception IllegalArgumentException if {@code null} is given as ID or geo object                          FeatureCollection<SimpleFeatureType, SimpleFeature> fc, String id,
108     */                          Translation title, Translation desc, Translation keywords,
109    public StyledFeatureCollection(FeatureCollection fc, String id, String title, String desc, String keywords, StyledMapStyle<Map<Integer,AttributeMetaData>> style, ImageIcon icon) {                          Style style, AttributeMetadataMap attrMetaData, ImageIcon icon) {
110      this(fc,                  super(fc, fc.getBounds(), fc.getSchema().getGeometryDescriptor()
111           id,                                  .getCoordinateReferenceSystem(), id, title, desc, keywords,
112           title,                                  style, icon);
113           desc,                  setAttributeMetaData(attrMetaData);
114           keywords,          }
115           style != null ? style.getGeoObjectStyle() : null,  
116           style != null ? style.getMetaData() : null,          /**
117           icon           * Creates a styled {@link FeatureCollection} with language-specific
118      );           * informations.
119    }           *
120             * @param fc
121    /**           *            the {@link FeatureCollection}
122     * Creates a styled {@link FeatureCollection} with a non-translated title,           * @param id
123     * no long description, no keywords, default attribute meta data and no icon.           *            a unique ID for the object
124     * @param fc the {@link FeatureCollection}           * @param title
125     * @param id a unique ID for the object           *            a (language-specific) short description
126     * @param title a short description           * @param desc
127     * @param style a display style (if {@code null}, a default style is created)           *            a (language-specific) long description
128     * @exception IllegalArgumentException if {@code null} is given as ID or geo object           * @param keywords
129     * @see #createDefaultAttributeMetaDataMap(FeatureCollection)           *            (language-specific) keywords for the geo objects
130     */           * @param style
131    public StyledFeatureCollection(FeatureCollection fc, String id, String title, Style style) {           *            a display style with attribute meta data information
132      this(fc, id, title, null, null, style, null, null);           * @param icon
133    }           *            an icon for the object (can be {@code null})
134             * @exception IllegalArgumentException
135    /**           *                if {@code null} is given as ID or geo object
136     * Creates a styled {@link FeatureCollection} with a non-translated title,           */
137     * no long description, no keywords, default attribute meta data and no icon.          public StyledFeatureCollection(
138     * @param fc the {@link FeatureCollection}                          FeatureCollection<SimpleFeatureType, SimpleFeature> fc, String id,
139     * @param id a unique ID for the object                          Translation title, Translation desc, Translation keywords,
140     * @param title a short description                          StyledLayerStyle<AttributeMetadataMap> style, ImageIcon icon) {
141     * @param style a display style (if {@code null}, a default style is created)                  super(fc, fc.getBounds(), fc.getSchema().getGeometryDescriptor()
142     * @exception IllegalArgumentException if {@code null} is given as ID or geo object                                  .getCoordinateReferenceSystem(), id, title, desc, keywords,
143     * @see #createDefaultAttributeMetaDataMap(FeatureCollection)                                  style != null ? style.getGeoObjectStyle() : null, icon);
144     */                  setAttributeMetaData(style != null ? style.getMetaData() : null);
145    public StyledFeatureCollection(FeatureCollection fc, String id, String title, StyledMapStyle<Map<Integer,AttributeMetaData>> style) {          }
146      this(  
147        fc,          /**
148        id,           * Creates a styled {@link FeatureCollection} with a language-specific
149        title,           * title, no long description, no keywords, default attribute meta data and
150        null,           * no icon.
151        null,           *
152        style != null ? style.getGeoObjectStyle() : null,           * @param fc
153        style != null ? style.getMetaData() : null,           *            the {@link FeatureCollection}
154        null           * @param id
155      );           *            a unique ID for the object
156    }           * @param title
157             *            a short description
158    /**           * @param style
159     * Creates a default style for the {@link FeatureCollection}.           *            a display style (if {@code null}, a default style is created)
160     * @see FeatureUtil#createDefaultStyle(FeatureCollection)           * @exception IllegalArgumentException
161     */           *                if {@code null} is given as ID or geo object
162    protected Style createDefaultStyle() {           * @see #createDefaultAttributeMetaDataMap(FeatureCollection)
163      return FeatureUtil.createDefaultStyle( geoObject );           */
164    }          public StyledFeatureCollection(
165                            FeatureCollection<SimpleFeatureType, SimpleFeature> fc, String id,
166    /**                          Translation title, Style style) {
167     * Returns the meta data needed for displaying a legend.                  this(fc, id, title, null, null, style, null, null);
168     */          }
169    public Map<Integer,AttributeMetaData> getAttributeMetaDataMap() {  
170      return attrMetaData;          /**
171    }           * Creates a styled {@link FeatureCollection} with non-translated
172             * informations.
173    /**           *
174     * Sets the meta data needed for displaying a legend.           * @param fc
175     * If {@code legendData} is {@code null} an empty map is set, so           *            the {@link FeatureCollection}
176     * {@link #getAttributeMetaDataMap()} never returns {@code null}.           * @param id
177     * @param attrMetaData map of attribute meta data           *            a unique ID for the object
178     */           * @param title
179    public void setAttributeMetaData(Map<Integer,AttributeMetaData> attrMetaData) {           *            a short description
180      this.attrMetaData = (attrMetaData != null) ? attrMetaData : createDefaultAttributeMetaDataMap(geoObject);           * @param desc
181    }           *            a long description
182             * @param keywords
183    /**           *            keywords for the geo objects
184     * Creates non-translated default meta data for a {@link FeatureCollection}           * @param style
185     * with all attributes visible and no unit set.           *            a display style (if {@code null}, a default style is created)
186     * @param fc a {@link FeatureCollection}           * @param attrMetaData
187     */           *            meta data for displaying a legend
188    public static Map<Integer,AttributeMetaData> createDefaultAttributeMetaDataMap(FeatureCollection fc) {           * @param icon
189      HashMap<Integer,AttributeMetaData> metaDataMap = new HashMap<Integer,AttributeMetaData>();           *            an icon for the object (can be {@code null})
190      FeatureType ftype = fc.getSchema();           * @exception IllegalArgumentException
191      for (int i=0; i<ftype.getAttributeCount(); i++) {           *                if {@code null} is given as ID or geo object
192        AttributeType aType = ftype.getAttributeType(i);           */
193        if ( aType != ftype.getDefaultGeometry() )          public StyledFeatureCollection(
194          metaDataMap.put(                          FeatureCollection<SimpleFeatureType, SimpleFeature> fc, String id,
195            i,                          String title, String desc, String keywords, Style style,
196            new AttributeMetaData(                          AttributeMetadataMap attrMetaData, ImageIcon icon) {
197              i,  // Column no.                  this(fc, id, (Translation) null, null, null, style, attrMetaData, icon);
198              true, // visible                  setTitle(title);
199              new Translation( aType.getName() ), // Column name                  setDesc(desc);
200              new Translation(), // description                  setKeywords(keywords);
201              "" // Unit          }
202            )  
203          );          /**
204      }           * Creates a styled {@link FeatureCollection} with non-translated
205      return metaDataMap;           * informations.
206    }           *
207             * @param fc
208    /**           *            the {@link FeatureCollection}
209     * Simply sets the {@link #geoObject}, {@link #crs}, {@link #envelope} and           * @param id
210     * {@link #attrMetaData} to {@code null}.           *            a unique ID for the object
211     */           * @param title
212    public void dispose() {           *            a short description
213      this.geoObject    = null;           * @param desc
214      this.envelope     = null;           *            a long description
215      this.crs          = null;           * @param keywords
216      this.attrMetaData = null;           *            keywords for the geo objects
217    }           * @param style
218             *            a display style with attribute meta data information
219    /**           * @param icon
220     * Tests whether the geo object is disposed.           *            an icon for the object (can be {@code null})
221     */           * @exception IllegalArgumentException
222    public boolean isDisposed() {           *                if {@code null} is given as ID or geo object
223      return geoObject == null;           */
224    }          public StyledFeatureCollection(
225                            FeatureCollection<SimpleFeatureType, SimpleFeature> fc, String id,
226    /**                          String title, String desc, String keywords,
227     * Does nothing, because the {@link AbstractStyledMap} bases on existing                          StyledLayerStyle<AttributeMetadataMap> style, ImageIcon icon) {
228     * objects (in memory) which can not be uncached and reloaded.                  this(fc, id, title, desc, keywords, style != null ? style
229     */                                  .getGeoObjectStyle() : null, style != null ? style
230    public void uncache() {                                  .getMetaData() : null, icon);
231      LOGGER.warn("Uncache functionality is not supported. Object remains in memory.");          }
232    }  
233            /**
234             * Creates a styled {@link FeatureCollection} with a non-translated title,
235    /*           * no long description, no keywords, default attribute meta data and no
236     * (non-Javadoc)           * icon.
237     * @see skrueger.geotools.StyledMapInterface#getInfoURL()           *
238     */           * @param fc
239          public URL getInfoURL() {           *            the {@link FeatureCollection}
240                  return null;           * @param id
241          }           *            a unique ID for the object
242             * @param title
243          /**           *            a short description
244           * If true, this layer will not be shown in the legend. Default = false           * @param style
245           */           *            a display style (if {@code null}, a default style is created)
246          /**           * @exception IllegalArgumentException
247           *           *                if {@code null} is given as ID or geo object
248           * Killed by SK: 6. April 09: Ein Layer soll nicht generell auf           * @see #createDefaultAttributeMetaDataMap(FeatureCollection)
249           * verstecken/nicht verstecken gestellt werden können. Das sind           */
250           * Eigenschaften der Karte/MapContext, ebenso wie die Reihenfolge der Layer.          public StyledFeatureCollection(
251           * Im Atlas verwaltet deshalb nun die Klasse skrueger.atlas.Map welche Layer                          FeatureCollection<SimpleFeatureType, SimpleFeature> fc, String id,
252           * nicht in der Legende auftauchen sollen. Meines Wissens hat keiner bisher                          String title, Style style) {
253           * die Funktion genutzt.                  this(fc, id, title, null, null, style, null, null);
254           *          }
255          public boolean isHideInLegend() {  
256                  return false;          /**
257          }           * Creates a styled {@link FeatureCollection} with a non-translated title,
258           */           * no long description, no keywords, default attribute meta data and no
259  }           * icon.
260             *
261             * @param fc
262             *            the {@link FeatureCollection}
263             * @param id
264             *            a unique ID for the object
265             * @param title
266             *            a short description
267             * @param style
268             *            a display style (if {@code null}, a default style is created)
269             * @exception IllegalArgumentException
270             *                if {@code null} is given as ID or geo object
271             * @see #createDefaultAttributeMetaDataMap(FeatureCollection)
272             */
273            public StyledFeatureCollection(
274                            FeatureCollection<SimpleFeatureType, SimpleFeature> fc, String id,
275                            String title, StyledLayerStyle<AttributeMetadataMap> style) {
276                    this(fc, id, title, null, null, style != null ? style
277                                    .getGeoObjectStyle() : null, style != null ? style
278                                    .getMetaData() : null, null);
279            }
280    
281            /**
282             * Creates a default style for the {@link FeatureCollection}.
283             *
284             * @see FeatureUtil#createDefaultStyle(FeatureCollection)
285             */
286            protected Style createDefaultStyle() {
287                    return FeatureUtil.createDefaultStyle(geoObject);
288            }
289    
290            /**
291             * Returns the meta data needed for displaying a legend.
292             */
293            public AttributeMetadataMap getAttributeMetaDataMap() {
294                    return attrMetaData;
295            }
296    
297            /**
298             * Sets the meta data needed for displaying a legend. If {@code legendData}
299             * is {@code null} an empty map is set, so
300             * {@link #getAttributeMetaDataMap()} never returns {@code null}.
301             *
302             * @param attrMetaData
303             *            map of attribute meta data
304             */
305            public void setAttributeMetaData(AttributeMetadataMap attrMetaData) {
306                    this.attrMetaData = (attrMetaData != null) ? attrMetaData
307                                    : createDefaultAttributeMetaDataMap(geoObject);
308            }
309    
310            /**
311             * Creates non-translated default meta data for a {@link FeatureCollection}
312             * with all attributes visible and no unit set.
313             *
314             * @param fc
315             *            a {@link FeatureCollection}
316             */
317            public static AttributeMetadataMap createDefaultAttributeMetaDataMap(
318                            FeatureCollection<SimpleFeatureType, SimpleFeature> fc) {
319                    AttributeMetadataMap metaDataMap = new AttributeMetadataImplMap();
320                    SimpleFeatureType ftype = fc.getSchema();
321                    for (int i = 0; i < ftype.getAttributeCount(); i++) {
322                            AttributeDescriptor aDesc = ftype.getAttributeDescriptors().get(i);
323                            if ( !FeatureUtil.isGeometryAttribute(aDesc) )
324                                    metaDataMap.put(aDesc.getName(), new AttributeMetadataImpl( new NameImpl( aDesc.getName().getNamespaceURI(), aDesc.getName().getLocalPart()),
325                                                    true, // visible
326                                                    new Translation(aDesc.getLocalName()), // Column name
327                                                    new Translation(aDesc.getLocalName()), // description
328                                                    "" // Unit
329                                    ));
330                    }
331                    return metaDataMap;
332            }
333    
334            /**
335             * Simply sets the {@link #geoObject}, {@link #crs}, {@link #envelope} and
336             * {@link #attrMetaData} to {@code null}.
337             */
338            public void dispose() {
339                    this.geoObject = null;
340                    this.envelope = null;
341                    this.crs = null;
342                    this.attrMetaData = null;
343            }
344    
345            /**
346             * Tests whether the geo object is disposed.
347             */
348            public boolean isDisposed() {
349                    return geoObject == null;
350            }
351    
352            /**
353             * Does nothing, because the {@link AbstractStyledLayer} bases on existing
354             * objects (in memory) which can not be uncached and reloaded.
355             */
356            public void uncache() {
357    
358                    /** It will be recreated on the next getFetureSource() **/
359                    featureSource = null;
360    
361                    LOGGER
362                                    .warn("Uncache onyl uncached any virtual FeatureSource. Object remains in memory.");
363            }
364    
365            /*
366             * (non-Javadoc)
367             *
368             * @see skrueger.geotools.StyledLayerInterface#getInfoURL()
369             */
370            public URL getInfoURL() {
371                    return null;
372            }
373    
374            /**
375             * Same as {@link #getGeoObject()} method, but complies to the
376             * {@link StyledFeaturesInterface}. The associated {@link Filter} is NOT
377             * automatically applied.
378             *
379             * @see {@link StyledFeaturesInterface}
380             * @see #getFeatureCollectionFiltered()
381             */
382            @Override
383            public FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatureCollection() {
384                    return getGeoObject();
385            }
386    
387            /**
388             * Same as {@link #getGeoObject()} method, but complies to the
389             * {@link StyledFeaturesInterface}. The associated {@link Filter} is
390             * automatically applied by creating a {@link SubFeatureCollection}.
391             *
392             * @see {@link StyledFeaturesInterface}
393             * @see #getFeatureCollectionFiltered()
394             */
395            @Override
396            public FeatureCollection<SimpleFeatureType, SimpleFeature> getFeatureCollectionFiltered() {
397                    final FeatureCollection<SimpleFeatureType, SimpleFeature> fc = getFeatureCollection();
398                    if (filter == Filter.EXCLUDE)
399                            return new EmptyFeatureCollection(fc.getSchema());
400                    if (filter == Filter.INCLUDE)
401                            return fc;
402                    return fc.subCollection(filter);
403            }
404    
405            /**
406             * Returns a virtual {@link FeatureSource} to access the
407             * {@link FeatureCollection}. Once created, it will be reused until
408             * {@link #uncache()} is called.<br/>
409             *
410             * @see {@link StyledFeaturesInterface}
411             */
412            @Override
413            public FeatureSource<SimpleFeatureType, SimpleFeature> getFeatureSource() {
414                    if (featureSource == null) {
415                            CollectionDataStore store = new CollectionDataStore(getGeoObject());
416                            try {
417                                    featureSource = store.getFeatureSource(store.getTypeNames()[0]);
418                            } catch (IOException e) {
419                                    throw new RuntimeException(
420                                                    "Could not create a FeatureSource from the CollectionDataStore:",
421                                                    e);
422                            }
423                    }
424                    return featureSource;
425            }
426    
427            @Override
428            public Filter getFilter() {
429                    return filter;
430            }
431    
432            @Override
433            public void setFilter(Filter filter) {
434                    this.filter = filter;
435            }
436    
437            @Override
438            public SimpleFeatureType getSchema() {
439                    return getGeoObject().getSchema();
440            }
441    
442    
443            @Override
444            public ReferencedEnvelope getReferencedEnvelope() {
445                    return new ReferencedEnvelope(getEnvelope(), getCrs());
446            }
447    
448    }

Legend:
Removed from v.40  
changed lines
  Added in v.1203

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26