Optional
domThe DOM element to listen to. If unspecified, this will use Instance.domElement.
The Giro3D instance.
Adds a listener to an event type.
The type of event to listen to.
The function that gets called when the event is fired.
Creates a LineString Shape.
Optional
options: CreationOptionsThe options.
A promise that eventually returns the Shape or null
if creation was cancelled.
Creates multiple point Shapes.
Optional
options: CreationOptionsThe options.
A promise that eventually returns the Shape or null
if creation was cancelled.
Creates a single point Shape.
Optional
options: CreationOptionsThe options.
A promise that eventually returns the Shape or null
if creation was cancelled.
Creates a polygon Shape.
Optional
options: CreationOptionsThe options.
A promise that eventually returns the Shape or null
if creation was cancelled.
Create a closed ring Shape.
Optional
options: CreationOptionsThe options.
A promise that eventually returns the Shape or null
if creation was cancelled.
Create a sector Shape.
Optional
options: CreationOptionsThe options.
A promise that eventually returns the Shape or null
if creation was cancelled.
Create a segment (straight line between two points).
Optional
options: CreationOptionsThe options.
A promise that eventually returns the Shape or null
if creation was cancelled.
Starts creating a Shape with the given parameters.
The shape creation options.
A promise that eventually resolves with the created shape, or null
if the creation
was cancelled.
Creates a vertical measure Shape that displays the vertical distance between the start and end point, as well as the angle between the segment formed by those points and the horizontal plane. The shape looks like a right triangle.
Optional
options: CreationOptionsThe options.
A promise that eventually returns the Shape or null
if creation was cancelled.
Fire an event type.
The event that gets fired.
Enter edition mode. In this mode, existing Shapes can be modified (add/remove points, move points).
Optional
options: { The options.
Optional
onThe optional callback called just before a point is clicked, to determine if it can be moved. By default, points are moved with a left click.
Optional
onThe optional callback called just before a point is clicked, to determine if it can be deleted. By default, points are removed with a click on the middle mouse button or Alt + Left click.
Optional
onAn optional callback called when a point has been inserted.
Optional
onAn optional callback called when a point has been removed.
Optional
onAn optional callback called when a point has been updated (i.e moved).
Optional
onThe optional callback to test for mouse or key combination when a segment is clicked. By default, points are inserted with a left click.
Optional
pick?: PickCallbackThe custom picking function. If unspecified, the default one will be used.
Optional
shapesThe shapes to edit. If undefined
or empty, all shapes become editable.
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.
Removes a listener from an event type.
The type of the listener that gets removed.
The listener function that gets removed.
A tool that allows interactive creation and edition of Shapes.
Creation
To create shapes, you can either use one of the preset methods (createSegment, createPolygon...), or start creating a free shape with createShape.
This method allows fine control over the constraints to apply to the shape (how many vertices, styling options, what component to display...).
Edition
The enterEditMode method allows the user to edit any shape that the mouse interacts with. Depending on the constraints put on the shape during the creation (assuming of course that the shape was created with this tool), some operations might not be permitted.
To exit edition mode, call exitEditMode.
Examples of constraints
If a shape was created with the createSegment method, it is not possible to insert or remove points, because the constraint forces the shape to have exactly 2 points.
If a shape was created with the createPolygon method, then any time the user moves the first or last vertex, the other one is automatically moved at the same position, to ensure the shape remains closed.