Package org.openstreetmap.josm.data.osm
Interface IWay<N extends INode>
-
- Type Parameters:
N
- type of OSM node
- All Superinterfaces:
java.lang.Comparable<IPrimitive>
,IPrimitive
,IQuadBucketType
,PrimitiveId
,Stylable
,Tagged
public interface IWay<N extends INode> extends IPrimitive
- Since:
- 4098
-
-
Field Summary
-
Fields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
compareTo(IPrimitive o)
N
firstNode()
Returns the first node of this way.default java.util.List<N>
getChildren()
Get child primitives that are referred by this primitive.default java.lang.String
getDisplayName(NameFormatter formatter)
Replies the display name of a primitive formatted byformatter
N
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<N>
getNodes()
Returns the list of nodes in this way.int
getNodesCount()
Replies the number of nodes in this way.default int
getRealNodesCount()
Replies the real number of nodes in this way (full number of nodes minus one if this way is closed)default boolean
hasIncompleteNodes()
Replies true if this way has incomplete nodes, false otherwise.boolean
isClosed()
Determines if this way is closed.default boolean
isEmpty()
Determines if this way is empty, i.e.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.N
lastNode()
Returns the last node of this way.void
setNodes(java.util.List<N> nodes)
Set new list of nodes to way.-
Methods inherited from interface org.openstreetmap.josm.data.osm.IPrimitive
accept, getBBox, getChangesetId, getDataSet, getDisplayType, getId, getInstant, getInterestingTags, getLocalName, getName, getOsmId, getOsmPrimitiveId, getPrimitiveId, getRawTimestamp, getReferrers, getReferrers, getStyleCacheSyncObject, getTimestamp, 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, setTimestamp, setUser, setVisible, visitReferrers
-
Methods inherited from interface org.openstreetmap.josm.data.osm.PrimitiveId
getType, 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
-
-
-
-
Method Detail
-
getNodesCount
int getNodesCount()
Replies the number of nodes in this way.- Returns:
- the number of nodes in this way.
-
isEmpty
default boolean isEmpty()
Determines if this way is empty, i.e. it has no nodes.- Returns:
true
if this way is empty, i.e. it has no nodes- Since:
- 16119
-
getRealNodesCount
default int getRealNodesCount()
Replies the real number of nodes in this way (full number of nodes minus one if this way is closed)- Returns:
- the real number of nodes in this way.
- Since:
- 5847, 13564 (IWay)
- See Also:
getNodesCount()
,isClosed()
-
getNode
N getNode(int index)
Replies the node at positionindex
.- Parameters:
index
- the position- Returns:
- the node at position
index
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- ifindex
< 0 orindex
>=getNodesCount()
- Since:
- 1862, 13717 (IWay)
-
getNodes
java.util.List<N> getNodes()
Returns the list of nodes in this way.- Returns:
- the list of nodes in this way
- Since:
- 1862, 13717 (IWay)
-
getChildren
default java.util.List<N> getChildren()
Description copied from interface:IPrimitive
Get child primitives that are referred by this primitive.Relation
: Members of the relationWay
: Nodes used by the wayNode
: None- Specified by:
getChildren
in interfaceIPrimitive
- Returns:
- List of child primitives
-
getNodeIds
java.util.List<java.lang.Long> getNodeIds()
Returns the list of node ids in this way.- Returns:
- the list of node ids in this way
- Since:
- 13717
-
getNodeId
long getNodeId(int idx)
Returns id of the node at given index.- Parameters:
idx
- node index- Returns:
- id of the node at given index
-
setNodes
void setNodes(java.util.List<N> nodes)
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.- Parameters:
nodes
- New way nodes. Can be null, in that case all way nodes are removed
-
isClosed
boolean isClosed()
Determines if this way is closed.- Returns:
true
if this way is closed,false
otherwise
-
compareTo
default int compareTo(IPrimitive o)
-
getDisplayName
default java.lang.String getDisplayName(NameFormatter formatter)
Description copied from interface:IPrimitive
Replies the display name of a primitive formatted byformatter
- Specified by:
getDisplayName
in interfaceIPrimitive
- Parameters:
formatter
- formatter to use- Returns:
- the display name
-
firstNode
N firstNode()
Returns the first node of this way. The result equalsgetNode
(0)
.- Returns:
- the first node of this way
- Since:
- 13922
-
lastNode
N lastNode()
Returns the last node of this way. The result equals
.getNode
(getNodesCount
- 1)- Returns:
- the last node of this way
- Since:
- 13922
-
isFirstLastNode
boolean isFirstLastNode(INode n)
Replies true if the given node is the first or the last one of this way, false otherwise.- Parameters:
n
- The node to test- Returns:
- true if the
n
is the first or the last node, false otherwise. - Since:
- 13922
-
isInnerNode
boolean isInnerNode(INode n)
Replies true if the given node is an inner node of this way, false otherwise.- Parameters:
n
- The node to test- Returns:
- true if the
n
is an inner node, false otherwise. - Since:
- 13922
-
hasIncompleteNodes
default boolean hasIncompleteNodes()
Replies true if this way has incomplete nodes, false otherwise.- Returns:
- true if this way has incomplete nodes, false otherwise.
- Since:
- 18019
-
-