UNPKG

@nativescript-community/ui-carto

Version:
61 lines 2.31 kB
import { geometryFromArgs, mapPosVectorFromArgs, mapPosVectorVectorFromArgs, nativeColorProperty } from '..'; import { BaseLineVectorElement } from './index.android'; import { BaseVectorElementStyleBuilder } from './index.common'; export class Polygon3DStyleBuilder extends BaseVectorElementStyleBuilder { createNative(options) { return new com.carto.styles.Polygon3DStyleBuilder(); } buildStyle() { if (!this.mBuildStyle) { this.mBuildStyle = this.getNative().buildStyle(); } return this.mBuildStyle; } } __decorate([ nativeColorProperty ], Polygon3DStyleBuilder.prototype, "color", void 0); __decorate([ nativeColorProperty ], Polygon3DStyleBuilder.prototype, "sideColor", void 0); export class Polygon3D extends BaseLineVectorElement { createNative(options) { const style = this.buildStyle(); let result; if (options.positions) { result = new com.carto.vectorelements.Polygon3D(mapPosVectorFromArgs(options.positions, options.ignoreAltitude), style, options.height); } else if (options.geometry) { result = new com.carto.vectorelements.Polygon3D(geometryFromArgs(options.geometry), style, options.height); } if (options.holes) { result.setHoles(mapPosVectorVectorFromArgs(options.holes, options.ignoreAltitude)); } // result['owner'] = new WeakRef(this); return result; } buildStyle() { let style; const styleBuilder = this.options.styleBuilder; if (styleBuilder instanceof com.carto.styles.Polygon3DStyle) { style = styleBuilder; } else if (styleBuilder instanceof Polygon3DStyleBuilder) { style = styleBuilder.buildStyle(); } else if (styleBuilder.hasOwnProperty) { style = new Polygon3DStyleBuilder(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()); } } } //# sourceMappingURL=polygon3d.android.js.map