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 |
directionKeyschangesetId, 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, versionMAX_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 |
isOutSideWorld()
Determines if this node is outside of the world.
|
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, 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, writeUnlockadvanceUniqueId, cloneFrom, currentUniqueId, doGet, 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, visitKeysclone, finalize, getClass, notify, notifyAll, wait, wait, waitcompareTo, getDisplayName, getEastNorth, isConnectionNodegetChangesetId, 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, visitReferrersget, getKeys, getNumKeys, hasKey, hasKeys, hasTag, hasTag, hasTag, hasTag, hasTagDifferent, hasTagDifferent, hasTagDifferent, isKeyFalse, isKeyTrue, keySet, put, put, remove, removeAll, setKeys, visitKeysgetUniqueId, isNewclearCachedStyle, declareCachedStyleUpToDate, getCachedStyle, isCachedStyleUpToDate, setCachedStyleisLatLonKnownprivate 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)
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 ILatLon.isLatLonKnown()getCoor in interface INodenull unless ILatLon.isLatLonKnown()public double lat()
ILatLonlat in interface ILatLonILatLon.isLatLonKnown() returns falsepublic double lon()
ILatLonlon in interface ILatLonILatLon.isLatLonKnown() returns falsepublic EastNorth getEastNorth(Projecting projection)
ILatLonThe result of the last conversion may be cached. Null is returned in case this object is invalid.
getEastNorth in interface ILatLonprojection - 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(OsmPrimitiveVisitor 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 OsmPrimitiveType getType()
PrimitiveIdgetType in interface PrimitiveIdNode,
Way,
Relationpublic BBox getBBox()
IPrimitivegetBBox in interface IPrimitiveprotected 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()
IPrimitiveA primitive is drawable if all conditions are met:
isDrawable in interface IPrimitiveisDrawable in class OsmPrimitivetrue if this object is drawablepublic boolean isReferredByWays(int n)
INodeisReferredByWays in interface INoden - 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()
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 areapublic java.util.List<Way> getParentWays()
public boolean isOutSideWorld()
true, if the coordinate is outside the world, compared by using lat/lon and east/north