[Schmitzm-commits] r559 - branches/1.0-gt2-2.6/src/skrueger/geotools/selection

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Nov 24 15:12:43 CET 2009


Author: alfonx
Date: 2009-11-24 15:12:41 +0100 (Tue, 24 Nov 2009)
New Revision: 559

Modified:
   branches/1.0-gt2-2.6/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
Log:
bugix: Under some conditions removing parts of a big selection has not been painted in the mappane


Modified: branches/1.0-gt2-2.6/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
===================================================================
--- branches/1.0-gt2-2.6/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java	2009-11-24 13:01:09 UTC (rev 558)
+++ branches/1.0-gt2-2.6/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java	2009-11-24 14:12:41 UTC (rev 559)
@@ -42,9 +42,11 @@
  **/
 package skrueger.geotools.selection;
 
+import java.awt.RenderingHints;
 import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.io.File;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -58,6 +60,9 @@
 import org.geotools.feature.FeatureIterator;
 import org.geotools.filter.FidFilterImpl;
 import org.geotools.map.MapLayer;
+import org.geotools.renderer.GTRenderer;
+import org.geotools.renderer.label.LabelCacheImpl;
+import org.geotools.renderer.lite.StreamingRenderer;
 import org.geotools.styling.FeatureTypeStyle;
 import org.geotools.styling.Style;
 import org.geotools.styling.visitor.DuplicatingStyleVisitor;
@@ -68,10 +73,11 @@
 import org.opengis.filter.identity.FeatureId;
 
 import schmitzm.geotools.FilterUtil;
+import schmitzm.geotools.GTUtil;
 import schmitzm.geotools.gui.SelectableXMapPane;
 import schmitzm.geotools.map.event.FeatureSelectedEvent;
-import schmitzm.geotools.map.event.MapPaneEvent;
 import schmitzm.geotools.map.event.JMapPaneListener;
+import schmitzm.geotools.map.event.MapPaneEvent;
 import schmitzm.geotools.styling.StylingUtil;
 import skrueger.geotools.MapPaneToolBar;
 import skrueger.geotools.StyledFeaturesInterface;
@@ -199,8 +205,9 @@
 							&& fts.getName().equals(SELECTION_STYLING_FTS_NAME)) {
 						originalStyle.featureTypeStyles().remove(fts);
 
-						replaceRenderer();
-						// mapPane.refresh();
+						mapLayer.setStyle(originalStyle);
+						// replaceRenderer();
+						// // mapPane.refresh();
 
 						return;
 					}
@@ -330,7 +337,7 @@
 
 		/**
 		 * testing, whether the selection really changed. If not, we can save
-		 * one paint!
+		 * one rendering!
 		 */
 		for (FeatureTypeStyle fts : originalStyle.featureTypeStyles()) {
 
@@ -364,6 +371,10 @@
 						}
 					}
 
+					if (antiFids.size() + newSelection.size() != styledLayer
+							.getFeatureCollectionFiltered().size())
+						return true;
+
 				} else {
 					FidFilterImpl origFidsFilter = (FidFilterImpl) filter;
 
@@ -404,42 +415,6 @@
 	 * Replaces the local renderer
 	 */
 	private void replaceRenderer() {
-		// //
-		// // // Has to be done before we apply the new Renderer
-		// // mapLayer.setStyle(style);
-		//
-		// GTRenderer oldRenderer = mapPane.getLocalRenderer();
-		//
-		// /**
-		// * Explicitly putting a new instance of LabelCacheDefault into the
-		// * renderer instance, so JMapPane doesn't reuse the old one. This is
-		// * very useful when changing the TextSymbolizer with AtlasStyler<br/>
-		// * SK 9.7.09: It's not enought to user LabelCache.clear(). We can not
-		// * reuse the old Renderer - better to create a new one!
-		// */
-		// final GTRenderer newRenderer = GTUtil.createGTRenderer();
-		//
-		// final HashMap<Object, Object> rendererHints =
-		// defaultGTRenderingHints;
-		// rendererHints.put(StreamingRenderer.LABEL_CACHE_KEY,
-		// new LabelCacheImpl());
-		//
-		// newRenderer.setRendererHints(rendererHints);
-		// mapPane.setLocalRenderer(newRenderer);
-		//
-		// if (oldRenderer != null) {
-		//
-		// RenderingHints java2DHints = oldRenderer.getJava2DHints();
-		// if (java2DHints != null) {
-		// newRenderer.setJava2DHints(java2DHints);
-		// }
-		//
-		// oldRenderer.setContext(null);
-		// oldRenderer = null;
-		// }
-
-		mapPane.refresh();
-
 	}
 
 	/**



More information about the Schmitzm-commits mailing list