source: josm/trunk/src/org/openstreetmap/josm/data/osm/WayData.java @ 5241

Revision 5170, 1.3 KB checked in by Don-vip, 6 weeks ago (diff)

cleanup svn:mime-type properties preventing Java sources from being viewed as such on Trac

  • Property svn:eol-style set to native
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm;
3
4import java.util.ArrayList;
5import java.util.List;
6
7import org.openstreetmap.josm.data.osm.visitor.PrimitiveVisitor;
8
9public class WayData extends PrimitiveData implements IWay {
10
11    private List<Long> nodes = new ArrayList<Long>();
12
13    public WayData() {
14
15    }
16
17    public WayData(WayData data) {
18        super(data);
19        nodes.addAll(data.getNodes());
20    }
21
22    public List<Long> getNodes() {
23        return nodes;
24    }
25
26    @Override
27    public int getNodesCount() {
28        return nodes.size();
29    }
30
31    @Override
32    public long getNodeId(int idx) {
33        return nodes.get(idx);
34    }
35
36    @Override
37    public boolean isClosed() {
38        if (isIncomplete()) return false;
39        return nodes.get(0).equals(nodes.get(nodes.size() - 1));
40    }
41
42    public void setNodes(List<Long> nodes) {
43        this.nodes = new ArrayList<Long>(nodes);
44    }
45
46    @Override
47    public WayData makeCopy() {
48        return new WayData(this);
49    }
50
51    @Override
52    public String toString() {
53        return super.toString() + " WAY" + nodes.toString();
54    }
55
56    @Override
57    public OsmPrimitiveType getType() {
58        return OsmPrimitiveType.WAY;
59    }
60
61    @Override
62    public void visit(PrimitiveVisitor visitor) {
63        visitor.visit(this);
64    }
65
66}
Note: See TracBrowser for help on using the repository browser.