Entity
Source: Entity.ts:119
Entity combines multiple visual features into one object. You can create it manually and add it to an entity collection.
Constructor
new Entity(options?: IEntityParams): EntityParameters
options(IEntityParams, optional) — Entity options.options.name(string, optional) — Name of the entity.options.properties(any, optional) — Additional properties of the entity.options.cartesian(Vec3 | NumberArray3, optional) — Cartesian position.options.lonlat(LonLat | NumberArray3 | NumberArray2, optional) — Geographic coordinates.options.altitude(number, optional) — Altitude.options.visibility(boolean, optional) — Visibility flag.options.billboard(Billboard | IBillboardParams, optional) — Billboard object or parameters.options.label(Label | ILabelParams, optional) — Label object or parameters.options.polyline(Polyline | IPolylineParams, optional) — Polyline object or parameters.options.ray(Ray | IRayParams, optional) — Ray object or parameters.options.pointCloud(PointCloud | IPointCloudParams, optional) — Point cloud object or parameters.options.geometry(Geometry | IGeometryParams, optional) — Geometry object or parameters.options.geoObject(GeoObject | IGeoObjectParams, optional) — Geo object or parameters.options.strip(Strip | IStripParams, optional) — Strip object or parameters.options.independentPicking(boolean, optional) — Independent picking flag.options.relativePosition(boolean, optional) — Whentrue, the entity position is relative to its parent.options.pitch(number, optional) — Rotation around local X-axis in radians.options.yaw(number, optional) — Rotation around local Y-axis in radians.options.roll(number, optional) — Rotation around local Z-axis in radians.options.scale(number | Vec3 | NumberArray3, optional) — Scaling factor.options.forceGlobalPosition(boolean, optional) — Forces the entity to use the same world position as its parent.options.forceGlobalRotation(boolean, optional) — Forces the entity to use the same world rotation as its parent.options.forceGlobalScale(boolean, optional) — Forces the entity to use the same world scale as its parent.options.localPosition(Vec3 | NumberArray3, optional) — Local position offset.
Instance Methods
isEqual(entity: Entity): boolean
Checks if the given entity is equal to the current entity.
Parameters
entity(Entity) — The entity to compare.
Returns
boolean— True if entities are equal, otherwise false.
getCollectionIndex(): number
Gets the collection index of the entity.
Returns
number— The entity collection index.
addTo(collection: EntityCollection | Vector): Entity
Adds the entity to a collection or vector layer.
Parameters
collection(EntityCollection | Vector) — Target collection or vector layer.
Returns
Entity— This object.
remove()
Removes the entity from its collection or layer.
setVisibility(visibility: boolean)
Sets the entity visibility.
Parameters
visibility(boolean) — Entity visibility.
setOpacity(opacity: number)
Sets entity opacity for all available features.
Parameters
opacity(number) — Entity opacity.
getOpacity(): number
Returns entity opacity.
Returns
number— Entity opacity.
getVisibility(): boolean
Returns entity visibility.
Returns
boolean— Entity visibility flag.
setCartesian3v(cartesian: Vec3)
Sets entity cartesian position.
Parameters
cartesian(Vec3) — Cartesian position in 3D space.
getScale(): Vec3
Returns the local scale.
Returns
setScale3v(scale: Vec3)
Sets per-axis local scale.
Parameters
scale(Vec3) — Scale vector.
setScale(val: number)
Sets uniform local scale.
Parameters
val(number) — Scale value.
getAbsoluteRotation(): Quat
Gets the absolute rotation direction of the entity.
Returns
Quat— The absolute rotation quaternion.
getRotation(): Quat
Gets the local rotation of the entity. For the root entity it is equal to the absolute rotation.
Returns
Quat— The rotation quaternion.
setLook3v(cart: Vec3)
Rotates the entity to look at a given point in world coordinates.
Parameters
cart(Vec3) — The target position to look at.
setLookLonLat(lonLat: LonLat)
Rotates the entity to look at a given geographic coordinate.
Parameters
lonLat(LonLat) — The longitude and latitude to look at.
setAbsoluteRotation(rot: Quat)
Sets the absolute rotation of the entity.
Parameters
rot(Quat) — The new absolute rotation quaternion.
setRotation(rot: Quat)
Sets the local rotation of the entity.
Parameters
rot(Quat) — The new rotation quaternion.
setDirectQuaternionRotation(rot: Quat)
Sets rotation directly from glTF quaternion with common coordinate system conversion. This method avoids the current pitch/yaw/roll conversion.
Parameters
rot(Quat) — Quaternion from glTF.
setPitch(val: number)
Sets the pitch rotation of the entity.
Parameters
val(number) — The new pitch angle in radians.
setYaw(val: number)
Sets the yaw rotation of the entity.
Parameters
val(number) — The new yaw angle in radians.
setRoll(val: number)
Sets the roll rotation of the entity.
Parameters
val(number) — The new roll angle in radians.
setPitchYawRoll(pitch: number, yaw: number, roll: number)
Sets pitch, yaw and roll at once.
Parameters
pitch(number) — The new pitch angle in radians.yaw(number) — The new yaw angle in radians.roll(number) — The new roll angle in radians.
getPitch(): number
Gets the pitch angle of the entity.
Returns
number— The pitch angle in radians.
getYaw(): number
Gets the yaw angle of the entity.
Returns
number— The yaw angle in radians.
getRoll(): number
Gets the roll angle of the entity.
Returns
number— The roll angle in radians.
setAbsolutePitch(val: number)
Sets the absolute pitch of the entity.
Parameters
val(number) — The absolute pitch angle in radians.
setAbsoluteYaw(val: number)
Sets the absolute yaw of the entity.
Parameters
val(number) — The absolute yaw angle in radians.
setAbsoluteRoll(val: number)
Sets the absolute roll of the entity.
Parameters
val(number) — The absolute roll angle in radians.
getAbsolutePitch(): number
Gets the absolute pitch angle of the entity.
Returns
number— The absolute pitch angle in radians.
getAbsoluteYaw(): number
Gets the absolute yaw angle of the entity.
Returns
number— The absolute yaw angle in radians.
getAbsoluteRoll(): number
Gets the absolute roll angle of the entity.
Returns
number— The absolute roll angle in radians.
setAbsoluteCartesian(x: number, y: number, z: number)
Sets the absolute cartesian position of the entity.
Parameters
x(number) — X coordinate.y(number) — Y coordinate.z(number) — Z coordinate.
setAbsoluteCartesian3v(absolutCartesian: Vec3)
Sets absolute cartesian position using a vector.
Parameters
absolutCartesian(Vec3) — Absolute cartesian position.
getAbsoluteCartesian(): Vec3
Returns absolute cartesian position.
Returns
Vec3— Absolute cartesian position.
setCartesian(x: number, y: number, z: number)
Sets local cartesian position.
Parameters
x(number) — X coordinate in 3D space.y(number) — Y coordinate in 3D space.z(number) — Z coordinate in 3D space.
_setCartesian3vSilent(cartesian: Vec3, skipLonLat: boolean)
Sets local cartesian position without dispatching events.
Parameters
cartesian(Vec3) — Cartesian position in 3D space.skipLonLat(boolean, default: false) — Skip geodetic conversion.
getLonLat(): LonLat
Returns geodetic coordinates.
Returns
LonLat— Entity geodetic coordinates.
setLonLat(lonlat: LonLat)
Sets geodetic coordinates.
Parameters
lonlat(LonLat) — Geodetic coordinates.
setLonLat2(lon: number, lat: number, height?: number)
Sets geodetic coordinates.
Parameters
lon(number) — Longitude.lat(number) — Latitude.height(number, optional) — Height.
setAltitude(altitude: number)
Sets entity altitude over the planet.
Parameters
altitude(number) — Altitude.
getAltitude(): number
Returns entity altitude over the planet.
Returns
number— Altitude.
getCartesian(): Vec3
Returns cartesian position.
Returns
Vec3— Cartesian position.
setBillboard(billboard: Billboard): Billboard
Sets entity billboard.
Parameters
billboard(Billboard) — Billboard object.
Returns
Billboard— Assigned billboard object.
setLabel(label: Label): Label
Sets entity label.
Parameters
label(Label) — Text label.
Returns
Label— Assigned label object.
setRay(ray: Ray): Ray
Sets entity ray.
Parameters
ray(Ray) — Ray object.
Returns
Ray— Assigned ray object.
setPolyline(polyline: Polyline): Polyline
Sets entity polyline.
Parameters
polyline(Polyline) — Polyline object.
Returns
Polyline— Assigned polyline object.
setPointCloud(pointCloud: PointCloud): PointCloud
Sets entity pointCloud.
Parameters
pointCloud(PointCloud) — PointCloud object.
Returns
PointCloud— Assigned point cloud object.
setGeometry(geometry: Geometry): Geometry
Sets entity geometry.
Parameters
geometry(Geometry) — Geometry object.
Returns
Geometry— Assigned geometry object.
setGeoObject(geoObject: GeoObject): GeoObject
Sets entity geoObject.
Parameters
geoObject(GeoObject) — GeoObject.
Returns
GeoObject— Assigned geo object.
setStrip(strip: Strip): Strip
Sets entity strip.
Parameters
strip(Strip) — Strip object.
Returns
Strip— Assigned strip object.
appendChildren(
entities: Array.<Entity>,
forceRelativePosition?: boolean,
)
Appends child entities.
Parameters
entities(Array.<Entity>) — Child entities.forceRelativePosition(boolean, optional) — If defined, setsrelativePositionfor each child.
appendChild(entity: Entity)
Appends a child entity.
Parameters
entity(Entity) — Child entity.
setPickingColor()
Applies entity picking color to all supported features.
getExtent(): Extent
Returns geodetic extent.
Returns
Extent— Geodetic extent.
Instance Fields
rootEntity
Returns the root entity.
Returns
Entity— Root entity.
relativePosition
Sets whether the entity position is relative to its parent.
Parameters
isRelative(boolean) — Relative-position flag.
relativePosition
Returns whether the entity position is relative to its parent.
Returns
boolean
entityCollection
Gets current entity collection container.
Returns
EntityCollection| null
id
Returns the entity id.
Returns
number
layerIndex
Gets the layer index of the entity.
Returns
number— The layer index.
instanceName
Returns the instance class name.
Returns
string— Always"Entity".
layer
Returns the assigned vector layer.
Returns
Vector| null