/[schmitzm]/branches/2.1/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
ViewVC logotype

Diff of /branches/2.1/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 558 by alfonx, Wed Nov 11 21:17:33 2009 UTC revision 559 by alfonx, Tue Nov 24 14:12:41 2009 UTC
# Line 42  Line 42 
42   **/   **/
43  package skrueger.geotools.selection;  package skrueger.geotools.selection;
44    
45    import java.awt.RenderingHints;
46  import java.beans.PropertyChangeEvent;  import java.beans.PropertyChangeEvent;
47  import java.beans.PropertyChangeListener;  import java.beans.PropertyChangeListener;
48  import java.io.File;  import java.io.File;
49    import java.util.HashMap;
50  import java.util.HashSet;  import java.util.HashSet;
51  import java.util.Iterator;  import java.util.Iterator;
52  import java.util.Set;  import java.util.Set;
# Line 58  import org.geotools.feature.FeatureColle Line 60  import org.geotools.feature.FeatureColle
60  import org.geotools.feature.FeatureIterator;  import org.geotools.feature.FeatureIterator;
61  import org.geotools.filter.FidFilterImpl;  import org.geotools.filter.FidFilterImpl;
62  import org.geotools.map.MapLayer;  import org.geotools.map.MapLayer;
63    import org.geotools.renderer.GTRenderer;
64    import org.geotools.renderer.label.LabelCacheImpl;
65    import org.geotools.renderer.lite.StreamingRenderer;
66  import org.geotools.styling.FeatureTypeStyle;  import org.geotools.styling.FeatureTypeStyle;
67  import org.geotools.styling.Style;  import org.geotools.styling.Style;
68  import org.geotools.styling.visitor.DuplicatingStyleVisitor;  import org.geotools.styling.visitor.DuplicatingStyleVisitor;
# Line 68  import org.opengis.filter.Not; Line 73  import org.opengis.filter.Not;
73  import org.opengis.filter.identity.FeatureId;  import org.opengis.filter.identity.FeatureId;
74    
75  import schmitzm.geotools.FilterUtil;  import schmitzm.geotools.FilterUtil;
76    import schmitzm.geotools.GTUtil;
77  import schmitzm.geotools.gui.SelectableXMapPane;  import schmitzm.geotools.gui.SelectableXMapPane;
78  import schmitzm.geotools.map.event.FeatureSelectedEvent;  import schmitzm.geotools.map.event.FeatureSelectedEvent;
 import schmitzm.geotools.map.event.MapPaneEvent;  
79  import schmitzm.geotools.map.event.JMapPaneListener;  import schmitzm.geotools.map.event.JMapPaneListener;
80    import schmitzm.geotools.map.event.MapPaneEvent;
81  import schmitzm.geotools.styling.StylingUtil;  import schmitzm.geotools.styling.StylingUtil;
82  import skrueger.geotools.MapPaneToolBar;  import skrueger.geotools.MapPaneToolBar;
83  import skrueger.geotools.StyledFeaturesInterface;  import skrueger.geotools.StyledFeaturesInterface;
# Line 199  public class FeatureMapLayerSelectionSyn Line 205  public class FeatureMapLayerSelectionSyn
205                                                          && fts.getName().equals(SELECTION_STYLING_FTS_NAME)) {                                                          && fts.getName().equals(SELECTION_STYLING_FTS_NAME)) {
206                                                  originalStyle.featureTypeStyles().remove(fts);                                                  originalStyle.featureTypeStyles().remove(fts);
207    
208                                                  replaceRenderer();                                                  mapLayer.setStyle(originalStyle);
209                                                  // mapPane.refresh();                                                  // replaceRenderer();
210                                                    // // mapPane.refresh();
211    
212                                                  return;                                                  return;
213                                          }                                          }
# Line 330  public class FeatureMapLayerSelectionSyn Line 337  public class FeatureMapLayerSelectionSyn
337    
338                  /**                  /**
339                   * testing, whether the selection really changed. If not, we can save                   * testing, whether the selection really changed. If not, we can save
340                   * one paint!                   * one rendering!
341                   */                   */
342                  for (FeatureTypeStyle fts : originalStyle.featureTypeStyles()) {                  for (FeatureTypeStyle fts : originalStyle.featureTypeStyles()) {
343    
# Line 364  public class FeatureMapLayerSelectionSyn Line 371  public class FeatureMapLayerSelectionSyn
371                                                  }                                                  }
372                                          }                                          }
373    
374                                            if (antiFids.size() + newSelection.size() != styledLayer
375                                                            .getFeatureCollectionFiltered().size())
376                                                    return true;
377    
378                                  } else {                                  } else {
379                                          FidFilterImpl origFidsFilter = (FidFilterImpl) filter;                                          FidFilterImpl origFidsFilter = (FidFilterImpl) filter;
380    
# Line 404  public class FeatureMapLayerSelectionSyn Line 415  public class FeatureMapLayerSelectionSyn
415           * Replaces the local renderer           * Replaces the local renderer
416           */           */
417          private void replaceRenderer() {          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();  
   
418          }          }
419    
420          /**          /**

Legend:
Removed from v.558  
changed lines
  Added in v.559

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26