Class: Entity

Entity

new Entity(options)

Entity instance class, which aggregates multiple visual objects into a single high-level object. Entities can be manually created and added to Viewer # entities, or generated by data sources such as CzmlDataSource and GeoJsonDataSource.

Name Type Description
options Object optional

Object is an object that contains the following properties:

Name Type Description
id String optional

The unique identifier of the object. If not provided, a GUID is generated.

name String optional

The readable name displayed to the user does not need to be unique.

availability TimeIntervalCollection optional

Whether to display the entity and its children.

show Boolean optional

Whether to display the entity and its children.

description Property optional

The HTML description of the entity.

position PositionProperty optional

The location of the entity.

orientation Property optional

The direction of the entity.

viewFrom Property optional

View the recommended initial offset for this entity object

parent Entity optional

The parent entity associated with this entity.

billboard BillboardGraphics optional

The billboard associated with this entity.

box BoxGraphics optional

The box object associated with this entity.

corridor CorridorGraphics optional

Corridor objects associated with entities.

cylinder CylinderGraphics optional

A cylindrical object associated with an entity.

ellipse EllipseGraphics optional

Elliptical objects associated with entities.

ellipsoid EllipsoidGraphics optional

An ellipsoid object associated with an entity.

label LabelGraphics optional

Label objects associated with entities.

model ModelGraphics optional

Model objects associated with entities.

path PathGraphics optional

The path object associated with the entity.

plane PlaneGraphics optional

A planar object associated with an entity.

point PointGraphics optional

Point objects associated with entities.

polygon PolygonGraphics optional

Polygonal objects associated with entities.

polyline PolylineGraphics optional

Line objects associated with entities

properties PropertyBag optional

Any attribute associated with an entity.

polylineVolume PolylineVolumeGraphics optional

A polyline cylindrical object associated with an entity.

rectangle RectangleGraphics optional

A rectangular object associated with an entity.

wall WallGraphics optional

The fence object associated with the entity.

Members

availabilityTimeIntervalCollection

The availability of objects. If availability is not defined, it is assumed that other properties of the object will return valid data at any time. If there is availability, other properties of the object will only provide valid data within the given time interval of the query.

Gets or sets the billboard object.

Get or set a rectangular object.

Retrieve or set corridor objects.

Get or set a cylindrical object.

readonly definitionChangedEvent

The event triggered when a property or sub property changes or is modified.

descriptionProperty

Get or set entity description.

Get or set an elliptical object.

Get or set an ellipsoid object.

entityCollectionEntityCollection

Get or set the entity collection to which this entity belongs.

idString

Get the unique identifier of the entity.

isShowingBoolean

Obtain the visibility of this entity, which takes into account its set of entities and the visibility of its parent entity.

Get or set tags.

Retrieve or set model objects.

nameString

Get or set the name of an object. The name is intended for end-users and does not need to be unique.

orientationProperty

Get or set the orientation of an entity.

parentEntity

Get or set the parent object of an entity.

Get or set the path object.

Get or set a planar object.

Get or set point graphic objects.

Get or set polygon objects.

Get or set a polyline object.

polylineVolumePolylineVolumeGraphics

Get or set polyline column objects.

Get or set the location of the entity.

propertiesPropertyBag

Get or set any property package associated with the entity object.

propertyNamesArray

Get all property names of the instance object.

Get or set a rectangular object.

scaleProperty

Get or set the scaling ratio of an entity.

showBoolean

Get or set the visibility of entity objects. If set to true, this entity will only be displayed when its parent entity's display property show is also set to true.

viewFromProperty

Get or set the recommended initial offset when viewing this object with a camera. Offset is defined in the "East North Up" coordinate system.

Get or set the fence object.

Methods

static supportsMaterialsforEntitiesOnTerrain(scene){Boolean}

Check if the specified scene supports pasting materials other than solid colors and 3D tiles. If not supported, the entity will be rendered with a non solid color material, but the height will be rendered as 0.

Name Type Description
scene Scene

The current scene.

Returns:
Type Description
Boolean Whether or not the current scene supports materials for entities on terrain.

static supportsPolylinesOnTerrain(scene){Boolean}

Check if the specified scene supports line to ground and 3D tiles. If not supported, PolylineGraphics will be rendered at the given height and rendered using arcType parameters instead of ground parameters.

Name Type Description
scene Scene

Current scene.

Returns:
Type Description
Boolean Does the given scene support line to ground, 3D tiles.

addProperty(propertyName)

Add an attribute to the entity.

Name Type Description
propertyName String

The name of the attribute to be added.

Throws:
  • 'Property Name' has been reserved.

    Type
    DeveloperError
  • 'Property Name' has already been registered.

    Type
    DeveloperError

computeModelMatrix(time, result){Matrix4}

Calculate the model matrix of the entity at a given time. If position and orientation are undefined, it will return undefined.

Name Type Description
time JulianDate

Given time.

result Matrix4 optional

Object for storing results

Returns:
Type Description
Matrix4 If position and orientation are undefined, it will return undefined. If position or orientation is defined and input parameters are provided, the modified input object will be returned. On the contrary, create a new instance to store the results.

isAvailable(time){Boolean}

If the object contains data within the specified time, return true.

Name Type Description
time JulianDate

Check the availability time.

Returns:
Type Description
Boolean If the object contains data within the specified time, return true; otherwise, return false.

merge(source)

Assign the same attribute value as the source object to each unassigned attribute of the object.

Name Type Description
source Entity

Objects to be merged into the target object.

removeProperty(propertyName)

Delete the property names previously added through the addProperty function.

Name Type Description
propertyName String

The name of the property to remove.

Throws:
  • 'Property Name' has been reserved.

    Type
    DeveloperError
  • 'Property Name' has already been registered.

    Type
    DeveloperError

setPolygonOffset(polyOffsetFactor, polyOffsetUnits)

Sets the polygon offset for the entity (currently only supports polygons).

Name Type Description
polyOffsetFactor Number

The polygon offset constant. When positive, the polygon is offset away from the viewer; when negative, it is offset towards the viewer.

polyOffsetUnits Number

Polygon scaling factor. The polygon scaling factor and offset constant together determine the offset of polygon objects in the depth direction of the screen, which can be used to solve the problem of flickering when polygons overlap.