Examples of OsmPrimitive


Examples of org.openstreetmap.josm.data.osm.OsmPrimitive

                    fireContentsChanged(this, 0, getSize());
                    if (selection != null) {
                        remember(selection);
                        if (selection.size() == 2) {
                            Iterator<? extends OsmPrimitive> it = selection.iterator();
                            OsmPrimitive n1 = it.next(), n2=it.next();
                            // show distance between two selected nodes
                            if (n1 instanceof Node && n2 instanceof Node) {
                                double d = ((Node) n1).getCoor().greatCircleDistance(((Node) n2).getCoor());
                                Main.map.statusLine.setDist(d);
                                return;
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.OsmPrimitive

     *
     * @param conflict The conflict information
     */
    public void populate(Conflict<? extends OsmPrimitive> conflict) {
        this.my = conflict.getMy();
        OsmPrimitive their = conflict.getTheir();
        if (my instanceof Node) {
            myCoords = ((Node)my).getCoor();
            theirCoords = ((Node)their).getCoor();
        } else {
            myCoords = null;
            theirCoords = null;
        }

        myDeletedState =  conflict.isMyDeleted() || my.isDeleted();
        theirDeletedState = their.isDeleted();

        myReferrers = my.getDataSet() == null?Collections.<OsmPrimitive>emptyList():my.getReferrers();
        theirReferrers = their.getDataSet() == null?Collections.<OsmPrimitive>emptyList():their.getReferrers();

        coordMergeDecision = UNDECIDED;
        deletedMergeDecision = UNDECIDED;
        setChanged();
        notifyObservers();
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.OsmPrimitive

        // list is empty we can assume that we won't do any joins
        if (ctrl || oldHighlights.isEmpty()) {
            rv = new StringBuilder(tr("Create new node."));
        } else {
            // oldHighlights may store a node or way, check if it's a node
            OsmPrimitive x = oldHighlights.iterator().next();
            if (x instanceof Node) {
                rv = new StringBuilder(tr("Select node under cursor."));
            } else {
                rv = new StringBuilder(trn("Insert new node into way.", "Insert new node into {0} ways.",
                        oldHighlights.size(), oldHighlights.size()));
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.OsmPrimitive

    public boolean highlight(Collection <? extends OsmPrimitive> prims, boolean only) {
        boolean needsRepaint = false;
        if (only) {
            Iterator<OsmPrimitive> it = highlightedPrimitives.iterator();
            while (it.hasNext()) {
                OsmPrimitive p = it.next();
                if (!prims.contains(p)) {
                    p.setHighlighted(false);
                    it.remove();
                    needsRepaint = true;
                }
            }
        }
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.OsmPrimitive

        Set<OsmPrimitive> result = new HashSet<>();
        Stack<OsmPrimitive> stack = new Stack<>();
        stack.addAll(primitives);

        while (!stack.isEmpty()) {
            OsmPrimitive p = stack.pop();

            if (result.contains(p)) {
                continue;
            }

            result.add(p);

            if (p instanceof Way) {
                for (OsmPrimitive n: ((Way)p).getNodes()) {
                    stack.push(n);
                }
            } else if (p instanceof Relation) {
                for (RelationMember rm: ((Relation)p).getMembers()) {
                    stack.push(rm.getMember());
                }
            }

            for (OsmPrimitive ref: p.getReferrers()) {
                stack.push(ref);
            }
        }

        return result;
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.OsmPrimitive

        }

        @Override
        public void actionPerformed(ActionEvent e) {
            if (!isEnabled()) return;
            OsmPrimitive p = getPrimitiveToZoom();
            if (p != null) {
                OsmDataLayer editLayer = Main.main.getEditLayer();
                if (editLayer != null) {
                    editLayer.data.setSelected(p.getPrimitiveId());
                    AutoScaleAction.autoScale("selection");
                }
            }
        }
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.OsmPrimitive

     */
    public static void updatePrimitive(PrimitiveId id) throws IllegalStateException, IllegalArgumentException{
        ensureParameterNotNull(id, "id");
        if (getEditLayer() == null)
            throw new IllegalStateException(tr("No current dataset found"));
        OsmPrimitive primitive = getEditLayer().data.getPrimitiveById(id);
        if (primitive == null)
            throw new IllegalStateException(tr("Did not find an object with id {0} in the current dataset", id));
        updatePrimitives(Collections.singleton(primitive));
    }
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.OsmPrimitive

        setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
    }

    @Override
    public OsmPrimitive getPrimitiveInLayer(int row, OsmDataLayer layer) {
        OsmPrimitive result = super.getPrimitiveInLayer(row, layer);
        if (model != null && result != null && layer != null && result.getDataSet() != layer.data) {
            result = model.getMyPrimitiveById(result);
        }
        return result;
    }
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.OsmPrimitive

     * Sets the {@link OsmPrimitive} in the role "my"
     *
     * @param my the primitive in the role "my"
     */
    protected void setMy(OsmPrimitive my) {
        OsmPrimitive old = this.my;
        this.my = my;
        if (old != this.my) {
            firePropertyChange(MY_PRIMITIVE_PROP, old, this.my);
        }
    }
View Full Code Here

Examples of org.openstreetmap.josm.data.osm.OsmPrimitive

     * Sets the {@link OsmPrimitive} in the role "their".
     *
     * @param their the primitive in the role "their"
     */
    protected void setTheir(OsmPrimitive their) {
        OsmPrimitive old = this.their;
        this.their = their;
        if (old != this.their) {
            firePropertyChange(THEIR_PRIMITIVE_PROP, old, this.their);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.