[Schmitzm-commits] r761 - in trunk/src/schmitzm: geotools/io jfree/resource/locales
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Mar 11 09:45:08 CET 2010
Author: alfonx
Date: 2010-03-11 09:45:06 +0100 (Thu, 11 Mar 2010)
New Revision: 761
Modified:
trunk/src/schmitzm/geotools/io/GeoImportUtil.java
trunk/src/schmitzm/jfree/resource/locales/JFreeResourceBundle.properties
trunk/src/schmitzm/jfree/resource/locales/JFreeResourceBundle_de.properties
Log:
Modified: trunk/src/schmitzm/geotools/io/GeoImportUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/io/GeoImportUtil.java 2010-03-10 13:44:39 UTC (rev 760)
+++ trunk/src/schmitzm/geotools/io/GeoImportUtil.java 2010-03-11 08:45:06 UTC (rev 761)
@@ -39,14 +39,18 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
import javax.imageio.IIOException;
import javax.imageio.ImageIO;
@@ -245,8 +249,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.");
@@ -304,8 +308,8 @@
if (prjString == null || prjString.trim().equals(""))
throw new FileNotFoundException("No proper prj-File exists: "
+ file.getName());
-// CRS.parseWKT(prjString);
- GTUtil.createCRS(prjString);
+ // CRS.parseWKT(prjString);
+ GTUtil.createCRS(prjString);
} catch (FileNotFoundException err) {
store.forceSchemaCRS(getDefaultCRS());
LOGGER.warn("No projection found for file " + file.getName()
@@ -1211,4 +1215,62 @@
openStream.close();
}
}
+
+ public static ZipEntry testShapeInZip(InputStream zippedInputstream)
+ throws IOException {
+ ZipInputStream inStream = new ZipInputStream(zippedInputstream);
+
+ try {
+ ZipEntry entry;
+ // Get next zip entry and start reading data
+ while ((entry = inStream.getNextEntry()) != null) {
+ if (entry.getName().toLowerCase().endsWith(".shp")) {
+ return entry;
+ }
+ }
+ return null;
+
+ } finally {
+ inStream.close();
+ }
+ }
+
+ public static URL uncompressShapeZip(InputStream zippedInputstream)
+ throws IOException {
+ ZipInputStream inStream = new ZipInputStream(zippedInputstream);
+
+ File tempDir = IOUtil.getTempDir();
+
+ File tempFolder = new File(tempDir, "unzipped"
+ + String.valueOf(System.nanoTime()));
+ tempFolder.mkdir();
+
+ URL shpUrl = null;
+
+ try {
+ ZipEntry entry;
+ byte[] buffer = new byte[1024];
+ int nrBytesRead;
+ // Get next zip entry and start reading data
+ while ((entry = inStream.getNextEntry()) != null) {
+
+ OutputStream outStream = new FileOutputStream(new File(
+ tempFolder, entry.getName()));
+ 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()));
+ }
+ outStream.close();
+ }
+
+ } finally {
+ inStream.close();
+ }
+
+ return shpUrl;
+ }
+
}
Modified: trunk/src/schmitzm/jfree/resource/locales/JFreeResourceBundle.properties
===================================================================
--- trunk/src/schmitzm/jfree/resource/locales/JFreeResourceBundle.properties 2010-03-10 13:44:39 UTC (rev 760)
+++ trunk/src/schmitzm/jfree/resource/locales/JFreeResourceBundle.properties 2010-03-11 08:45:06 UTC (rev 761)
@@ -87,4 +87,4 @@
regressionline.tooltip=<html><i>r</i> is the product-moment-correlation coefficient and gives information about how strong the variables are related.</html>
-Exception.noWeightAttributeDefinedforAWeightedAggregation=A weighted AggregationFunction is selected, but not artribute for weighting is selected.
\ No newline at end of file
+Exception.noWeightAttributeDefinedforAWeightedAggregation=A weighted AggregationFunction is selected, but not artribute for weighting is selected.
Modified: trunk/src/schmitzm/jfree/resource/locales/JFreeResourceBundle_de.properties
===================================================================
--- trunk/src/schmitzm/jfree/resource/locales/JFreeResourceBundle_de.properties 2010-03-10 13:44:39 UTC (rev 760)
+++ trunk/src/schmitzm/jfree/resource/locales/JFreeResourceBundle_de.properties 2010-03-11 08:45:06 UTC (rev 761)
@@ -82,4 +82,4 @@
regression.total=vollkommener Zusammenhang
regressionline.tooltip=<html><i>r</i> ist der Produktmomentkorrelationskoefizient und sagt aus, wie stark zwei Variablen voneinander abh\u00e4ngen.
-Exception.noWeightAttributeDefinedforAWeightedAggregation=Eine gewichtete Aggregierungsfunktion ist ausgew\u00e4hlt, aber kein Attribut f\u00fcr die Gewichtung.
\ No newline at end of file
+Exception.noWeightAttributeDefinedforAWeightedAggregation=Eine gewichtete Aggregierungsfunktion ist ausgew\u00e4hlt, aber kein Attribut f\u00fcr die Gewichtung.
More information about the Schmitzm-commits
mailing list