[Schmitzm-commits] r331 - in branches/1.0-gt2-2.6/src: schmitzm/geotools/gui skrueger/geotools

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Aug 26 18:22:38 CEST 2009


Author: mojays
Date: 2009-08-26 18:22:38 +0200 (Wed, 26 Aug 2009)
New Revision: 331

Modified:
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureFilterPanel.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java
   branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFeatureCollection.java
Log:


Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureFilterPanel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureFilterPanel.java	2009-08-26 16:16:16 UTC (rev 330)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureFilterPanel.java	2009-08-26 16:22:38 UTC (rev 331)
@@ -43,6 +43,7 @@
 
 import org.geotools.feature.FeatureCollection;
 import org.geotools.filter.Filter;
+import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
 
 import schmitzm.geotools.feature.AttributeTypeFilter;
@@ -110,7 +111,7 @@
 	 *            definiert die zur Verfuegung gestellten SimpleFeature-Attribute
 	 * @see FeatureCollection#getSchema()
 	 */
-	public FeatureFilterPanel(FeatureCollection fc) {
+	public FeatureFilterPanel(FeatureCollection<SimpleFeatureType,SimpleFeature> fc) {
 		this(fc.getSchema());
 	}
 

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java	2009-08-26 16:16:16 UTC (rev 330)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/JMapPane.java	2009-08-26 16:22:38 UTC (rev 331)
@@ -1561,9 +1561,9 @@
       // .getFeatureSource().getSchema().getDefaultGeometry()
       // .getLocalName());
       // filter.setExpression1(geometry);
+      FeatureSource<SimpleFeatureType,SimpleFeature> featureSource = (FeatureSource<SimpleFeatureType,SimpleFeature>)layer.getFeatureSource();
       GeometryFilterImpl filter = new BoundingBoxFilterGenerator(env,
-          getContext().getCoordinateReferenceSystem()).adaptFilter(layer
-          .getFeatureSource());
+          getContext().getCoordinateReferenceSystem()).adaptFilter(featureSource);
       return !layer.getFeatureSource().getFeatures(filter).isEmpty();
     } catch (Exception err) {
       return false;

Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFeatureCollection.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFeatureCollection.java	2009-08-26 16:16:16 UTC (rev 330)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/StyledFeatureCollection.java	2009-08-26 16:22:38 UTC (rev 331)
@@ -38,11 +38,11 @@
 
 import org.geotools.data.FeatureSource;
 import org.geotools.data.collection.CollectionDataStore;
-import org.geotools.feature.AttributeType;
 import org.geotools.feature.FeatureCollection;
 import org.geotools.styling.Style;
 import org.opengis.feature.simple.SimpleFeature;
 import org.opengis.feature.simple.SimpleFeatureType;
+import org.opengis.feature.type.AttributeDescriptor;
 
 import schmitzm.geotools.feature.FeatureUtil;
 import skrueger.AttributeMetaData;
@@ -93,12 +93,12 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledFeatureCollection(FeatureCollection fc, String id,
+	public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id,
 			Translation title, Translation desc, Translation keywords,
 			Style style, Map<Integer, AttributeMetaData> attrMetaData,
 			ImageIcon icon) {
-		super(fc, fc.getBounds(), fc.getSchema().getDefaultGeometry()
-				.getCoordinateSystem(), id, title, desc, keywords, style, icon);
+		super(fc, fc.getBounds(), fc.getSchema().getGeometryDescriptor()
+				.getCoordinateReferenceSystem(), id, title, desc, keywords, style, icon);
 		setAttributeMetaData(attrMetaData);
 	}
 
@@ -123,12 +123,12 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledFeatureCollection(FeatureCollection fc, String id,
+	public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id,
 			Translation title, Translation desc, Translation keywords,
 			StyledLayerStyle<Map<Integer, AttributeMetaData>> style,
 			ImageIcon icon) {
-		super(fc, fc.getBounds(), fc.getSchema().getDefaultGeometry()
-				.getCoordinateSystem(), id, title, desc, keywords,
+		super(fc, fc.getBounds(), fc.getSchema().getGeometryDescriptor()
+				.getCoordinateReferenceSystem(), id, title, desc, keywords,
 				style != null ? style.getGeoObjectStyle() : null, icon);
 		setAttributeMetaData(style != null ? style.getMetaData() : null);
 	}
@@ -150,7 +150,7 @@
 	 *                if {@code null} is given as ID or geo object
 	 * @see #createDefaultAttributeMetaDataMap(FeatureCollection)
 	 */
-	public StyledFeatureCollection(FeatureCollection fc, String id,
+	public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id,
 			Translation title, Style style) {
 		this(fc, id, title, null, null, style, null, null);
 	}
@@ -178,7 +178,7 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledFeatureCollection(FeatureCollection fc, String id,
+	public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id,
 			String title, String desc, String keywords, Style style,
 			Map<Integer, AttributeMetaData> attrMetaData, ImageIcon icon) {
 		this(fc, id, (Translation) null, null, null, style, attrMetaData, icon);
@@ -208,7 +208,7 @@
 	 * @exception IllegalArgumentException
 	 *                if {@code null} is given as ID or geo object
 	 */
-	public StyledFeatureCollection(FeatureCollection fc, String id,
+	public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id,
 			String title, String desc, String keywords,
 			StyledLayerStyle<Map<Integer, AttributeMetaData>> style,
 			ImageIcon icon) {
@@ -234,7 +234,7 @@
 	 *                if {@code null} is given as ID or geo object
 	 * @see #createDefaultAttributeMetaDataMap(FeatureCollection)
 	 */
-	public StyledFeatureCollection(FeatureCollection fc, String id,
+	public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id,
 			String title, Style style) {
 		this(fc, id, title, null, null, style, null, null);
 	}
@@ -256,7 +256,7 @@
 	 *                if {@code null} is given as ID or geo object
 	 * @see #createDefaultAttributeMetaDataMap(FeatureCollection)
 	 */
-	public StyledFeatureCollection(FeatureCollection fc, String id,
+	public StyledFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, String id,
 			String title, StyledLayerStyle<Map<Integer, AttributeMetaData>> style) {
 		this(fc, id, title, null, null, style != null ? style
 				.getGeoObjectStyle() : null, style != null ? style
@@ -301,15 +301,15 @@
 	 *            a {@link FeatureCollection}
 	 */
 	public static Map<Integer, AttributeMetaData> createDefaultAttributeMetaDataMap(
-			FeatureCollection fc) {
+			FeatureCollection<SimpleFeatureType,SimpleFeature> fc) {
 		HashMap<Integer, AttributeMetaData> metaDataMap = new HashMap<Integer, AttributeMetaData>();
 		SimpleFeatureType ftype = fc.getSchema();
 		for (int i = 0; i < ftype.getAttributeCount(); i++) {
-			AttributeType aType = ftype.getAttributeType(i);
-			if (aType != ftype.getDefaultGeometry())
+			AttributeDescriptor aType = ftype.getAttributeDescriptors().get(i);
+			if (aType != ftype.getGeometryDescriptor())
 				metaDataMap.put(i, new AttributeMetaData(i, // Column no.
 						true, // visible
-						new Translation(aType.getName()), // Column name
+						new Translation(aType.getLocalName()), // Column name
 						new Translation(), // description
 						"" // Unit
 				));
@@ -362,7 +362,7 @@
 	 * @see {@link StyledFeaturesInterface}
 	 */
 	@Override
-	public FeatureCollection getFeatureCollection() {
+	public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatureCollection() {
 		return getGeoObject();
 	}
 
@@ -373,7 +373,7 @@
 	 * @see {@link StyledFeaturesInterface}
 	 */
 	@Override
-	public FeatureSource getFeatureSource() {
+	public FeatureSource<SimpleFeatureType,SimpleFeature> getFeatureSource() {
 		if (featureSource == null) {
 			CollectionDataStore store = new CollectionDataStore(getGeoObject());
 			try {



More information about the Schmitzm-commits mailing list