The type of the userData property.
Creates a Shape.
Optional
options: ShapeConstructorOptionsThe constructor options.
Protected
_distanceReadonly
idThe unique identifier of this entity.
Readonly
isRead-only flag to check if a given object is of type Entity.
Readonly
isRead-only flag to check if a given object is of type Entity3D.
Readonly
isReadonly flag to indicate that his object implements MemoryUsage.
Readonly
isReadonly
isThe name of this entity.
Readonly
typeThe name of the type of this object.
Readonly
userAn object that can be used to store custom data about the Entity.
Gets or sets the border width, in pixels.
Gets or sets the clipping planes set on this entity. Default is null
(no clipping planes).
Note: custom entities must ensure that the materials and shaders used do support the clipping plane feature of three.js. Refer to the three.js documentation for more information.
Gets or sets the color of the shape.
Toggle the dash on lines.
The dash size.
Toggles depth test on or off.
The floor elevation for the vertical lines.
Gets or sets the font size, in pixels.
Gets or sets the font weight.
Gets or sets the frozen status of this entity. A frozen entity is still visible but will not be updated automatically.
Useful for debugging purposes.
Gets whether the line is closed.
Note: To close the line, use makeClosed.
Gets or sets the opacity factor of the labels. The final opacity of the label is the product of this value with opacity.
Gets or sets the line width, in pixels.
Gets whether this entity is currently loading data.
Returns the root object of this entity.
Gets or sets the opacity of this entity.
Make labels pickable.
Gets the current loading progress (between 0 and 1).
Note: This property is only meaningful if loading is true
.
Determine if this entity is ready to use.
Gets or sets the render order of this entity.
Toggle the display of floor line.
Toggle the display of floor vertices.
Toggle display of the line.
Toggle the label for the entire line.
Toggle the labels for each segment.
Toggle the display of the surface.
Toggle the surface label.
Toggle the vertex labels.
Toggle the vertical line labels (one label per vertical line).
Toggle the display of vertical distances (distances from each vertex to a defined elevation).
Toggle the display of vertices.
Gets or sets the specific opacity factor of the surface. The final opacity of the surface is the product of this value with opacity.
Gets or sets the radius of the vertices, in pixels.
Gets or sets the visibility of this entity. A non-visible entity will not be automatically updated.
Adds a listener to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
Protected
assignAssigns the render order of this object.
This may be overriden to perform custom logic.
Fire an event type.
The event that gets fired.
Filters what objects need to be updated, based on updatedSources
.
The returned objects are then passed to preUpdate and postUpdate.
Inherited classes should override shouldFullUpdate and shouldUpdate if they need to change this behavior.
Sources that triggered an update
Set of objects to update
Returns the closest point on the line to the specified point.
The point to test.
An object containing the location of the closest point, as well as the index of the first point that makes the segment in which the point was found.
Returns an approximation of the memory used by this object, in bytes.
Returns the point just after the specified index, taking into account closed lines.
The point index.
The location of the next point, if any, otherwise null
.
Note: if the line is not closed, requesting the point after index (n - 1) will return null, but if the line is closed, it will return the point after the first one.
Returns the point just before the specified index, taking into account closed lines.
The point index.
The location of the previous point, if any, otherwise null
.
Note: if the line is not closed, requesting the point before index zero will return null, but if the line is closed, it will return the point before the last one.
Checks if listener is added to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
Inserts a point at the specified index.
The point index.
The position of the point.
Protected
isProtected
notifyApplies entity-level setup on a new object.
Note: this method should be called from the subclassed entity to notify the parent class that a new 3D object has just been created, so that it can be setup with entity-wide parameters.
The object to prepare.
Picks objects from this entity.
Implementations must respect at least limit
and filter
options.
Coordinates on the rendering canvas
Optional
_options: PickOptionsOptions
Target
Method called after Entity.update.
the update context.
the objects that triggered an update step. This is useful to filter out unnecessary updates if no sources are relevant to this entity. For example, if one of the sources is a camera that moved during the previous frame, any entity that depends on the camera's field of view should be updated.
Protected
preprocessAsynchronously preprocess the entity. This method may be overriden to perform any operation that must be done before the entity can be used in the scene, such as fetching metadata about a dataset, etc.
A promise that resolves when the entity is ready to be used.
This method is called just before update()
to filter and select
which elements should be actually updated. For example, in the
case of complex entities made of a hierarchy of elements, the entire
hierarchy may not need to be updated.
Use this method to optimize the update step by reducing the number of elements to process.
Note: if this functions returns nothing, update()
will not be called.
the elements to update during update()
.
Removes a listener from an event type.
The type of the listener that gets removed.
The listener function that gets removed.
Sets the points of the shape.
Optional
points: Vector3[]The points. If null
, all points are removed.
Protected
setupApplies entity-level setup on new object's material.
Subclasses can override this to setup custom logic, for instance if the entity can produce objects that are naturally transparent.
the material of the newly created object
This method is called before update
to check if the MainLoop
should try to update this entity or not. For better performances,
it should return false
if the entity has no impact on the
rendering (e.g. the element is not visible).
The inherited child can completely ignore this value if it makes sense.
true
if should check for update
This method is called at the beginning of the update
step to determine
if we should do a full render of the object. This should be the case if, for
instance, the source is the camera.
You can override this depending on your needs. The inherited child should
not ignore this value, it should do a boolean OR, e.g.:
return super.shouldFullUpdate(updateSource) || this.contains(updateSource);
Source of change
true
if requires a full update of this object
This method is called at the beginning of the update
step to determine
if we should re-render updateSource
.
Not used when shouldFullUpdate
returns true
.
You can override this depending on your needs. The inherited child should
not ignore this value, it should do a boolean OR, e.g.:
return super.shouldUpdate(updateSource) || this.contains(updateSource);
Source of change
true
if requires an update of updateSource
Returns the GeoJSON (in WGS84 coordinates) feature equivalent to this shape.
Optional
options: ShapeExportOptionsReturns the OpenLayers feature (in WGS84 coordinates) equivalent to this shape.
Optional
options: ShapeExportOptionsTraverses all objects in the hierarchy of this entity.
The callback.
The traversal root. If undefined, the traversal starts at the root object of this entity.
Traverses all materials in the hierarchy of this entity.
The callback.
The traversal root. If undefined, the traversal starts at the root object of this entity.
Traverses all meshes in the hierarchy of this entity.
The callback.
The raversal root. If undefined, the traversal starts at the root object of this entity.
Sets the position of an existing point.
The index of the point to update.
The new position of the point.
An entity that displays a geometric shape made of connected vertices.
Shape components
A shape is made of several optional components:
All components can be hidden. In that case the shape displays nothing, even though its visible property is set to
true
.Vertices
Vertices can be displayed for each point of the shape.
Note: vertices do not have to be displayed for the points to be editable.
Main line
The main line is the line that connects the
points
of the shape. This line can form a ring if the shape is closed (with the makeClosed() method).Note: the main line can only be displayed if there are 2 or more vertices.
Surface
If the main line is a ring, the surface can be displayed by toggling showSurface. The surface has the same color as the shape, but its opacity can be changed with surfaceOpacity.
Note: the surface can only be displayed if there are 4 or more vertices (and the first and last vertices must be equal).
Secondary lines
Secondary lines are:
The elevation of the floor can be set with floorElevation.
Floor vertices
Floor vertices are a secondary set of uneditable vertices that connect each main vertex to the floor elevation. They can be toggled with showFloorVertices.
Styling
The shape can be styled with different parameters:
Note: the border color is automatically computed to provide sufficient contrast from the main color.せtぽい
Labels
Labels can be displayed for various areas of the shape:
Label styling
Labels are DOM elements and are styled with three properties:
Label formatting
The text of each label is provided by a Formatter. The formatter either returns a
string
ornull
. Ifnull
, the label is not displayed at all.Formatter examples
To display the parity of the vertex index:
To display the length of segments in feet:
To display the area of the surface in acres:
Hooks
Each operation that modifies the list of the points (updatePoint, removePoint, insertPoint, but not setPoints) triggers two hooks:
The PreHook can be used to cancel the operation by returning
false
.Hooks can be used to enforce constraints. For example to prevent removal of points such that the number of points becomes insufficient to represent a polygon.
PostHooks can be used to update the shape after an operation.
For example, suppose we have a 2-point shape, and we want to ensure that both points have the same elevation (Z coordinate). Whenever a point is moved, we might also want to update the other point.