[Schmitzm-commits] r833 - in trunk: src/schmitzm/geotools/feature src/schmitzm/geotools/io src/schmitzm/geotools/styling src/schmitzm/io src/schmitzm/jfree/chart/style src/schmitzm/jfree/feature src/schmitzm/jfree/feature/style src/skrueger/geotools src/skrueger/lang src_junit/schmitzm/jfree/feature/style src_junit/skrueger/versionnumber

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu May 6 21:50:35 CEST 2010


Author: alfonx
Date: 2010-05-06 21:50:32 +0200 (Thu, 06 May 2010)
New Revision: 833

Modified:
   trunk/src/schmitzm/geotools/feature/FeatureUtil.java
   trunk/src/schmitzm/geotools/io/GeoImportUtil.java
   trunk/src/schmitzm/geotools/styling/StylingUtil.java
   trunk/src/schmitzm/io/IOUtil.java
   trunk/src/schmitzm/jfree/chart/style/AbstractChartStyle.java
   trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java
   trunk/src/schmitzm/jfree/chart/style/ChartRendererStyle.java
   trunk/src/schmitzm/jfree/chart/style/PieChartStyle.java
   trunk/src/schmitzm/jfree/feature/Feature2PieDatasetMapping.java
   trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
   trunk/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java
   trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
   trunk/src/skrueger/geotools/AttributeMetadataMap.java
   trunk/src/skrueger/lang/PropertiesLoaded.java
   trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java
   trunk/src_junit/skrueger/versionnumber/ReleaseUtilTest.java
Log:
Organized Imports and minor improvements in IOUtil.readURLtoString

Modified: trunk/src/schmitzm/geotools/feature/FeatureUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/feature/FeatureUtil.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/geotools/feature/FeatureUtil.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -61,7 +61,6 @@
 import org.geotools.data.DataUtilities;
 import org.geotools.data.DefaultQuery;
 import org.geotools.data.FeatureSource;
-import org.geotools.data.Query;
 import org.geotools.data.memory.MemoryDataStore;
 import org.geotools.factory.CommonFactoryFinder;
 import org.geotools.factory.GeoTools;

Modified: trunk/src/schmitzm/geotools/io/GeoImportUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/io/GeoImportUtil.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/geotools/io/GeoImportUtil.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -1268,7 +1268,26 @@
 		return uncompressShapeZip(new FileInputStream(zipFile));
 	}
 
