39 |
import schmitzm.geotools.styling.StylingUtil; |
import schmitzm.geotools.styling.StylingUtil; |
40 |
import schmitzm.lang.LangUtil; |
import schmitzm.lang.LangUtil; |
41 |
import skrueger.geotools.MapPaneToolBar; |
import skrueger.geotools.MapPaneToolBar; |
42 |
import skrueger.geotools.StyledMapInterface; |
import skrueger.geotools.StyledLayerInterface; |
43 |
|
|
44 |
/** |
/** |
45 |
* This class keeps the selection of a (feature) {@link JTable} synchronized |
* This class keeps the selection of a (feature) {@link JTable} synchronized |
68 |
* model. |
* model. |
69 |
*/ |
*/ |
70 |
protected final MapLayer mapLayer; |
protected final MapLayer mapLayer; |
71 |
protected final StyledMapInterface<?> styledMapLayer; |
protected final StyledLayerInterface<?> styledLayer; |
72 |
protected final JMapPane mapPane; |
protected final JMapPane mapPane; |
73 |
private final MapPaneToolBar toolBar; |
private final MapPaneToolBar toolBar; |
74 |
|
|
84 |
*/ |
*/ |
85 |
public FeatureMapLayerSelectionSynchronizer( |
public FeatureMapLayerSelectionSynchronizer( |
86 |
StyledFeatureLayerSelectionModel layerSelModel, |
StyledFeatureLayerSelectionModel layerSelModel, |
87 |
StyledMapInterface<?> styledMapLayer, MapLayer mapLayer, |
StyledLayerInterface<?> styledLayer, MapLayer mapLayer, |
88 |
JMapPane mapPane, MapPaneToolBar toolBar) { |
JMapPane mapPane, MapPaneToolBar toolBar) { |
89 |
|
|
90 |
super(layerSelModel); |
super(layerSelModel); |
91 |
this.styledMapLayer = styledMapLayer; |
this.styledLayer = styledLayer; |
92 |
|
|
93 |
this.mapLayer = mapLayer; |
this.mapLayer = mapLayer; |
94 |
this.mapPane = mapPane; |
this.mapPane = mapPane; |
145 |
try { |
try { |
146 |
if (newSelection.isEmpty()) { |
if (newSelection.isEmpty()) { |
147 |
|
|
148 |
selectionMapStyle = styledMapLayer.getStyle(); |
selectionMapStyle = styledLayer.getStyle(); |
149 |
// LOGGER.debug("NO SELECTION .. set to original style directly"); |
// LOGGER.debug("NO SELECTION .. set to original style directly"); |
150 |
|
|
151 |
} else { |
} else { |
152 |
LOGGER.debug("SELECTION .. change style"); |
LOGGER.debug("SELECTION .. change style"); |
153 |
|
|
154 |
// We take Style from the MapLayer that is displayed at the |
// We take Style from the MapLayer that is displayed at the |
155 |
// moment. We do not use the styledMapLayer.getStyle, because in |
// moment. We do not use the styledLayer.getStyle, because in |
156 |
// the atlas, this always return the default style, but |
// the atlas, this always return the default style, but |
157 |
// additionaly styles might be selected. |
// additional styles might be selected. |
158 |
// Taking the style from the mapLayer indicated, that we have to |
// Taking the style from the mapLayer indicated, that we have to |
159 |
// remove any selection rules first. |
// remove any selection rules first. |
160 |
Style originalStyle = mapLayer.getStyle(); |
Style originalStyle = mapLayer.getStyle(); |
162 |
// TODO The default style is not good here. We need |
// TODO The default style is not good here. We need |
163 |
// .createSelectionStyle(normalStyle, geoObj); |
// .createSelectionStyle(normalStyle, geoObj); |
164 |
selectionMapStyle = StylingUtil |
selectionMapStyle = StylingUtil |
165 |
.createSelectionStyle(styledMapLayer.getGeoObject()); |
.createSelectionStyle(styledLayer.getGeoObject()); |
166 |
// selectionMapStyle = StylingUtil |
// selectionMapStyle = StylingUtil |
167 |
// .createDefaultStyle(styledMapLayer.getGeoObject()); |
// .createDefaultStyle(styledLayer.getGeoObject()); |
168 |
|
|
169 |
selectionMapStyle.getFeatureTypeStyles()[0] |
selectionMapStyle.getFeatureTypeStyles()[0] |
170 |
.setName(SELECTION_STYLING); |
.setName(SELECTION_STYLING); |