144 |
// the atlas, this always return the default style, but |
// the atlas, this always return the default style, but |
145 |
// additionaly styles might be selected. |
// additionaly styles might be selected. |
146 |
// Taking the style from the mapLayer indicated, that we have to |
// Taking the style from the mapLayer indicated, that we have to |
147 |
// remove any selection rules first. |
// remove any selection rules first. |
148 |
Style originalStyle = mapLayer.getStyle(); |
Style originalStyle = mapLayer.getStyle(); |
149 |
|
|
150 |
// TODO The default style is not good here. We need |
// TODO The default style is not good here. We need |
176 |
public boolean evaluate(Object obj) { |
public boolean evaluate(Object obj) { |
177 |
if (obj instanceof Feature) { |
if (obj instanceof Feature) { |
178 |
Feature f = (Feature) obj; |
Feature f = (Feature) obj; |
179 |
// TODO BAD CODE! says Martin.. i am fine with it.. well.. not great... |
// TODO BAD CODE! says Martin.. i am fine |
180 |
|
// with it.. well.. not great... |
181 |
for (String ffID : newSelection) { |
for (String ffID : newSelection) { |
182 |
if (ffID.equals(f.getID())) |
if (ffID.equals(f.getID())) |
183 |
return true; |
return true; |
190 |
|
|
191 |
}); |
}); |
192 |
|
|
193 |
FeatureTypeStyle[] originalFeatureTypeStyles = originalStyle.getFeatureTypeStyles(); |
FeatureTypeStyle[] originalFeatureTypeStyles = originalStyle |
194 |
FeatureTypeStyle[] newFeatureTypes ; |
.getFeatureTypeStyles(); |
195 |
if (originalFeatureTypeStyles[originalFeatureTypeStyles.length-1].getName() != null && originalFeatureTypeStyles[originalFeatureTypeStyles.length-1].getName().equals(SELECTION_STYLING)){ |
FeatureTypeStyle[] newFeatureTypes; |
196 |
newFeatureTypes = Arrays.copyOf(originalFeatureTypeStyles, originalFeatureTypeStyles.length-1); |
if (originalFeatureTypeStyles[originalFeatureTypeStyles.length - 1] |
197 |
|
.getName() != null |
198 |
|
&& originalFeatureTypeStyles[originalFeatureTypeStyles.length - 1] |
199 |
|
.getName().equals(SELECTION_STYLING)) { |
200 |
|
newFeatureTypes = Arrays.copyOf(originalFeatureTypeStyles, |
201 |
|
originalFeatureTypeStyles.length - 1); |
202 |
} else { |
} else { |
203 |
newFeatureTypes = originalFeatureTypeStyles; |
newFeatureTypes = originalFeatureTypeStyles; |
204 |
} |
} |
205 |
// |
// |
206 |
// // REMOVE any Selection_Styling FTS (usually the last one) |
// // REMOVE any Selection_Styling FTS (usually the last one) |
207 |
// |
// |
208 |
// for (FeatureTypeStyle fts : originalFeatureTypeStyles){ |
// for (FeatureTypeStyle fts : originalFeatureTypeStyles){ |
209 |
// if (fts.getName().equals(SELECTION_STYLING)) continue; |
// if (fts.getName().equals(SELECTION_STYLING)) continue; |
210 |
// newFeatureTypes = |
// newFeatureTypes = |
211 |
// |
// |
212 |
// LangUtil.extendArray( |
// LangUtil.extendArray( |
213 |
// originalFeatureTypeStyles, selectionMapStyle |
// originalFeatureTypeStyles, selectionMapStyle |
214 |
// .getFeatureTypeStyles()); |
// .getFeatureTypeStyles()); |
215 |
// } |
// } |
216 |
|
|
217 |
// The last FTS is the selection FTS |
// The last FTS is the selection FTS |
218 |
newFeatureTypes = LangUtil.extendArray(newFeatureTypes, selectionMapStyle |
newFeatureTypes = LangUtil.extendArray(newFeatureTypes, |
219 |
.getFeatureTypeStyles()); |
selectionMapStyle.getFeatureTypeStyles()); |
220 |
|
|
|
|
|
221 |
selectionMapStyle.setFeatureTypeStyles(newFeatureTypes); |
selectionMapStyle.setFeatureTypeStyles(newFeatureTypes); |
222 |
|
|
223 |
// selectionMapStyle.setFeatureTypeStyles(originalStyle.getF) |
// selectionMapStyle.setFeatureTypeStyles(originalStyle.getF) |