+
 	/**
+	 * Entpackt ein ZIP nach tmp (wo es angeblich von der Java VM nach JRE Ende
+	 * gelöscht wird und liefert eine URL auf die erste gefundene .SHP Datei
+	 * zurück. TODO Die entpacketen Dateien bleiben in Temp liegen!.
+	 * 
+	 * @throws IOException
+	 */
+	public static URL uncompressShapeZip(URL zipUrl)
+			throws FileNotFoundException, IOException {
+		InputStream zipUrlStream = zipUrl.openStream();
+		try {
+			return uncompressShapeZip(zipUrlStream);
+		} finally {
+			zipUrlStream.close();
+		}
+	}
+
+	
+	/**
 	 * Entpackt einen ZIP Stream nach tmp und liefert eine URL auf die erste gefundene .SHP Datei
 	 * zurück. TODO Die entpackten Dateien bleiben in Temp liegen!.
 	 * 
@@ -1293,14 +1312,15 @@
 			// Get next zip entry and start reading data
 			while ((entry = inStream.getNextEntry()) != null) {
 
-				OutputStream outStream = new FileOutputStream(new File(
-						tempFolder, entry.getName()));
+				File targetFile = new File(
+						tempFolder, entry.getName());
+				targetFile.getParentFile().mkdirs();
+				OutputStream outStream = new FileOutputStream(targetFile);
 				while ((nrBytesRead = inStream.read(buffer)) > 0) {
 					outStream.write(buffer, 0, nrBytesRead);
 				}
 				if (entry.getName().toLowerCase().endsWith(".shp")) {
-					shpUrl = DataUtilities.fileToURL(new File(tempFolder, entry
-							.getName()));
+					shpUrl = DataUtilities.fileToURL(targetFile);
 				}
 				outStream.close();
 			}

Modified: trunk/src/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/styling/StylingUtil.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/geotools/styling/StylingUtil.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -39,7 +39,6 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Reader;
-import java.io.StringReader;
 import java.lang.reflect.Array;
 import java.net.URL;
 import java.nio.charset.Charset;
@@ -113,7 +112,6 @@
 import org.geotools.util.NumberRange;
 import org.jdom.Element;
 import org.jdom.output.XMLOutputter;
-import org.jfree.util.Log;
 import org.opengis.coverage.grid.Grid;
 import org.opengis.coverage.grid.GridCoverage;
 import org.opengis.feature.simple.SimpleFeature;

Modified: trunk/src/schmitzm/io/IOUtil.java
===================================================================
--- trunk/src/schmitzm/io/IOUtil.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/io/IOUtil.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -712,7 +712,7 @@
 
 	/**
 	 * @return a {@link String} with the content of the {@link URL}. Do not use
-	 *         this on long files! Returns <code>null</code> if an erro occured.
+	 *         this on long files! Returns <code>null</code> if an error occured.
 	 */
 	public static String readURLasString(URL url) {
 		try {
@@ -725,8 +725,14 @@
 
 					BufferedReader inReader = new BufferedReader(inStream);
 					try {
-						String content = inReader.readLine();
-						return content;
+						String oneLine = inReader.readLine();
+						if (oneLine == null) return "";
+						StringBuffer content = new StringBuffer(oneLine);
+						while (oneLine != null) {
+							content.append(oneLine+"\n");
+							oneLine = inReader.readLine();
+						}
+						return content.toString();
 					} finally {
 						inReader.close();
 					}

Modified: trunk/src/schmitzm/jfree/chart/style/AbstractChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/style/AbstractChartStyle.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/jfree/chart/style/AbstractChartStyle.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -54,7 +54,6 @@
 import org.jfree.chart.labels.StandardXYToolTipGenerator;
 import org.jfree.chart.labels.XYToolTipGenerator;
 import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PiePlot;
 import org.jfree.chart.plot.PlotOrientation;
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.chart.renderer.AbstractRenderer;

Modified: trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/jfree/chart/style/ChartAxisStyle.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -36,14 +36,9 @@
 
 import org.jfree.chart.axis.Axis;
 import org.jfree.chart.axis.CategoryAxis;
-import org.jfree.chart.axis.CategoryLabelPosition;
 import org.jfree.chart.axis.CategoryLabelPositions;
 import org.jfree.chart.axis.DateAxis;
 import org.jfree.chart.axis.NumberAxis;
-import org.jfree.text.TextBlockAnchor;
-import org.jfree.ui.RectangleAnchor;
-import org.jfree.ui.RectangleInsets;
-import org.jfree.ui.TextAnchor;
 
 import schmitzm.lang.LangUtil;
 import skrueger.i8n.Translation;

Modified: trunk/src/schmitzm/jfree/chart/style/ChartRendererStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/style/ChartRendererStyle.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/jfree/chart/style/ChartRendererStyle.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -39,7 +39,6 @@
 import org.jfree.chart.labels.StandardCategorySeriesLabelGenerator;
 import org.jfree.chart.labels.StandardXYSeriesLabelGenerator;
 import org.jfree.chart.labels.XYSeriesLabelGenerator;
-import org.jfree.chart.plot.PiePlot;
 import org.jfree.chart.renderer.AbstractRenderer;
 import org.jfree.chart.renderer.category.AbstractCategoryItemRenderer;
 import org.jfree.chart.renderer.xy.AbstractXYItemRenderer;

Modified: trunk/src/schmitzm/jfree/chart/style/PieChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/chart/style/PieChartStyle.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/jfree/chart/style/PieChartStyle.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -41,18 +41,11 @@
 
 import org.jfree.chart.ChartFactory;
 import org.jfree.chart.JFreeChart;
-import org.jfree.chart.plot.CategoryPlot;
-import org.jfree.chart.plot.PlotOrientation;
-import org.jfree.chart.plot.XYPlot;
 import org.jfree.data.category.CategoryDataset;
 import org.jfree.data.general.Dataset;
 import org.jfree.data.general.PieDataset;
-import org.jfree.data.xy.IntervalXYDataset;
-import org.jfree.data.xy.TableXYDataset;
-import org.jfree.data.xy.XYBarDataset;
 import org.jfree.data.xy.XYDataset;
 
-import schmitzm.jfree.JFreeChartUtil;
 import schmitzm.lang.LangUtil;
 
 /**

Modified: trunk/src/schmitzm/jfree/feature/Feature2PieDatasetMapping.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/Feature2PieDatasetMapping.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/jfree/feature/Feature2PieDatasetMapping.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -30,7 +30,6 @@
 package schmitzm.jfree.feature;
 
 import org.geotools.feature.FeatureCollection;
-import org.jfree.data.category.CategoryDataset;
 import org.jfree.data.general.PieDataset;
 import org.opengis.feature.simple.SimpleFeature;
 

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureBasicChartStyle.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -29,7 +29,6 @@
  ******************************************************************************/
 package schmitzm.jfree.feature.style;
 
-import java.util.HashSet;
 import java.util.Set;
 
 import org.geotools.feature.FeatureCollection;

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureChartStyleXMLFactory.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -29,10 +29,8 @@
  ******************************************************************************/
 package schmitzm.jfree.feature.style;
 
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.StringTokenizer;
 
 import org.geotools.feature.FeatureCollection;
 import org.jdom.Element;
@@ -42,7 +40,6 @@
 import schmitzm.jfree.chart.style.ChartStyleXMLFactory;
 import schmitzm.jfree.chart.style.ChartType;
 import schmitzm.jfree.feature.AggregationFunction;
-import schmitzm.lang.LangUtil;
 import schmitzm.xml.XMLUtil;
 	
 /**

Modified: trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java
===================================================================
--- trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/schmitzm/jfree/feature/style/FeatureChartUtil.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -37,7 +37,6 @@
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Set;
 import java.util.Vector;
 
 import org.apache.log4j.Logger;

Modified: trunk/src/skrueger/geotools/AttributeMetadataMap.java
===================================================================
--- trunk/src/skrueger/geotools/AttributeMetadataMap.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/skrueger/geotools/AttributeMetadataMap.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -161,4 +161,5 @@
 		}
 		return list;
 	}
+
 }

Modified: trunk/src/skrueger/lang/PropertiesLoaded.java
===================================================================
--- trunk/src/skrueger/lang/PropertiesLoaded.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src/skrueger/lang/PropertiesLoaded.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -1,7 +1,6 @@
 package skrueger.lang;
 
 import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
 import java.net.URL;
 import java.util.Properties;
 

Modified: trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java
===================================================================
--- trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src_junit/schmitzm/jfree/feature/style/FeatureChartStyleTest.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -1,9 +1,9 @@
 package schmitzm.jfree.feature.style;
 
-import static org.junit.Assert.*;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.awt.Color;
 import java.awt.GraphicsEnvironment;
@@ -13,7 +13,6 @@
 import java.net.URL;
 
 import org.apache.log4j.Logger;
-import org.geotools.data.DataUtilities;
 import org.geotools.feature.FeatureCollection;
 import org.geotools.filter.text.cql2.CQLException;
 import org.jfree.chart.ChartFrame;
@@ -27,10 +26,8 @@
 import schmitzm.jfree.chart.style.ChartAxisStyle;
 import schmitzm.jfree.chart.style.ChartLabelStyle;
 import schmitzm.jfree.chart.style.ChartRendererStyle;
-import schmitzm.jfree.chart.style.ChartStyleUtil;
 import schmitzm.jfree.chart.style.ChartType;
 import schmitzm.jfree.feature.AggregationFunction;
-import schmitzm.xml.XMLUtil;
 
 public class FeatureChartStyleTest {
 	private static Logger log = Logger.getLogger(FeatureChartStyleTest.class);

Modified: trunk/src_junit/skrueger/versionnumber/ReleaseUtilTest.java
===================================================================
--- trunk/src_junit/skrueger/versionnumber/ReleaseUtilTest.java	2010-05-06 17:53:05 UTC (rev 832)
+++ trunk/src_junit/skrueger/versionnumber/ReleaseUtilTest.java	2010-05-06 19:50:32 UTC (rev 833)
@@ -1,6 +1,6 @@
 package skrueger.versionnumber;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import org.apache.log4j.Logger;
 import org.junit.Test;



More information about the Schmitzm-commits mailing list