[Schmitzm-commits] r853 - in branches/2.0-GP14/src/schmitzm: geotools/io jfree/chart/style jfree/feature/style

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri May 21 13:34:54 CEST 2010


Author: alfonx
Date: 2010-05-21 13:34:52 +0200 (Fri, 21 May 2010)
New Revision: 853

Modified:
   branches/2.0-GP14/src/schmitzm/geotools/io/GeoImportUtil.java
   branches/2.0-GP14/src/schmitzm/jfree/chart/style/ChartStyleXMLFactory.java
   branches/2.0-GP14/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java
Log:
Backported a bugfix where the aggregation function of a bar chart was not correctly loaded/saved to XML. Added a JUnit test for it

Modified: branches/2.0-GP14/src/schmitzm/geotools/io/GeoImportUtil.java
===================================================================
--- branches/2.0-GP14/src/schmitzm/geotools/io/GeoImportUtil.java	2010-05-21 11:34:34 UTC (rev 852)
+++ branches/2.0-GP14/src/schmitzm/geotools/io/GeoImportUtil.java	2010-05-21 11:34:52 UTC (rev 853)
@@ -214,7 +214,6 @@
 	public static CoordinateReferenceSystem getDefaultCRS() {
 		return DEFAULT_CRS;
 	}
-
 	// /////////////////////////////////////////////////////////////////////////
 	// FEATURE IMPORT
 	// /////////////////////////////////////////////////////////////////////////
@@ -226,8 +225,24 @@
 	 * 
 	 * @param url
 	 *            {@link URL} to Shape-File
+	 *            
+	 * @return {@link FeatureCollection} that was read
+	 * @throws IOException 
+	 */
+	public static FeatureCollection<SimpleFeatureType, SimpleFeature> readFeaturesFromShapeURL(URL url) throws IOException {
+		return readFeaturesFromShapeURL(url, null);
+	}
+			
+	/**
+	 * Diese Methode extrahiert saemtliche Features aus einem ShapeFile-Projekt
+	 * (<code><i>name</i>.shp <i>name</i>.prj <i>name</i>.dbf ...</code>) und
+	 * speichert diese in einer
+	 * <code>org.geotools.feature.FeatureCollection</code>.<br>
+	 * 
+	 * @param url
+	 *            {@link URL} to Shape-File
 	 * @param prjUrl
-	 *            {@link URL} zu .prj Datei des Shape-File
+	 *            {@link URL} zu .prj Datei des Shape-File. Darf <code>null</code> sein.
 	 * 
 	 * 
 	 * @author <a href="mailto:skpublic at wikisquare.de">Stefan Alfons
@@ -245,8 +260,8 @@
 			// Standard-CRS
 			// zu setzen
 			LOGGER.debug("  parseWKT on " + prjUrl);
-//            CRS.parseWKT(readProjectionString(prjUrl));
-            GTUtil.createCRS(readProjectionString(prjUrl));
+			// CRS.parseWKT(readProjectionString(prjUrl));
+			GTUtil.createCRS(readProjectionString(prjUrl));
 		} catch (Exception err) {
 			LOGGER.warn(" CRS.parseWKT mit Ex\n: ", err);
 			LOGGER.warn(" No projection found for file. Default is used.");
@@ -271,7 +286,6 @@
 
 		return fc;
 	}
-
 	/**
 	 * Diese Methode extrahiert saemtliche Features aus einem ShapeFile-Projekt
 	 * (<code><i>name</i>.shp <i>name</i>.prj <i>name</i>.dbf ...</code>) und

Modified: branches/2.0-GP14/src/schmitzm/jfree/chart/style/ChartStyleXMLFactory.java
===================================================================
--- branches/2.0-GP14/src/schmitzm/jfree/chart/style/ChartStyleXMLFactory.java	2010-05-21 11:34:34 UTC (rev 852)
+++ branches/2.0-GP14/src/schmitzm/jfree/chart/style/ChartStyleXMLFactory.java	2010-05-21 11:34:52 UTC (rev 853)
@@ -66,6 +66,13 @@
   }
 
   /**
+   * Reads a {@link ChartStyle} from an XML file.
+   * @param filePath        file to read the style from
+   */
+  public E readStyleFromFile(File filePath) throws IOException {
+    return (E)ChartStyleUtil.readStyleFromXML(filePath.toURI().toURL(), this);
+  }
+  /**
    * Reads a chart definition from XML element.
    * @param element the XML element
    * @param id      the ID for the style (if {@code null} the

Modified: branches/2.0-GP14/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java
===================================================================
--- branches/2.0-GP14/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java	2010-05-21 11:34:34 UTC (rev 852)
+++ branches/2.0-GP14/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java	2010-05-21 11:34:52 UTC (rev 853)
@@ -98,7 +98,7 @@
       chartStyle.setAttributeName(rangeAttrNo, featureAttrName);
       chartStyle.setAttributeNormalized(rangeAttrNo, XMLUtil.getBooleanAttribute(domainAttrElem, "normalize", false));
 
-      String aggrFuncStr = XMLUtil.getAttribute(domainAttrElem, "function", (String)null);
+      String aggrFuncStr = XMLUtil.getAttribute(rangeAttrElem, "function", (String)null);
       if ( aggrFuncStr != null )
         chartStyle.setAttributeAggregation(rangeAttrNo, AggregationFunction.valueOf(aggrFuncStr) );
       



More information about the Schmitzm-commits mailing list