[Schmitzm-commits] r328 - in branches/1.0-gt2-2.6: . src/schmitzm/geotools/grid src/schmitzm/geotools/gui

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


Author: mojays
Date: 2009-08-26 18:01:21 +0200 (Wed, 26 Aug 2009)
New Revision: 328

Modified:
   branches/1.0-gt2-2.6/migration_to_gt2-2.6.txt
   branches/1.0-gt2-2.6/src/schmitzm/geotools/grid/GridUtil.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionTableModel.java
   branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureTablePane.java
Log:
FeatureCollecion and FeatureType parameterized with <SimpleFeatureType,SimpleFeature> at some points.
FactoryFinder replaces with CoverageFactoryFinder
GridRange replaced with GridEnvelope

Modified: branches/1.0-gt2-2.6/migration_to_gt2-2.6.txt
===================================================================
--- branches/1.0-gt2-2.6/migration_to_gt2-2.6.txt	2009-08-26 15:55:48 UTC (rev 327)
+++ branches/1.0-gt2-2.6/migration_to_gt2-2.6.txt	2009-08-26 16:01:21 UTC (rev 328)
@@ -47,11 +47,18 @@
 
 GeneralGridRange
 ================
-GeneralGridRange replaced with GeneralGridEnvelope
-GridRange2D replaced with GeneralEnvelope2D
+- GeneralGridRange replaced with GeneralGridEnvelope
+- GridRange2D replaced with GeneralEnvelope2D
+- GridRange.getUpper/Lower(.) replaced with .getHigh/Low(.)
 
 
-Attribute's locale name
-=======================
-FeatureType.getAttributeType(.).getLocalName() replaced with
-FeatureType.getAttributeDescriptors().get(.).getLocalName()
+Attribute
+=========
+- FeatureType.getAttributeType(.).getLocalName() replaced with
+  FeatureType.getAttributeDescriptors().get(.).getLocalName()
+- getNumberOfAttributes() replaced with getAttributeCount()
+
+
+GridCoverage factory
+====================
+- FactoryFinder replaced with CoverageFactoryFinder
\ No newline at end of file

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/grid/GridUtil.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/grid/GridUtil.java	2009-08-26 15:55:48 UTC (rev 327)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/grid/GridUtil.java	2009-08-26 16:01:21 UTC (rev 328)
@@ -47,6 +47,7 @@
 
 import org.apache.log4j.Category;
 import org.apache.log4j.Logger;
+import org.geotools.coverage.CoverageFactoryFinder;
 import org.geotools.coverage.GridSampleDimension;
 import org.geotools.coverage.grid.GridCoverage2D;
 import org.geotools.coverage.grid.GridCoverageFactory;
@@ -58,6 +59,7 @@
 import org.geotools.styling.StyleBuilder;
 import org.opengis.coverage.PointOutsideCoverageException;
 import org.opengis.coverage.SampleDimension;
+import org.opengis.coverage.grid.GridEnvelope;
 import org.opengis.coverage.grid.GridRange;
 import org.opengis.geometry.Envelope;
 
