70 |
import schmitzm.geotools.FilterUtil; |
import schmitzm.geotools.FilterUtil; |
71 |
import schmitzm.geotools.gui.SelectableXMapPane; |
import schmitzm.geotools.gui.SelectableXMapPane; |
72 |
import schmitzm.geotools.map.event.FeatureSelectedEvent; |
import schmitzm.geotools.map.event.FeatureSelectedEvent; |
|
import schmitzm.geotools.map.event.MapPaneEvent; |
|
73 |
import schmitzm.geotools.map.event.JMapPaneListener; |
import schmitzm.geotools.map.event.JMapPaneListener; |
74 |
|
import schmitzm.geotools.map.event.MapPaneEvent; |
75 |
import schmitzm.geotools.styling.StylingUtil; |
import schmitzm.geotools.styling.StylingUtil; |
76 |
import skrueger.geotools.MapPaneToolBar; |
import skrueger.geotools.MapPaneToolBar; |
77 |
import skrueger.geotools.StyledFeaturesInterface; |
import skrueger.geotools.StyledFeaturesInterface; |
199 |
&& fts.getName().equals(SELECTION_STYLING_FTS_NAME)) { |
&& fts.getName().equals(SELECTION_STYLING_FTS_NAME)) { |
200 |
originalStyle.featureTypeStyles().remove(fts); |
originalStyle.featureTypeStyles().remove(fts); |
201 |
|
|
202 |
replaceRenderer(); |
mapLayer.setStyle(originalStyle); |
203 |
// mapPane.refresh(); |
// replaceRenderer(); |
204 |
|
// // mapPane.refresh(); |
205 |
|
|
206 |
return; |
return; |
207 |
} |
} |
317 |
} |
} |
318 |
|
|
319 |
/** |
/** |
320 |
* Analyses whether the selection has changed in comparison to the selection |
* Analyzes whether the selection has changed in comparison to the selection |
321 |
* stored in the mapLayer.Style |
* stored in the mapLayer.Style |
322 |
* |
* |
323 |
* @param newSelection |
* @param newSelection a List<String> of all newly selected FIDs |
324 |
* @param originalStyle |
* @param originalStyle the original {@link Style} that has an earlier selection coded into the {@link Style} |
325 |
* @return |
* @return <code>true</code> if changed. |
326 |
*/ |
*/ |
327 |
private boolean selectionChanged(Vector<String> newSelection, |
private boolean selectionChanged(Vector<String> newSelection, |
328 |
Style originalStyle) { |
Style originalStyle) { |
331 |
|
|
332 |
/** |
/** |
333 |
* testing, whether the selection really changed. If not, we can save |
* testing, whether the selection really changed. If not, we can save |
334 |
* one paint! |
* one rendering! |
335 |
*/ |
*/ |
336 |
for (FeatureTypeStyle fts : originalStyle.featureTypeStyles()) { |
for (FeatureTypeStyle fts : originalStyle.featureTypeStyles()) { |
337 |
|
|
365 |
} |
} |
366 |
} |
} |
367 |
|
|
368 |
|
if (antiFids.size() + newSelection.size() != styledLayer |
369 |
|
.getFeatureCollectionFiltered().size()) |
370 |
|
return true; |
371 |
|
|
372 |
} else { |
} else { |
373 |
FidFilterImpl origFidsFilter = (FidFilterImpl) filter; |
FidFilterImpl origFidsFilter = (FidFilterImpl) filter; |
374 |
|
|
409 |
* Replaces the local renderer |
* Replaces the local renderer |
410 |
*/ |
*/ |
411 |
private void replaceRenderer() { |
private void replaceRenderer() { |
|
// // |
|
|
// // // Has to be done before we apply the new Renderer |
|
|
// // mapLayer.setStyle(style); |
|
|
// |
|
|
// GTRenderer oldRenderer = mapPane.getLocalRenderer(); |
|
|
// |
|
|
// /** |
|
|
// * Explicitly putting a new instance of LabelCacheDefault into the |
|
|
// * renderer instance, so JMapPane doesn't reuse the old one. This is |
|
|
// * very useful when changing the TextSymbolizer with AtlasStyler<br/> |
|
|
// * SK 9.7.09: It's not enought to user LabelCache.clear(). We can not |
|
|
// * reuse the old Renderer - better to create a new one! |
|
|
// */ |
|
|
// final GTRenderer newRenderer = GTUtil.createGTRenderer(); |
|
|
// |
|
|
// final HashMap<Object, Object> rendererHints = |
|
|
// defaultGTRenderingHints; |
|
|
// rendererHints.put(StreamingRenderer.LABEL_CACHE_KEY, |
|
|
// new LabelCacheImpl()); |
|
|
// |
|
|
// newRenderer.setRendererHints(rendererHints); |
|
|
// mapPane.setLocalRenderer(newRenderer); |
|
|
// |
|
|
// if (oldRenderer != null) { |
|
|
// |
|
|
// RenderingHints java2DHints = oldRenderer.getJava2DHints(); |
|
|
// if (java2DHints != null) { |
|
|
// newRenderer.setJava2DHints(java2DHints); |
|
|
// } |
|
|
// |
|
|
// oldRenderer.setContext(null); |
|
|
// oldRenderer = null; |
|
|
// } |
|
|
|
|
|
mapPane.refresh(); |
|
|
|
|
412 |
} |
} |
413 |
|
|
414 |
/** |
/** |