Package org.openstreetmap.josm.data.osm

Examples of org.openstreetmap.josm.data.osm.Way.addNode()


            .getCoordinates()) {
          Point p = f.createPoint(coordenada);
          p = (Point) JTS.transform(p,
              CRS.findMathTransform(targetCRS, sourceCRS));
          LatLon ll = new LatLon(p.getY(), p.getX());
          way.addNode(new Node(ll));
          // if (log.isTraceEnabled())
          // BasicWindow.showOnMap(ll, 1);
        }
        res.add(way);
      }
View Full Code Here


          int numGeometries = multilinestring.getNumGeometries();
          for (int i = 0; i < numGeometries; i++) {
            for (Coordinate coordenada : multilinestring
                .getGeometryN(i).getCoordinates()) {
              LatLon ll = new LatLon(coordenada.y, coordenada.x);
              way.addNode(new Node(ll));
              if (info == null)
                info = ll;
            }
            way.mappaintStyle = ls;
            layer.data.ways.add(way);
View Full Code Here

        }

        if (via.get(0) instanceof Node) {
            final Node viaNode = (Node) via.get(0);
            final Way viaPseudoWay = new Way();
            viaPseudoWay.addNode(viaNode);
            checkIfConnected(fromWay, viaPseudoWay,
                    tr("The \"from\" way does not start or end at a \"via\" node."), FROM_VIA_NODE);
            if (toWay.isOneway() != 0 && viaNode.equals(toWay.lastNode(true))) {
                errors.add(new TestError(this, Severity.WARNING, tr("Superfluous turnrestriction as \"to\" way is oneway"), SUPERFLUOUS, r));
                return;
View Full Code Here

            Way wnew = new Way(w);
            wnew.setNodes(null);
            Node lastN = null;
            for (Node n : w.getNodes()) {
                if (lastN == null) {
                    wnew.addNode(n);
                } else if (n == lastN) {
                    // Skip this node
                } else {
                    wnew.addNode(n);
                }
View Full Code Here

                if (lastN == null) {
                    wnew.addNode(n);
                } else if (n == lastN) {
                    // Skip this node
                } else {
                    wnew.addNode(n);
                }
                lastN = n;
            }
            if (wnew.getNodesCount() < 2)
                // Empty way, delete
View Full Code Here

            fixNodes.add(w.lastNode());
            fixNodes.addAll(nodes);
            fixNodes.addAll(collectNodesWithExternReferers(ways));
            // Temporary closed way used to reorder nodes
            Way closedWay = new Way(w);
            closedWay.addNode(w.firstNode());
            ArrayList<Way> usedWays = new ArrayList<>(1);
            usedWays.add(closedWay);
            nodes = collectNodesAnticlockwise(usedWays);
        } else if (!ways.isEmpty() && checkWaysArePolygon(ways)) {
            // Case 2
View Full Code Here

            Node n = new Node(Main.map.mapView.getLatLon(e.getX(), e.getY()));
            EastNorth A = ws.getFirstNode().getEastNorth();
            EastNorth B = ws.getSecondNode().getEastNorth();
            n.setEastNorth(Geometry.closestPointToSegment(A, B, n.getEastNorth()));
            Way wnew = new Way(ws.way);
            wnew.addNode(ws.lowerIndex+1, n);
            SequenceCommand cmds = new SequenceCommand(tr("Add a new node to an existing way"),
                    new AddCommand(n), new ChangeCommand(ws.way, wnew));
            Main.main.undoRedo.add(cmds);
        }
    }
View Full Code Here

        // crete a new rectangle
        Collection<Command> cmds = new LinkedList<>();
        Node third = new Node(newN2en);
        Node fourth = new Node(newN1en);
        Way wnew = new Way();
        wnew.addNode(selectedSegment.getFirstNode());
        wnew.addNode(selectedSegment.getSecondNode());
        wnew.addNode(third);
        if (!dualAlignSegmentCollapsed) {
            // rectangle can degrade to triangle for dual alignment after collapsing
            wnew.addNode(fourth);
View Full Code Here

        Collection<Command> cmds = new LinkedList<>();
        Node third = new Node(newN2en);
        Node fourth = new Node(newN1en);
        Way wnew = new Way();
        wnew.addNode(selectedSegment.getFirstNode());
        wnew.addNode(selectedSegment.getSecondNode());
        wnew.addNode(third);
        if (!dualAlignSegmentCollapsed) {
            // rectangle can degrade to triangle for dual alignment after collapsing
            wnew.addNode(fourth);
        }
View Full Code Here

        Node third = new Node(newN2en);
        Node fourth = new Node(newN1en);
        Way wnew = new Way();
        wnew.addNode(selectedSegment.getFirstNode());
        wnew.addNode(selectedSegment.getSecondNode());
        wnew.addNode(third);
        if (!dualAlignSegmentCollapsed) {
            // rectangle can degrade to triangle for dual alignment after collapsing
            wnew.addNode(fourth);
        }
        // ... and close the way
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.