org.openstreetmap.josm.data.osm
Class Node

java.lang.Object
  extended by org.openstreetmap.josm.data.osm.AbstractPrimitive
      extended by org.openstreetmap.josm.data.osm.OsmPrimitive
          extended by org.openstreetmap.josm.data.osm.Node
All Implemented Interfaces:
java.lang.Comparable<OsmPrimitive>, INode, IPrimitive, PrimitiveId, Tagged, TemplateEngineDataProvider

public final class Node
extends OsmPrimitive
implements INode

One node data, consisting of one world coordinate waypoint.


Field Summary
private  double east
           
private  double lat
           
private  double lon
           
private  double north
           
 
Fields inherited from class org.openstreetmap.josm.data.osm.OsmPrimitive
allPredicate, FLAG_DIRECTION_REVERSED, FLAG_DISABLED, FLAG_DISABLED_TYPE, FLAG_HAS_DIRECTIONS, FLAG_HIDDEN_TYPE, FLAG_HIDE_IF_DISABLED, FLAG_HIGHLIGHTED, FLAG_TAGGED, isSelectablePredicate, isUsablePredicate, mappaintCacheIdx, mappaintStyle, modifiedPredicate, multipolygonPredicate, nodePredicate, nonDeletedCompletePredicate, nonDeletedPhysicalPredicate, nonDeletedPredicate, relationPredicate, wayPredicate
 
Fields inherited from class org.openstreetmap.josm.data.osm.AbstractPrimitive
changesetId, FLAG_DELETED, FLAG_INCOMPLETE, FLAG_MODIFIED, FLAG_VISIBLE, flags, id, keys, timestamp, user, version
 
Constructor Summary
  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 clearId)
          Constructs an identical clone of the argument.
 
Method Summary
 void cloneFrom(OsmPrimitive osm)
          Get and write all attributes from the parameter.
 int compareTo(OsmPrimitive o)
           
 java.lang.String get3892DebugInfo()
          Deprecated. This method will be remove by the end of 2012 if no report appears.
 BBox getBBox()
           
 LatLon getCoor()
           
 java.lang.String getDisplayName(NameFormatter formatter)
          Replies the display name of a primitive formatted by formatter
 EastNorth getEastNorth()
          Replies the projected east/north coordinates.
 OsmPrimitiveType getType()
          Gets the type of object represented by this object.
 boolean hasEqualSemanticAttributes(OsmPrimitive other)
          Replies true if this primitive and other are equal with respect to their semantic attributes.
 void invalidateEastNorthCache()
          Invoke to invalidate the internal cache of projected east/north coordinates.
 boolean isConnectionNode()
          Check whether this node connects 2 ways.
 boolean isDrawable()
           
private  boolean isLatLonKnown()
           
 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)
           
protected  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)
           
 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, ...)
 void visit(PrimitiveVisitor visitor)
           
 void visit(Visitor visitor)
           
 
Methods inherited from class org.openstreetmap.josm.data.osm.OsmPrimitive
addReferrer, checkDataset, clearCachedStyle, clearOsmId, equals, evaluateCondition, getDataSet, getDisabledType, getFilteredList, getFilteredSet, getFlagsAsString, getHiddenType, getParentRelations, getReferrer, getReferrers, getReferrers, getTemplateKeys, getTemplateValue, getUninterestingKeys, hasDirectionKeys, hasEqualTechnicalAttributes, hashCode, isDisabled, isDisabledAndHidden, isHighlighted, isMemberOfSelected, isReferredByWays, isSelectable, isSelected, isTagged, isUninterestingKey, keysChangedImpl, put, remove, removeAll, removeReferrer, reversedDirection, saveCommonAttributes, setChangesetId, setDeleted, setDisabledState, setDisabledType, setHiddenType, setHighlighted, setIncomplete, setKeys, setOsmId, setTimestamp, setUser, setVisible, unsetDisabledState, updateFlags, visitReferrers, writeLock, writeUnlock
 
Methods inherited from class org.openstreetmap.josm.data.osm.AbstractPrimitive
cloneFrom, generateUniqueId, get, getChangesetId, getDisplayType, getId, getIgnoreCase, getKeys, getLocalName, getName, getPrimitiveId, getTimestamp, getUniqueId, getUser, getVersion, hasKey, hasKeys, hasSameTags, hasTag, hasTag, isDeleted, isIncomplete, isModified, isNew, isNewOrUndeleted, isTimestampEmpty, isUndeleted, isUsable, isVisible, keySet, setModified
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openstreetmap.josm.data.osm.IPrimitive
getChangesetId, getId, getLocalName, getName, getPrimitiveId, getTimestamp, getUser, getVersion, isDeleted, isIncomplete, isModified, isNewOrUndeleted, isTimestampEmpty, isVisible, setChangesetId, setDeleted, setModified, setOsmId, setTimestamp, setUser, setVisible
 
Methods inherited from interface org.openstreetmap.josm.data.osm.Tagged
get, getKeys, hasKeys, keySet, put, remove, removeAll, setKeys
 
Methods inherited from interface org.openstreetmap.josm.data.osm.PrimitiveId
getUniqueId, isNew
 

Field Detail

lat

private double lat

lon

private double lon

east

private double east

north

private double north
Constructor Detail

Node

protected Node(long id,
               boolean allowNegative)

Node

public Node()
Constructs a new local Node with id 0.


Node

public Node(long id)
     throws java.lang.IllegalArgumentException
Constructs an incomplete Node object with the given id.

Parameters:
id - The id. Must be >= 0
Throws:
java.lang.IllegalArgumentException - if id < 0

Node

