Entity

Entity instances aggregate multiple forms of visualization into a single high-level object. They can be created manually and added to entity collection.

Constructor

new Entity(optionsopt)

Parameters:
NameTypeAttributesDescription
optionsIEntityParams<optional>

Entity options:

Properties
NameTypeAttributesDescription
namestring<optional>

Name of the entity.

propertiesany<optional>

Additional properties of the entity.

cartesianVec3 | NumberArray3<optional>

Cartesian position.

lonlatLonLat | NumberArray3 | NumberArray2<optional>

Geographic coordinates.

altitudenumber<optional>

Altitude.

visibilityboolean<optional>

Visibility flag.

billboardBillboard | IBillboardParams<optional>

Billboard object or parameters.

labelLabel | ILabelParams<optional>

Label object or parameters.

polylinePolyline | IPolylineParams<optional>

Polyline object or parameters.

rayRay | IRayParams<optional>

Ray object or parameters.

pointCloudPointCloud | IPointCloudParams<optional>

Point cloud object or parameters.

geometryGeometry | IGeometryParams<optional>

Geometry object or parameters.

geoObjectGeoObject | IGeoObjectParams<optional>

Geo object or parameters.

stripStrip | IStripParams<optional>

Strip object or parameters.

independentPickingboolean<optional>

Independent picking flag.

relativePositionboolean<optional>

Parent relative position flag, otherwise position is absolute.

pitchnumber<optional>

Rotation around local X-axis in radians.

yawnumber<optional>

Rotation around local Y-axis in radians.

rollnumber<optional>

Rotation around local Z-axis in radians.

scalenumber | Vec3 | NumberArray3<optional>

Scaling factor.

forceGlobalPositionboolean<optional>

Forces global position for the entity make the same position as its parent.

forceGlobalRotationboolean<optional>

Forces global rotation for the entity make the same rotation as its parent.

forceGlobalScaleboolean<optional>

Forces global scale for the entity make the same scale as its parent.

Members

entityCollection

Gets current entity collection container.

id

Gets entity uniq id

instanceName

Gets the instance class name of the entity.

layer

Gets layer container

layerIndex

Gets the layer index of the entity.

relativePosition

Sets relative position property

relativePosition

Gets relative position property

rootEntity

Returns root entity object.

Methods

_setCartesian3vSilent(cartesian, skipLonLat)

Sets entity cartesian position without event dispatching.

Parameters:
NameTypeDefaultDescription
cartesianVec3

Cartesian position in 3d space.

skipLonLatbooleanfalse

skip geodetic calculation.

addTo(collection, rightNowopt) → {Entity}

Adds current entity into the specified entity collection.

Parameters:
NameTypeAttributesDefaultDescription
collectionEntityCollection | Vector

Specified entity collection or vector layer.

rightNowboolean<optional>
false

Entity insertion option for vector layer.

Returns:
  • This object.
Type: 
Entity

appendChild(entity)

Append child entity.

Parameters:
NameTypeDescription
entityEntity

Child entity.

getAbsoluteCartesian() → {Vec3}

Returns absolute cartesian position.

Returns:
Type: 
Vec3

getAbsolutePitch() → {number}

Gets the absolute pitch angle of the entity.

Returns:

The absolute pitch angle in radians.

Type: 
number

getAbsoluteRoll() → {number}

Gets the absolute roll angle of the entity.

Returns:

The absolute roll angle in radians.

Type: 
number

getAbsoluteRotation() → {Quat}

Gets the absolute rotation direction of the entity.

Returns:

The absolute rotation quaternion.

Type: 
Quat

getAbsoluteYaw() → {number}

Gets the absolute yaw angle of the entity.

Returns:

The absolute yaw angle in radians.

Type: 
number

getAltitude() → {number}

Sets entity altitude over the planet.

Returns:

Altitude.

Type: 
number

getCartesian() → {Vec3}

Returns cartesian position.

Returns:
Type: 
Vec3

getCollectionIndex() → {number}

Gets the collection index of the entity.

Returns:

The entity collection index.

Type: 
number

getExtent() → {Extent}

Return geodetic extent.

Returns:
Type: 
Extent

getLonLat() → {LonLat}

Gets entity geodetic coordinates.

Returns:
Type: 
LonLat

getPitch() → {number}

Gets the pitch angle of the entity.

Returns:

The pitch angle in radians.

Type: 
number

getRoll() → {number}

Gets the roll angle of the entity.

Returns:

The roll angle in radians.

Type: 
number

getRotation() → {Quat}

Gets the local rotation of the entity. For the root entity it is equal to the absolute rotation.

Returns:

The rotation quaternion.

Type: 
Quat

getScale() → {Vec3}

Gets scale factor

Returns:
Type: 
Vec3

getVisibility() → {boolean}

Returns entity visibility.

Returns:
Type: 
boolean

getYaw() → {number}

Gets the yaw angle of the entity.

Returns:

The yaw angle in radians.

Type: 
number

isEqual(entity) → {boolean}

