UNPKG

@nativescript-community/ui-carto

Version:

NativeScript plugin for CARTO Mobile SDK

105 lines 3.39 kB
import { geometryFromArgs, nativeCartoImageProperty, nativeColorProperty, nativeProperty } from '..'; import { BaseBillboardVectorElement, BillboardStyleBuilder } from './index.android'; import { styleBuilderProperty } from './index.common'; export class MarkerStyleBuilder extends BillboardStyleBuilder { createNative(options) { return new com.carto.styles.MarkerStyleBuilder(); } 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, "anchorPointX", void 0); __decorate([ nativeProperty ], MarkerStyleBuilder.prototype, "anchorPointY", 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 = new com.carto.vectorelements.Marker(geometryFromArgs(options.geometry), style); } else { const nativePos = this.getNativePos(options.position, options.projection); result = new com.carto.vectorelements.Marker(nativePos, style); } return result; } buildStyle() { let style; const styleBuilder = this.options.styleBuilder; if (styleBuilder instanceof com.carto.styles.MarkerStyle) { 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.android.js.map