Last change
on this file since 329 was 329, checked in by framm, 17 years ago |
This commit is a manual merge of all changes that have been made to
the intermediate "core_0.5" branch on the main OSM repository,
bevore JOSM was moved to openstreetmap.de.
Changes incorporated here:
r4464@svn.openstreetmap.org
r4466@svn.openstreetmap.org
r4468@svn.openstreetmap.org
r4469@svn.openstreetmap.org
r4479@svn.openstreetmap.org
|
File size:
1.5 KB
|
Line | |
---|
1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.data.osm;
|
---|
3 |
|
---|
4 | import java.util.ArrayList;
|
---|
5 | import java.util.Arrays;
|
---|
6 | import java.util.List;
|
---|
7 |
|
---|
8 | import org.openstreetmap.josm.data.osm.visitor.Visitor;
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * One full way, consisting of a list of way nodes.
|
---|
12 | *
|
---|
13 | * @author imi
|
---|
14 | */
|
---|
15 | public final class Way extends OsmPrimitive {
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * All way nodes in this way
|
---|
19 | */
|
---|
20 | public final List<Node> nodes = new ArrayList<Node>();
|
---|
21 |
|
---|
22 | @Override public void visit(Visitor visitor) {
|
---|
23 | visitor.visit(this);
|
---|
24 | }
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * Create an identical clone of the argument (including the id)
|
---|
28 | */
|
---|
29 | public Way(Way clone) {
|
---|
30 | cloneFrom(clone);
|
---|
31 | }
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Create an empty way without id. Use this only if you set meaningful
|
---|
35 | * values yourself.
|
---|
36 | */
|
---|
37 | public Way() {
|
---|
38 | }
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Create an incomplete Way.
|
---|
42 | */
|
---|
43 | public Way(long id) {
|
---|
44 | this.id = id;
|
---|
45 | incomplete = true;
|
---|
46 | }
|
---|
47 |
|
---|
48 | @Override public void cloneFrom(OsmPrimitive osm) {
|
---|
49 | super.cloneFrom(osm);
|
---|
50 | nodes.clear();
|
---|
51 | nodes.addAll(((Way)osm).nodes);
|
---|
52 | }
|
---|
53 |
|
---|
54 | @Override public String toString() {
|
---|
55 | return "{Way id="+id+" nodes="+Arrays.toString(nodes.toArray())+"}";
|
---|
56 | }
|
---|
57 |
|
---|
58 | @Override public boolean realEqual(OsmPrimitive osm, boolean semanticOnly) {
|
---|
59 | return osm instanceof Way ? super.realEqual(osm, semanticOnly) && nodes.equals(((Way)osm).nodes) : false;
|
---|
60 | }
|
---|
61 |
|
---|
62 | public int compareTo(OsmPrimitive o) {
|
---|
63 | return o instanceof Way ? Long.valueOf(id).compareTo(o.id) : -1;
|
---|
64 | }
|
---|
65 |
|
---|
66 | @Deprecated
|
---|
67 | public boolean isIncomplete() {
|
---|
68 | return false;
|
---|
69 | }
|
---|
70 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.