[Schmitzm-commits] r698 - in trunk/src/schmitzm: geotools/feature geotools/gui geotools/io geotools/styling lang
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Sat Feb 13 17:35:23 CET 2010
Author: mojays
Date: 2010-02-13 17:35:22 +0100 (Sat, 13 Feb 2010)
New Revision: 698
Modified:
trunk/src/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java
trunk/src/schmitzm/geotools/gui/JMapEditorPane.java
trunk/src/schmitzm/geotools/io/GeoExportUtil.java
trunk/src/schmitzm/geotools/styling/StylingUtil.java
trunk/src/schmitzm/lang/LangUtil.java
trunk/src/schmitzm/lang/ResourceProvider.java
Log:
- FeatureTypeBuilderTableModel: bug with translation key fixed
- JMapEditorPane: bug with translation key fixed
- GeoExportUtil.writeFeaturesToShapeFile(.): handle destination file without ".shp" extension
- StylingUtil.saveStyleToSLD(.): automatically add file extension ".sld"
- LangUtil: new method to log stack trace
- ResoureProvider: when resource is missing log stack trace (instead of print to standard out)
Modified: trunk/src/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java
===================================================================
--- trunk/src/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java 2010-02-13 14:46:42 UTC (rev 697)
+++ trunk/src/schmitzm/geotools/feature/FeatureTypeBuilderTableModel.java 2010-02-13 16:35:22 UTC (rev 698)
@@ -376,7 +376,7 @@
if ( Number.class.isAssignableFrom(type) )
valueGenerator = new NumberValueGenerator((Number)defaultValue);
else
- throw new UnsupportedOperationException( GeotoolsGUIUtil.RESOURCE.getString("schmitzm.geotools.gui.JEditorToolBar.NewLayer.Err.AutoVal", type.getSimpleName()));
+ throw new UnsupportedOperationException( GeotoolsGUIUtil.RESOURCE.getString("schmitzm.geotools.gui.JMapEditorToolBar.NewLayer.Err.AutoVal", type.getSimpleName()));
FeatureUtil.registerAutoValueGenerator(aType, valueGenerator);
} else
FeatureUtil.unregisterAutoValueGenerator(aType);
Modified: trunk/src/schmitzm/geotools/gui/JMapEditorPane.java
===================================================================
--- trunk/src/schmitzm/geotools/gui/JMapEditorPane.java 2010-02-13 14:46:42 UTC (rev 697)
+++ trunk/src/schmitzm/geotools/gui/JMapEditorPane.java 2010-02-13 16:35:22 UTC (rev 698)
@@ -829,7 +829,7 @@
attrInputOption.setValue(feature);
Object[] value = MultipleOptionPane.showMultipleInputDialog(
this,
- GeotoolsGUIUtil.RESOURCE.getString("schmitzm.geotools.gui.JEditorToolBar.NewFeature.title"),
+ GeotoolsGUIUtil.RESOURCE.getString("schmitzm.geotools.gui.JMapEditorToolBar.NewFeature.title"),
attrInputOption
);
if ( value == null )
Modified: trunk/src/schmitzm/geotools/io/GeoExportUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/io/GeoExportUtil.java 2010-02-13 14:46:42 UTC (rev 697)
+++ trunk/src/schmitzm/geotools/io/GeoExportUtil.java 2010-02-13 16:35:22 UTC (rev 698)
@@ -89,12 +89,17 @@
public static void writeFeaturesToShapeFile(
FeatureCollection<SimpleFeatureType, SimpleFeature> fc, File outFile)
throws Exception {
- // FeatureCollectionReader featureReader = new
- // FeatureCollectionReader(fc);
-
// DataStore fuer Ausgabe-Datei oeffnen
- ShapefileDataStore shpStore = new ShapefileDataStore(outFile.toURI()
- .toURL());
+ ShapefileDataStore shpStore = null;
+ try {
+ shpStore = new ShapefileDataStore(outFile.toURI().toURL());
+ } catch (IllegalArgumentException err) {
+ // ShapefileDataStore schmeisst eine IllegalArgumentException,
+ // wenn Dateiname nicht ".shp", ".dbf", ... ist
+ // -> Erweiterung anhaengen
+ outFile = IOUtil.appendFileExt(outFile, ".shp");
+ shpStore = new ShapefileDataStore(outFile.toURI().toURL());
+ }
// shpStore.createSchema(featureReader.getFeatureType());
shpStore.createSchema(fc.getSchema());
// FeatureStore aus dem ShapeFile-DataStore ermitteln
Modified: trunk/src/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/styling/StylingUtil.java 2010-02-13 14:46:42 UTC (rev 697)
+++ trunk/src/schmitzm/geotools/styling/StylingUtil.java 2010-02-13 16:35:22 UTC (rev 698)
@@ -122,6 +122,7 @@
import schmitzm.geotools.feature.FeatureUtil;
import schmitzm.geotools.feature.FeatureUtil.GeometryForm;
import schmitzm.geotools.grid.GridUtil;
+import schmitzm.io.IOUtil;
import schmitzm.lang.LangUtil;
import skrueger.geotools.StyledFeaturesInterface;
import skrueger.geotools.StyledRasterInterface;
@@ -1083,6 +1084,10 @@
public static final boolean saveStyleToSLD(Style origStyle,
File exportFile, Charset charset) throws TransformerException,
IOException {
+ // Wenn Datei nicht mit .sld endet, die Dateierweiterung
+ // anhängen
+ exportFile = IOUtil.appendFileExt(exportFile, ".sld");
+
SLDTRANSFORMER.setIndentation(2);
// LOGGER.debug("default charset = "+ Charset.defaultCharset());
// SLDTRANSFORMER.setEncoding(Charset.forName("UTF-8"));
Modified: trunk/src/schmitzm/lang/LangUtil.java
===================================================================
--- trunk/src/schmitzm/lang/LangUtil.java 2010-02-13 14:46:42 UTC (rev 697)
+++ trunk/src/schmitzm/lang/LangUtil.java 2010-02-13 16:35:22 UTC (rev 698)
@@ -1025,5 +1025,23 @@
logDebugWarn(logger,null,err);
}
+ /**
+ * Logs the last X classes from a stack trace as debug message.
+ * @param logger the logger
+ * @param stackTrace stack trace to explore
+ * @param depth maximum count of classes, which are explored in the stack
+ * trace
+ */
+ public static void logDebugLastStackTraceClasses(Category logger, StackTraceElement[] stackTrace, int depth) {
+ String[] lastClasses = getLastStackTraceClasses(stackTrace, depth);
+ for (int i=0; i<lastClasses.length; i++) {
+ String message = "";
+ if (i > 0)
+ message = "\t...";
+ message += lastClasses[i];
+ logger.debug(message);
+ }
+ }
+
}
Modified: trunk/src/schmitzm/lang/ResourceProvider.java
===================================================================
--- trunk/src/schmitzm/lang/ResourceProvider.java 2010-02-13 14:46:42 UTC (rev 697)
+++ trunk/src/schmitzm/lang/ResourceProvider.java 2010-02-13 16:35:22 UTC (rev 698)
@@ -340,10 +340,10 @@
return ResourceBundle.getBundle(defaultResourceBundle, requestedLocale).getObject(key);
} catch (final MissingResourceException err2) {
// Wenn Ressource auch im Standard-Bundle nicht vorhanden ist,
- // Fehler werfen (oder ignorieren
+ // Fehler werfen (oder ignorieren)
if ( ignoreMissingResource ) {
LOGGER.warn("ResourceBundle "+primaryBundle+": "+err.getMessage()+" in");
- LangUtil.printLastStackTraceClasses(err.getStackTrace(), 4);
+ LangUtil.logDebugLastStackTraceClasses(LOGGER, err.getStackTrace(), 4);
return null;
}
throw err2;
More information about the Schmitzm-commits
mailing list