Package org.openstreetmap.josm.gui.layer

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


    protected void initFromLayer(Layer layer) {
        if (!(layer instanceof OsmDataLayer)) {
            model.setRelations(null);
            return;
        }
        OsmDataLayer l = (OsmDataLayer)layer;
        model.setRelations(l.data.getRelations());
        model.updateTitle();
        updateActionsRelationLists();
    }
View Full Code Here


        @Override
        public void actionPerformed(ActionEvent arg0) {
            if (!isEnabled())
                return;
            if (Main.main == null || !Main.main.hasEditLayer()) return;
            OsmDataLayer layer = Main.main.getEditLayer();
            Set<OsmPrimitive> target = new HashSet<>();
            for (OsmPrimitive p: layer.data.allPrimitives()) {
                if (p.isUsable() && p.getChangesetId() == current.getId()) {
                    target.add(p);
                }
View Full Code Here

        MapView.addEditLayerChangeListener(model);
        SelectionEventManager.getInstance().addSelectionListener(model, FireMode.IN_EDT_CONSOLIDATED);
        DatasetEventManager.getInstance().addDatasetListener(model, FireMode.IN_EDT);
        MapView.addEditLayerChangeListener(actSearch);
        // editLayerChanged also gets the selection history of the level
        OsmDataLayer editLayer = Main.main.getEditLayer();
        model.editLayerChanged(null, editLayer);
        if (editLayer != null) {
            model.setJOSMSelection(editLayer.data.getAllSelected());
        }
        actSearch.updateEnabledState();
View Full Code Here

        @Override
        public void mouseClicked(MouseEvent e) {
            int idx = lstPrimitives.locationToIndex(e.getPoint());
            if (idx < 0) return;
            if (isDoubleClick(e)) {
                OsmDataLayer layer = Main.main.getEditLayer();
                if (layer == null) return;
                layer.data.setSelected(Collections.singleton(model.getElementAt(idx)));
            } else if (highlightEnabled && Main.isDisplayingMapView()) {
                if (helper.highlightOnly(model.getElementAt(idx))) {
                    Main.map.mapView.repaint();
View Full Code Here

        @Override
        public void actionPerformed(ActionEvent e) {
            Collection<OsmPrimitive> sel = model.getSelected();
            if (sel.isEmpty())return;
            OsmDataLayer editLayer = Main.main.getEditLayer();
            if (editLayer == null) return;
            editLayer.data.setSelected(sel);
        }
View Full Code Here

            List<String> layerNames = new ArrayList<>();
            for (Layer l: Main.map.mapView.getAllLayers()) {
                layerNames.add(l.getName());
            }
            if (layer instanceof OsmDataLayer) {
                OsmDataLayer oldLayer = (OsmDataLayer)layer;
                // Translators: "Copy of {layer name}"
                String newName = tr("Copy of {0}", oldLayer.getName());
                int i = 2;
                while (layerNames.contains(newName)) {
                    // Translators: "Copy {number} of {layer name}"
                    newName = tr("Copy {1} of {0}", oldLayer.getName(), i);
                    i++;
                }
                Main.main.addLayer(new OsmDataLayer(oldLayer.data.clone(), newName, null));
            }
        }
View Full Code Here

        referenceNodeListTableModel = new DiffTableModel();
        currentNodeListTableModel = new DiffTableModel();
        currentRelationMemberTableModel = new DiffTableModel();
        referenceRelationMemberTableModel = new DiffTableModel();

        OsmDataLayer editLayer = Main.main.getEditLayer();
        if (editLayer != null) {
            editLayer.data.addDataSetListener(this);
        }
        MapView.addLayerChangeListener(this);
    }
View Full Code Here

     */
    public void setHistory(History history) {
        this.history = history;
        if (history.getNumVersions() > 0) {
            HistoryOsmPrimitive newLatest = null;
            OsmDataLayer editLayer = Main.main.getEditLayer();
            if (editLayer != null) {
                OsmPrimitive p = editLayer.data.getPrimitiveById(history.getId(), history.getType());
                if (canShowAsLatest(p)) {
                    newLatest = new HistoryPrimitiveBuilder().build(p);
                }
View Full Code Here

     * Removes this model as listener for data change and layer change
     * events.
     *
     */
    public void unlinkAsListener() {
        OsmDataLayer editLayer = Main.main.getEditLayer();
        if (editLayer != null) {
            editLayer.data.removeDataSetListener(this);
        }
        MapView.removeLayerChangeListener(this);
    }
View Full Code Here

    /* LayerChangeListener                                                    */
    /* ---------------------------------------------------------------------- */
    @Override
    public void activeLayerChange(Layer oldLayer, Layer newLayer) {
        if (oldLayer instanceof OsmDataLayer) {
            OsmDataLayer l = (OsmDataLayer)oldLayer;
            l.data.removeDataSetListener(this);
        }
        if (!(newLayer instanceof OsmDataLayer)) {
            latest = null;
            fireModelChange();
            return;
        }
        OsmDataLayer l = (OsmDataLayer)newLayer;
        l.data.addDataSetListener(this);
        OsmPrimitive primitive = l.data.getPrimitiveById(history.getId(), history.getType());
        HistoryOsmPrimitive latest;
        if (canShowAsLatest(primitive)) {
            latest = new HistoryPrimitiveBuilder().build(primitive);
View Full Code Here

TOP

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

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.