source: josm/src/org/openstreetmap/josm/data/osm/Node.java@ 17

Last change on this file since 17 was 17, checked in by imi, 19 years ago
  • added Layer support
  • added support for raw GPS data
  • fixed tooltips
  • added options for loading gpx files
File size: 1.4 KB
Line 
1package org.openstreetmap.josm.data.osm;
2
3import java.util.Collection;
4import java.util.Collections;
5import java.util.LinkedList;
6
7import org.openstreetmap.josm.data.GeoPoint;
8import org.openstreetmap.josm.data.osm.visitor.Visitor;
9
10
11/**
12 * One node data, consisting of one world coordinate waypoint.
13 *
14 * @author imi
15 */
16public class Node extends OsmPrimitive {
17
18 /**
19 * The coordinates of this node.
20 */
21 public GeoPoint coor;
22
23 /**
24 * The list of line segments, this node is part of.
25 */
26 transient Collection<LineSegment> parentSegment = new LinkedList<LineSegment>();
27
28 /**
29 * Returns a read-only list of all segments this node is in.
30 * @return A list of all segments. Readonly.
31 */
32 public Collection<LineSegment> getParentSegments() {
33 return Collections.unmodifiableCollection(parentSegment);
34 }
35
36 /**
37 * Merge the node given at parameter with this node.
38 * All parents of the parameter-node become parents of this node.
39 *
40 * The argument node is not changed.
41 *
42 * @param node Merge the node to this.
43 */
44 public void mergeFrom(Node node) {
45 parentSegment.addAll(node.parentSegment);
46 if (keys == null)
47 keys = node.keys;
48 else if (node.keys != null)
49 keys.putAll(node.keys);
50 }
51
52 /**
53 * Return a list only this added.
54 */
55 @Override
56 public Collection<Node> getAllNodes() {
57 LinkedList<Node> nodes = new LinkedList<Node>();
58 nodes.add(this);
59 return nodes;
60 }
61
62 @Override
63 public void visit(Visitor visitor) {
64 visitor.visit(this);
65 }
66}
Note: See TracBrowser for help on using the repository browser.