Skip to content

Commit e6fa7a6

Browse files
committed
fix: update to latest native SDK
# Conflicts: # src/layers/vector.android.ts # src/layers/vector.ios.ts # src/typings/carto.android.d.ts
1 parent 00daac1 commit e6fa7a6

23 files changed

+13722
-13147
lines changed

src/datasources/cache.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { TileDownloadListener as ITileDownloadListener, MemoryCacheTileDataSourceOptions, PersistentCacheTileDataSourceOptions } from './cache';
22
import { TileDataSource } from '.';
33
import { MapBounds, toNativeMapBounds } from '../core';
4-
import { nativeProperty } from '../index.common';
4+
import { nativeProperty } from '..';
55

66
export class PersistentCacheTileDataSource extends TileDataSource<com.carto.datasources.PersistentCacheTileDataSource, PersistentCacheTileDataSourceOptions> {
77
@nativeProperty capacity: number;

src/datasources/cache.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { MemoryCacheTileDataSourceOptions, PersistentCacheTileDataSourceOptions, TileDownloadListener } from './cache';
22
import { TileDataSource } from '.';
33
import { MapBounds, toNativeMapBounds } from '../core';
4-
import { nativeProperty } from '../index.common';
4+
import { nativeProperty } from '..';
55

66
@NativeClass
77
class NTTileDownloadListenerImpl extends NTTileDownloadListener {

src/datasources/http.android.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { HTTPTileDataSourceOptions } from './http';
22
import { TileDataSource } from '.';
3-
import { nativeProperty } from '../index.common';
3+
import { nativeProperty } from '..';
44

55
export class HTTPTileDataSource extends TileDataSource<com.carto.datasources.HTTPTileDataSource, HTTPTileDataSourceOptions> {
66
@nativeProperty({

src/datasources/http.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { HTTPTileDataSourceOptions } from './http';
22
import { TileDataSource } from '.';
3-
import { nativeProperty } from '../index.common';
3+
import { nativeProperty } from '..';
44

55
export class HTTPTileDataSource extends TileDataSource<NTHTTPTileDataSource, HTTPTileDataSourceOptions> {
66
@nativeProperty({

src/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { FeatureCollection } from './geometry/feature';
66
export abstract class BaseNative<T, U extends {}> extends Observable {
77
options: U;
88
native: T;
9+
10+
duringInit: boolean;
911
constructor(options?: U, native?: T);
1012
initNativeView(native: T, options: U): void;
1113
getNative(): T;

src/layers/index.ios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { BaseLayer } from './index.common';
22
import { LayerOptions, TileLayerOptions } from '.';
3-
import { nativeProperty } from '../index.common';
3+
import { nativeProperty } from '..';
44
import { TileDataSource } from '../datasources';
55
import { Projection } from '../projections';
66

src/layers/vector.android.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { BaseNative } from '..';
2-
import { nativeProperty, nonenumerable } from '../index.common';
2+
import { nativeProperty } from '..';
33
import { fromNativeMapPos, fromNativeScreenPos } from '../core';
44
import { VectorDataSource } from '../datasources/vector';
55
import { Projection } from '../projections';
@@ -16,6 +16,7 @@ import {
1616
VectorTileEventListener as IVectorTileEventListener,
1717
VectorLayerOptions,
1818
VectorTileLayerOptions,
19+
VectorTileRenderOrder as IVectorTileRenderOrder,
1920
} from './vector';
2021
import { Line } from '../vectorelements/line';
2122

@@ -61,15 +62,31 @@ function getGeojsonWriter() {
6162
}
6263

6364
export abstract class BaseVectorTileLayer<T extends com.carto.layers.VectorTileLayer, U extends VectorTileLayerOptions> extends TileLayer<T, U> {
65+
projection?: Projection;
66+
listener?: IVectorTileEventListener;
67+
nListener?: com.akylas.carto.additions.AKVectorTileEventListener;
68+
69+
@nativeProperty layerBlendingSpeed:number
70+
@nativeProperty labelBlendingSpeed:number
71+
@nativeProperty tileCacheCapacity:number
72+
@nativeProperty clickRadius:number
73+
@nativeProperty labelRenderOrder: IVectorTileRenderOrder
74+
@nativeProperty buildingRenderOrder: IVectorTileRenderOrder
75+
constructor(options) {
76+
super(options);
77+
for (const property of ['listener', 'nListener']) {
78+
const descriptor = Object.getOwnPropertyDescriptor(BaseVectorTileLayer.prototype, property);
79+
if (descriptor) {
80+
descriptor.enumerable = false;
81+
}
82+
}
83+
}
6484
setLabelRenderOrder(order: com.carto.layers.VectorTileRenderOrder) {
6585
this.getNative().setLabelRenderOrder(order);
6686
}
6787
setBuildingRenderOrder(order: com.carto.layers.VectorTileRenderOrder) {
6888
this.getNative().setBuildingRenderOrder(order);
6989
}
70-
projection?: Projection;
71-
@nonenumerable listener?: IVectorTileEventListener;
72-
@nonenumerable nListener?: com.akylas.carto.additions.AKVectorTileEventListener;
7390
setVectorTileEventListener(listener: IVectorTileEventListener, projection?: Projection) {
7491
this.listener = listener;
7592
this.projection = projection;
@@ -161,8 +178,8 @@ export class CartoOfflineVectorTileLayer extends TileLayer<com.carto.layers.Cart
161178

162179
export abstract class BaseVectorLayer<T extends com.carto.layers.VectorLayer, U extends VectorLayerOptions> extends Layer<T, U> {
163180
projection?: Projection;
164-
@nonenumerable elementListener?: IVectorElementEventListener;
165-
@nonenumerable nElementListener?: com.akylas.carto.additions.AKVectorElementEventListener;
181+
elementListener?: IVectorElementEventListener;
182+
nElementListener?: com.akylas.carto.additions.AKVectorElementEventListener;
166183
setVectorElementEventListener(listener: IVectorElementEventListener, projection?: Projection) {
167184
this.elementListener = listener;
168185
this.projection = projection;
@@ -242,8 +259,8 @@ export class EditableVectorLayer extends BaseVectorLayer<com.carto.layers.Editab
242259
this.native.setSelectedVectorElement(element instanceof BaseNative ? element.getNative() : element);
243260
}
244261
}
245-
@nonenumerable editListener?: IVectorEditEventListener;
246-
@nonenumerable nEditListener?: com.akylas.carto.additions.AKVectorEditEventListener;
262+
editListener?: IVectorEditEventListener;
263+
nEditListener?: com.akylas.carto.additions.AKVectorEditEventListener;
247264
projection?: Projection;
248265
setVectorEditEventListener(listener: IVectorEditEventListener, projection?: Projection) {
249266
this.editListener = listener;

src/layers/vector.d.ts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,39 @@ export interface VectorLayerOptions extends LayerOptions {
7171
export interface VectorTileLayerOptions extends TileLayerOptions {
7272
dataSource?: TileDataSource<any, any>;
7373
decoder?: VectorTileDecoder;
74+
/**
75+
* Sets the relative layer blending speed.
76+
* Default is 1.0. Use zero or negative values to disable blending.
77+
*/
78+
layerBlendingSpeed?: number;
79+
/**
80+
* Sets the relative label blending speed.
81+
* Default is 1.0. Use zero or negative values to disable blending.
82+
*/
83+
labelBlendingSpeed?: number;
84+
/**
85+
* display order of the labels. Default is VECTOR_TILE_RENDER_ORDER_LAYER
86+
*/
87+
clickRadius?: number;
88+
89+
/**
90+
* the vector tile cache capacity in bytes. Tile cache is the primary storage for vector data,
91+
* all tiles contained within the cache are stored as uncompressed vertex buffers and can immediately be
92+
* drawn to the screen. Setting the cache size too small may cause artifacts, such as disappearing tiles.
93+
* The more tiles are visible on the screen, the larger this cache should be.
94+
* The default is 10MB, which should be enough for most use cases with preloading enabled. If preloading is
95+
* disabled, the cache size should be reduced by the user to conserve memory.
96+
*/
97+
tileCacheCapacity?: number;
98+
/**
99+
* display order of the labels. Default is VECTOR_TILE_RENDER_ORDER_LAYER
100+
*/
101+
labelRenderOrder?: VectorTileRenderOrder;
102+
/**
103+
* Sets the current display order of the buildings.
104+
* Default is VECTOR_TILE_RENDER_ORDER_LAYER.
105+
*/
106+
buildingRenderOrder?: VectorTileRenderOrder;
74107
}
75108

76109
export interface CartoOnlineVectorTileLayerOptions extends VectorTileLayerOptions {
@@ -90,6 +123,42 @@ export interface ClusteredVectorLayerLayerOptions extends VectorTileLayerOptions
90123
}
91124

92125
export abstract class BaseVectorTileLayer<T, U extends TileLayerOptions> extends TileLayer<T, U> {
126+
/**
127+
* Sets the relative layer blending speed.
128+
* Default is 1.0. Use zero or negative values to disable blending.
129+
*/
130+
layerBlendingSpeed: number;
131+
/**
132+
* Sets the relative label blending speed.
133+
* Default is 1.0. Use zero or negative values to disable blending.
134+
*/
135+
labelBlendingSpeed: number;
136+
137+
/**
138+
* Sets the click radius of vector tile features.
139+
* The click radius is applied as an extra buffer to the vector tile features to make clicking on small features less sensitive.
140+
* Units are screen density independent pixels (DP or DIP).
141+
*The default value is 4.
142+
*/
143+
clickRadius: number;
144+
/**
145+
* display order of the labels. Default is VECTOR_TILE_RENDER_ORDER_LAYER
146+
*/
147+
labelRenderOrder: VectorTileRenderOrder;
148+
/**
149+
* Sets the current display order of the buildings.
150+
* Default is VECTOR_TILE_RENDER_ORDER_LAYER.
151+
*/
152+
buildingRenderOrder: VectorTileRenderOrder;
153+
/**
154+
* the vector tile cache capacity in bytes. Tile cache is the primary storage for vector data,
155+
* all tiles contained within the cache are stored as uncompressed vertex buffers and can immediately be
156+
* drawn to the screen. Setting the cache size too small may cause artifacts, such as disappearing tiles.
157+
* The more tiles are visible on the screen, the larger this cache should be.
158+
* The default is 10MB, which should be enough for most use cases with preloading enabled. If preloading is
159+
* disabled, the cache size should be reduced by the user to conserve memory.
160+
*/
161+
tileCacheCapacity: number;
93162
setLabelRenderOrder(order: VectorTileRenderOrder): void;
94163
setBuildingRenderOrder(order: VectorTileRenderOrder);
95164
setVectorTileEventListener<T = DefaultLatLonKeys>(listener: VectorTileEventListener<T>, projection?: Projection): void;

src/layers/vector.ios.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ import {
55
VectorElementEventListener as IVectorElementEventListener,
66
VectorTileEventListener as IVectorTileEventListener,
77
VectorLayerOptions,
8-
VectorTileLayerOptions
8+
VectorTileRenderOrder as IVectorTileRenderOrder,
9+
VectorTileLayerOptions,
910
} from './vector';
1011
import { Layer, TileLayer } from '.';
1112
import { BaseNative } from '..';
1213
import { VectorDataSource } from '../datasources/vector';
1314
import { MBVectorTileDecoder } from '../vectortiles';
14-
import { nativeProperty } from '../index.common';
15+
import { nativeProperty } from '..';
1516
import { fromNativeMapPos } from '../core';
1617
import { Projection } from '../projections';
1718
import { VectorElement } from '../vectorelements';
@@ -148,6 +149,13 @@ export class NTVectorTileEventListenerImpl extends NTVectorTileEventListener {
148149
}
149150

150151
export abstract class BaseVectorTileLayer<T extends NTVectorTileLayer, U extends VectorTileLayerOptions> extends TileLayer<T, U> {
152+
153+
@nativeProperty layerBlendingSpeed:number
154+
@nativeProperty labelBlendingSpeed:number
155+
@nativeProperty tileCacheCapacity:number
156+
@nativeProperty clickRadius:number
157+
@nativeProperty labelRenderOrder: IVectorTileRenderOrder
158+
@nativeProperty buildingRenderOrder: IVectorTileRenderOrder
151159
setLabelRenderOrder(order: NTVectorTileRenderOrder) {
152160
this.getNative().setLabelRenderOrder(order);
153161
}

0 commit comments

Comments
 (0)