Package org.openstreetmap.josm.gui.layer

Examples of org.openstreetmap.josm.gui.layer.Layer$MultiLayerAction


            }
        } else if (klass.isAssignableFrom(GpxLayer.class)) {
            if (!Main.isDisplayingMapView())
                return null;
            boolean merge = Main.pref.getBoolean("download.gps.mergeWithLocal", false);
            Layer active = Main.map.mapView.getActiveLayer();
            if (active instanceof GpxLayer && (merge || ((GpxLayer) active).data.fromServer))
                return ((GpxLayer) active).data.getDataSourceBounds();
            for (GpxLayer l : Main.map.mapView.getLayersOfType(GpxLayer.class)) {
                if (merge || l.data.fromServer)
                    return l.data.getDataSourceBounds();
View Full Code Here


  }

  private void clearRoute() {
    route.data.nodes.clear();
    route.data.ways.clear();
    Layer capaABorrar = null;
    try {
      for (Layer l : view.getAllLayers()) {
        if (l.name.equals(route.name)) {
          capaABorrar = l;
          break;
View Full Code Here

      Main.ds = editLayer.data;
    } else {
      Main.ds.setSelected();
    }
    DataSet.fireSelectionChanged(Main.ds.getSelected());
    Layer old = getActiveLayer();
    setActiveLayerReflect(layer);

    if (old != layer) {
      for (Layer.LayerChangeListener l : Layer.listeners) {
        l.activeLayerChange(old, layer);
View Full Code Here

    for (Layer.LayerChangeListener l : Layer.listeners)
      l.layerAdded(layer);
    if (layer instanceof OsmDataLayer || activeLayer == null) {
      // autoselect the new layer
      Layer old = activeLayer;
      setActiveLayer(layer);
      for (Layer.LayerChangeListener l : Layer.listeners)
        l.activeLayerChange(old, layer);
    }
    repaint();
View Full Code Here

    Graphics2D tempG = offscreenBuffer.createGraphics();
    tempG.setColor(Main.pref.getColor("background", Color.BLACK));
    tempG.fillRect(0, 0, getWidth(), getHeight());

    for (int i = layers.size() - 1; i >= 0; --i) {
      Layer l = layers.get(i);
      if (l.visible/* && l != getActiveLayer() */)
        l.paint(tempG, this);
    }

    /*
     * if (getActiveLayer() != null && getActiveLayer().visible)
     * getActiveLayer().paint(tempG, this);
View Full Code Here

      editLayer = (OsmDataLayer) layer;
      Main.ds = editLayer.data;
    } else
      Main.ds.setSelected();
    DataSet.fireSelectionChanged(Main.ds.getSelected());
    Layer old = activeLayer;
    activeLayer = layer;
    if (old != layer) {
      for (Layer.LayerChangeListener l : Layer.listeners)
        l.activeLayerChange(old, layer);
    }
View Full Code Here

            true, "action/mergelayer", true);
        putValue("help", ht("/Action/MergeLayer"));
    }

    protected void doMerge(List<Layer> targetLayers, final Collection<Layer> sourceLayers) {
        final Layer targetLayer = askTargetLayer(targetLayers);
        if (targetLayer == null)
            return;
        Main.worker.submit(new Runnable() {
            @Override
            public void run() {
                boolean layerMerged = false;
                for (final Layer sourceLayer: sourceLayers) {
                    if (sourceLayer != null && sourceLayer != targetLayer) {
                        if (sourceLayer instanceof OsmDataLayer && targetLayer instanceof OsmDataLayer
                                && ((OsmDataLayer)sourceLayer).isUploadDiscouraged() != ((OsmDataLayer)targetLayer).isUploadDiscouraged()) {
                            if (warnMergingUploadDiscouragedLayers(sourceLayer, targetLayer)) {
                                break;
                            }
                        }
                        targetLayer.mergeFrom(sourceLayer);
                        GuiHelper.runInEDTAndWait(new Runnable() {
                            @Override
                            public void run() {
                                Main.main.removeLayer(sourceLayer);
                            }
View Full Code Here

        doMerge(targetLayers, Collections.singleton(sourceLayer));
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        Layer sourceLayer = Main.main.getEditLayer();
        if (sourceLayer == null)
            return;
        merge(sourceLayer);
    }
View Full Code Here

     */
    public static class LayerListCellRenderer extends DefaultListCellRenderer {

        @Override
        public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            Layer layer = (Layer) value;
            JLabel label = (JLabel) super.getListCellRendererComponent(list, layer.getName(), index, isSelected, cellHasFocus);
            Icon icon = layer.getIcon();
            label.setIcon(icon);
            label.setToolTipText(layer.getToolTipText());
            return label;
        }
View Full Code Here

            break;
        case "layer":
            if (Main.main.getActiveLayer() == null)
                return null;
            // try to zoom to the first selected layer
            Layer l = getFirstSelectedLayer();
            if (l == null) return null;
            l.visitBoundingBox(v);
            break;
        case "selection":
        case "conflict":
            Collection<OsmPrimitive> sel = new HashSet<>();
            if ("selection".equals(mode)) {
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.gui.layer.Layer$MultiLayerAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.