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

Last change on this file since 627 was 627, checked in by framm, 16 years ago
  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. Copyright 2007 by Immanuel Scholz and others
2package org.openstreetmap.josm.data.osm;
3
4import org.openstreetmap.josm.Main;
5import org.openstreetmap.josm.data.coor.LatLon;
6import org.openstreetmap.josm.data.coor.EastNorth;
7import org.openstreetmap.josm.data.osm.visitor.Visitor;
8
9
10/**
11 * One node data, consisting of one world coordinate waypoint.
12 *
13 * @author imi
14 */
15public final class Node extends OsmPrimitive {
16
17 public LatLon coor;
18 public volatile EastNorth eastNorth;
19
20 /**
21 * Create an incomplete Node object
22 */
23 public Node(long id) {
24 this.id = id;
25 incomplete = true;
26 }
27
28 /**
29 * Create an identical clone of the argument (including the id)
30 */
31 public Node(Node clone) {
32 cloneFrom(clone);
33 }
34
35 public Node(LatLon latlon) {
36 this.coor = latlon;
37 eastNorth = Main.proj.latlon2eastNorth(latlon);
38 }
39
40 @Override public void visit(Visitor visitor) {
41 visitor.visit(this);
42 }
43
44 @Override public void cloneFrom(OsmPrimitive osm) {
45 super.cloneFrom(osm);
46 coor = ((Node)osm).coor;
47 eastNorth = ((Node)osm).eastNorth;
48 }
49
50 @Override public String toString() {
51 if (coor == null) return "{Node id="+id+"}";
52 return "{Node id="+id+",version="+version+",lat="+coor.lat()+",lon="+coor.lon()+"}";
53 }
54
55 @Override public boolean realEqual(OsmPrimitive osm, boolean semanticOnly) {
56 return osm instanceof Node ? super.realEqual(osm, semanticOnly) && coor.equals(((Node)osm).coor) : false;
57 }
58
59 public int compareTo(OsmPrimitive o) {
60 return o instanceof Node ? Long.valueOf(id).compareTo(o.id) : 1;
61 }
62}
Note: See TracBrowser for help on using the repository browser.