source: josm/trunk/src/org/openstreetmap/josm/data/osm/history/HistoryNode.java@ 11608

Last change on this file since 11608 was 11608, checked in by Don-vip, 7 years ago

fix #14402 - add blacklist for leisure area values to avoid false positives - improve globally the detection of keys/tags

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.data.osm.history;
3
4import java.util.Date;
5
6import org.openstreetmap.josm.data.coor.LatLon;
7import org.openstreetmap.josm.data.osm.Node;
8import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
9import org.openstreetmap.josm.data.osm.User;
10
11/**
12 * Represents an immutable OSM node in the context of a historical view on OSM data.
13 * @since 1670
14 */
15public class HistoryNode extends HistoryOsmPrimitive {
16
17 /** the coordinates. May be null for deleted nodes */
18 private LatLon coords;
19
20 /**
21 * Constructs a new {@code HistoryNode}.
22 *
23 * @param id the id (> 0 required)
24 * @param version the version (> 0 required)
25 * @param visible whether the node is still visible
26 * @param user the user (!= null required)
27 * @param changesetId the changeset id (> 0 required)
28 * @param timestamp the timestamp (!= null required)
29 * @param coords the coordinates
30 * @throws IllegalArgumentException if preconditions are violated
31 */
32 public HistoryNode(long id, long version, boolean visible, User user, long changesetId, Date timestamp, LatLon coords) {
33 this(id, version, visible, user, changesetId, timestamp, coords, true);
34 }
35
36 /**
37 * Constructs a new {@code HistoryNode} with a configurable checking of historic parameters.
38 * This is needed to build virtual HistoryNodes for modified nodes, which do not have a timestamp and a changeset id.
39 *
40 * @param id the id (> 0 required)
41 * @param version the version (> 0 required)
42 * @param visible whether the node is still visible
43 * @param user the user (!= null required)
44 * @param changesetId the changeset id (> 0 required if {@code checkHistoricParams} is true)
45 * @param timestamp the timestamp (!= null required if {@code checkHistoricParams} is true)
46 * @param coords the coordinates
47 * @param checkHistoricParams if true, checks values of {@code changesetId} and {@code timestamp}
48 * @throws IllegalArgumentException if preconditions are violated
49 * @since 5440
50 */
51 public HistoryNode(long id, long version, boolean visible, User user, long changesetId, Date timestamp, LatLon coords,
52 boolean checkHistoricParams) {
53 super(id, version, visible, user, changesetId, timestamp, checkHistoricParams);
54 setCoords(coords);
55 }
56
57 /**
58 * Constructs a new {@code HistoryNode} from an existing {@link Node}.
59 * @param n the node
60 */
61 public HistoryNode(Node n) {
62 super(n);
63 setCoords(n.getCoor());
64 }
65
66 @Override
67 public OsmPrimitiveType getType() {
68 return OsmPrimitiveType.NODE;
69 }
70
71 /**
72 * Replies the coordinates. May be null.
73 * @return the coordinates. May be null.
74 */
75 public final LatLon getCoords() {
76 return coords;
77 }
78
79 /**
80 * Sets the coordinates. Can be null.
81 * @param coords the coordinates. Can be null.
82 */
83 public final void setCoords(LatLon coords) {
84 this.coords = coords;
85 }
86
87 @Override
88 public String getDisplayName(HistoryNameFormatter formatter) {
89 return formatter.format(this);
90 }
91}
Note: See TracBrowser for help on using the repository browser.