java.lang.Object | ||
↳ | com.carto.datasources.VectorDataSource | |
↳ | com.carto.datasources.LocalVectorDataSource |
A modifiable vector data source that keeps all the elements in the local memory.
Optionally vector elements can be kept in a spatial index and only the visible elements get rendered.
There can be a small delay before previously invisible elements become visible after view changes.
This makes it suitable for cases where there are a large number of static vector elements.
The draw order of vector elements within the data source is undefined.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
LocalVectorDataSource(Projection projection)
Constructs an LocalVectorDataSource object with no spatial index.
| |||||||||||
LocalVectorDataSource(Projection projection, LocalSpatialIndexType spatialIndexType)
Constructs an LocalVectorDataSource object with specified spatial index.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
add(VectorElement element)
Adds a vector element to the data source.
| ||||||||||
void |
addAll(VectorElementVector elements)
Adds multiple vector elements to the data source.
| ||||||||||
void |
addFeatureCollection(FeatureCollection featureCollection, Style style)
Loads all vector elements from specified feature collection by applying specified style.
| ||||||||||
void |
clear()
Clear the data source by removing all elements.
| ||||||||||
synchronized void | delete() | ||||||||||
VectorElementVector |
getAll()
Returns all vector elements added to this data source using add() and addAll() methods.
| ||||||||||
MapBounds |
getDataExtent()
Returns the extent of the data of this data source.
| ||||||||||
FeatureCollection |
getFeatureCollection()
Returns the elements of this data source as a feature collection.
| ||||||||||
GeometrySimplifier |
getGeometrySimplifier()
Returns the active geometry simplifier of the data source.
| ||||||||||
VectorData |
loadElements(CullState cullState)
Loads all the elements within the defined envelope.
| ||||||||||
boolean |
remove(VectorElement element)
Removes a vector element from the data source.
| ||||||||||
boolean |
removeAll(VectorElementVector elements)
Removes multiple vector elements from the data source.
| ||||||||||
void |
setAll(VectorElementVector elements)
Replaces all vector elements in the data source with the given list of vector elements.
| ||||||||||
void |
setGeometrySimplifier(GeometrySimplifier simplifier)
Attaches geometry simplifier to the data source.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Constructs an LocalVectorDataSource object with no spatial index.
projection | The projection used by this data source. |
---|
Constructs an LocalVectorDataSource object with specified spatial index.
projection | The projection used by this data source. |
---|---|
spatialIndexType | The spatial index type to use. |
Adds a vector element to the data source. The vector element's coordinates are expected to be
in the data source's projection's coordinate system. The order in which the elements are added has
no effect on the order they get rendered.
element | The vector element to be added. |
---|
Adds multiple vector elements to the data source. The vector elements' coordinates are expected to be
in the data source's projection's coordinate system. The order in which the elements are added has
no effect on the order they get rendered.
elements | A list of vector elements to be added. |
---|
Loads all vector elements from specified feature collection by applying specified style.
featureCollection | The feature collection to load elements from. |
---|---|
style | The geometry collection style to use. Only elements compatible with style are created. |
Clear the data source by removing all elements.
Returns all vector elements added to this data source using add() and addAll() methods.
Returns the extent of the data of this data source.
The bounds are in coordinate system of the projection of the data source.
Returns the elements of this data source as a feature collection. The feature collection can be then serialized as a GeoJSON, for example.
Returns the active geometry simplifier of the data source.
Loads all the elements within the defined envelope.
cullState | State for describing view parameters and conservative view envelope. |
---|
Removes a vector element from the data source.
element | The vector element to be removed. |
---|
Removes multiple vector elements from the data source.
elements | A list of vector elements to be removed. |
---|
Replaces all vector elements in the data source with the given list of vector elements.
elements | The list of new vector elements |
---|
Attaches geometry simplifier to the data source. If the specified simplifier is null, detaches any active simplifier.
simplifier | The new geometry simplifier to use (can be null). |
---|