@nativescript-community/ui-carto
Version:
NativeScript plugin for CARTO Mobile SDK
92 lines • 3.32 kB
JavaScript
import { BaseLayer } from './index.common';
import { nativeProperty } from '..';
import { TileDataSource } from '../datasources';
import { Projection } from '../projections';
export var TileSubstitutionPolicy;
(function (TileSubstitutionPolicy) {
TileSubstitutionPolicy[TileSubstitutionPolicy["TILE_SUBSTITUTION_POLICY_ALL"] = 0] = "TILE_SUBSTITUTION_POLICY_ALL";
TileSubstitutionPolicy[TileSubstitutionPolicy["TILE_SUBSTITUTION_POLICY_VISIBLE"] = 1] = "TILE_SUBSTITUTION_POLICY_VISIBLE";
TileSubstitutionPolicy[TileSubstitutionPolicy["TILE_SUBSTITUTION_POLICY_NONE"] = 2] = "TILE_SUBSTITUTION_POLICY_NONE";
})(TileSubstitutionPolicy || (TileSubstitutionPolicy = {}));
export class Layer extends BaseLayer {
get visibleZoomRange() {
if (this.native) {
const zoomRange = this.native.getVisibleZoomRange();
return [zoomRange.getMin(), zoomRange.getMax()];
}
return this.options.visibleZoomRange;
}
set visibleZoomRange(value) {
this.native && this.native.setVisibleZoomRange(NTMapRange.alloc().initWithMinMax(value[0], value[1]));
}
get minVisibleZoom() {
if (this.native) {
const zoomRange = this.native.getVisibleZoomRange();
return zoomRange.getMin();
}
return this.options.visibleZoomRange?.[0];
}
set minVisibleZoom(value) {
if (this.native) {
const zoomRange = this.native.getVisibleZoomRange();
this.native.setVisibleZoomRange(NTMapRange.alloc().initWithMinMax(value, zoomRange.getMax()));
}
}
get maxVisibleZoom() {
if (this.native) {
const zoomRange = this.native.getVisibleZoomRange();
return zoomRange.getMax();
}
return this.options.visibleZoomRange?.[1];
}
set maxVisibleZoom(value) {
if (this.native) {
const zoomRange = this.native.getVisibleZoomRange();
this.native.setVisibleZoomRange(NTMapRange.alloc().initWithMinMax(zoomRange.getMin(), value));
}
}
refresh() {
this.native && this.native.refresh();
}
}
export class TileLayer extends Layer {
get dataSource() {
if (this.options.dataSource) {
return this.options.dataSource;
}
return new TileDataSource(undefined, this.getNative().getDataSource());
}
set dataSource(value) {
// no op cant change!
}
get projection() {
if (this.options['projection']) {
return this.options['projection'];
}
return new Projection(undefined, this.getNative().getDataSource().getProjection());
}
clearTileCaches(all) {
if (this.native) {
this.native.clearTileCaches(all);
}
}
}
__decorate([
nativeProperty
], TileLayer.prototype, "preloading", void 0);
__decorate([
nativeProperty
], TileLayer.prototype, "synchronizedRefresh", void 0);
__decorate([
nativeProperty
], TileLayer.prototype, "zoomLevelBias", void 0);
__decorate([
nativeProperty
], TileLayer.prototype, "maxOverzoomLevel", void 0);
__decorate([
nativeProperty
], TileLayer.prototype, "maxUnderzoomLevel", void 0);
__decorate([
nativeProperty
], TileLayer.prototype, "tileSubstitutionPolicy", void 0);
//# sourceMappingURL=index.ios.js.map