[Schmitzm-commits] r106 - trunk/src/skrueger/geotools/selection

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri May 8 17:13:49 CEST 2009


Author: alfonx
Date: 2009-05-08 17:13:49 +0200 (Fri, 08 May 2009)
New Revision: 106

Modified:
   trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
   trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java
Log:
* Improved styling for selected features.

Modified: trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
===================================================================
--- trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java	2009-05-08 15:02:28 UTC (rev 105)
+++ trunk/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java	2009-05-08 15:13:49 UTC (rev 106)
@@ -67,8 +67,8 @@
  *         (University of Bonn/Germany)
  */
 public class FeatureMapLayerSelectionSynchronizer extends
-		StyledLayerSelectionModelSynchronizer<StyledFeatureLayerSelectionModel> implements
-		JMapPaneListener {
+		StyledLayerSelectionModelSynchronizer<StyledFeatureLayerSelectionModel>
+		implements JMapPaneListener {
 	/**
 	 * Holds the {@link MapLayer} to keep synchronized with the layer selection
 	 * model.
@@ -140,57 +140,57 @@
 
 				selectionMapStyle = styledMapLayer.getStyle();
 				LOGGER.debug("NO SELECTION .. reset original style");
-				
+
 			} else {
 				LOGGER.debug("SELECTION .. change style");
-				
+
 				Style originalStyle = styledMapLayer.getStyle();
-				
-				// TODO This clone is a deep clone and it is slow.. 
-				selectionMapStyle =  StylingUtil.clone(originalStyle);
-				
-				
-				Rule selectedRule = StylingUtil.STYLE_FACTORY.createRule();
-				selectedRule.setFilter(new Filter() {
 
-					@Override
-					public Object accept(FilterVisitor visitor, Object extraData) {
-						return null;
-					}
+				// TODO This clone is a deep clone and it is slow..
+				selectionMapStyle = StylingUtil.clone(originalStyle);
 
-					@Override
-					public boolean evaluate(Object obj) {
-						if (obj instanceof Feature) {
-							Feature f = (Feature)obj;
-							LOGGER.info("treffer");
-							// TODO BAD CODE
-							for (Feature ff : newSelection){
-								if (ff.getID().equals(f.getID())) return true;
+				// TODO BAD CODE
+				Style defaultStyle = StylingUtil
+						.createDefaultStyle(styledMapLayer.getGeoObject());
+
+				// Rule selectedRule = StylingUtil.STYLE_FACTORY.createRule();
+				defaultStyle.getFeatureTypeStyles()[0].getRules()[0]
+						.setFilter(new Filter() {
+
+							@Override
+							public Object accept(FilterVisitor visitor,
+									Object extraData) {
+								return null;
 							}
-							return false;
-							
-						}
-						LOGGER.info("kein treffer");
-						return false;
-					}
-					
-				});
-				
-				Style defaultStyle = StylingUtil.createDefaultStyle(styledMapLayer.getGeoObject());
-				selectedRule.setSymbolizers(new Symbolizer[] {defaultStyle.getFeatureTypeStyles()[0].getRules()[0].getSymbolizers()[0]} );
-				
-				Rule[] rules = selectionMapStyle.getFeatureTypeStyles()[0].getRules();
-				rules = LangUtil.extendArray(rules, selectedRule);
-				
-				selectionMapStyle.getFeatureTypeStyles()[0].setRules(rules);
-				
-//				selectionMapStyle.setFeatureTypeStyles(originalStyle.getF)
-				
+
+							@Override
+							public boolean evaluate(Object obj) {
+								if (obj instanceof Feature) {
+									Feature f = (Feature) obj;
+									// TODO BAD CODE
+									for (Feature ff : newSelection) {
+										if (ff.getID().equals(f.getID()))
+											return true;
+									}
+									return false;
+
+								}
+								return false;
+							}
+
+						});
+
+				selectionMapStyle.setFeatureTypeStyles(LangUtil.extendArray(
+						selectionMapStyle.getFeatureTypeStyles(), defaultStyle
+								.getFeatureTypeStyles()[0]));
+
+				// selectionMapStyle.setFeatureTypeStyles(originalStyle.getF)
+
 				// Flat copy the style
-				
-//				selectionMapStyle = StylingUtil.createDefaultStyle(styledMapLayer.getGeoObject());
-				
-				
+
+				// selectionMapStyle =
+				// StylingUtil.createDefaultStyle(styledMapLayer.getGeoObject());
+
 			}
 
 			mapLayer.setStyle(selectionMapStyle);
@@ -216,15 +216,15 @@
 
 	@Override
 	public void performMapPaneEvent(JMapPaneEvent e) {
-		
+
 		if (!(e instanceof FeatureSelectedEvent)) {
-			LOGGER.debug("Ignoring event "+e);
+//			LOGGER.debug("Ignoring event " + e);
 			return;
 		}
 
 		FeatureSelectedEvent fse = (FeatureSelectedEvent) e;
-		LOGGER.debug("Do event "+fse);
-		LOGGER.debug("Do event "+fse.getSelectionResult());
+//		LOGGER.debug("Do event " + fse);
+//		LOGGER.debug("Do event " + fse.getSelectionResult());
 
 		// ignore event if it is caused by the DpLayerVectorSelectionModel
 		if (selectionChangeCausedByMe)
@@ -252,7 +252,7 @@
 		// Show selected feature in the map, which is not automatically done by
 		// the FeatureSelectedEvent
 		changeLayerStyle(layerSelModel.getSelection());
-		
+
 		// Danger of event circles in propertyChange(..) banned
 		selectionChangeCausedByMe = false;
 	}

Modified: trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java
===================================================================
--- trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java	2009-05-08 15:02:28 UTC (rev 105)
+++ trunk/src/skrueger/geotools/selection/TableSelectionSynchronizer.java	2009-05-08 15:13:49 UTC (rev 106)
@@ -106,8 +106,8 @@
 		if (newSelection == null)
 			return;
 		
-		LOGGER.debug("Table pop changed "+selEvt);
-		LOGGER.debug("Table pop changed to "+newSelection);
+//		LOGGER.debug("Table pop changed "+selEvt);
+//		LOGGER.debug("Table pop changed to "+newSelection);
 
 		// Avoid event circles in valueChanged(..)
 		selectionChangeCausedByMe = true;



More information about the Schmitzm-commits mailing list