layerList.add(layer);
public MapContent(MapContext context) { this(); for (MapLayer mapLayer : context.getLayers()) { layerList.add(mapLayer.toLayer()); } if (context.getTitle() != null) { setTitle(context.getTitle()); } if (context.getAbstract() != null) { getUserData().put("abstract", context.getAbstract()); } if (context.getContactInformation() != null) { getUserData().put("contact", context.getContactInformation()); } if (context.getKeywords() != null) { getUserData().put("keywords", context.getKeywords()); } if (context.getAreaOfInterest() != null) { getViewport().setBounds(context.getAreaOfInterest()); } }
@Deprecated public MapContent(MapLayer[] array, String title, String contextAbstract, String contactInformation, String[] keywords, final CoordinateReferenceSystem crs) { this(); if (array != null) { for (MapLayer mapLayer : array) { if (mapLayer == null) { continue; } Layer layer = mapLayer.toLayer(); layerList.add(layer); } } if (title != null) { setTitle(title); } if (contextAbstract != null) { getUserData().put("abstract", contextAbstract); } if (contactInformation != null) { getUserData().put("contact", contactInformation); } if (keywords != null) { getUserData().put("keywords", keywords); } if (crs != null) { getViewport().setCoordinateReferenceSystem(crs); } }
add(pos, layer); if (layerListener != null) { layer.addMapLayerListener(layerListener);
/** * Replaces the layer at the given position with another. Equivalent to: * <pre><code> * remove(index); * add(index, element); * </code></pre> * The same events will be sent to {@link MapLayerListListener} objects as * if the above code had been called. * * @param index position of the layer to be replaced * @param element the new layer * @return the layer that was replaced */ @Override public Layer set(int index, Layer element) { /* * Note: rather than calling the superclass set method here * we call remove followed by add to ensure correct event * and listener handling. */ Layer removed = remove(index); add(index, element); checkViewportCRS(); return removed; }
public MapContent(MapContext context) { this(); for (MapLayer mapLayer : context.getLayers()) { layerList.add(mapLayer.toLayer()); } if (context.getTitle() != null) { setTitle(context.getTitle()); } if (context.getAbstract() != null) { getUserData().put("abstract", context.getAbstract()); } if (context.getContactInformation() != null) { getUserData().put("contact", context.getContactInformation()); } if (context.getKeywords() != null) { getUserData().put("keywords", context.getKeywords()); } if (context.getAreaOfInterest() != null) { getViewport().setBounds(context.getAreaOfInterest()); } }
/** * Replaces the layer at the given position with another. Equivalent to: * * <pre><code> * remove(index); * add(index, element); * </code></pre> * * The same events will be sent to {@link MapLayerListListener} objects as if the above code * had been called. * * @param index position of the layer to be replaced * @param element the new layer * @return the layer that was replaced */ @Override public Layer set(int index, Layer element) { /* * Note: rather than calling the superclass set method here * we call remove followed by add to ensure correct event * and listener handling. */ Layer removed = remove(index); add(index, element); checkViewportCRS(); return removed; }
/** * Adds all layers from the input collection that are not already present in this list, with * the first added layer taking position {@code index}. * * @param index position of the first added layer in this list * @param layers candidate layers to add * @return {@code true} if any layers were added; {@code false} otherwise */ @Override public boolean addAll(int index, Collection<? extends Layer> layers) { boolean added = false; int pos = index; for (Layer layer : layers) { if (!contains(layer)) { add(pos, layer); if (layerListener != null) { layer.addMapLayerListener(layerListener); } added = true; pos++; } } if (added) { checkViewportCRS(); fireLayerAdded(null, index, size() - 1); } return added; }