Changeset 23 in josm for src/org/openstreetmap/josm/data/osm/LineSegment.java
- Timestamp:
- 2005-10-27T00:38:03+02:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/org/openstreetmap/josm/data/osm/LineSegment.java
r21 r23 1 1 package org.openstreetmap.josm.data.osm; 2 3 import java.util.Collection;4 import java.util.Collections;5 import java.util.LinkedList;6 2 7 3 import org.openstreetmap.josm.data.osm.visitor.Visitor; … … 26 22 27 23 /** 28 * The tracks, this line segment is part of.29 */30 transient Collection<Track> parent = new LinkedList<Track>();31 32 /**33 24 * Create an line segment from the given starting and ending node 34 25 * @param start Starting node of the line segment. … … 38 29 this.start = start; 39 30 this.end = end; 40 start.parentSegment.add(this);41 end.parentSegment.add(this);42 }43 44 /**45 * Return all parent tracks this line segment is part of. The list is readonly.46 */47 public Collection<Track> getParents() {48 return Collections.unmodifiableCollection(parent);49 }50 51 public void setStart(Node start) {52 this.start.parentSegment.remove(this);53 this.start = start;54 start.parentSegment.add(this);55 }56 public Node getStart() {57 return start;58 }59 public void setEnd(Node end) {60 this.end.parentSegment.remove(this);61 this.end = end;62 end.parentSegment.add(this);63 }64 public Node getEnd() {65 return end;66 }67 68 /**69 * The LineSegment is going to be destroyed. Unlink all back references.70 */71 public void destroy() {72 start.parentSegment.remove(this);73 end.parentSegment.remove(this);74 }75 76 /**77 * Return start and end in a list.78 */79 @Override80 public Collection<Node> getAllNodes() {81 LinkedList<Node> nodes = new LinkedList<Node>();82 nodes.add(getStart());83 nodes.add(getEnd());84 return nodes;85 31 } 86 32
Note:
See TracChangeset
for help on using the changeset viewer.