@nativescript-community/ui-carto
Version:
NativeScript plugin for CARTO Mobile SDK
47 lines • 1.58 kB
JavaScript
import { DataSource } from '.';
import { fromNativeMapBounds } from '../core';
import { featureCollectionFromArgs, styleFromArgs } from '..';
export class VectorDataSource extends DataSource {
}
export class LocalVectorDataSource extends VectorDataSource {
createNative(options) {
return NTLocalVectorDataSource.alloc().initWithProjection(options.projection.getNative());
}
add(element) {
const nativeObj = element.getNative();
if (nativeObj instanceof NTVectorElementVector) {
this.getNative().addAll(nativeObj);
}
else {
this.getNative().add(nativeObj);
}
}
remove(element) {
const nativeObj = element.getNative();
if (nativeObj instanceof NTVectorElementVector) {
this.getNative().removeAll(nativeObj);
}
else {
this.getNative().remove(nativeObj);
}
}
clear() {
this.getNative().clear();
}
addFeatureCollection(featureCollection, style) {
this.getNative().addFeatureCollectionStyle(featureCollectionFromArgs(featureCollection), styleFromArgs(style));
}
addAll(elements) {
this.getNative().addAll(elements.getNative());
}
removeAll(elements) {
this.getNative().removeAll(elements.getNative());
}
setGeometrySimplifier(simplifier) {
this.getNative().setGeometrySimplifier(simplifier.getNative());
}
getDataExtent() {
return fromNativeMapBounds(this.getNative().getDataExtent());
}
}
//# sourceMappingURL=vector.ios.js.map