Changeset 13907 in josm


Ignore:
Timestamp:
2018-06-10T21:05:01+02:00 (6 years ago)
Author:
Don-vip
Message:

add IWay.setNodes()

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/IWay.java

    r13766 r13907  
    6868
    6969    /**
     70     * Set new list of nodes to way. This method is preferred to multiple calls to addNode/removeNode
     71     * and similar methods because nodes are internally saved as array which means lower memory overhead
     72     * but also slower modifying operations.
     73     * @param nodes New way nodes. Can be null, in that case all way nodes are removed
     74     */
     75    void setNodes(List<N> nodes);
     76
     77    /**
    7078     * Determines if this way is closed.
    7179     * @return {@code true} if this way is closed, {@code false} otherwise
  • trunk/src/org/openstreetmap/josm/data/osm/Way.java

    r13816 r13907  
    4040    }
    4141
    42     /**
    43      * Set new list of nodes to way. This method is preferred to multiple calls to addNode/removeNode
    44      * and similar methods because nodes are internally saved as array which means lower memory overhead
    45      * but also slower modifying operations.
    46      * @param nodes New way nodes. Can be null, in that case all way nodes are removed
    47      * @since 1862
    48      */
     42    @Override
    4943    public void setNodes(List<Node> nodes) {
    5044        checkDatasetNotReadOnly();
  • trunk/src/org/openstreetmap/josm/data/osm/WayData.java

    r13764 r13907  
    7171    }
    7272
     73    @Override
     74    public void setNodes(List<NodeData> nodes) {
     75        throw new UnsupportedOperationException("Use setNodeIds(List) instead");
     76    }
     77
    7378    /**
    7479     * Sets the nodes array
    7580     * @param nodes The nodes this way consists of
     81     * @since 13907
    7682     */
    77     public void setNodes(List<Long> nodes) {
     83    public void setNodeIds(List<Long> nodes) {
    7884        this.nodes = new ArrayList<>(nodes);
    7985    }
  • trunk/src/org/openstreetmap/josm/data/osm/history/HistoryWay.java

    r11878 r13907  
    153153    public WayData fillPrimitiveData(WayData data) {
    154154        super.fillPrimitiveCommonData(data);
    155         data.setNodes(nodeIds);
     155        data.setNodeIds(nodeIds);
    156156        return data;
    157157    }
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/MergeSourceBuildingVisitor.java

    r12809 r13907  
    8282            newNodes.add(mappedPrimitives.get(n).getUniqueId());
    8383        }
    84         clone.setNodes(newNodes);
     84        clone.setNodeIds(newNodes);
    8585        mappedPrimitives.put(w, clone);
    8686    }
  • trunk/src/org/openstreetmap/josm/gui/datatransfer/importers/PrimitiveDataPaster.java

    r13717 r13907  
    132132            }
    133133        }
    134         ((WayData) data).setNodes(newNodes);
     134        ((WayData) data).setNodeIds(newNodes);
    135135    }
    136136
  • trunk/test/unit/org/openstreetmap/josm/command/AddPrimitivesCommandTest.java

    r13079 r13907  
    268268        WayData way = new WayData();
    269269        way.put("test", "test");
    270         way.setNodes(Arrays.asList(node1.getId(), node2.getId()));
     270        way.setNodeIds(Arrays.asList(node1.getId(), node2.getId()));
    271271        List<PrimitiveData> testData = Arrays.<PrimitiveData>asList(node1, node2, way);
    272272        return testData;
  • trunk/test/unit/org/openstreetmap/josm/data/osm/WayDataTest.java

    r11324 r13907  
    1919    public void testSerializationForDragAndDrop() throws Exception {
    2020        final WayData data = new WayData();
    21         data.setNodes(Arrays.asList(1415L, 9265L, 3589L, 7932L, 3846L));
     21        data.setNodeIds(Arrays.asList(1415L, 9265L, 3589L, 7932L, 3846L));
    2222        data.setId(314);
    2323        data.setVersion(14);
Note: See TracChangeset for help on using the changeset viewer.