Entity

Entity combines multiple visual features into one object. You can create it manually and add it to an 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>

When true, the entity position is relative to its parent.

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 the entity to use the same world position as its parent.

forceGlobalRotationboolean<optional>

Forces the entity to use the same world rotation as its parent.

forceGlobalScaleboolean<optional>

Forces the entity to use the same world scale as its parent.

localPositionVec3 | NumberArray3<optional>

Local position offset.

Members

entityCollection

Gets current entity collection container.

id

Returns the entity id.

instanceName

Returns the instance class name.

layer

Returns the assigned vector layer.

layerIndex

Gets the layer index of the entity.

relativePosition

Sets whether the entity position is relative to its parent.

relativePosition

Returns whether the entity position is relative to its parent.

rootEntity

Returns the root entity.

Methods

_setCartesian3vSilent(cartesian, skipLonLat)

Sets local cartesian position without dispatching events.

Parameters:
NameTypeDefaultDescription
cartesianVec3

Cartesian position in 3D space.

skipLonLatbooleanfalse

Skip geodetic conversion.

addTo(collection) → {Entity}

Adds the entity to a collection or vector layer.

Parameters:
NameTypeDescription
collectionEntityCollection | Vector

Target collection or vector layer.

Returns:

This object.

Type: 
Entity

appendChild(entity)

Appends a child entity.

Parameters:
NameTypeDescription
entityEntity

Child entity.

appendChildren(entities, forceRelativePositionopt)

Appends child entities.

Parameters:
NameTypeAttributesDescription
entitiesArray.<Entity>

Child entities.

forceRelativePositionboolean<optional>

If defined, sets relativePosition for each child.

getAbsoluteCartesian() → {Vec3}

Returns absolute cartesian position.

Returns:

Absolute cartesian position.

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}

Returns entity altitude over the planet.

Returns:

Altitude.

Type: 
number

getCartesian() → {Vec3}

Returns cartesian position.

Returns:

Cartesian position.

Type: 
Vec3

getCollectionIndex() → {number}

Gets the collection index of the entity.

Returns:

The entity collection index.

Type: 
number

getExtent() → {Extent}

Returns geodetic extent.

Returns:

Geodetic extent.

Type: 
Extent

getLonLat() → {LonLat}

Returns geodetic coordinates.

Returns:

Entity geodetic coordinates.

Type: 
LonLat

getOpacity() → {number}

Returns entity opacity.

Returns:

Entity opacity.

Type: 
number

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}

Returns the local scale.

Returns:
Type: 
Vec3

getVisibility() → {boolean}

Returns entity visibility.

Returns:

Entity visibility flag.

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 the 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 absolute cartesian position using a vector.

Parameters:
NameTypeDescription
absolutCartesianVec3

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:

Assigned billboard object.

Type: 
Billboard

setCartesian(x, y, z)

Sets local cartesian position.

Parameters:
NameTypeDescription
xnumber

X coordinate in 3D space.

ynumber

Y coordinate in 3D space.

znumber

Z coordinate in 3D space.

setCartesian3v(cartesian)

Sets entity cartesian position.

Parameters:
NameTypeDescription
cartesianVec3

Cartesian position in 3D space.

setDirectQuaternionRotation(rot)

Sets rotation directly from glTF quaternion with common coordinate system conversion. This method avoids the current pitch/yaw/roll conversion.

Parameters:
NameTypeDescription
rotQuat

Quaternion from glTF.

setGeoObject(geoObject) → {GeoObject}

Sets entity geoObject.

Parameters:
NameTypeDescription
geoObjectGeoObject

GeoObject.

Returns:

Assigned geo object.

Type: 
GeoObject

setGeometry(geometry) → {Geometry}

Sets entity geometry.

Parameters:
NameTypeDescription
geometryGeometry

Geometry object.

Returns:

Assigned geometry object.

Type: 
Geometry

setLabel(label) → {Label}

Sets entity label.

Parameters:
NameTypeDescription
labelLabel

Text label.

Returns:

Assigned label object.

Type: 
Label

setLonLat(lonlat)

Sets geodetic coordinates.

Parameters:
NameTypeDescription
lonlatLonLat

Geodetic coordinates.

setLonLat2(lon, lat, heightopt)

Sets geodetic coordinates.

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.

setOpacity(opacity)

Sets entity opacity for all available features.

Parameters:
NameTypeDescription
opacitynumber

Entity opacity.

setPickingColor()

Applies entity picking color to all supported features.

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:

Assigned point cloud object.

Type: 
PointCloud

setPolyline(polyline) → {Polyline}

Sets entity polyline.

Parameters:
NameTypeDescription
polylinePolyline

Polyline object.

Returns:

Assigned polyline object.

Type: 
Polyline

setRay(ray) → {Ray}

Sets entity ray.

Parameters:
NameTypeDescription
rayRay

Ray object.

Returns:

Assigned ray object.

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 uniform local scale.

Parameters:
NameTypeDescription
valnumber

Scale value.

setScale3v(scale)

Sets per-axis local scale.

Parameters:
NameTypeDescription
scaleVec3

Scale vector.

setStrip(strip) → {Strip}

Sets entity strip.

Parameters:
NameTypeDescription
stripStrip

Strip object.

Returns:

Assigned strip object.

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.