[Schmitzm-commits] r1041 - in trunk/src: schmitzm/geotools/styling skrueger/swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Sep 22 12:56:21 CEST 2010


Author: alfonx
Date: 2010-09-22 12:56:20 +0200 (Wed, 22 Sep 2010)
New Revision: 1041

Modified:
   trunk/src/schmitzm/geotools/styling/StylingUtil.java
   trunk/src/skrueger/swing/DialogManager.java
Log:
When opening a dialog is canceled during construction, no more empty dialog will appear

Modified: trunk/src/schmitzm/geotools/styling/StylingUtil.java
===================================================================
--- trunk/src/schmitzm/geotools/styling/StylingUtil.java	2010-09-22 10:55:00 UTC (rev 1040)
+++ trunk/src/schmitzm/geotools/styling/StylingUtil.java	2010-09-22 10:56:20 UTC (rev 1041)
@@ -895,6 +895,12 @@
 	 */
 	public static Style createStyleFromSLD(Element element) {
 		String xmlDefinition = new XMLOutputter().outputString(element);
+		// TODO: Workaround, because gt2-2.6.x has problems when the
+        //       ColorMapEntries are not in the ascending order according to
+        //       their values
+		// --> maybe we can bring the XML-Elements to an ascending order
+		//     prior to interprete the XML
+		
 		ByteArrayInputStream inputStream = null;
 		try {
 			inputStream = new ByteArrayInputStream(xmlDefinition.getBytes());
@@ -2484,7 +2490,26 @@
 
 		return filterSLDVisibleOnly(fc, style, scaleDenominator);
 	}
+	
+	/**
+	 * Corrct RasterStyle specific pitfalls.<br/>
+	 *  1. check the getGeometryPropertyName<br/>
+	 *  2. check colormaps are in correct order 
+	 */
+	public Style correctRasterStyle(Style style) {
+		DuplicatingStyleVisitor dsv = new DuplicatingStyleVisitor() {
+			@Override
+			public void visit(ColorMap cm) {
+				// TODO
+			};
+		};
+		
+		dsv.visit(style);
 
+		Style copiedCleanStyle = (Style) dsv.getCopy();
+		return copiedCleanStyle;
+	}
+	
 	/**
 	 * Since GT2.6, the AttributeNames are case sensitive. Also the raster
 	 * Styles need GeometryProperty set to "geom" to work. This method checks
@@ -2509,6 +2534,7 @@
 				}
 				super.visit(sym);
 			};
+			
 
 			@Override
 			public void visit(LineSymbolizer sym) {

Modified: trunk/src/skrueger/swing/DialogManager.java
===================================================================
--- trunk/src/skrueger/swing/DialogManager.java	2010-09-22 10:55:00 UTC (rev 1040)
+++ trunk/src/skrueger/swing/DialogManager.java	2010-09-22 10:56:20 UTC (rev 1041)
@@ -45,6 +45,10 @@
 	 * @return
 	 */
 	protected DIALOG bringup(DIALOG dialog) {
+		if (dialog == null){
+			// The dialog creation may have been cancelled
+			return null;
+		}
 		if (!dialog.isVisible())
 			dialog.setVisible(true);
 		dialog.toFront();
@@ -124,6 +128,10 @@
 		} else {
 
 			dialog = factory.create();
+			if (dialog.isDisposed) {
+				// The creation of the Dialog may have been cancelled for some reason
+				return null;
+			}
 			dialogCache.put(key, dialog);
 			dialog.setVisible(true);
 			dialog.toFront();



More information about the Schmitzm-commits mailing list