Class HistoryNode
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive
-
- org.openstreetmap.josm.data.osm.history.HistoryNode
-
- All Implemented Interfaces:
java.lang.Comparable<HistoryOsmPrimitive>
,PrimitiveId
,Tagged
public class HistoryNode extends HistoryOsmPrimitive
Represents an immutable OSM node in the context of a historical view on OSM data.- Since:
- 1670
-
-
Field Summary
Fields Modifier and Type Field Description private LatLon
coords
the coordinates.-
Fields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH
-
-
Constructor Summary
Constructors Constructor Description HistoryNode(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, LatLon coords)
Constructs a newHistoryNode
.HistoryNode(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, LatLon coords, boolean checkHistoricParams)
Constructs a newHistoryNode
with a configurable checking of historic parameters.HistoryNode(Node n)
Constructs a newHistoryNode
from an existingNode
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeData
fillPrimitiveData(NodeData data)
Fills the node attributes with values from this history.LatLon
getCoords()
Replies the coordinates.java.lang.String
getDisplayName(HistoryNameFormatter formatter)
Replies the display name of a primitive formatted byformatter
OsmPrimitiveType
getType()
Gets the type of object represented by this object.void
setCoords(LatLon coords)
Sets the coordinates.-
Methods inherited from class org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive
compareTo, ensurePositiveLong, equals, fillPrimitiveCommonData, forOsmPrimitive, get, getChangeset, getChangesetId, getId, getInstant, getKeys, getLocalName, getName, getNumKeys, getPrimitiveId, getTags, getTimestamp, getUniqueId, getUser, getVersion, hashCode, hasKey, hasKeys, isNew, isVisible, keySet, matches, matches, put, remove, removeAll, setChangeset, setKeys, setTags, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.data.osm.Tagged
hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, keys, put, putAll, visitKeys
-
-
-
-
Constructor Detail
-
HistoryNode
public HistoryNode(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, LatLon coords)
Constructs a newHistoryNode
.- Parameters:
id
- the id (> 0 required)version
- the version (> 0 required)visible
- whether the node is still visibleuser
- the user (!= null required)changesetId
- the changeset id (> 0 required)timestamp
- the timestamp (!= null required)coords
- the coordinates- Throws:
java.lang.IllegalArgumentException
- if preconditions are violated
-
HistoryNode
public HistoryNode(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, LatLon coords, boolean checkHistoricParams)
Constructs a newHistoryNode
with a configurable checking of historic parameters. This is needed to build virtual HistoryNodes for modified nodes, which do not have a timestamp and a changeset id.- Parameters:
id
- the id (> 0 required)version
- the version (> 0 required)visible
- whether the node is still visibleuser
- the user (!= null required)changesetId
- the changeset id (> 0 required ifcheckHistoricParams
is true)timestamp
- the timestamp (!= null required ifcheckHistoricParams
is true)coords
- the coordinatescheckHistoricParams
- if true, checks values ofchangesetId
andtimestamp
- Throws:
java.lang.IllegalArgumentException
- if preconditions are violated- Since:
- 5440
-
HistoryNode
public HistoryNode(Node n)
Constructs a newHistoryNode
from an existingNode
.- Parameters:
n
- the node
-
-
Method Detail
-
getType
public OsmPrimitiveType getType()
Description copied from interface:PrimitiveId
Gets the type of object represented by this object. Note that this should return the base primitive type (OsmPrimitiveType.NODE
,OsmPrimitiveType.WAY
, andOsmPrimitiveType.RELATION
).
-
getCoords
public final LatLon getCoords()
Replies the coordinates. May be null.- Returns:
- the coordinates. May be null.
-
setCoords
public final void setCoords(LatLon coords)
Sets the coordinates. Can be null.- Parameters:
coords
- the coordinates. Can be null.
-
getDisplayName
public java.lang.String getDisplayName(HistoryNameFormatter formatter)
Description copied from class:HistoryOsmPrimitive
Replies the display name of a primitive formatted byformatter
- Specified by:
getDisplayName
in classHistoryOsmPrimitive
- Parameters:
formatter
- The formatter used to generate a display name- Returns:
- the display name
-
fillPrimitiveData
public NodeData fillPrimitiveData(NodeData data)
Fills the node attributes with values from this history.- Parameters:
data
- node data to fill- Returns:
- filled node data
- Since:
- 11878
-
-