true or false depending on if the instance is stopped or started
A method for adding features to the store. This method will validate the features returning an array of validation results. Features must match one of the modes enabled in the instance.
an array of GeoJSON features
an array of validation results
Removes all data from the current store and ensures any rendered data is cleared from the map.
Provides the ability to programmatically deselect a feature using the instances provided select mode. If not select mode is provided in the instance, an error will be thrown. If the instance is not currently in the select mode, it will switch to it.
the id of the feature to deselect
Returns the next feature id from the store - defaults to UUID4 unless you have set a custom idStrategy. This method can be useful if you are needing creating features outside of the Terra Draw instance but want to add them in to the store.
a id, either number of string based on whatever the configured idStrategy is
Gets the features at a given longitude and latitude. Will return point and linestrings that are a given pixel distance away from the lng/lat and any polygons which contain it.
Optionaloptions: GetFeatureOptionsTakes a given pointer event and will return point and linestrings that are a given pixel distance away from the longitude/latitude, and any polygons which contain it.
Optionaloptions: GetFeatureOptionsA method for getting the current mode name
the current mode name
Get the state of the mode i.e. if we are currently unregistered, registered, drawing etc. This can be used to make decisions based on what the current mode is doing.
the current mode state as a string
Allows the user to get a snapshot (copy) of all given features
An array of all given Feature Geometries in the instances store
Allows the user to get a snapshot (copy) of a given feature by id
A copy of the feature geometry in the instances store
Returns true or false depending on if the Terra Draw instance has a feature with a given id
a boolean determining if the instance has a feature with the given id
Unregisters a Terra Draw event
The name of the event you wish to unregister
The callback you originally provided to the 'on' method
Registers a Terra Draw event
The name of the event you wish to listen for
The callback with you wish to be called when this event occurs
Provides the ability to programmatically select a feature using the instances provided select mode. If not select mode is provided in the instance, an error will be thrown. If the instance is not currently in the select mode, it will switch to it.
the id of the feature to select
A method for setting the current mode by name. Under the hood this will stop the previous mode and start the new one.
The mode name you wish to start
The mode you wish to set a style for
The styles you wish to set for the mode - this is the same as the initialisation style schema
A method starting Terra Draw. It put the instance into a started state, and in registers the passed adapter giving it all the callbacks required to operate.
A method for stopping Terra Draw. Will clear the store, deregister the adapter and remove any rendered layers in the process.
A method for transforming a feature's geometry. This can be used to rotate or scale a feature's geometry. This matches the functionality of the scale and rotate behaviors in the select mode.
the id of the feature to transform
the transformation to apply to the feature's geometry
Updates a features geometry. This an be used to programmatically change the coordinates of a feature. This can be useful for if you want to modify a geometry via a button or some similar user interaction.
the id of the feature to update the geometry for
the new geometry that will replace the existing geometry
Updates a features properties. This can be used to programmatically change the properties of a feature. The update is a shallow merge so only the properties you provide will be updated. Certain internal properties are reserved and cannot be updated.
the id of the feature to update the property for
an object of key value pairs that will be shallowly merged in to the features properties
Allow updating of the current options passed to the mode dynamically after the mode has been started. You can also use this method to update styles as these are passed from the options object.
the mode name you wish to update (the mode name is the public 'mode' property of the mode class)
the options object - this allows partial updating of the modes options (i.e. you do not need to pass the whole options object)
A property used to determine whether the instance is active or not. You can use the start method to set this to true, and stop method to set this to false. This is a read only property.