@@ -141,12 +143,12 @@
 	   */
 	  public static GridStatistic determineStatistic(GridCoverage2D gc, int band, int histogramSteps, Integer histogrammDigits) {
 	    GridStatistic gs = new GridStatistic();
-	    GridRange     gr = gc.getGridGeometry().getGridRange();
+	    GridEnvelope  gr = gc.getGridGeometry().getGridRange();
 	    Envelope2D    ev = gc.getEnvelope2D();
-	    gs.minX          = gr.getLower(0);
-	    gs.minY          = gr.getLower(1);
-	    gs.maxX          = gr.getUpper(0);
-	    gs.maxY          = gr.getUpper(1);
+	    gs.minX          = gr.getLow(0);
+	    gs.minY          = gr.getLow(1);
+	    gs.maxX          = gr.getHigh(0);
+	    gs.maxY          = gr.getHigh(1);
 	    gs.widthC        = gs.maxX - gs.minX;
 	    gs.heightC       = gs.maxY - gs.minY;
 	    gs.widthR        = ev.getLength(0);
@@ -486,7 +488,7 @@
     final Map properties = new HashMap();
     //  properties.put("GC_NODATA", -9999.0);
 
-    return FactoryFinder.getGridCoverageFactory(null).create(
+    return CoverageFactoryFinder.getGridCoverageFactory(null).create(
         gc.getName(),
         gc.getRenderedImage(),
         (GridGeometry2D)gc.getGridGeometry(),

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java	2009-08-26 15:55:48 UTC (rev 327)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionFilterPanel.java	2009-08-26 16:01:21 UTC (rev 328)
@@ -55,6 +55,8 @@
 import org.geotools.feature.FeatureCollection;
 import org.geotools.map.DefaultMapLayer;
 import org.geotools.styling.Style;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
 import org.opengis.filter.Filter;
 
 import schmitzm.geotools.feature.AttributeTypeFilter;
@@ -160,7 +162,7 @@
 	/** Speichert, ob im Vorschau-Panel eine grafische Anzeige erscheinen soll */
 	private boolean geomPrev = false;
 	/** Speichert, die FeatureCollection */
-	private FeatureCollection fullFeatureCollection = null;
+	private FeatureCollection<SimpleFeatureType,SimpleFeature> fullFeatureCollection = null;
 
 	/** Speichert den letzten Fehler in der Filter-Regel. */
 	protected Throwable testError = null;
@@ -181,7 +183,7 @@
 	 *            oder nicht ({@code false})
 	 * @see FeatureCollection#getSchema()
 	 */
-	public FeatureCollectionFilterPanel(FeatureCollection fc, boolean geomPrev) {
+	public FeatureCollectionFilterPanel(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, boolean geomPrev) {
 		this(fc, geomPrev, true);
 	}
 
@@ -195,7 +197,7 @@
 	 *            werden soll (wenn {@code false} muss die explizit durch die
 	 *            Unterklasse erfolgen!)
 	 */
-	protected FeatureCollectionFilterPanel(FeatureCollection fc,
+	protected FeatureCollectionFilterPanel(FeatureCollection<SimpleFeatureType,SimpleFeature> fc,
 			boolean geomPrev, boolean initGUI) {
 		super(fc.getSchema(), false);
 		this.geomPrev = geomPrev;
@@ -339,9 +341,9 @@
 					if (getPreviewPanel() == null)
 						return;
 
-					FeatureCollection specialFeatureCollection = getFeatureCollection();
+					FeatureCollection<SimpleFeatureType,SimpleFeature> specialFeatureCollection = getFeatureCollection();
 
-					final FeatureCollection allFeatures = FeatureCollectionFilterPanel.this
+					final FeatureCollection<SimpleFeatureType,SimpleFeature> allFeatures = FeatureCollectionFilterPanel.this
 							.getFeatureCollection();
 
 					if (specialFeatureCollection != null && allFeatures != null)
@@ -532,7 +534,7 @@
 	 */
 	protected void performRuleTest() {
 		try {
-			FeatureCollection subCollection = filterFeatureCollection();
+			FeatureCollection<SimpleFeatureType,SimpleFeature> subCollection = filterFeatureCollection();
 			getPreviewPanel().setFeatureCollection(subCollection);
 			resetComponentsAfterTest(null);
 		} catch (Exception err) {
@@ -568,7 +570,7 @@
 	 *                passt
 	 * @see FeatureCollection#getSchema()
 	 */
-	public void setFeatureCollection(FeatureCollection fc) {
+	public void setFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc) {
 		if (getFeatureType() == null)
 			setFeatureType(fc.getSchema());
 		if (!fc.getSchema().equals(getFeatureType()))
@@ -585,7 +587,7 @@
 	 * Liefert die ungefilterte {@link FeatureCollection}, auf der gefiltert
 	 * wird.
 	 */
-	public FeatureCollection getFeatureCollection() {
+	public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatureCollection() {
 		return fullFeatureCollection;
 	}
 
@@ -614,7 +616,7 @@
 	 * 
 	 * @see FeatureCollection#subCollection(Filter)
 	 */
-	public FeatureCollection filterFeatureCollection() {
+	public FeatureCollection<SimpleFeatureType,SimpleFeature> filterFeatureCollection() {
 		return getFeatureCollection().subCollection(createFilter());
 	}
 
@@ -625,7 +627,7 @@
 	 * 
 	 * @see FeatureCollection#subCollection(Filter)
 	 */
-	public FeatureCollection filterFeatureCollection(FeatureCollection fc) {
+	public FeatureCollection<SimpleFeatureType,SimpleFeature> filterFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc) {
 		return fc.subCollection(createFilter());
 	}
 

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionTableModel.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionTableModel.java	2009-08-26 15:55:48 UTC (rev 327)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureCollectionTableModel.java	2009-08-26 16:01:21 UTC (rev 328)
@@ -63,7 +63,7 @@
  */
 public class FeatureCollectionTableModel extends AbstractTableModel {
   /** Holds the feature table that will be represented by this model. */
-  protected FeatureCollection featureTable = null;
+  protected FeatureCollection<SimpleFeatureType,SimpleFeature> featureTable = null;
   /** Array mit den Daten von {@link #featureTable}. Wird nur beim Aufruf von
    *  {@link #reorganize} befuellt. */
   protected SimpleFeature[] featureArray;
@@ -96,7 +96,7 @@
    * Erzeugt ein neues Tabellen-Modell.
    * @param features Daten fuer die Tabelle
    */
-  public FeatureCollectionTableModel(final FeatureCollection features) {
+  public FeatureCollectionTableModel(final FeatureCollection<SimpleFeatureType,SimpleFeature> features) {
     super();
     setFeatureCollection(features);
   }
@@ -163,7 +163,7 @@
    * erst nach erneutem {@link #reorganize()} in das Tabellen-Modell uebernommen!
    * @param features Daten-Basis fuer die Tabelle
    */
-  public void setFeatureCollection(final FeatureCollection features) {
+  public void setFeatureCollection(final FeatureCollection<SimpleFeatureType,SimpleFeature> features) {
       featureTable = features;
       reorganize();
    }
@@ -173,7 +173,7 @@
    * Nachtraegliche Aenderungen an der {@link FeatureCollection} werden
    * erst nach erneutem {@link #reorganize()} in das Tabellen-Modell uebernommen!
    */
-  public FeatureCollection getFeatureCollection() {
+  public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatureCollection() {
     return featureTable;
   }
 
@@ -258,8 +258,8 @@
    * Liefert Features der Tabelle als Collection.
    * @param idx Indizes der FeatureCollection
    */
-  public FeatureCollection getFeaturesAsCollection(int[] idx) {
-    FeatureCollection featureCol = FeatureCollections.newCollection();
+  public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeaturesAsCollection(int[] idx) {
+    FeatureCollection<SimpleFeatureType,SimpleFeature> featureCol = FeatureCollections.newCollection();
     for (int i=0; idx != null && i<idx.length; i++)
       featureCol.add( featureArray[ idx[i] ] );
     return featureCol;

Modified: branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureTablePane.java
===================================================================
--- branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureTablePane.java	2009-08-26 15:55:48 UTC (rev 327)
+++ branches/1.0-gt2-2.6/src/schmitzm/geotools/gui/FeatureTablePane.java	2009-08-26 16:01:21 UTC (rev 328)
@@ -48,6 +48,8 @@
 import org.geotools.feature.FeatureCollection;
 import org.geotools.map.DefaultMapLayer;
 import org.geotools.styling.Style;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
 
 import schmitzm.geotools.feature.AttributeTypeFilter;
 import schmitzm.geotools.feature.FeatureUtil;
@@ -115,7 +117,7 @@
 	 * @param fc
 	 *            angezeigte Features
 	 */
-	public FeatureTablePane(FeatureCollection fc) {
+	public FeatureTablePane(FeatureCollection<SimpleFeatureType,SimpleFeature> fc) {
 		this(fc, true);
 	}
 
@@ -139,7 +141,7 @@
 	 *            bestimmt, ob ein Preview-Bereich angezeigt wird ({@code true})
 	 *            oder nicht ({@code false})
 	 */
-	public FeatureTablePane(FeatureCollection fc, boolean geomPreview) {
+	public FeatureTablePane(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, boolean geomPreview) {
 		this(fc, null, geomPreview);
 	}
 
@@ -154,7 +156,7 @@
 	 *            bestimmt, ob ein Preview-Bereich angezeigt wird ({@code true})
 	 *            oder nicht ({@code false})
 	 */
-	public FeatureTablePane(FeatureCollection fc, Style style,
+	public FeatureTablePane(FeatureCollection<SimpleFeatureType,SimpleFeature> fc, Style style,
 			boolean geomPreview) {
 		this(new FeatureCollectionTableModel(fc), style, geomPreview);
 	}
@@ -312,7 +314,7 @@
 	 * @param fc
 	 *            anzuzeigende Features
 	 */
-	public void setFeatureCollection(FeatureCollection fc) {
+	public void setFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> fc) {
 		featuresTableModel.setFeatureCollection(fc);
 	}
 
@@ -327,7 +329,7 @@
 	/**
 	 * Liefert die angezeigten Features.
 	 */
-	public FeatureCollection getFeatureCollection() {
+	public FeatureCollection<SimpleFeatureType,SimpleFeature> getFeatureCollection() {
 		return featuresTableModel.getFeatureCollection();
 	}
 
@@ -351,7 +353,7 @@
 	/**
 	 * Liefert die in der Tabelle selektierten Features.
 	 */
-	public FeatureCollection getSelectedFeatures() {
+	public FeatureCollection<SimpleFeatureType,SimpleFeature> getSelectedFeatures() {
 		return featuresTableModel.getFeaturesAsCollection(featuresTable
 				.getSelectedModelRows());
 	}
@@ -380,7 +382,7 @@
 		if (mapPane == null)
 			return;
 
-		FeatureCollection selectedFeatures = getSelectedFeatures();
+		FeatureCollection<SimpleFeatureType,SimpleFeature> selectedFeatures = getSelectedFeatures();
 
 		/**
 		 * Das layer mit allen features soll nicht immer neu eingefügt werden.
@@ -388,7 +390,7 @@
 		 */
 		if (mapPane.getContext().getLayerCount() == 0) {
 
-			final FeatureCollection allFeatures = getFeatureCollection();
+			final FeatureCollection<SimpleFeatureType,SimpleFeature> allFeatures = getFeatureCollection();
 
 			/**
 			 * Add ALL features to the JMapPane as the base layer and style them
@@ -409,7 +411,7 @@
 
 		// Und ggf. neu hinzufügen
 		if (selectedFeatures != null && selectedFeatures.size() > 0  &&
-		    selectedFeatures.getSchema().getDefaultGeometry() != null) {
+		    selectedFeatures.getSchema().getGeometryDescriptor() != null) {
 
 			if (getFeatureStyle() == null) {
 				setFeatureStyle(StylingUtil.createStyleSimple(selectedFeatures,



More information about the Schmitzm-commits mailing list