@nativescript-community/ui-carto
Version:
NativeScript plugin for CARTO Mobile SDK
172 lines • 5.46 kB
JavaScript
import { nativeProperty } from '../index.common';
import { BaseNative } from '../BaseNative';
import { nativeMapToJS } from '../utils';
import { fromNativeMapPos, toNativeMapPos } from '../core';
import { mapPosVectorFromArgs } from '..';
import { BaseVectorElementStyleBuilder } from './index.common';
export { BaseVectorElementStyleBuilder };
export const BillboardOrientation = {
get FACE_CAMERA() {
return 0 /* NTBillboardOrientation.T_BILLBOARD_ORIENTATION_FACE_CAMERA */;
},
get FACE_CAMERA_GROUND() {
return 1 /* NTBillboardOrientation.T_BILLBOARD_ORIENTATION_FACE_CAMERA_GROUND */;
},
get GROUND() {
return 2 /* NTBillboardOrientation.T_BILLBOARD_ORIENTATION_GROUND */;
}
};
export const BillboardScaling = {
get CONST_SCREEN_SIZE() {
return 2 /* NTBillboardScaling.T_BILLBOARD_SCALING_CONST_SCREEN_SIZE */;
},
get SCREEN_SIZE() {
return 1 /* NTBillboardScaling.T_BILLBOARD_SCALING_SCREEN_SIZE */;
},
get WORLD_SIZE() {
return 0 /* NTBillboardScaling.T_BILLBOARD_SCALING_WORLD_SIZE */;
}
};
export class BaseVectorElement extends BaseNative {
createNative(options) {
return null;
}
get metaData() {
if (this.native) {
return nativeMapToJS(this.native.getMetaData());
}
else {
return this.options.metaData;
}
}
set metaData(value) {
this.options.metaData = value;
if (this.native) {
const theMap = NTStringVariantMap.alloc().init();
for (const key in value) {
theMap.setX(key, NTVariant.alloc().initWithString(value[key]));
}
this.native.setMetaData(theMap);
}
}
rebuildStyle() {
this.native.setStyle(this.buildStyle());
}
}
__decorate([
nativeProperty
], BaseVectorElement.prototype, "visible", void 0);
export class BasePointVectorElement extends BaseVectorElement {
get position() {
if (this.native && this.native.getPos) {
const nativePos = this.native.getPos();
return fromNativeMapPos(nativePos);
}
return this.options.position;
}
set position(pos) {
this.options.position = pos;
if (this.native && this.native.setPos) {
this.native.setPos(this.getNativePos(pos, this.projection));
}
}
getNativePos(pos, projection) {
let nativePos;
if (projection) {
nativePos = projection.getNative().fromWgs84(toNativeMapPos(pos));
}
else {
nativePos = toNativeMapPos(pos);
}
return nativePos;
}
}
export class BaseBillboardVectorElement extends BasePointVectorElement {
}
__decorate([
nativeProperty
], BaseBillboardVectorElement.prototype, "rotation", void 0);
export class BaseLineVectorElement extends BaseVectorElement {
get positions() {
// if (this.native && this.native.getPoses) {
// const nativePos = this.native.getPoses();
// if (this.projection) {
// return fromNativeMapPos(this.projection.getNative().toWgs84(nativePos));
// }
// return fromNativeMapPos(nativePos);
// }
return this.options.positions;
}
set positions(positions) {
this.options.positions = positions;
if (this.native && this.native.setPoses) {
this.native.setPoses(mapPosVectorFromArgs(positions, this.options.ignoreAltitude));
}
}
}
export class VectorElement extends BaseVectorElement {
buildStyle() { }
}
export class VectorElementVector extends BaseNative {
constructor() {
super(...arguments);
this.elements = [];
}
createNative() {
const result = NTVectorElementVector.alloc().init();
if (this.elements.length > 0) {
this.elements.forEach((element) => {
result.add(element.getNative());
});
}
return result;
}
size() {
if (this.native) {
return this.native.size();
}
return this.elements.length;
}
getElement(index) {
return this.elements[index] || new VectorElement(undefined, this.native.get(index));
}
add(element) {
this.elements.push(element);
if (this.native) {
this.native.add(element.getNative());
}
}
}
export class BillboardStyleBuilder extends BaseVectorElementStyleBuilder {
createNative(options) {
return null;
}
}
__decorate([
nativeProperty
], BillboardStyleBuilder.prototype, "scaleWithDPI", void 0);
__decorate([
nativeProperty
], BillboardStyleBuilder.prototype, "hideIfOverlapped", void 0);
__decorate([
nativeProperty
], BillboardStyleBuilder.prototype, "horizontalOffset", void 0);
__decorate([
nativeProperty
], BillboardStyleBuilder.prototype, "verticalOffset", void 0);
__decorate([
nativeProperty
], BillboardStyleBuilder.prototype, "animationStyle", void 0);
__decorate([
nativeProperty
], BillboardStyleBuilder.prototype, "placementPriority", void 0);
__decorate([
nativeProperty
], BillboardStyleBuilder.prototype, "causesOverlap", void 0);
__decorate([
nativeProperty
], BillboardStyleBuilder.prototype, "attachAnchorPointX", void 0);
__decorate([
nativeProperty
], BillboardStyleBuilder.prototype, "attachAnchorPointY", void 0);
//# sourceMappingURL=index.ios.js.map