Packagenet.systemeD.halcyon.connection
Classpublic class Entity
InheritanceEntity Inheritance flash.events.EventDispatcher
SubclassesChangeset, EntityCollection, Marker, Node, Relation, Way

An Entity is an object stored in the map database, and therefore uploaded and downloaded. This includes Nodes, Ways, Relations but also Changesets etc.



Public Properties
 PropertyDefined by
  connection : Connection
[read-only] Connection to which this entity belongs.
Entity
  deleted : Boolean = false
Entity
  entities : Array
[read-only] List of entities.
Entity
  hasParents : Boolean
[read-only] Whether this entity has any parents.
Entity
  hasParentWays : Boolean
[read-only] Whether this entity has any parents that are Ways.
Entity
  id : Number
[read-only] OSM ID.
Entity
  isDirty : Boolean
[read-only] Check if entity is modified since last markClean().
Entity
  loaded : Boolean
[read-only] Is entity fully loaded, or is it just a placeholder reference (as a relation member)?
Entity
  locked : Boolean = false
Lock against purging when off-screen
Entity
  memberships : Array
[read-only] Returns all relations that this Entity is part of, as array of {relation, position, role}, sorted by position.
Entity
  numParentWays : uint
[read-only] How many parents are Ways?
Entity
  parentObjects : Array
[read-only] All parents of this entity.
Entity
  parentRelations : Array
[read-only] All parents that are Relations
Entity
  parentsLoaded : Boolean = true
Have all its parents (ie, relations that contain this object as a member, ways that contain this node) been loaded into memory
Entity
  parentWays : Array
[read-only] Get array of all Ways of which this object (presumably a node) is a child.
Entity
  status : String
Entity
  timestamp : String
[read-only] Most recent modification of the entity (from OSM API).
Entity
  uid : Number
[read-only] User ID who last edited this entity (from OSM API).
Entity
  version : uint
[read-only] Current version number.
Entity
Public Methods
 MethodDefined by
  
Entity(connection:Connection, id:Number, version:uint, tags:Object, loaded:Boolean, uid:Number, timestamp:String)
Entity
  
addParent(parent:Entity):void
Create parent link from this entity to another.
Entity
  
countParentObjects(within:Object):uint
How many parents does this entity have that satisfy the "within" constraint?
Entity
  
findParentRelationsOfType(type:String, role:String = null):Array
Returns parents that are relations, and of the specified type, and of which this entity is the correct role (if provided).
Entity
  
getDescription():String
Basic description of Entity - should be overriden by subclass.
Entity
  
Entity
  
getTag(key:String):String
Retrieve a tag by key.
Entity
  
getTagArray():Array
Returns an array that duplicates the tags on this entity.
Entity
  
Entity
  
getTagsCopy():Object
Returns an object that duplicates the tags on this entity.
Entity
  
getTagsHash():Object
Entity
  
getType():String
The type of Entity (node, way etc).
Entity
  
Whether the entity has any tags other than meta-tags (attribution, created_by, source, tiger:...)
Entity
  
hasParent(entity:Entity):Boolean
Whether 'entity' is a parent of this Entity.
Entity
  
hasTags():Boolean
Whether the entity has > 0 tags.
Entity
  
isDeleted():Boolean
Whether entity is marked deleted.
Entity
  
isEmpty():Boolean
Whether entity is "empty" - to be overridden by subclass.
Entity
  
isType(str:String):Boolean
Compare type against supplied string
Entity
  
isUneditedTiger():Boolean
Rough function to detect entities untouched since TIGER import.
Entity
  
markClean():void
Reset modified flag.
Entity
  
markDirty():void
Set entity as modified.
Entity
  
mergeTags(source:Entity, performAction:Function):Boolean
Copy tags from another entity into this one, creating "key=value1; value2" pairs if necessary.
Entity
  
nullify():void
Free up memory by converting entity to a dummy entity, for entities that we no longer need but which are part of a still-in-memory relation
Entity
  
remove(performAction:Function):void
Delete entity - must be overridden.
Entity
  
removeFromParents(performAction:Function):void
Entity
  
removeParent(parent:Entity):void
Remove parent link.
Entity
  
renameTag(oldKey:String, newKey:String, performAction:Function):void
Change oldKey=[value] to newKey=[value], with optional undoability.
Entity
  
renumber(newID:Number, newVersion:uint):void
Assign a new ID and version.
Entity
  
resume():void
Resume redrawing of the object
Entity
  
sameTags(entity:Entity):Boolean
Compare tags between two entities.
Entity
  
setDeletedState(isDeleted:Boolean):void
Mark entity as deleted.
Entity
  
