Package org.openstreetmap.josm.gui.layer

Examples of org.openstreetmap.josm.gui.layer.OsmDataLayer$LayerStateChangeListener


        return new Bounds(minY, minX, maxY, maxX);
    }

    private Collection<Bounds> getExisting(Class<?> klass) {
        if (klass.isAssignableFrom(OsmDataLayer.class)) {
            OsmDataLayer layer = Main.map.mapView.getEditLayer();
            if (layer == null) {
                Collection<Layer> layers = Main.map.mapView.getAllLayersAsList();
                for (Layer layer1 : layers) {
                    if (layer1 instanceof OsmDataLayer)
                        return ((OsmDataLayer) layer1).data.getDataSourceBounds();
View Full Code Here


    setAlwaysOnTop(true);
    setResizable(false);
    iconTransparente = LogicConstants.getIcon("48x48_transparente");
    iconEnviando = LogicConstants.getIcon("anim_calculando");
    try {
      route = new OsmDataLayer(new DataSet(), "route",
          File.createTempFile("route", "route"));
    } catch (IOException e) {
      log.error(e.getMessage(), e);
    }
    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
View Full Code Here

          stops.data.add(new StopMarker(ll, array[2], "tsp_stop",
              stops, 0, 0, ls.color));
        }
        this.mapView.addLayer(stops, true);

        OsmDataLayer layer = new OsmDataLayer(new DataSet(),
            "Route Plan " + id_layer++, File.createTempFile(
                "planning", "route"));
        String way2 = plan.getWay();

        if (way2 != null) {
View Full Code Here

            if (warnUploadDiscouraged(layer)) {
                return false;
            }
        }
        if (layer instanceof OsmDataLayer) {
            OsmDataLayer osmLayer = (OsmDataLayer) layer;
            ConflictCollection conflicts = osmLayer.getConflicts();
            if (apiData.participatesInConflict(conflicts)) {
                alertUnresolvedConflicts(osmLayer);
                return false;
            }
        }
View Full Code Here

        this.ids = ids;
        this.downloadReferrers = downloadReferrers;
        this.full = full;
        this.newLayer = newLayer;
        // All downloaded primitives are put in a tmpLayer
        tmpLayer = new OsmDataLayer(new DataSet(), OsmDataLayer.createNewName(), null);
    }
View Full Code Here

            if(canceled)
                return;
        }

        // Append downloaded data to JOSM
        OsmDataLayer layer = Main.main.getEditLayer();
        if(layer == null || this.newLayer)
            Main.main.addLayer(tmpLayer);
        else
            layer.mergeFrom(tmpLayer);

        // Warm about missing primitives
        final Set<PrimitiveId> errs = mainTask.getMissingPrimitives();
        if (errs != null && !errs.isEmpty())
            GuiHelper.runInEDTAndWait(new Runnable() {
View Full Code Here

    @Override
    public void startTest(ProgressMonitor monitor) {

        super.startTest(monitor);

        OsmDataLayer layer = Main.main.getEditLayer();

        if (layer != null) {
            downloadedArea = layer.data.getDataSourceArea();
        }
View Full Code Here

     * @param id the primitive ID
     */
    protected void synchronizePrimitive(final OsmPrimitiveType type, final long id) {
        // FIXME: should now about the layer this task is running for. might
        // be different from the current edit layer
        OsmDataLayer layer = Main.main.getEditLayer();
        if (layer == null)
            throw new IllegalStateException(tr("Failed to update primitive with id {0} because current edit layer is null", id));
        OsmPrimitive p = layer.data.getPrimitiveById(id, type);
        if (p == null)
            throw new IllegalStateException(tr("Failed to update primitive with id {0} because current edit layer does not include such a primitive", id));
View Full Code Here

        modified.add(my);
    }

    @Override
    public void undoCommand() {
        OsmDataLayer layer = getLayer();
        if (! Main.map.mapView.hasLayer(layer)) {
            Main.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more",
                    this.toString(),
                    layer.toString()
            ));
            return;
        }

        Main.map.mapView.setActiveLayer(layer);
        OsmDataLayer editLayer = Main.main.getEditLayer();

        // restore the former state
        //
        super.undoCommand();

        // restore a conflict if necessary
        //
        if (!editLayer.getConflicts().hasConflictForMy(my)) {
            editLayer.getConflicts().add(my,their);
        }
    }
View Full Code Here

     * reconstitutes all remembered conflicts. Add the remembered conflicts to the
     * set of conflicts of the {@link OsmDataLayer} this command was applied to.
     *
     */
    protected void reconstituteConflicts() {
        OsmDataLayer editLayer = getLayer();
        for(Conflict<?> c : resolvedConflicts) {
            if (!editLayer.getConflicts().hasConflictForMy(c.getMy())) {
                editLayer.getConflicts().add(c);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.gui.layer.OsmDataLayer$LayerStateChangeListener

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.