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, mappaintStylechangesetId, 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_TAGGED, 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.
|
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.
|
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.
|
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 |
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, getMappaintCacheIdx, getParentRelations, getReferrer, getReferrers, getReferrers, getTemplateKeys, getTemplateValue, getUninterestingKeys, getWorkInProgressKeys, hasAreaTags, hasDirectionKeys, hasEqualSemanticAttributes, hasEqualSemanticFlags, 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, setMappaintCacheIdx, setModified, setOsmId, setTimestamp, setUser, setVisible, unsetDisabledState, updateFlags, visitReferrers, writeLock, writeUnlockcloneFrom, 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, visitKeysclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetChangesetId, getId, getLocalName, getName, getPrimitiveId, getRawTimestamp, getTimestamp, getUser, getVersion, isDeleted, isIncomplete, isModified, isNewOrUndeleted, isTimestampEmpty, isUndeleted, isUsable, isVisible, setChangesetId, setDeleted, setModified, setOsmId, setRawTimestamp, setTimestamp, setUser, setVisibleget, getKeys, hasKeys, keySet, put, put, remove, removeAll, setKeysgetUniqueId, isNewprivate 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)
INodepublic void setEastNorth(EastNorth eastNorth)
INodesetEastNorth in interface INodeeastNorth - east/north coordinates of this nodeprivate void updateCoor(LatLon coor, EastNorth eastNorth)
public LatLon getCoor()
null unless isLatLonKnown()getCoor in interface INodenull 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 INodenullinvalidateEastNorthCache()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)
OsmPrimitivesetDataset in class OsmPrimitivedataSet - the parent datasetpublic void accept(Visitor visitor)
OsmPrimitiveaccept in class OsmPrimitivevisitor - The visitor from which the visit() function must be called.public void accept(PrimitiveVisitor visitor)
IPrimitiveaccept in interface IPrimitivevisitor - visitorpublic void cloneFrom(OsmPrimitive osm)
OsmPrimitivecloneFrom in class OsmPrimitiveosm - 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 OsmPrimitiveother - 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)
OsmPrimitiveload in class OsmPrimitivedata - The object which should be clonedpublic NodeData save()
OsmPrimitivesave in class OsmPrimitivepublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean hasEqualSemanticAttributes(OsmPrimitive other, boolean testInterestingTagsOnly)
hasEqualSemanticAttributes in class OsmPrimitiveprivate boolean hasEqualCoordinates(Node other)
public int compareTo(OsmPrimitive o)
compareTo in interface java.lang.Comparable<OsmPrimitive>public java.lang.String getDisplayName(NameFormatter formatter)
OsmPrimitiveformattergetDisplayName in class OsmPrimitiveformatter - formatter to usepublic OsmPrimitiveType getType()
PrimitiveIdgetType in interface PrimitiveIdNode,
Way,
Relationpublic BBox getBBox()
OsmPrimitivegetBBox in class OsmPrimitiveprotected void addToBBox(BBox box, java.util.Set<PrimitiveId> visited)
OsmPrimitiveaddToBBox in class OsmPrimitivebox - a bbox instancevisited - a set of visited members or nullpublic void updatePosition()
OsmPrimitiveupdatePosition in class OsmPrimitivepublic boolean isDrawable()
OsmPrimitiveA primitive is complete if all conditions are met:
isDrawable in class OsmPrimitivetrue if this object is drawablepublic boolean isConnectionNode()
OsmPrimitive.isReferredByWays(int)public void invalidateEastNorthCache()
getEastNorth() is invoked
next time.public boolean concernsArea()
OsmPrimitiveconcernsArea in class OsmPrimitivetrue 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()
OsmPrimitiveDataSet.isOutsideDownloadArea in class OsmPrimitivetrue if this primitive lies outside of the downloaded area