source: josm/src/org/openstreetmap/josm/data/osm/Way.java@ 203

Last change on this file since 203 was 203, checked in by imi, 17 years ago
  • Fixed a bug in the Merger/Conflict to auto-resolve marked changes without real changes
  • Fixed bug in split way, that reversed the order of segments in one way.
  • Fixed bug where dialogs did not update anymore after loading a dataset twice
File size: 1.3 KB
Line 
1package org.openstreetmap.josm.data.osm;
2
3import java.util.ArrayList;
4import java.util.Arrays;
5import java.util.List;
6
7import org.openstreetmap.josm.data.osm.visitor.Visitor;
8
9/**
10 * One full way, consisting of several way segments chained together.
11 *
12 * @author imi
13 */
14public class Way extends OsmPrimitive {
15
16 /**
17 * All way segments in this way
18 */
19 public final List<Segment> segments = new ArrayList<Segment>();
20
21 @Override public void visit(Visitor visitor) {
22 visitor.visit(this);
23 }
24
25 /**
26 * Create an identical clone of the argument (including the id)
27 */
28 public Way(Way clone) {
29 cloneFrom(clone);
30 }
31
32 public Way() {
33 }
34
35 @Override public void cloneFrom(OsmPrimitive osm) {
36 super.cloneFrom(osm);
37 segments.clear();
38 segments.addAll(((Way)osm).segments);
39 }
40
41 @Override public String toString() {
42 return "{Way id="+id+" segments="+Arrays.toString(segments.toArray())+"}";
43 }
44
45 @Override public boolean realEqual(OsmPrimitive osm, boolean semanticOnly) {
46 return osm instanceof Way ? super.realEqual(osm, semanticOnly) && segments.equals(((Way)osm).segments) : false;
47 }
48
49 public int compareTo(OsmPrimitive o) {
50 return o instanceof Way ? Long.valueOf(id).compareTo(o.id) : -1;
51 }
52
53 public boolean isIncomplete() {
54 for (Segment s : segments)
55 if (s.incomplete)
56 return true;
57 return false;
58 }
59}
Note: See TracBrowser for help on using the repository browser.