26 |
|
|
27 |
import org.geotools.feature.Feature; |
import org.geotools.feature.Feature; |
28 |
import org.geotools.map.MapLayer; |
import org.geotools.map.MapLayer; |
29 |
|
import org.geotools.styling.PolygonSymbolizer; |
30 |
import org.geotools.styling.Rule; |
import org.geotools.styling.Rule; |
31 |
import org.geotools.styling.RuleImpl; |
import org.geotools.styling.RuleImpl; |
32 |
import org.geotools.styling.Style; |
import org.geotools.styling.Style; |
36 |
import org.opengis.filter.FilterVisitor; |
import org.opengis.filter.FilterVisitor; |
37 |
import org.opengis.layer.StyleURL; |
import org.opengis.layer.StyleURL; |
38 |
|
|
39 |
|
import schmitzm.geotools.FilterUtil; |
40 |
import schmitzm.geotools.gui.FeatureCollectionTableModel; |
import schmitzm.geotools.gui.FeatureCollectionTableModel; |
41 |
import schmitzm.geotools.gui.JMapPane; |
import schmitzm.geotools.gui.JMapPane; |
42 |
import schmitzm.geotools.map.event.FeatureSelectedEvent; |
import schmitzm.geotools.map.event.FeatureSelectedEvent; |
149 |
Style originalStyle = styledMapLayer.getStyle(); |
Style originalStyle = styledMapLayer.getStyle(); |
150 |
|
|
151 |
// TODO This clone is a deep clone and it is slow.. |
// TODO This clone is a deep clone and it is slow.. |
152 |
selectionMapStyle = StylingUtil.clone(originalStyle); |
selectionMapStyle = StylingUtil |
|
|
|
|
// TODO BAD CODE |
|
|
Style defaultStyle = StylingUtil |
|
153 |
.createDefaultStyle(styledMapLayer.getGeoObject()); |
.createDefaultStyle(styledMapLayer.getGeoObject()); |
154 |
|
|
155 |
|
// Symbolizer sss = selectionMapStyle.getFeatureTypeStyles()[0].getRules()[0].getSymbolizers()[0]; |
156 |
|
// if (sss instanceof PolygonSymbolizer) { |
157 |
|
// PolygonSymbolizer ps = (PolygonSymbolizer) sss; |
158 |
|
// ps.getFill().setOpacity( FilterUtil.FILTER_FAC.literal(0.5)); |
159 |
|
// } |
160 |
|
|
161 |
// Rule selectedRule = StylingUtil.STYLE_FACTORY.createRule(); |
// Rule selectedRule = StylingUtil.STYLE_FACTORY.createRule(); |
162 |
defaultStyle.getFeatureTypeStyles()[0].getRules()[0] |
selectionMapStyle.getFeatureTypeStyles()[0].getRules()[0] |
163 |
.setFilter(new Filter() { |
.setFilter(new Filter() { |
164 |
|
|
165 |
@Override |
@Override |
186 |
}); |
}); |
187 |
|
|
188 |
selectionMapStyle.setFeatureTypeStyles(LangUtil.extendArray( |
selectionMapStyle.setFeatureTypeStyles(LangUtil.extendArray( |
189 |
selectionMapStyle.getFeatureTypeStyles(), defaultStyle |
originalStyle |
190 |
.getFeatureTypeStyles()[0])); |
.getFeatureTypeStyles(), selectionMapStyle.getFeatureTypeStyles())); |
191 |
|
|
192 |
// selectionMapStyle.setFeatureTypeStyles(originalStyle.getF) |
// selectionMapStyle.setFeatureTypeStyles(originalStyle.getF) |
193 |
|
|
226 |
// LOGGER.debug("Ignoring event " + e); |
// LOGGER.debug("Ignoring event " + e); |
227 |
return; |
return; |
228 |
} |
} |
229 |
|
// only listen to events directly coming from JMapPane |
230 |
|
// selection (ignore selections from FilterDialog) |
231 |
|
if ( e.getSourceObject() != this.mapPane ) |
232 |
|
return; |
233 |
|
|
234 |
FeatureSelectedEvent fse = (FeatureSelectedEvent) e; |
FeatureSelectedEvent fse = (FeatureSelectedEvent) e; |
235 |
// LOGGER.debug("Do event " + fse); |
// LOGGER.debug("Do event " + fse); |
236 |
// LOGGER.debug("Do event " + fse.getSelectionResult()); |
// LOGGER.debug("Do event " + fse.getSelectionResult()); |