public final class Node extends OsmPrimitive implements INode
AbstractPrimitive.KeyValueVisitor
Modifier and Type | Field and Description |
---|---|
private double |
east |
private java.lang.Object |
eastNorthCacheKey
|
private double |
lat |
private double |
lon |
private double |
north |
directionKeys, FLAG_ANNOTATED, FLAG_DIRECTION_REVERSED, FLAG_DISABLED, FLAG_DISABLED_TYPE, FLAG_HAS_DIRECTIONS, FLAG_HIDDEN_TYPE, FLAG_HIDE_IF_DISABLED, FLAG_HIGHLIGHTED, FLAG_TAGGED, mappaintCacheIdx, mappaintStyle
changesetId, FLAG_DELETED, FLAG_INCOMPLETE, FLAG_MODIFIED, FLAG_VISIBLE, flags, id, keys, timestamp, user, version
Modifier | Constructor and Description |
---|---|
|
Node()
Constructs a new local
Node with id 0. |
|
Node(EastNorth eastNorth)
Constructs a new
Node with the given east/north with id 0. |
|
Node(LatLon latlon)
Constructs a new
Node with the given lat/lon with id 0. |
|
Node(long id)
Constructs an incomplete
Node object with the given id. |
protected |
Node(long id,
boolean allowNegative) |
|
Node(long id,
int version)
Constructs a new
Node with the given id and version. |
|
Node(Node clone)
Constructs an identical clone of the argument (including the id).
|
|
Node(Node clone,
boolean clearMetadata)
Constructs an identical clone of the argument.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(PrimitiveVisitor visitor)
Makes the given visitor visit this primitive.
|
void |
accept(Visitor visitor)
Implementation of the visitor scheme.
|
void |
cloneFrom(OsmPrimitive osm)
Get and write all attributes from the parameter.
|
int |
compareTo(OsmPrimitive o) |
boolean |
concernsArea()
Determines if this primitive semantically concerns an area.
|
BBox |
getBBox()
Fetch the bounding box of the primitive
|
LatLon |
getCoor()
Returns lat/lon coordinates of this node, or
null unless isLatLonKnown() |
java.lang.String |
getDisplayName(NameFormatter formatter)
Replies the display name of a primitive formatted by
formatter |
EastNorth |
getEastNorth()
Replies the projected east/north coordinates.
|
EastNorth |
getEastNorth(Projection projection)
Replies the projected east/north coordinates.
|
OsmPrimitiveType |
getType()
Gets the type of object represented by this object.
|
boolean |
hasEqualSemanticAttributes(OsmPrimitive other,
boolean testInterestingTagsOnly) |
void |
invalidateEastNorthCache()
Invoke to invalidate the internal cache of projected east/north coordinates.
|
boolean |
isConnectedTo(java.util.Collection<Node> otherNodes,
int hops,
java.util.function.Predicate<Node> predicate)
Tests whether
this node is connected to otherNode via at most hops nodes
matching the predicate (which may be null to consider all nodes). |
private boolean |
isConnectedTo(java.util.Collection<Node> otherNodes,
int hops,
java.util.function.Predicate<Node> predicate,
java.util.Set<Node> visited) |
boolean |
isConnectionNode()
Check whether this node connects 2 ways.
|
boolean |
isDrawable()
Determines if this object is drawable.
|
boolean |
isLatLonKnown()
Determines if this node has valid coordinates.
|
boolean |
isOutsideDownloadArea()
Tests if this primitive lies outside of the downloaded area of its
DataSet . |
void |
load(PrimitiveData data)
Loads (clone) this primitive from provided PrimitiveData
|
void |
mergeFrom(OsmPrimitive other)
Merges the technical and semantical attributes from
other onto this. |
NodeData |
save()
Save parameters of this primitive to the transport object
|
void |
setCoor(LatLon coor)
Sets lat/lon coordinates of this node.
|
(package private) void |
setCoorInternal(LatLon coor,
EastNorth eastNorth)
To be used only by Dataset.reindexNode
|
(package private) void |
setDataset(DataSet dataSet)
This method should never ever by called from somewhere else than Dataset.addPrimitive or removePrimitive methods
|
void |
setEastNorth(EastNorth eastNorth)
Sets east/north coordinates of this node.
|
java.lang.String |
toString() |
private void |
updateCoor(LatLon coor,
EastNorth eastNorth) |
void |
updatePosition()
Called by Dataset to update cached position information of primitive (bbox, cached EarthNorth, ...)
|
addReferrer, checkDataset, clearCachedStyle, clearOsmMetadata, equals, evaluateCondition, getDataSet, getDisabledType, getDiscardableKeys, getFilteredList, getFilteredSet, getFlagsAsString, getHiddenType, getInterestingTags, getParentRelations, getReferrer, getReferrers, getReferrers, getTemplateKeys, getTemplateValue, getUninterestingKeys, getWorkInProgressKeys, hasAreaTags, hasDirectionKeys, hasEqualSemanticAttributes, hasEqualTechnicalAttributes, hashCode, hasSameInterestingTags, isAnnotated, isDisabled, isDisabledAndHidden, isHighlighted, isMemberOfSelected, isMultipolygon, isOuterMemberOfSelected, isReferredByWays, isSelectable, isSelected, isTagged, isUninterestingKey, keysChangedImpl, put, remove, removeAll, removeReferrer, reversedDirection, saveCommonAttributes, setChangesetId, setDeleted, setDisabledState, setDisabledType, setHiddenType, setHighlighted, setIncomplete, setKeys, setKeys, setModified, setOsmId, setTimestamp, setUser, setVisible, unsetDisabledState, updateFlags, visitReferrers, writeLock, writeUnlock
cloneFrom, generateUniqueId, get, getChangesetId, getDisplayType, getId, getIgnoreCase, getKeys, getLocalName, getName, getNumKeys, getPrimitiveId, getRawTimestamp, getTimestamp, getUniqueId, getUser, getVersion, hasKey, hasKeys, hasTag, hasTag, hasTag, isDeleted, isIncomplete, isKeyFalse, isKeyTrue, isModified, isNew, isNewOrUndeleted, isTimestampEmpty, isUndeleted, isUsable, isVisible, keySet, setRawTimestamp, visitKeys
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getChangesetId, getId, getLocalName, getName, getPrimitiveId, getRawTimestamp, getTimestamp, getUser, getVersion, isDeleted, isIncomplete, isModified, isNewOrUndeleted, isTimestampEmpty, isUndeleted, isUsable, isVisible, setChangesetId, setDeleted, setModified, setOsmId, setRawTimestamp, setTimestamp, setUser, setVisible
get, getKeys, hasKeys, keySet, put, put, remove, removeAll, setKeys
getUniqueId, isNew
private double lat
private double lon
private double east
private double north
private java.lang.Object eastNorthCacheKey
protected Node(long id, boolean allowNegative)
public Node()
Node
with id 0.public Node(long id)
Node
object with the given id.id
- The id. Must be >= 0java.lang.IllegalArgumentException
- if id < 0public Node(long id, int version)
Node
with the given id and version.id
- The id. Must be >= 0version
- The versionjava.lang.IllegalArgumentException
- if id < 0public Node(Node clone, boolean clearMetadata)
clone
- The node to cloneclearMetadata
- If true
, clears the OSM id and other metadata as defined by OsmPrimitive.clearOsmMetadata()
.
If false
, does nothingpublic Node(Node clone)
clone
- The node to clone, including its idpublic Node(LatLon latlon)
Node
with the given lat/lon with id 0.latlon
- The LatLon
coordinatespublic boolean isLatLonKnown()
true
if this node has valid coordinatespublic void setCoor(LatLon coor)
INode
public void setEastNorth(EastNorth eastNorth)
INode
setEastNorth
in interface INode
eastNorth
- east/north coordinates of this nodeprivate void updateCoor(LatLon coor, EastNorth eastNorth)
public LatLon getCoor()
null
unless isLatLonKnown()
getCoor
in interface INode
null
unless isLatLonKnown()
public EastNorth getEastNorth()
Replies the projected east/north coordinates.
Uses the global projection
to project the lan/lon-coordinates.
Internally caches the projected coordinates.
Replies null
if this node doesn't know lat/lon-coordinates, i.e. because it is an incomplete node.
getEastNorth
in interface INode
null
invalidateEastNorthCache()
public EastNorth getEastNorth(Projection projection)
The result of the last conversion is cached. The cache object is used as cache key.
projection
- The projection to use.void setCoorInternal(LatLon coor, EastNorth eastNorth)
coor
- lat/loneastNorth
- east/northvoid setDataset(DataSet dataSet)
OsmPrimitive
setDataset
in class OsmPrimitive
dataSet
- the parent datasetpublic void accept(Visitor visitor)
OsmPrimitive
accept
in class OsmPrimitive
visitor
- The visitor from which the visit() function must be called.public void accept(PrimitiveVisitor visitor)
IPrimitive
accept
in interface IPrimitive
visitor
- visitorpublic void cloneFrom(OsmPrimitive osm)
OsmPrimitive
cloneFrom
in class OsmPrimitive
osm
- other primitivepublic void mergeFrom(OsmPrimitive other)
other
onto this.
Both this and other must be new, or both must be assigned an OSM ID. If both this and other
have an assigend OSM id, the IDs have to be the same.mergeFrom
in class OsmPrimitive
other
- the other primitive. Must not be null.java.lang.IllegalArgumentException
- if other is null.DataIntegrityProblemException
- if either this is new and other is not, or other is new and this is notDataIntegrityProblemException
- if other is new and other.getId() != this.getId()public void load(PrimitiveData data)
OsmPrimitive
load
in class OsmPrimitive
data
- The object which should be clonedpublic NodeData save()
OsmPrimitive
save
in class OsmPrimitive
public java.lang.String toString()
toString
in class java.lang.Object
public boolean hasEqualSemanticAttributes(OsmPrimitive other, boolean testInterestingTagsOnly)
hasEqualSemanticAttributes
in class OsmPrimitive
public int compareTo(OsmPrimitive o)
compareTo
in interface java.lang.Comparable<OsmPrimitive>
public java.lang.String getDisplayName(NameFormatter formatter)
OsmPrimitive
formatter
getDisplayName
in class OsmPrimitive
formatter
- formatter to usepublic OsmPrimitiveType getType()
PrimitiveId
getType
in interface PrimitiveId
Node
,
Way
,
Relation
public BBox getBBox()
OsmPrimitive
getBBox
in class OsmPrimitive
public void updatePosition()
OsmPrimitive
updatePosition
in class OsmPrimitive
public boolean isDrawable()
OsmPrimitive
A primitive is complete if all conditions are met:
isDrawable
in class OsmPrimitive
true
if this object is drawablepublic boolean isConnectionNode()
OsmPrimitive.isReferredByWays(int)
public void invalidateEastNorthCache()
getEastNorth()
is invoked
next time.public boolean concernsArea()
OsmPrimitive
concernsArea
in class OsmPrimitive
true
if this primitive semantically concerns an area, according to its type, geometry and tags, false
otherwise.public boolean isConnectedTo(java.util.Collection<Node> otherNodes, int hops, java.util.function.Predicate<Node> predicate)
this
node is connected to otherNode
via at most hops
nodes
matching the predicate
(which may be null
to consider all nodes).otherNodes
- other nodeshops
- number of hopspredicate
- predicate to matchtrue
if this
node mets the conditionsprivate boolean isConnectedTo(java.util.Collection<Node> otherNodes, int hops, java.util.function.Predicate<Node> predicate, java.util.Set<Node> visited)
public boolean isOutsideDownloadArea()
OsmPrimitive
DataSet
.isOutsideDownloadArea
in class OsmPrimitive
true
if this primitive lies outside of the downloaded area