Checks if the given entity is equal to the current entity.

Parameters:
NameTypeDescription
entityEntity

The entity to compare.

Returns:

True if entities are equal, otherwise false.

Type: 
boolean

remove()

Removes current entity from its collection or layer.

setAbsoluteCartesian(x, y, z)

Sets the absolute cartesian position of the entity.

Parameters:
NameTypeDescription
xnumber

X coordinate.

ynumber

Y coordinate.

znumber

Z coordinate.

setAbsoluteCartesian3v(absolutCartesian)

Sets the absolute cartesian position of the entity using a Vec3.

Parameters:
NameTypeDescription
absolutCartesianVec3

The absolute cartesian position.

setAbsolutePitch(val)

Sets the absolute pitch of the entity.

Parameters:
NameTypeDescription
valnumber

The absolute pitch angle in radians.

setAbsoluteRoll(val)

Sets the absolute roll of the entity.

Parameters:
NameTypeDescription
valnumber

The absolute roll angle in radians.

setAbsoluteRotation(rot)

Sets the absolute rotation of the entity.

Parameters:
NameTypeDescription
rotQuat

The new absolute rotation quaternion.

setAbsoluteYaw(val)

Sets the absolute yaw of the entity.

Parameters:
NameTypeDescription
valnumber

The absolute yaw angle in radians.

setAltitude(altitude)

Sets entity altitude over the planet.

Parameters:
NameTypeDescription
altitudenumber

Altitude.

setBillboard(billboard) → {Billboard}

Sets entity billboard.

Parameters:
NameTypeDescription
billboardBillboard

Billboard object.

Returns:
Type: 
Billboard

setCartesian(x, y, z)

Sets entity cartesian position.

Parameters:
NameTypeDescription
xnumber

3d space X - position.

ynumber

3d space Y - position.

znumber

3d space Z - position.

setCartesian3v(cartesian)

Sets entity cartesian position.

Parameters:
NameTypeDescription
cartesianVec3

Cartesian position in 3d space.

setGeoObject(geoObject) → {GeoObject}

Sets entity geoObject.

Parameters:
NameTypeDescription
geoObjectGeoObject

GeoObject.

Returns:
Type: 
GeoObject

setGeometry(geometry) → {Geometry}

Sets entity geometry.

Parameters:
NameTypeDescription
geometryGeometry

Geometry object.

Returns:
Type: 
Geometry

setLabel(label) → {Label}

Sets entity label.

Parameters:
NameTypeDescription
labelLabel

Text label.

Returns:
Type: 
Label

setLonLat(lonlat)

Sets geodetic coordinates of the entity point object.

Parameters:
NameTypeDescription
lonlatLonLat

coordinates.

setLonLat2(lon, lat, heightopt)

Sets geodetic coordinates of the entity point object.

Parameters:
NameTypeAttributesDescription
lonnumber

Longitude.

latnumber

Latitude

heightnumber<optional>

Height

setLook3v(cart)

Rotates the entity to look at a given point in world coordinates.

Parameters:
NameTypeDescription
cartVec3

The target position to look at.

setLookLonLat(lonLat)

Rotates the entity to look at a given geographic coordinate.

Parameters:
NameTypeDescription
lonLatLonLat

The longitude and latitude to look at.

setPickingColor()

Appends entity items(billboard, label etc.) picking color.

setPitch(val)

Sets the pitch rotation of the entity.

Parameters:
NameTypeDescription
valnumber

The new pitch angle in radians.

setPointCloud(pointCloud) → {PointCloud}

Sets entity pointCloud.

Parameters:
NameTypeDescription
pointCloudPointCloud

PointCloud object.

Returns:
Type: 
PointCloud

setPolyline(polyline) → {Polyline}

Sets entity polyline.

Parameters:
NameTypeDescription
polylinePolyline

Polyline object.

Returns:
Type: 
Polyline

setRay(ray) → {Ray}

Sets entity ray.

Parameters:
NameTypeDescription
rayRay

Ray object.

Returns:
Type: 
Ray

setRoll(val)

Sets the roll rotation of the entity.

Parameters:
NameTypeDescription
valnumber

The new roll angle in radians.

setRotation(rot)

Sets the local rotation of the entity.

Parameters:
NameTypeDescription
rotQuat

The new rotation quaternion.

setScale(val)

Sets scale for the inner object such as GeoObject

Parameters:
NameTypeDescription
valnumber

Scale factor

setScale3v(scale)

Sets XYZ axis scale for the inner object such as GeoObject

Parameters:
NameTypeDescription
scaleVec3

Scale factor

setStrip(strip) → {Strip}

Sets entity strip.

Parameters:
NameTypeDescription
stripStrip

Strip object.

Returns:
Type: 
Strip

setVisibility(visibility)

Sets the entity visibility.

Parameters:
NameTypeDescription
visibilityboolean

Entity visibility.

setYaw(val)

Sets the yaw rotation of the entity.

Parameters:
NameTypeDescription
valnumber

The new yaw angle in radians.