setStatus(s:String):void
Change entity status.
Entity
  
setTag(key:String, value:String, performAction:Function):void
Set key=value, with optional undoability.
Entity
  
suspend():void
Temporarily prevent redrawing of the object.
Entity
  
tagIs(key:String, value:String):Boolean
Entity
  
updateEntityProperties(version:uint, tags:Object, loaded:Boolean, parentsLoaded:Boolean, uid:Number, timestamp:String):void
Set a bunch of properties in one hit.
Entity
  
within(left:Number, right:Number, top:Number, bottom:Number):Boolean
Entity
Protected Methods
 MethodDefined by
  
Implement nullifybehaviour: delete tags, etc.
Entity
Property detail
connectionproperty
connection:Connection  [read-only]

Connection to which this entity belongs.

Implementation
    public function get connection():Connection
deletedproperty 
public var deleted:Boolean = false
entitiesproperty 
entities:Array  [read-only]

List of entities. Overridden by EntityCollection.

Implementation
    public function get entities():Array
hasParentsproperty 
hasParents:Boolean  [read-only]

Whether this entity has any parents.

Implementation
    public function get hasParents():Boolean
hasParentWaysproperty 
hasParentWays:Boolean  [read-only]

Whether this entity has any parents that are Ways.

Implementation
    public function get hasParentWays():Boolean
idproperty 
id:Number  [read-only]

OSM ID.

Implementation
    public function get id():Number
isDirtyproperty 
isDirty:Boolean  [read-only]

Check if entity is modified since last markClean().

Implementation
    public function get isDirty():Boolean
loadedproperty 
loaded:Boolean  [read-only]

Is entity fully loaded, or is it just a placeholder reference (as a relation member)?

Implementation
    public function get loaded():Boolean
lockedproperty 
public var locked:Boolean = false

Lock against purging when off-screen

membershipsproperty 
memberships:Array  [read-only]

Returns all relations that this Entity is part of, as array of {relation, position, role}, sorted by position.

Implementation
    public function get memberships():Array
numParentWaysproperty 
numParentWays:uint  [read-only]

How many parents are Ways?

Implementation
    public function get numParentWays():uint
parentObjectsproperty 
parentObjects:Array  [read-only]

All parents of this entity.

Implementation
    public function get parentObjects():Array
parentRelationsproperty 
parentRelations:Array  [read-only]

All parents that are Relations

Implementation
    public function get parentRelations():Array
parentsLoadedproperty 
public var parentsLoaded:Boolean = true

Have all its parents (ie, relations that contain this object as a member, ways that contain this node) been loaded into memory

parentWaysproperty 
parentWays:Array  [read-only]

Get array of all Ways of which this object (presumably a node) is a child.

Implementation
    public function get parentWays():Array
statusproperty 
public var status:String
timestampproperty 
timestamp:String  [read-only]

Most recent modification of the entity (from OSM API).

Implementation
    public function get timestamp():String
uidproperty 
uid:Number  [read-only]

User ID who last edited this entity (from OSM API).

Implementation
    public function get uid():Number
versionproperty 
version:uint  [read-only]

Current version number.

Implementation
    public function get version():uint
Constructor detail
Entity()constructor
public function Entity(connection:Connection, id:Number, version:uint, tags:Object, loaded:Boolean, uid:Number, timestamp:String)Parameters
connection:Connection
 
id:Number
 
version:uint
 
tags:Object
 
loaded:Boolean
 
uid:Number
 
timestamp:String
Method detail
addParent()method
public function addParent(parent:Entity):void

Create parent link from this entity to another.

Parameters
parent:Entity
countParentObjects()method 
public function countParentObjects(within:Object):uint

How many parents does this entity have that satisfy the "within" constraint?

Parameters
within:Object

Returns
uint
findParentRelationsOfType()method 
public function findParentRelationsOfType(type:String, role:String = null):Array

Returns parents that are relations, and of the specified type, and of which this entity is the correct role (if provided).

Parameters
type:String
 
role:String (default = null)

Returns
Array

Example
entity.findParentRelationsOfType('multipolygon','inner');

getDescription()method 
public function getDescription():String

Basic description of Entity - should be overriden by subclass.

Returns
String
getRelationMemberships()method 
public function getRelationMemberships():Array

Returns
Array
getTag()method 
public function getTag(key:String):String

Retrieve a tag by key.

Parameters
key:String

Returns
String
getTagArray()method 
public function getTagArray():Array

Returns an array that duplicates the tags on this entity.

Returns
Array
getTagList()method 
public function getTagList():TagList

