/[schmitzm]/branches/2.0-RC2/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java
ViewVC logotype

Diff of /branches/2.0-RC2/src/skrueger/geotools/selection/FeatureMapLayerSelectionSynchronizer.java

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

revision 123 by alfonx, Wed May 20 15:54:51 2009 UTC revision 127 by mojays, Sat May 30 14:29:58 2009 UTC
# Line 24  import javax.swing.ListSelectionModel; Line 24  import javax.swing.ListSelectionModel;
24  import javax.swing.event.ListSelectionListener;  import javax.swing.event.ListSelectionListener;
25    
26  import org.geotools.feature.Feature;  import org.geotools.feature.Feature;
 import org.geotools.feature.FeatureCollection;  
27  import org.geotools.map.MapLayer;  import org.geotools.map.MapLayer;
28  import org.geotools.styling.FeatureTypeStyle;  import org.geotools.styling.FeatureTypeStyle;
29  import org.geotools.styling.Style;  import org.geotools.styling.Style;
# Line 144  public class FeatureMapLayerSelectionSyn Line 143  public class FeatureMapLayerSelectionSyn
143                                  // the atlas, this always return the default style, but                                  // the atlas, this always return the default style, but
144                                  // additionaly styles might be selected.                                  // additionaly styles might be selected.
145                                  // Taking the style from the mapLayer indicated, that we have to                                  // Taking the style from the mapLayer indicated, that we have to
146                                  // remove any selection rules first.                                  // remove any selection rules first.
147                                  Style originalStyle = mapLayer.getStyle();                                  Style originalStyle = mapLayer.getStyle();
148    
149                                  // TODO The default style is not good here. We need                                  // TODO The default style is not good here. We need
# Line 176  public class FeatureMapLayerSelectionSyn Line 175  public class FeatureMapLayerSelectionSyn
175                                                          public boolean evaluate(Object obj) {                                                          public boolean evaluate(Object obj) {
176                                                                  if (obj instanceof Feature) {                                                                  if (obj instanceof Feature) {
177                                                                          Feature f = (Feature) obj;                                                                          Feature f = (Feature) obj;
178                                                                          // TODO BAD CODE! says Martin.. i am fine with it.. well.. not great...                                                                          // TODO BAD CODE! says Martin.. i am fine
179                                                                            // with it.. well.. not great...
180                                                                          for (String ffID : newSelection) {                                                                          for (String ffID : newSelection) {
181                                                                                  if (ffID.equals(f.getID()))                                                                                  if (ffID.equals(f.getID()))
182                                                                                          return true;                                                                                          return true;
# Line 189  public class FeatureMapLayerSelectionSyn Line 189  public class FeatureMapLayerSelectionSyn
189    
190                                                  });                                                  });
191    
192                                  FeatureTypeStyle[] originalFeatureTypeStyles = originalStyle.getFeatureTypeStyles();                                  FeatureTypeStyle[] originalFeatureTypeStyles = originalStyle
193                                  FeatureTypeStyle[] newFeatureTypes ;                                                  .getFeatureTypeStyles();
194                                  if (originalFeatureTypeStyles[originalFeatureTypeStyles.length-1].getName() != null && originalFeatureTypeStyles[originalFeatureTypeStyles.length-1].getName().equals(SELECTION_STYLING)){                                  FeatureTypeStyle[] newFeatureTypes;
195                                          newFeatureTypes = Arrays.copyOf(originalFeatureTypeStyles, originalFeatureTypeStyles.length-1);                                  if (originalFeatureTypeStyles[originalFeatureTypeStyles.length - 1]
196                                                    .getName() != null
197                                                    && originalFeatureTypeStyles[originalFeatureTypeStyles.length - 1]
198                                                                    .getName().equals(SELECTION_STYLING)) {
199                                            newFeatureTypes = Arrays.copyOf(originalFeatureTypeStyles,
200                                                            originalFeatureTypeStyles.length - 1);
201                                  } else {                                  } else {
202                                          newFeatureTypes = originalFeatureTypeStyles;                                          newFeatureTypes = originalFeatureTypeStyles;
203                                  }                                  }
204  //                                                                //                              
205  //                              // REMOVE any Selection_Styling FTS (usually the last one)                                  // // REMOVE any Selection_Styling FTS (usually the last one)
206  //                                                                //                              
207  //                              for (FeatureTypeStyle fts : originalFeatureTypeStyles){                                  // for (FeatureTypeStyle fts : originalFeatureTypeStyles){
208  //                                      if (fts.getName().equals(SELECTION_STYLING)) continue;                                  // if (fts.getName().equals(SELECTION_STYLING)) continue;
209  //                                      newFeatureTypes =                                  // newFeatureTypes =
210  //                                                                        //                                      
211  //                                      LangUtil.extendArray(                                  // LangUtil.extendArray(
212  //                                              originalFeatureTypeStyles, selectionMapStyle                                  // originalFeatureTypeStyles, selectionMapStyle
213  //                                                              .getFeatureTypeStyles());                                  // .getFeatureTypeStyles());
214  //                              }                                  // }
215                                    
216                                  // The last FTS is the selection FTS                                  // The last FTS is the selection FTS
217                                  newFeatureTypes =  LangUtil.extendArray(newFeatureTypes, selectionMapStyle                                  newFeatureTypes = LangUtil.extendArray(newFeatureTypes,
218                                                  .getFeatureTypeStyles());                                                  selectionMapStyle.getFeatureTypeStyles());
219                                    
                                   
220                                  selectionMapStyle.setFeatureTypeStyles(newFeatureTypes);                                  selectionMapStyle.setFeatureTypeStyles(newFeatureTypes);
221    
222                                  // selectionMapStyle.setFeatureTypeStyles(originalStyle.getF)                                  // selectionMapStyle.setFeatureTypeStyles(originalStyle.getF)

Legend:
Removed from v.123  
changed lines
  Added in v.127

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26