Class HistoryWay
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.history.HistoryOsmPrimitive
-
- org.openstreetmap.josm.data.osm.history.HistoryWay
-
- All Implemented Interfaces:
java.lang.Comparable<HistoryOsmPrimitive>
,PrimitiveId
,Tagged
public class HistoryWay extends HistoryOsmPrimitive
Represents an immutable OSM way in the context of a historical view on OSM data.- Since:
- 1670
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<java.lang.Long>
nodeIds
-
Fields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH
-
-
Constructor Summary
Constructors Constructor Description HistoryWay(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp)
Constructs a newHistoryWay
.HistoryWay(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, boolean checkHistoricParams)
Constructs a newHistoryWay
with a configurable checking of historic parameters.HistoryWay(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, java.util.List<java.lang.Long> nodeIdList)
Constructs a newHistoryWay
with a given list of node ids.HistoryWay(Way w)
Constructs a newHistoryWay
from an existingWay
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNode(long ref)
adds a node id to the list nodes of this wayWayData
fillPrimitiveData(WayData data)
Fills the way attributes with values from this history.java.lang.String
getDisplayName(HistoryNameFormatter formatter)
Replies the display name of a primitive formatted byformatter
long
getNodeId(int idx)
replies the idx-th node id in the list of node ids of this wayjava.util.List<java.lang.Long>
getNodes()
replies an immutable list of the ways node idsint
getNumNodes()
replies the number of nodes in this wayOsmPrimitiveType
getType()
replies the ways type, i.e.boolean
isClosed()
Replies true if this way is closed.-
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, 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
-
-
-
-
Field Detail
-
nodeIds
private final java.util.List<java.lang.Long> nodeIds
-
-
Constructor Detail
-
HistoryWay
public HistoryWay(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp)
Constructs a newHistoryWay
.- 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)- Throws:
java.lang.IllegalArgumentException
- if preconditions are violated
-
HistoryWay
public HistoryWay(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, boolean checkHistoricParams)
Constructs a newHistoryWay
with a configurable checking of historic parameters. This is needed to build virtual HistoryWays for modified ways, 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)checkHistoricParams
- if true, checks values ofchangesetId
andtimestamp
- Throws:
java.lang.IllegalArgumentException
- if preconditions are violated- Since:
- 5440
-
HistoryWay
public HistoryWay(long id, long version, boolean visible, User user, long changesetId, java.time.Instant timestamp, java.util.List<java.lang.Long> nodeIdList)
Constructs a newHistoryWay
with a given list of node ids.- 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)nodeIdList
- the node ids (!= null required)- Throws:
java.lang.IllegalArgumentException
- if preconditions are violated
-
HistoryWay
public HistoryWay(Way w)
Constructs a newHistoryWay
from an existingWay
.- Parameters:
w
- the way
-
-
Method Detail
-
getNumNodes
public int getNumNodes()
replies the number of nodes in this way- Returns:
- the number of nodes
-
getNodeId
public long getNodeId(int idx)
replies the idx-th node id in the list of node ids of this way- Parameters:
idx
- the index- Returns:
- the idx-th node id
- Throws:
java.lang.IndexOutOfBoundsException
- if idx < 0 || idx >= {#seegetNumNodes()
-
getNodes
public java.util.List<java.lang.Long> getNodes()
replies an immutable list of the ways node ids- Returns:
- the ways node ids
-
getType
public OsmPrimitiveType getType()
replies the ways type, i.e.OsmPrimitiveType.WAY
-
addNode
public void addNode(long ref)
adds a node id to the list nodes of this way- Parameters:
ref
- the node id to add
-
isClosed
public boolean isClosed()
Replies true if this way is closed.- Returns:
- true if this way is closed.
-
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 WayData fillPrimitiveData(WayData data)
Fills the way attributes with values from this history.- Parameters:
data
- way data to fill- Returns:
- filled way data
- Since:
- 11878
-
-