public Node(long id,
            int version)
     throws java.lang.IllegalArgumentException
Constructs a new Node with the given id and version.

Parameters:
id - The id. Must be >= 0
version - The version
Throws:
java.lang.IllegalArgumentException - if id < 0

Node

public Node(Node clone,
            boolean clearId)
Constructs an identical clone of the argument.

Parameters:
clone - The node to clone
clearId - If true, set version to 0 and id to new unique value

Node

public Node(Node clone)
Constructs an identical clone of the argument (including the id).

Parameters:
clone - The node to clone, including its id

Node

public Node(LatLon latlon)
Constructs a new Node with the given lat/lon with id 0.

Parameters:
latlon - The LatLon coordinates

Node

public Node(EastNorth eastNorth)
Constructs a new Node with the given east/north with id 0.

Parameters:
eastNorth - The EastNorth coordinates
Method Detail

isLatLonKnown

private boolean isLatLonKnown()

setCoor

public final void setCoor(LatLon coor)
Specified by:
setCoor in interface INode

setEastNorth

public final void setEastNorth(EastNorth eastNorth)
Specified by:
setEastNorth in interface INode

updateCoor

private void updateCoor(LatLon coor,
                        EastNorth eastNorth)

getCoor

public final LatLon getCoor()
Specified by:
getCoor in interface INode

getEastNorth

public final EastNorth getEastNorth()

Replies the projected east/north coordinates.

Uses the global projection to project the lan/lon-coordinates. Internally caches the projected coordinates.

Caveat: doesn't listen to projection changes. Clients must invalidate the internal cache.

Replies null if this node doesn't know lat/lon-coordinates, i.e. because it is an incomplete node.

Specified by:
getEastNorth in interface INode
Returns:
the east north coordinates or null
See Also:
invalidateEastNorthCache()

setCoorInternal

protected void setCoorInternal(LatLon coor,
                               EastNorth eastNorth)
To be used only by Dataset.reindexNode


setDataset

void setDataset(DataSet dataSet)
Description copied from class: OsmPrimitive
This method should never ever by called from somewhere else than Dataset.addPrimitive or removePrimitive methods

Overrides:
setDataset in class OsmPrimitive

visit

public void visit(Visitor visitor)
Specified by:
visit in class OsmPrimitive

visit

public void visit(PrimitiveVisitor visitor)
Specified by:
visit in interface IPrimitive

cloneFrom

public void cloneFrom(OsmPrimitive osm)
Description copied from class: OsmPrimitive
Get and write all attributes from the parameter. Does not fire any listener, so use this only in the data initializing phase

Overrides:
cloneFrom in class OsmPrimitive

mergeFrom

public void mergeFrom(OsmPrimitive other)
Merges the technical and semantical attributes from 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.

Overrides:
mergeFrom in class OsmPrimitive
Parameters:
other - the other primitive. Must not be null.
Throws:
java.lang.IllegalArgumentException - thrown if other is null.
DataIntegrityProblemException - thrown if either this is new and other is not, or other is new and this is not
DataIntegrityProblemException - thrown if other is new and other.getId() != this.getId()

load

public void load(PrimitiveData data)
Description copied from class: OsmPrimitive
Loads (clone) this primitive from provided PrimitiveData

Overrides:
load in class OsmPrimitive

save

public NodeData save()
Description copied from class: OsmPrimitive
Save parameters of this primitive to the transport object

Specified by:
save in class OsmPrimitive
Returns:

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hasEqualSemanticAttributes

public boolean hasEqualSemanticAttributes(OsmPrimitive other)
Description copied from class: OsmPrimitive
Replies true if this primitive and other are equal with respect to their semantic attributes.
  1. equal id
  • both are complete or both are incomplete
  • both have the same tags
  • Overrides:
    hasEqualSemanticAttributes in class OsmPrimitive
    Returns:
    true if this primitive and other are equal with respect to their semantic attributes.

    compareTo

    public int compareTo(OsmPrimitive o)
    Specified by:
    compareTo in interface java.lang.Comparable<OsmPrimitive>

    getDisplayName

    public java.lang.String getDisplayName(NameFormatter formatter)
    Description copied from class: OsmPrimitive
    Replies the display name of a primitive formatted by formatter

    Specified by:
    getDisplayName in class OsmPrimitive
    Returns:
    the display name

    getType

    public OsmPrimitiveType getType()
    Description copied from interface: PrimitiveId
    Gets the type of object represented by this object.

    Specified by:
    getType in interface PrimitiveId
    Returns:
    the object type
    See Also:
    Node, Way, Relation

    getBBox

    public BBox getBBox()
    Specified by:
    getBBox in class OsmPrimitive

    updatePosition

    public void updatePosition()
    Description copied from class: OsmPrimitive
    Called by Dataset to update cached position information of primitive (bbox, cached EarthNorth, ...)

    Specified by:
    updatePosition in class OsmPrimitive

    isDrawable

    public boolean isDrawable()
    Overrides:
    isDrawable in class OsmPrimitive

    isConnectionNode

    public boolean isConnectionNode()
    Check whether this node connects 2 ways.

    Returns:
    true if isReferredByWays(2) returns true
    See Also:
    OsmPrimitive.isReferredByWays(int)

    get3892DebugInfo

    public java.lang.String get3892DebugInfo()
    Deprecated. This method will be remove by the end of 2012 if no report appears.

    Get debug info for bug #3892.

    Returns:
    debug info for bug #3892.

    invalidateEastNorthCache

    public void invalidateEastNorthCache()
    Invoke to invalidate the internal cache of projected east/north coordinates. Coordinates are reprojected on demand when the getEastNorth() is invoked next time.



    JOSM