@Override public void layerChanged(MapLayerEvent event) { Layer layer = (Layer) event.getSource(); int index = layerList.indexOf(layer); fireLayerEvent(layer, index, event); }
/** * Set or change the coordinate reference system for this context. This will trigger a * MapBoundsEvent to be published to listeners. * * @param crs * @throws FactoryException * @throws TransformException */ public void setCoordinateReferenceSystem(final CoordinateReferenceSystem crs) { getViewport().setCoordinateReferenceSystem(crs); }
/** * Add an array of new layers and trigger a {@link LayerListEvent}. * * @param layers The new layers that are to be added. * @return the number of layers actually added to the MapContext */ public int addLayers(MapLayer[] array) { if ((array == null) || (array.length == 0)) { return 0; } return super.addLayers(toLayerList(array)); }
/** * Add a new layer and trigger a {@link LayerListEvent}. * * @param featureSource a SimpleFeatureSource with the new layer that will be added. */ public void addLayer(FeatureSource featureSource, Style style) { addLayer(new DefaultMapLayer(featureSource, style, "")); }
/** * Creates a new instance of DefaultMapLayer using a non-emtpy feature collection as a parameter * * @param collection the source feature collection * @param style the style used to represent this layer * @param title Title of map layer */ public MapLayer(FeatureCollection collection, Style style, String title) { internal = new FeatureLayer(collection, style, title); }
/** * Gets the current area of interest provided by {@link #getViewport()#getBounds()}. * * <p>If the viewport has not been created, it will be filled in by default based on the layer * bounds provided by {@link #getMaxBounds()}. * * @return Current area of interest */ public ReferencedEnvelope getAreaOfInterest() { return getViewport().getBounds(); }
/** * Get the current coordinate system. * * @return the coordinate system of this box. */ public CoordinateReferenceSystem getCoordinateReferenceSystem() { return super.getCoordinateReferenceSystem(); }
/** * Moves a layer from a position to another. Will fire a MapLayerListEvent * * @param sourcePosition the layer current position * @param destPosition the layer new position */ public void moveLayer(int sourcePosition, int destPosition) { super.moveLayer(sourcePosition, destPosition); }
/** * Determine whether this layer is visible on a map pane or whether the layer is hidden. * * @return <code>true</code> if the layer is visible, or <code>false</code> if the layer is * hidden. */ public boolean isVisible() { return internal.isVisible(); }
@Override public void dispose() { preDispose(); super.dispose(); disposed = true; }
public WrappingDirectLayer(DirectLayer delegate) { super(); this.delegate = delegate; // this prevents the annoying message about not calling predispose // as we have no listeners it has no effect super.preDispose(); }
/** * Alerts listeners that this layer has been scheduled to be disposed to give them a chance to * finish or cancel any tasks using the layer. */ public void preDispose() { if (!preDispose) { preDispose = true; fireMapLayerListenerLayerPreDispose(); } }
/** * Adds all layers from the input collection that are not already present in this list. * Equivalent to {@code addAllAbsent(layers) > 0}. * * @param layers candidate layers to add * @return {@code true} is any layers were added; {@code false} otherwise */ @Override public boolean addAll(Collection<? extends Layer> layers) { return addAllAbsent(layers) > 0; }
/** * Removes PropertyChangeListener from the list of listeners. * * @param listener The listener to remove. */ public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) { super.removePropertyChangeListener(listener); }
/** * Creates a new instance of DefaultMapLayer using a non-emtpy feature collection as a parameter * * @param collection the source feature collection * @param style the style used to represent this layer */ public MapLayer(FeatureCollection collection, Style style) { internal = new FeatureLayer((FeatureCollection) collection, style); }
@Override public void layerDeselected(MapLayerEvent event) { Layer layer = (Layer) event.getSource(); int index = layerList.indexOf(layer); fireLayerEvent(layer, index, event); }
@Override public void layerSelected(MapLayerEvent event) { Layer layer = (Layer) event.getSource(); int index = layerList.indexOf(layer); fireLayerEvent(layer, index, event); }
@Override public void layerShown(MapLayerEvent event) { Layer layer = (Layer) event.getSource(); int index = layerList.indexOf(layer); fireLayerEvent(layer, index, event); }
@Override public void layerHidden(MapLayerEvent event) { Layer layer = (Layer) event.getSource(); int index = layerList.indexOf(layer); fireLayerEvent(layer, index, event); }
@Override public void layerPreDispose(MapLayerEvent event) { Layer layer = (Layer) event.getSource(); int index = layerList.indexOf(layer); fireLayerEvent(layer, index, event); } };