Package org.openstreetmap.josm.data.osm
Interface IWay<N extends INode>
- Type Parameters:
N- type of OSM node
- All Superinterfaces:
Comparable<IPrimitive>,IPrimitive,IQuadBucketType,PrimitiveId,Stylable,Tagged
- Since:
- 4098
-
Field Summary
Fields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH -
Method Summary
Modifier and TypeMethodDescriptiondefault intReturns the first node of this way.Get child primitives that are referred by this primitive.default StringgetDisplayName(NameFormatter formatter) Replies the display name of a primitive formatted byformattergetNode(int index) Replies the node at positionindex.longgetNodeId(int idx) Returns id of the node at given index.Returns the list of node ids in this way.getNodes()Returns the list of nodes in this way.intReplies the number of nodes in this way.default intReplies the real number of nodes in this way (full number of nodes minus one if this way is closed)default booleanReplies true if this way has incomplete nodes, false otherwise.booleanisClosed()Determines if this way is closed.default booleanisEmpty()Determines if this way is empty, i.e.booleanReplies true if the given node is the first or the last one of this way, false otherwise.booleanisInnerNode(INode n) Replies true if the given node is an inner node of this way, false otherwise.lastNode()Returns the last node of this way.voidSet 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, 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, visitReferrersMethods inherited from interface org.openstreetmap.josm.data.osm.PrimitiveId
getType, getUniqueId, isNewMethods inherited from interface org.openstreetmap.josm.data.osm.Stylable
clearCachedStyle, declareCachedStyleUpToDate, getCachedStyle, isCachedStyleUpToDate, setCachedStyleMethods 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 Details
-
getNodesCount
int getNodesCount()Replies the number of nodes in this way.- Returns:
- the number of nodes in this way.
-
isEmpty
Determines if this way is empty, i.e. it has no nodes.- Returns:
trueif this way is empty, i.e. it has no nodes- Since:
- 16119
-
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:
-
getNode
Replies the node at positionindex.- Parameters:
index- the position- Returns:
- the node at position
index - Throws:
ArrayIndexOutOfBoundsException- ifindex< 0 orindex>=getNodesCount()- Since:
- 1862, 13717 (IWay)
-
getNodes
Returns the list of nodes in this way.- Returns:
- the list of nodes in this way
- Since:
- 1862, 13717 (IWay)
-
getChildren
Description copied from interface:IPrimitiveGet child primitives that are referred by this primitive.Relation: Members of the relationWay: Nodes used by the wayNode: None- Specified by:
getChildrenin interfaceIPrimitive- Returns:
- List of child primitives
-
getNodeIds
List<Long> getNodeIds()Returns the list of node ids in this way.- Returns:
- the list of node ids in this way
- Since:
- 13717
-
getNodeId
Returns id of the node at given index.- Parameters:
idx- node index- Returns:
- id of the node at given index
-
setNodes
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:
trueif this way is closed,falseotherwise
-
compareTo
- Specified by:
compareToin interfaceComparable<N extends INode>
-
getDisplayName
Description copied from interface:IPrimitiveReplies the display name of a primitive formatted byformatter- Specified by:
getDisplayNamein interfaceIPrimitive- Parameters:
formatter- formatter to use- Returns:
- the display name
-
firstNode
Returns the first node of this way. The result equalsgetNode(0).- Returns:
- the first node of this way
- Since:
- 13922
-
lastNode
Returns the last node of this way. The result equals.getNode(getNodesCount- 1)- Returns:
- the last node of this way
- Since:
- 13922
-
isFirstLastNode
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
nis the first or the last node, false otherwise. - Since:
- 13922
-
isInnerNode
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
nis an inner node, false otherwise. - Since:
- 13922
-
hasIncompleteNodes
Replies true if this way has incomplete nodes, false otherwise.- Returns:
- true if this way has incomplete nodes, false otherwise.
- Since:
- 18019
-