Package org.openstreetmap.josm.data.osm

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


     * @param w the way
     */
    protected void rememberWay(Way w) {
        if (isAlreadyRemembered(w))
            return;
        WayData clone = w.save();
        List<Long> newNodes = new ArrayList<>(w.getNodesCount());
        for (Node n: w.getNodes()) {
            newNodes.add(mappedPrimitives.get(n).getUniqueId());
        }
        clone.setNodes(newNodes);
        mappedPrimitives.put(w, clone);
    }
View Full Code Here


                        case NODE:
                            data = new NodeData();
                            ((NodeData)data).setCoor(((HistoryNode)hp).getCoords());
                            break;
                        case WAY:
                            data = new WayData();
                            List<Long> nodeIds = ((HistoryWay)hp).getNodes();
                            ((WayData)data).setNodes(nodeIds);
                            // Find incomplete nodes to load at next run
                            for (Long nodeId : nodeIds) {
                                if (p.getDataSet().getPrimitiveById(nodeId, OsmPrimitiveType.NODE) == null) {
View Full Code Here

                    // but that would not free memory in case the
                    // user clears undo/redo buffer after purge
                    PrimitiveData empty;
                    switch(osm.getType()) {
                    case NODE: empty = new NodeData(); break;
                    case WAY: empty = new WayData(); break;
                    case RELATION: empty = new RelationData(); break;
                    default: throw new AssertionError();
                    }
                    empty.setId(osm.getUniqueId());
                    empty.setIncomplete(true);
View Full Code Here

                return n;
        }
    }

    protected Way parseWay() throws XMLStreamException {
        WayData wd = new WayData();
        readCommon(wd);
        Way w = new Way(wd.getId(), wd.getVersion());
        w.setVisible(wd.isVisible());
        w.load(wd);
        externalIdMap.put(wd.getPrimitiveId(), w);

        Collection<Long> nodeIds = new ArrayList<>();
        while (true) {
            int event = parser.next();
            if (event == XMLStreamConstants.START_ELEMENT) {
                switch (parser.getLocalName()) {
                case "nd":
                    nodeIds.add(parseWayNode(w));
                    break;
                case "tag":
                    parseTag(w);
                    break;
                default:
                    parseUnknown();
                }
            } else if (event == XMLStreamConstants.END_ELEMENT) {
                break;
            }
        }
        if (w.isDeleted() && !nodeIds.isEmpty()) {
            Main.info(tr("Deleted way {0} contains nodes", w.getUniqueId()));
            nodeIds = new ArrayList<>();
        }
        ways.put(wd.getUniqueId(), nodeIds);
        return w;
    }
View Full Code Here

TOP

Related Classes of org.openstreetmap.josm.data.osm.WayData

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.