/** Called when a map layer has changed, e.g. features added to a displayed feature collection */ public void layerChanged(MapLayerListEvent event) { if (layerTable != null) { layerTable.repaint(event.getElement()); } redrawBaseImage = true; int reason = event.getMapLayerEvent().getReason(); if (reason == MapLayerEvent.DATA_CHANGED) { setFullExtent(); } if (reason != MapLayerEvent.SELECTION_CHANGED) { if (!isDisposed()) redraw(); } }
/** Called when a map layer has been removed */ public void layerRemoved(MapLayerListEvent event) { Layer layer = event.getElement(); if (layerTable != null) { layerTable.onRemoveLayer(layer); } redrawBaseImage = true; if (content.layers().size() == 0) { clearFields(); } else { setFullExtent(); } if (!isDisposed()) redraw(); }
/** * Called when a new map layer has been added. Sets the layer as selected (for queries) and, if * the layer table is being used, adds the new layer to the table. */ public void layerAdded(MapLayerListEvent event) { Layer layer = event.getElement(); if (layerTable != null) { layerTable.onAddLayer(layer); } layer.setSelected(true); redrawBaseImage = true; boolean atFullExtent = equalsFullExtent(getDisplayArea()); boolean firstLayer = content.layers().size() == 1; if (firstLayer || atFullExtent) { reset(); if (firstLayer) { setCrs(layer.getBounds().getCoordinateReferenceSystem()); return; } } if (!isDisposed()) redraw(); }
/** * Overrides the default behavior of layerChanged. The repaint() is commented so when the layer is * changed and the map is refreshed the image is not reseted completely. */ @Override public void layerChanged(MapLayerListEvent event) { paramsLock.writeLock().lock(); try { int reason = event.getMapLayerEvent().getReason(); if (reason == MapLayerEvent.DATA_CHANGED) { setFullExtent(); } if (reason != MapLayerEvent.SELECTION_CHANGED) { clearLabelCache.set(true); drawLayers(false); } } finally { paramsLock.writeLock().unlock(); } // repaint(); }