Package org.openstreetmap.josm.data.osm
Class Node
java.lang.Object
org.openstreetmap.josm.data.osm.AbstractPrimitive
org.openstreetmap.josm.data.osm.OsmPrimitive
org.openstreetmap.josm.data.osm.Node
- All Implemented Interfaces:
Comparable<IPrimitive>,ILatLon,IQuadBucketType,IFilterablePrimitive,INode,IPrimitive,PrimitiveId,Stylable,Tagged,TemplateEngineDataProvider
One node data, consisting of one world coordinate waypoint.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleprivate Object(package private) static final UniqueIdGeneratorprivate doubleprivate doubleprivate doubleFields inherited from class org.openstreetmap.josm.data.osm.OsmPrimitive
directionKeysFields inherited from class org.openstreetmap.josm.data.osm.AbstractPrimitive
changesetId, FLAG_ALL_REFERRERS_DOWNLOADED, 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, mappaintCacheIdx, timestamp, user, versionFields inherited from interface org.openstreetmap.josm.data.coor.ILatLon
MAX_SERVER_PRECISIONFields inherited from interface org.openstreetmap.josm.data.osm.Tagged
MAX_TAG_LENGTH -
Constructor Summary
ConstructorsConstructorDescriptionNode()Constructs a new localNodewith id 0.Node(long id) Constructs an incompleteNodeobject with the given id.Node(long id, boolean allowNegative) Node(long id, int version) Constructs a newNodewith the given id and version.Constructs a newNodewith the given east/north with id 0.Constructs a newNodewith the given lat/lon with id 0.Constructs an identical clone of the argument (including the id).Constructs an identical clone of the argument. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(OsmPrimitiveVisitor visitor) Implementation of the visitor scheme.voidaccept(PrimitiveVisitor visitor) Makes the given visitor visit this primitive.protected voidaddToBBox(BBox box, Set<PrimitiveId> visited) If necessary, extend the bbox to contain this primitivevoidcloneFrom(OsmPrimitive osm, boolean copyChildren) Get and write all attributes from the parameter.booleanDetermines if this primitive semantically concerns an area.getBBox()Fetches the bounding box of the primitive.getCoor()Returns lat/lon coordinates of this node, ornullunlessILatLon.isLatLonKnown()getEastNorth(Projecting projection) Replies the projected east/north coordinates.Returns the unique identifier generator.Replies the list of referring ways.getType()Gets the type of object represented by this object.private booleanhasEqualCoordinates(Node other) booleanhasEqualSemanticAttributes(OsmPrimitive other, boolean testInterestingTagsOnly) voidInvoke to invalidate the internal cache of projected east/north coordinates.booleanDetermines if this object is drawable.booleanTests if this primitive lies outside of the downloaded area of itsDataSet.booleanDetermines if this node is outside of the world.booleanisReferredByWays(int n) Return true, if this primitive is referred by at least n waysdoublelat()Returns the latitude, i.e., the north-south position in degrees.voidload(PrimitiveData data) Loads (clone) this primitive from provided PrimitiveDatadoublelon()Returns the longitude, i.e., the east-west position in degrees.voidmergeFrom(OsmPrimitive other) Merges the technical and semantical attributes fromotheronto this.save()Save parameters of this primitive to the transport objectvoidSets lat/lon coordinates of this node.(package private) voidsetCoorInternal(LatLon coor, EastNorth eastNorth) To be used only by Dataset.reindexNode(package private) voidsetDataset(DataSet dataSet) This method should never ever by called from somewhere else than Dataset.addPrimitive or removePrimitive methodsvoidsetEastNorth(EastNorth eastNorth) Sets east/north coordinates of this node.toString()private voidupdateCoor(LatLon coor, EastNorth eastNorth) protected voidvoidCalled by Dataset to update cached position information of primitive (bbox, cached EarthNorth, ...)Methods inherited from class org.openstreetmap.josm.data.osm.OsmPrimitive
addReferrer, checkDataset, checkDatasetNotReadOnly, clearCachedStyle, clearOsmMetadata, cloneFrom, declareCachedStyleUpToDate, equals, evaluateCondition, getCachedStyle, getDataSet, getFlagsAsString, getParentRelations, getReferrer, getReferrers, getReferrers, getTemplateKeys, getTemplateValue, hasAreaTags, hasEqualSemanticAttributes, hasEqualSemanticFlags, hasEqualTechnicalAttributes, hashCode, isCachedStyleUpToDate, isMemberOfSelected, isNodeReferredByWays, isOuterMemberOfSelected, isSelectable, isSelected, keysChangedImpl, put, referrers, remove, removeAll, removeReferrer, saveCommonAttributes, setCachedStyle, setChangesetId, setDeleted, setDisabledState, setHighlighted, setIncomplete, setKeys, setKeys, setModified, setOsmId, setPreserved, setUser, setVisible, unsetDisabledState, updateFlags, visitReferrers, visitReferrers, writeLock, writeUnlockMethods inherited from class org.openstreetmap.josm.data.osm.AbstractPrimitive
cloneFrom, doGet, get, getChangesetId, getDisabledType, getDiscardableKeys, getHiddenType, getId, getIgnoreCase, getInstant, getInterestingTags, getKeys, getNumKeys, getRawTimestamp, getUninterestingKeys, getUniqueId, getUser, getVersion, getWorkInProgressKeys, hasDirectionKeys, hasKey, hasKey, hasKeys, isAnnotated, isDeleted, isDisabled, isDisabledAndHidden, isHighlighted, isIncomplete, isModified, isNew, isNewOrUndeleted, isPreserved, isReferrersDownloaded, isTagged, isTimestampEmpty, isUndeleted, isUninterestingKey, isUsable, isVisible, keys, keySet, putAll, reversedDirection, setDisabledType, setHiddenType, setInstant, setRawTimestamp, setReferrersDownloaded, updateFlagsChanged, visitKeysMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openstreetmap.josm.data.coor.ILatLon
bearing, distanceSq, distanceSq, equalsEpsilon, equalsEpsilon, greatCircleDistance, interpolate, isLatLonKnownMethods inherited from interface org.openstreetmap.josm.data.osm.INode
compareTo, getDisplayName, getEastNorth, isConnectionNodeMethods inherited from interface org.openstreetmap.josm.data.osm.IPrimitive
getChangesetId, getChildren, getDataSet, getDisplayType, getId, getInstant, getInterestingTags, getLocalName, getName, getOsmId, getOsmPrimitiveId, getPrimitiveId, getRawTimestamp, getReferrers, getReferrers, getStyleCacheSyncObject, getUser, getVersion, hasDirectionKeys, hasSameInterestingTags, isAnnotated, isDeleted, isDisabled, isDisabledAndHidden, 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
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
-
Field Details
-
idGenerator
-
lat
-
lon
-
east
-
north
-
eastNorthCacheKey
-
-
Constructor Details
-
Node
Node(long id, boolean allowNegative) -
Node
public Node()Constructs a new localNodewith id 0. -
Node
Constructs an incompleteNodeobject with the given id.- Parameters:
id- The id. Must be >= 0- Throws:
IllegalArgumentException- if id < 0
-
Node
Constructs a newNodewith the given id and version.- Parameters:
id- The id. Must be >= 0version- The version- Throws:
IllegalArgumentException- if id < 0
-
Node
Constructs an identical clone of the argument.- Parameters:
clone- The node to cloneclearMetadata- Iftrue, clears the OSM id and other metadata as defined byOsmPrimitive.clearOsmMetadata(). Iffalse, does nothing
-
Node
Constructs an identical clone of the argument (including the id).- Parameters:
clone- The node to clone, including its id
-
Node
Constructs a newNodewith the given lat/lon with id 0.- Parameters:
latlon- TheLatLoncoordinates
-
Node
Constructs a newNodewith the given east/north with id 0.- Parameters:
eastNorth- TheEastNorthcoordinates
-
-
Method Details
-
setCoor
Description copied from interface:INodeSets lat/lon coordinates of this node. -
setEastNorth
Description copied from interface:INodeSets east/north coordinates of this node.- Specified by:
setEastNorthin interfaceINode- Parameters:
eastNorth- east/north coordinates of this node
-
updateCoor
-
getCoor
Returns lat/lon coordinates of this node, ornullunlessILatLon.isLatLonKnown()- Specified by:
getCoorin interfaceINode- Returns:
- lat/lon coordinates of this node, or
nullunlessILatLon.isLatLonKnown()
-
lat
Description copied from interface:ILatLonReturns the latitude, i.e., the north-south position in degrees.- Specified by:
latin interfaceILatLon- Returns:
- the latitude or NaN if
ILatLon.isLatLonKnown()returns false
-
lon
Description copied from interface:ILatLonReturns the longitude, i.e., the east-west position in degrees.- Specified by:
lonin interfaceILatLon- Returns:
- the longitude or NaN if
ILatLon.isLatLonKnown()returns false
-
getEastNorth
Description copied from interface:ILatLonReplies the projected east/north coordinates.The result of the last conversion may be cached. Null is returned in case this object is invalid.
- Specified by:
getEastNorthin interfaceILatLon- Parameters:
projection- The projection to use.- Returns:
- The projected east/north coordinates
-
setCoorInternal
To be used only by Dataset.reindexNode- Parameters:
coor- lat/loneastNorth- east/north
-
setDataset
Description copied from class:OsmPrimitiveThis method should never ever by called from somewhere else than Dataset.addPrimitive or removePrimitive methods- Overrides:
setDatasetin classOsmPrimitive- Parameters:
dataSet- the parent dataset
-
accept
Description copied from class:OsmPrimitiveImplementation of the visitor scheme. Subclasses have to call the correct visitor function.- Specified by:
acceptin classOsmPrimitive- Parameters:
visitor- The visitor from which the visit() function must be called.
-
accept
Description copied from interface:IPrimitiveMakes the given visitor visit this primitive.- Specified by:
acceptin interfaceIPrimitive- Parameters:
visitor- visitor
-
cloneFrom
Description copied from class:OsmPrimitiveGet and write all attributes from the parameter. Does not fire any listener, so use this only in the data initializing phase- Overrides:
cloneFromin classOsmPrimitive- Parameters:
osm- other primitivecopyChildren- whether to copy child primitives too
-
mergeFrom
Merges the technical and semantical attributes fromotheronto this. Both this and other must be new, or both must be assigned an OSM ID. If both this andotherhave an assigend OSM id, the IDs have to be the same.- Overrides:
mergeFromin classOsmPrimitive- Parameters:
other- the other primitive. Must not be null.- Throws:
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()
-
load
Description copied from class:OsmPrimitiveLoads (clone) this primitive from provided PrimitiveData- Overrides:
loadin classOsmPrimitive- Parameters:
data- The object which should be cloned
-
save
Description copied from class:OsmPrimitiveSave parameters of this primitive to the transport object- Specified by:
savein classOsmPrimitive- Returns:
- The saved object data
-
toString
-
hasEqualSemanticAttributes
- Overrides:
hasEqualSemanticAttributesin classOsmPrimitive
-
hasEqualCoordinates
-
getType
Description copied from interface:PrimitiveIdGets the type of object represented by this object. Note that this should return the base primitive type (OsmPrimitiveType.NODE,OsmPrimitiveType.WAY, andOsmPrimitiveType.RELATION).- Specified by:
getTypein interfacePrimitiveId- Returns:
- the object type
- See Also:
-
getBBox
Description copied from interface:IPrimitiveFetches the bounding box of the primitive. Since 17752, the returned bounding box might be immutable, i.e., modifying calls throw anUnsupportedOperationException.- Specified by:
getBBoxin interfaceIPrimitive- Specified by:
getBBoxin interfaceIQuadBucketType- Returns:
- Bounding box of the object
-
addToBBox
Description copied from class:OsmPrimitiveIf necessary, extend the bbox to contain this primitive- Specified by:
addToBBoxin classOsmPrimitive- Parameters:
box- a bbox instancevisited- a set of visited members or null
-
updatePosition
Description copied from class:OsmPrimitiveCalled by Dataset to update cached position information of primitive (bbox, cached EarthNorth, ...)- Specified by:
updatePositionin classOsmPrimitive
-
isDrawable
Description copied from interface:IPrimitiveDetermines if this object is drawable.A primitive is drawable if all conditions are met:
- type and id is known
- tags are known
- it is not deleted
- it is not hidden by a filter
- for nodes: lat/lon are known
- for ways: all nodes are known and complete
- for relations: all members are known and complete
- Specified by:
isDrawablein interfaceIPrimitive- Overrides:
isDrawablein classAbstractPrimitive- Returns:
trueif this object is drawable
-
isReferredByWays
Description copied from interface:INodeReturn true, if this primitive is referred by at least n ways- Specified by:
isReferredByWaysin interfaceINode- Parameters:
n- Minimal number of ways to return true. Must be positive- Returns:
trueif this primitive is referred by at least n ways
-
invalidateEastNorthCache
Invoke to invalidate the internal cache of projected east/north coordinates. Coordinates are reprojected on demand when theINode.getEastNorth()is invoked next time. -
concernsArea
Description copied from class:OsmPrimitiveDetermines if this primitive semantically concerns an area.- Specified by:
concernsAreain classOsmPrimitive- Returns:
trueif this primitive semantically concerns an area, according to its type, geometry and tags,falseotherwise.
-
isOutsideDownloadArea
Description copied from class:OsmPrimitiveTests if this primitive lies outside of the downloaded area of itsDataSet.- Specified by:
isOutsideDownloadAreain classOsmPrimitive- Returns:
trueif this primitive lies outside of the downloaded area
-
getParentWays
Replies the list of referring ways.- Returns:
- the list of referring ways
- Since:
- 12031
-
isOutSideWorld
Determines if this node is outside of the world. See also #13538.- Returns:
true, if the coordinate is outside the world, compared by using lat/lon and east/north- Since:
- 14960
-
getIdGenerator
Description copied from class:AbstractPrimitiveReturns the unique identifier generator.- Specified by:
getIdGeneratorin classAbstractPrimitive- Returns:
- the unique identifier generator
-
updateDirectionFlags
- Overrides:
updateDirectionFlagsin classOsmPrimitive
-