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; |
149 |
// TODO The default style is not good here. We need |
// TODO The default style is not good here. We need |
150 |
// .createSelectionStyle(normalStyle, geoObj); |
// .createSelectionStyle(normalStyle, geoObj); |
151 |
selectionMapStyle = StylingUtil |
selectionMapStyle = StylingUtil |
152 |
.createDefaultStyle(styledMapLayer.getGeoObject()); |
.createSelectionStyle(styledMapLayer.getGeoObject()); |
153 |
|
// selectionMapStyle = StylingUtil |
154 |
|
// .createDefaultStyle(styledMapLayer.getGeoObject()); |
155 |
|
|
156 |
selectionMapStyle.getFeatureTypeStyles()[0] |
selectionMapStyle.getFeatureTypeStyles()[0] |
157 |
.setName(SELECTION_STYLING); |
.setName(SELECTION_STYLING); |
158 |
|
|
|
// Symbolizer sss = |
|
|
// selectionMapStyle.getFeatureTypeStyles()[0].getRules()[0].getSymbolizers()[0]; |
|
|
// if (sss instanceof PolygonSymbolizer) { |
|
|
// PolygonSymbolizer ps = (PolygonSymbolizer) sss; |
|
|
// ps.getFill().setOpacity( FilterUtil.FILTER_FAC.literal(0.5)); |
|
|
// } |
|
|
|
|
159 |
// Rule selectedRule = StylingUtil.STYLE_FACTORY.createRule(); |
// Rule selectedRule = StylingUtil.STYLE_FACTORY.createRule(); |
160 |
selectionMapStyle.getFeatureTypeStyles()[0].getRules()[0] |
selectionMapStyle.getFeatureTypeStyles()[0].getRules()[0] |
161 |
.setFilter(new Filter() { |
.setFilter(new Filter() { |
196 |
} else { |
} else { |
197 |
newFeatureTypes = originalFeatureTypeStyles; |
newFeatureTypes = originalFeatureTypeStyles; |
198 |
} |
} |
199 |
// |
|
|
// // REMOVE any Selection_Styling FTS (usually the last one) |
|
|
// |
|
|
// for (FeatureTypeStyle fts : originalFeatureTypeStyles){ |
|
|
// if (fts.getName().equals(SELECTION_STYLING)) continue; |
|
|
// newFeatureTypes = |
|
|
// |
|
|
// LangUtil.extendArray( |
|
|
// originalFeatureTypeStyles, selectionMapStyle |
|
|
// .getFeatureTypeStyles()); |
|
|
// } |
|
|
|
|
200 |
// The last FTS is the selection FTS |
// The last FTS is the selection FTS |
201 |
newFeatureTypes = LangUtil.extendArray(newFeatureTypes, |
newFeatureTypes = LangUtil.extendArray(newFeatureTypes, |
202 |
selectionMapStyle.getFeatureTypeStyles()); |
selectionMapStyle.getFeatureTypeStyles()); |
203 |
|
|
204 |
selectionMapStyle.setFeatureTypeStyles(newFeatureTypes); |
selectionMapStyle.setFeatureTypeStyles(newFeatureTypes); |
205 |
|
|
|
// selectionMapStyle.setFeatureTypeStyles(originalStyle.getF) |
|
|
|
|
|
// Flat copy the style |
|
|
|
|
|
// selectionMapStyle = |
|
|
// StylingUtil.createDefaultStyle(styledMapLayer.getGeoObject()); |
|
|
|
|
206 |
} |
} |
207 |
|
|
208 |
mapLayer.setStyle(selectionMapStyle); |
mapLayer.setStyle(selectionMapStyle); |