@@ -4,6 +4,7 @@ import { BaseVectorElement, VectorElementVector } from '../vectorelements';
44import { GeometrySimplifier } from '../geometry/simplifier' ;
55import { FeatureCollection } from '../geometry/feature' ;
66import { fromNativeMapBounds } from '../core' ;
7+ import { featureCollectionFromArgs , styleFromArgs } from '..' ;
78
89export abstract class VectorDataSource < T extends com . carto . datasources . VectorDataSource , U extends LocalVectorDataSourceOptions > extends DataSource < T , U > {
910 // createNative(options: U) {
@@ -16,22 +17,20 @@ export class LocalVectorDataSource extends VectorDataSource<com.carto.datasource
1617 }
1718 add ( element : BaseVectorElement < any , any > ) {
1819 // a native element could have been passed
19- const nativeObj = element . getNative ? element . getNative ( ) : element ;
20+ const nativeObj = element . getNative ? element . getNative ( ) : element ;
2021 if ( nativeObj instanceof com . carto . vectorelements . VectorElementVector ) {
2122 this . getNative ( ) . addAll ( nativeObj ) ;
2223 } else {
2324 this . getNative ( ) . add ( nativeObj as com . carto . vectorelements . VectorElement ) ;
24-
2525 }
2626 }
2727 remove ( element : BaseVectorElement < any , any > ) {
2828 // a native element could have been passed
29- const nativeObj = element . getNative ? element . getNative ( ) : element ;
29+ const nativeObj = element . getNative ? element . getNative ( ) : element ;
3030 if ( nativeObj instanceof com . carto . vectorelements . VectorElementVector ) {
3131 this . getNative ( ) . removeAll ( nativeObj ) ;
3232 } else {
3333 this . getNative ( ) . remove ( nativeObj as com . carto . vectorelements . VectorElement ) ;
34-
3534 }
3635 }
3736 addAll ( elements : VectorElementVector ) {
@@ -46,8 +45,8 @@ export class LocalVectorDataSource extends VectorDataSource<com.carto.datasource
4645 clear ( ) {
4746 this . getNative ( ) . clear ( ) ;
4847 }
49- addFeatureCollection ( featureCollection : FeatureCollection , style : com . carto . styles . Style ) {
50- this . getNative ( ) . addFeatureCollection ( featureCollection . getNative ( ) , style ) ;
48+ addFeatureCollection ( featureCollection : FeatureCollection , style : any ) {
49+ this . getNative ( ) . addFeatureCollection ( featureCollectionFromArgs ( featureCollection ) , styleFromArgs ( style ) ) ;
5150 }
5251
5352 getDataExtent ( ) {
0 commit comments