public final class Node extends OsmPrimitive implements INode
Modifier and Type | Field and Description |
---|---|
private double |
east |
private java.lang.Object |
eastNorthCacheKey
|
private double |
lat |
private double |
lon |
private double |
north |
directionKeys
changesetId, 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, timestamp, user, version
MAX_TAG_LENGTH
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(OsmPrimitiveVisitor visitor)
Implementation of the visitor scheme.
|
void |
accept(PrimitiveVisitor visitor)
Makes the given visitor visit this primitive.
|
protected void |
addToBBox(BBox box,
java.util.Set<PrimitiveId> visited)
If necessary, extend the bbox to contain this primitive
|
void |
cloneFrom(OsmPrimitive osm)
Get and write all attributes from the parameter.
|
boolean |
concernsArea()
Determines if this primitive semantically concerns an area.
|
BBox |
getBBox()
Fetches the bounding box of the primitive.
|
LatLon |
getCoor()
Returns lat/lon coordinates of this node, or
null unless ILatLon.isLatLonKnown() |
EastNorth |
getEastNorth(Projecting projection)
Replies the projected east/north coordinates.
|
java.util.List<Way> |
getParentWays()
Replies the set of referring ways.
|
OsmPrimitiveType |
getType()
Gets the type of object represented by this object.
|
private boolean |
hasEqualCoordinates(Node other) |
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 |
isDrawable()
Determines if this object is drawable.
|
boolean |
isOutsideDownloadArea()
Tests if this primitive lies outside of the downloaded area of its
DataSet . |
boolean |
isReferredByWays(int n)
Return true, if this primitive is referred by at least n ways
|
double |
lat()
Returns the latitude, i.e., the north-south position in degrees.
|
void |
load(PrimitiveData data)
Loads (clone) this primitive from provided PrimitiveData
|
double |
lon()
Returns the longitude, i.e., the east-west position in degrees.
|
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, checkDatasetNotReadOnly, clearOsmMetadata, declareCachedStyleUpToDate, equals, evaluateCondition, getCachedStyle, getDataSet, getDisabledType, getFilteredList, getFilteredSet, getFlagsAsString, getHiddenType, getParentRelations, getReferrer, getReferrers, getReferrers, getTemplateKeys, getTemplateValue, hasAreaTags, hasDirectionKeys, hasEqualSemanticAttributes, hasEqualSemanticFlags, hasEqualTechnicalAttributes, hashCode, isAnnotated, isCachedStyleUpToDate, isDisabled, isDisabledAndHidden, isHighlighted, isMemberOfSelected, isNodeReferredByWays, isOuterMemberOfSelected, isPreserved, isSelectable, isSelected, isTagged, keysChangedImpl, put, referrers, remove, removeAll, removeReferrer, reversedDirection, saveCommonAttributes, setCachedStyle, setChangesetId, setDeleted, setDisabledState, setDisabledType, setHiddenType, setHighlighted, setIncomplete, setKeys, setKeys, setModified, setOsmId, setPreserved, setTimestamp, setUser, setVisible, unsetDisabledState, updateFlags, visitReferrers, visitReferrers, writeLock, writeUnlock
advanceUniqueId, cloneFrom, currentUniqueId, generateUniqueId, get, getChangesetId, getDiscardableKeys, getId, getIgnoreCase, getInterestingTags, getKeys, getNumKeys, getRawTimestamp, getTimestamp, getUninterestingKeys, getUniqueId, getUser, getVersion, getWorkInProgressKeys, hasKey, hasKey, hasKeys, isDeleted, isIncomplete, isModified, isNew, isNewOrUndeleted, isTimestampEmpty, isUndeleted, isUninterestingKey, isUsable, isVisible, keySet, setRawTimestamp, visitKeys
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
compareTo, getDisplayName, getEastNorth, isConnectionNode
getChangesetId, getDataSet, getDisplayType, getId, getInterestingTags, getLocalName, getName, getOsmId, getOsmPrimitiveId, getPrimitiveId, getRawTimestamp, getReferrers, getReferrers, getTimestamp, getUser, getVersion, hasDirectionKeys, hasSameInterestingTags, isAnnotated, isDeleted, isDisabled, isDisabledAndHidden, isHighlighted, isIncomplete, isMemberOfSelected, isModified, isMultipolygon, isNewOrUndeleted, isOuterMemberOfSelected, isPreserved, isSelectable, isSelected, isTagged, isTimestampEmpty, isUndeleted, isUsable, isVisible, reversedDirection, setChangesetId, setDeleted, setHighlighted, setModified, setOsmId, setRawTimestamp, setTimestamp, setUser, setVisible, visitReferrers
get, getKeys, getNumKeys, hasKey, hasKeys, hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, keySet, put, put, remove, removeAll, setKeys, visitKeys
getUniqueId, isNew
clearCachedStyle, declareCachedStyleUpToDate, getCachedStyle, isCachedStyleUpToDate, setCachedStyle
isLatLonKnown
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 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 ILatLon.isLatLonKnown()
getCoor
in interface INode
null
unless ILatLon.isLatLonKnown()
public double lat()
ILatLon
lat
in interface ILatLon
ILatLon.isLatLonKnown()
returns falsepublic double lon()
ILatLon
lon
in interface ILatLon
ILatLon.isLatLonKnown()
returns falsepublic EastNorth getEastNorth(Projecting projection)
ILatLon
The result of the last conversion may be cached. Null is returned in case this object is invalid.
getEastNorth
in interface ILatLon
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(OsmPrimitiveVisitor 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
private boolean hasEqualCoordinates(Node other)
public OsmPrimitiveType getType()
PrimitiveId
getType
in interface PrimitiveId
Node
,
Way
,
Relation
public BBox getBBox()
IPrimitive
getBBox
in interface IPrimitive
protected void addToBBox(BBox box, java.util.Set<PrimitiveId> visited)
OsmPrimitive
addToBBox
in class OsmPrimitive
box
- a bbox instancevisited
- a set of visited members or nullpublic void updatePosition()
OsmPrimitive
updatePosition
in class OsmPrimitive
public boolean isDrawable()
IPrimitive
A primitive is complete if all conditions are met:
isDrawable
in interface IPrimitive
isDrawable
in class OsmPrimitive
true
if this object is drawablepublic boolean isReferredByWays(int n)
INode
isReferredByWays
in interface INode
n
- Minimal number of ways to return true. Must be positivetrue
if this primitive is referred by at least n wayspublic void invalidateEastNorthCache()
INode.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 areapublic java.util.List<Way> getParentWays()