UNPKG

@nativescript-community/ui-carto

Version:

NativeScript plugin for CARTO Mobile SDK

100 lines 3.2 kB
import { BillboardStyleBuilder } from '.'; import { geometryFromArgs, nativeCartoImageProperty, nativeColorProperty, nativeProperty } from '..'; import { styleBuilderProperty } from './index.common'; import { BaseBillboardVectorElement } from './index.ios'; export class MarkerStyleBuilder extends BillboardStyleBuilder { createNative(options) { return NTMarkerStyleBuilder.alloc().init(); } buildStyle() { if (!this.mBuildStyle) { this.mBuildStyle = this.getNative().buildStyle(); } return this.mBuildStyle; } } __decorate([ nativeProperty ], MarkerStyleBuilder.prototype, "width", void 0); __decorate([ nativeProperty ], MarkerStyleBuilder.prototype, "size", void 0); __decorate([ nativeColorProperty ], MarkerStyleBuilder.prototype, "color", void 0); __decorate([ nativeCartoImageProperty ], MarkerStyleBuilder.prototype, "bitmap", void 0); __decorate([ nativeProperty ], MarkerStyleBuilder.prototype, "clickSize", void 0); __decorate([ nativeProperty ], MarkerStyleBuilder.prototype, "scalingMode", void 0); __decorate([ nativeProperty ], MarkerStyleBuilder.prototype, "orientationMode", void 0); export class Marker extends BaseBillboardVectorElement { createNative(options) { const style = this.buildStyle(); let result; if (options.geometry) { result = NTMarker.alloc().initWithGeometryStyle(geometryFromArgs(options.geometry), style); } else { const nativePos = this.getNativePos(options.position, options.projection); result = NTMarker.alloc().initWithPosStyle(nativePos, style); } return result; } buildStyle() { let style; const styleBuilder = this.options.styleBuilder; if (styleBuilder instanceof NTMarkerStyle) { style = styleBuilder; } else if (styleBuilder instanceof MarkerStyleBuilder) { style = styleBuilder.buildStyle(); } else if (styleBuilder.hasOwnProperty) { style = new MarkerStyleBuilder(styleBuilder).buildStyle(); } return style; } get styleBuilder() { return this.native ? this.native.getStyle() : this.options.styleBuilder; } set styleBuilder(value) { if (this.native && !this.duringInit) { this.options.styleBuilder = value; this.native.setStyle(this.buildStyle()); } } set geometry(geometry) { if (this.native) { this.native.setGeometry(geometryFromArgs(geometry)); } } } __decorate([ styleBuilderProperty ], Marker.prototype, "color", void 0); __decorate([ styleBuilderProperty ], Marker.prototype, "bitmap", void 0); __decorate([ styleBuilderProperty ], Marker.prototype, "size", void 0); __decorate([ styleBuilderProperty ], Marker.prototype, "width", void 0); __decorate([ styleBuilderProperty ], Marker.prototype, "clickSize", void 0); __decorate([ styleBuilderProperty ], Marker.prototype, "anchorPointX", void 0); __decorate([ styleBuilderProperty ], Marker.prototype, "anchorPointY", void 0); //# sourceMappingURL=marker.ios.js.map