Returns
TagList
getTagsCopy()method 
public function getTagsCopy():Object

Returns an object that duplicates the tags on this entity.

Returns
Object
getTagsHash()method 
public function getTagsHash():Object

Returns
Object
getType()method 
public function getType():String

The type of Entity (node, way etc). By default, returns ''.

Returns
String
hasInterestingTags()method 
public function hasInterestingTags():Boolean

Whether the entity has any tags other than meta-tags (attribution, created_by, source, tiger:...)

Returns
Boolean
hasParent()method 
public function hasParent(entity:Entity):Boolean

Whether 'entity' is a parent of this Entity.

Parameters
entity:Entity

Returns
Boolean
hasTags()method 
public function hasTags():Boolean

Whether the entity has > 0 tags.

Returns
Boolean
isDeleted()method 
public function isDeleted():Boolean

Whether entity is marked deleted.

Returns
Boolean
isEmpty()method 
public function isEmpty():Boolean

Whether entity is "empty" - to be overridden by subclass.

Returns
Boolean
isType()method 
public function isType(str:String):Boolean

Compare type against supplied string

Parameters
str:String

Returns
Boolean
isUneditedTiger()method 
public function isUneditedTiger():Boolean

Rough function to detect entities untouched since TIGER import.

Returns
Boolean
markClean()method 
public function markClean():void

Reset modified flag. You should not be calling this directly, instead you should be calling markClean from your UndoableEntityAction

markDirty()method 
public function markDirty():void

Set entity as modified. You should not be calling this directly, instead you should be calling markDirty from your UndoableEntityAction

mergeTags()method 
public function mergeTags(source:Entity, performAction:Function):Boolean

Copy tags from another entity into this one, creating "key=value1; value2" pairs if necessary.

Parameters
source:Entity
 
performAction:Function

Returns
Boolean — Array of keys that require manual merging, in order to warn the user.
nullify()method 
public function nullify():void

Free up memory by converting entity to a dummy entity, for entities that we no longer need but which are part of a still-in-memory relation

nullifyEntity()method 
protected function nullifyEntity():void

Implement nullifybehaviour: delete tags, etc.

remove()method 
public function remove(performAction:Function):void

Delete entity - must be overridden.

Parameters
performAction:Function
removeFromParents()method 
public function removeFromParents(performAction:Function):voidParameters
performAction:Function
removeParent()method 
public function removeParent(parent:Entity):void

Remove parent link.

Parameters
parent:Entity
renameTag()method 
public function renameTag(oldKey:String, newKey:String, performAction:Function):void

Change oldKey=[value] to newKey=[value], with optional undoability.

Parameters
oldKey:String — Name of key to rename
 
newKey:String — Single-argument function to pass a SetTagKeyAction to.
 
performAction:Function

Example
renameTag("building", "amenity", MainUndoStack.getGlobalStack().addAction);

renumber()method 
public function renumber(newID:Number, newVersion:uint):void

Assign a new ID and version.

Parameters
newID:Number
 
newVersion:uint
resume()method 
public function resume():void

Resume redrawing of the object

sameTags()method 
public function sameTags(entity:Entity):Boolean

Compare tags between two entities.

Parameters
entity:Entity

Returns
Boolean
setDeletedState()method 
public function setDeletedState(isDeleted:Boolean):void

Mark entity as deleted.

Parameters
isDeleted:Boolean
setStatus()method 
public function setStatus(s:String):void

Change entity status.

Parameters
s:String
setTag()method 
public function setTag(key:String, value:String, performAction:Function):void

Set key=value, with optional undoability.

Parameters
key:String — Name of key to set
 
value:String — Value to set tag to
 
performAction:Function — Single-argument function to pass a SetTagAction to.

Example
setTag("highway", "residential", MainUndoStack.getGlobalStack().addAction);

suspend()method 
public function suspend():void

Temporarily prevent redrawing of the object.

tagIs()method 
public function tagIs(key:String, value:String):Boolean

Parameters
key:String
 
value:String

Returns
Boolean — true if there exists key=value
updateEntityProperties()method 
public function updateEntityProperties(version:uint, tags:Object, loaded:Boolean, parentsLoaded:Boolean, uid:Number, timestamp:String):void

Set a bunch of properties in one hit. Implicitly makes entity not deleted.

Parameters
version:uint
 
tags:Object
 
loaded:Boolean
 
parentsLoaded:Boolean
 
uid:Number
 
timestamp:String
within()method 
public function within(left:Number, right:Number, top:Number, bottom:Number):BooleanParameters
left:Number
 
right:Number
 
top:Number
 
bottom:Number

Returns
Boolean