Package org.openstreetmap.josm.data.osm
Class WayData
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.AbstractPrimitive
-
- org.openstreetmap.josm.data.osm.PrimitiveData
-
- org.openstreetmap.josm.data.osm.WayData
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<IPrimitive>
,IQuadBucketType
,IFilterablePrimitive
,IPrimitive
,IWay<NodeData>
,PrimitiveId
,Stylable
,Tagged
public class WayData extends PrimitiveData implements IWay<NodeData>
The data (tags and node ids) that is stored for a way in the database.- Since:
- 2284
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static UniqueIdGenerator
idGenerator
private java.util.List<java.lang.Long>
nodes
private static long
serialVersionUID
-
Fields inherited from class org.openstreetmap.josm.data.osm.AbstractPrimitive
changesetId, FLAG_ALL_REFERRERS_DOWNLOADED, FLAG_ANNOTATED, FLAG_DELETED, FLAG_DIRECTION_REVERSED, FLAG_DISABLED, FLAG_DISABLED_TYPE, FLAG_HAS_DIRECTIONS, FLAG_HIDDEN_TYPE, FLAG_HIDE_IF_DISABLED, FLAG_HIGHLIGHTED, FLAG_INCOMPLETE, FLAG_MODIFIED, FLAG_PRESERVED, FLAG_TAGGED, FLAG_VISIBLE, flags, id, keys, mappaintCacheIdx, timestamp, user, version
-
Fields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accept(PrimitiveVisitor visitor)
Makes the given visitor visit this primitive.NodeData
firstNode()
Returns the first node of this way.BBox
getBBox()
Fetches the bounding box of the primitive.UniqueIdGenerator
getIdGenerator()
Returns the unique identifier generator.NodeData
getNode(int index)
Replies the node at positionindex
.long
getNodeId(int idx)
Returns id of the node at given index.java.util.List<java.lang.Long>
getNodeIds()
Returns the list of node ids in this way.java.util.List<NodeData>
getNodes()
Returns the list of nodes in this way.int
getNodesCount()
Replies the number of nodes in this way.OsmPrimitiveType
getType()
Gets the type of object represented by this object.boolean
isClosed()
Determines if this way is closed.boolean
isFirstLastNode(INode n)
Replies true if the given node is the first or the last one of this way, false otherwise.boolean
isInnerNode(INode n)
Replies true if the given node is an inner node of this way, false otherwise.NodeData
lastNode()
Returns the last node of this way.WayData
makeCopy()
Returns a copy of this primitive data.void
setNodeIds(java.util.List<java.lang.Long> nodes)
Sets the nodes arrayvoid
setNodes(java.util.List<NodeData> nodes)
Set new list of nodes to way.java.lang.String
toString()
-
Methods inherited from class org.openstreetmap.josm.data.osm.PrimitiveData
declareCachedStyleUpToDate, getCachedStyle, getDataSet, getReferrers, hasDirectionKeys, isAnnotated, isCachedStyleUpToDate, isHighlighted, isTagged, keysChangedImpl, reversedDirection, setCachedStyle, setHighlighted, setId, setIncomplete, setVersion, visitReferrers
-
Methods inherited from class org.openstreetmap.josm.data.osm.AbstractPrimitive
clearOsmMetadata, cloneFrom, doGet, get, getChangesetId, getDisabledType, getDiscardableKeys, getFlagsAsString, getHiddenType, getId, getIgnoreCase, getInstant, getInterestingTags, getKeys, getNumKeys, getRawTimestamp, getUninterestingKeys, getUniqueId, getUser, getVersion, getWorkInProgressKeys, hasKey, hasKey, hasKeys, isDeleted, isDisabled, isDisabledAndHidden, isDrawable, isIncomplete, isModified, isNew, isNewOrUndeleted, isPreserved, isReferrersDownloaded, isTimestampEmpty, isUndeleted, isUninterestingKey, isUsable, isVisible, keys, keySet, put, putAll, remove, removeAll, setChangesetId, setDeleted, setDisabledState, setDisabledType, setHiddenType, setInstant, setKeys, setKeys, setModified, setOsmId, setRawTimestamp, setReferrersDownloaded, setUser, setVisible, unsetDisabledState, updateFlags, updateFlagsChanged, visitKeys
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.data.osm.IPrimitive
getChangesetId, getDataSet, getDisplayType, getId, getInstant, getInterestingTags, getLocalName, getName, getOsmId, getOsmPrimitiveId, getPrimitiveId, getRawTimestamp, getReferrers, getReferrers, getStyleCacheSyncObject, getUser, getVersion, hasDirectionKeys, hasSameInterestingTags, isAnnotated, isDeleted, isDisabled, isDisabledAndHidden, isDrawable, isHighlighted, isIncomplete, isMemberOfSelected, isModified, isMultipolygon, isNewOrUndeleted, isOuterMemberOfSelected, isPreserved, isReferrersDownloaded, isSelectable, isSelected, isTagged, isTimestampEmpty, isUndeleted, isUsable, isVisible, reversedDirection, setChangesetId, setDeleted, setHighlighted, setInstant, setModified, setOsmId, setRawTimestamp, setReferrersDownloaded, setUser, setVisible, visitReferrers
-
Methods inherited from interface org.openstreetmap.josm.data.osm.IWay
compareTo, getChildren, getDisplayName, getRealNodesCount, hasIncompleteNodes, isEmpty
-
Methods inherited from interface org.openstreetmap.josm.data.osm.PrimitiveId
getUniqueId, isNew
-
Methods inherited from interface org.openstreetmap.josm.data.osm.Stylable
clearCachedStyle, declareCachedStyleUpToDate, getCachedStyle, isCachedStyleUpToDate, setCachedStyle
-
Methods inherited from interface org.openstreetmap.josm.data.osm.Tagged
get, getKeys, getNumKeys, hasKey, hasKeys, hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, keys, keySet, put, put, putAll, remove, removeAll, setKeys, visitKeys
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
idGenerator
private static final UniqueIdGenerator idGenerator
-
nodes
private java.util.List<java.lang.Long> nodes
-
-
Method Detail
-
getNodes
public java.util.List<NodeData> getNodes()
Description copied from interface:IWay
Returns the list of nodes in this way.
-
getNode
public NodeData getNode(int index)
Description copied from interface:IWay
Replies the node at positionindex
.
-
getNodeIds
public java.util.List<java.lang.Long> getNodeIds()
Description copied from interface:IWay
Returns the list of node ids in this way.- Specified by:
getNodeIds
in interfaceIWay<NodeData>
- Returns:
- the list of node ids in this way
-
getNodesCount
public int getNodesCount()
Description copied from interface:IWay
Replies the number of nodes in this way.- Specified by:
getNodesCount
in interfaceIWay<NodeData>
- Returns:
- the number of nodes in this way.
-
getNodeId
public long getNodeId(int idx)
Description copied from interface:IWay
Returns id of the node at given index.
-
isClosed
public boolean isClosed()
Description copied from interface:IWay
Determines if this way is closed.
-
setNodes
public void setNodes(java.util.List<NodeData> nodes)
Description copied from interface:IWay
Set new list of nodes to way. This method is preferred to multiple calls to addNode/removeNode and similar methods because nodes are internally saved as array which means lower memory overhead but also slower modifying operations.
-
setNodeIds
public void setNodeIds(java.util.List<java.lang.Long> nodes)
Sets the nodes array- Parameters:
nodes
- The nodes this way consists of- Since:
- 13907
-
makeCopy
public WayData makeCopy()
Description copied from class:PrimitiveData
Returns a copy of this primitive data.- Specified by:
makeCopy
in classPrimitiveData
- Returns:
- a copy of this primitive data
-
toString
public java.lang.String toString()
- Overrides:
toString
in classPrimitiveData
-
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
).- Specified by:
getType
in interfacePrimitiveId
- Returns:
- the object type
- See Also:
Node
,Way
,Relation
-
accept
public void accept(PrimitiveVisitor visitor)
Description copied from interface:IPrimitive
Makes the given visitor visit this primitive.- Specified by:
accept
in interfaceIPrimitive
- Parameters:
visitor
- visitor
-
getBBox
public BBox getBBox()
Description copied from interface:IPrimitive
Fetches the bounding box of the primitive. Since 17752, the returned bounding box might be immutable, i.e., modifying calls throw anUnsupportedOperationException
.- Specified by:
getBBox
in interfaceIPrimitive
- Specified by:
getBBox
in interfaceIQuadBucketType
- Returns:
- Bounding box of the object
-
firstNode
public NodeData firstNode()
Description copied from interface:IWay
Returns the first node of this way. The result equalsgetNode
(0)
.
-
lastNode
public NodeData lastNode()
Description copied from interface:IWay
Returns the last node of this way. The result equals
.getNode
(getNodesCount
- 1)
-
isFirstLastNode
public boolean isFirstLastNode(INode n)
Description copied from interface:IWay
Replies true if the given node is the first or the last one of this way, false otherwise.- Specified by:
isFirstLastNode
in interfaceIWay<NodeData>
- Parameters:
n
- The node to test- Returns:
- true if the
n
is the first or the last node, false otherwise.
-
isInnerNode
public boolean isInnerNode(INode n)
Description copied from interface:IWay
Replies true if the given node is an inner node of this way, false otherwise.- Specified by:
isInnerNode
in interfaceIWay<NodeData>
- Parameters:
n
- The node to test- Returns:
- true if the
n
is an inner node, false otherwise.
-
getIdGenerator
public UniqueIdGenerator getIdGenerator()
Description copied from class:AbstractPrimitive
Returns the unique identifier generator.- Specified by:
getIdGenerator
in classAbstractPrimitive
- Returns:
- the unique identifier generator
-
-