/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/angular-cesium-ivy@0.0.85/bundles/angular-cesium-ivy.umd.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("geodesy"),require("rxjs/operators"),require("rxjs"),require("primitive-primitives"),require("angular2parse"),require("json-string-mapper"),require("lodash.get")):"function"==typeof define&&define.amd?define("angular-cesium-ivy",["exports","@angular/core","@angular/common","geodesy","rxjs/operators","rxjs","primitive-primitives","angular2parse","json-string-mapper","lodash.get"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self)["angular-cesium-ivy"]={},e.ng.core,e.ng.common,e.geodesy,e.rxjs.operators,e.rxjs,e.primitivePrimitives,e.i1,e.jsonStringMapper,e._get)}(this,(function(e,t,i,n,o,r,s,a,c,l){"use strict";function p(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,n.get?n:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}var d=p(t),u=p(i),h=p(n),f=p(a),g=p(l),y=function(){function e(){this.cesium=Cesium}return e.prototype.createViewer=function(e,t){return t?new this.cesium.Viewer(e,Object.assign({contextOptions:{webgl:{preserveDrawingBuffer:!0}}},t)):new this.cesium.Viewer(e,{contextOptions:{webgl:{preserveDrawingBuffer:!0}}})},e}();y.ɵfac=function(e){return new(e||y)},y.ɵprov=d.ɵɵdefineInjectable({token:y,factory:y.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(y,[{type:t.Injectable}],(function(){return[]}),null);var v=function(){function e(){this.nextViewerOptionsIndex=0,this.nextViewerModifierIndex=0}return Object.defineProperty(e.prototype,"viewerOptions",{get:function(){return this._viewerOptions},set:function(e){this._viewerOptions=e},enumerable:!1,configurable:!0}),e.prototype.getNextViewerOptions=function(){return this._viewerOptions instanceof Array?this._viewerOptions[this.nextViewerOptionsIndex++]:this._viewerOptions},Object.defineProperty(e.prototype,"viewerModifier",{get:function(){return this._viewerModifier},set:function(e){this._viewerModifier=e},enumerable:!1,configurable:!0}),e.prototype.getNextViewerModifier=function(){return this._viewerModifier instanceof Array?this._viewerModifier[this.nextViewerModifierIndex++]:this._viewerModifier},e}();v.ɵfac=function(e){return new(e||v)},v.ɵprov=d.ɵɵdefineInjectable({token:v,factory:v.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(v,[{type:t.Injectable}],null,null);var m,b=function(){function e(e,t,i){this.ngZone=e,this.viewerFactory=t,this.viewerConfiguration=i}return e.prototype.init=function(e,t){var i=this;this.map=t,this.ngZone.runOutsideAngular((function(){var t=i.viewerConfiguration?i.viewerConfiguration.getNextViewerOptions():void 0;i.cesiumViewer=i.viewerFactory.createViewer(e,t);var n=i.viewerConfiguration&&i.viewerConfiguration.getNextViewerModifier();"function"==typeof n&&n(i.cesiumViewer)}))},e.prototype.getViewer=function(){return this.cesiumViewer},e.prototype.getScene=function(){return this.cesiumViewer.scene},e.prototype.getCanvas=function(){return this.cesiumViewer.canvas},e.prototype.getMap=function(){return this.map},e}();b.ɵfac=function(e){return new(e||b)(d.ɵɵinject(d.NgZone),d.ɵɵinject(y),d.ɵɵinject(v,8))},b.ɵprov=d.ɵɵdefineInjectable({token:b,factory:b.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(b,[{type:t.Injectable}],(function(){return[{type:d.NgZone},{type:y},{type:v,decorators:[{type:t.Optional}]}]}),null),e.SceneMode=void 0,(m=e.SceneMode||(e.SceneMode={}))[m.SCENE3D=0]="SCENE3D",m[m.COLUMBUS_VIEW=1]="COLUMBUS_VIEW",m[m.SCENE2D=2]="SCENE2D",m[m.PERFORMANCE_SCENE2D=3]="PERFORMANCE_SCENE2D";var E,P,C=function(){function t(){this.isSceneModePerformance2D=!1}return t.prototype.init=function(e){this.viewer=e.getViewer(),this.scene=e.getScene(),this.screenSpaceCameraController=this.scene.screenSpaceCameraController,this.camera=this.scene.camera,this.lastRotate=this.screenSpaceCameraController.enableRotate,this.lastTilt=this.screenSpaceCameraController.enableTilt,this.lastLook=this.screenSpaceCameraController.enableLook},t.prototype._listenToSceneModeMorph=function(e){this.morphListenerCancelFn=this.scene.morphStart.addEventListener(e)},t.prototype._revertCameraProperties=function(){this.isSceneModePerformance2D=!1,this.enableTilt(this.lastTilt),this.enableRotate(this.lastRotate),this.enableLook(this.lastLook)},t.prototype.getCamera=function(){return this.camera},t.prototype.getScreenSpaceCameraController=function(){return this.screenSpaceCameraController},t.prototype.getMinimumZoom=function(){return this.screenSpaceCameraController.minimumZoomDistance},t.prototype.setMinimumZoom=function(e){this.screenSpaceCameraController.minimumZoomDistance=e},t.prototype.getMaximumZoom=function(){return this.screenSpaceCameraController.maximumZoomDistance},t.prototype.setMaximumZoom=function(e){this.screenSpaceCameraController.maximumZoomDistance=e},t.prototype.enableTilt=function(e){this.screenSpaceCameraController.enableTilt=e},t.prototype.enableRotate=function(e){this.screenSpaceCameraController.enableRotate=e},t.prototype.enableLook=function(e){this.screenSpaceCameraController.enableLook=e},t.prototype.enableTranslate=function(e){this.screenSpaceCameraController.enableTranslate=e},t.prototype.enableZoom=function(e){this.screenSpaceCameraController.enableZoom=e},t.prototype.enableInputs=function(e){this.screenSpaceCameraController.enableInputs=e},t.prototype.setSceneMode=function(i,n){var o=this;switch(i){case e.SceneMode.SCENE3D:this.isSceneModePerformance2D&&this._revertCameraProperties(),this.scene.morphTo3D(n);break;case e.SceneMode.COLUMBUS_VIEW:this.isSceneModePerformance2D&&this._revertCameraProperties(),this.scene.morphToColumbusView(n);break;case e.SceneMode.SCENE2D:this.isSceneModePerformance2D&&this._revertCameraProperties(),this.scene.morphTo2D(n);break;case e.SceneMode.PERFORMANCE_SCENE2D:this.isSceneModePerformance2D=!0,this.lastLook=this.screenSpaceCameraController.enableLook,this.lastTilt=this.screenSpaceCameraController.enableTilt,this.lastRotate=this.screenSpaceCameraController.enableRotate,this.screenSpaceCameraController.enableTilt=!1,this.screenSpaceCameraController.enableRotate=!1,this.screenSpaceCameraController.enableLook=!1,this.morphListenerCancelFn&&this.morphListenerCancelFn(),this.scene.morphToColumbusView(n);var r=this.scene.morphComplete.addEventListener((function(){o.camera.setView({destination:Cesium.Cartesian3.fromDegrees(0,0,Math.min(t.PERFORMANCE_2D_ALTITUDE,o.getMaximumZoom())),orientation:{pitch:Cesium.Math.toRadians(-90)}}),r(),o._listenToSceneModeMorph(o._revertCameraProperties.bind(o))}))}},t.prototype.cameraFlyTo=function(e){return this.camera.flyTo(e)},t.prototype.flyTo=function(e,t){return this.viewer.flyTo(e,t)},t.prototype.zoomIn=function(e){return this.camera.zoomIn(e||this.camera.defaultZoomAmount)},t.prototype.zoomOut=function(e){return this.camera.zoomOut(e||this.camera.defaultZoomAmount)},t.prototype.zoomTo=function(e,t){return this.viewer.zoomTo(e,t)},t.prototype.setView=function(e){this.camera.setView(e)},t.prototype.setRotation=function(e){this.setView({orientation:{heading:e}})},t.prototype.lockRotation=function(e){this.scene.screenSpaceCameraController.enableRotate=!e},t.prototype.trackEntity=function(e,t){var i=this,n=t&&t.flyTo||!1;return this.viewer.trackedEntity=void 0,new Promise((function(o){if(n){var r=t&&t.flyToDuration||1,s=t&&t.altitude||1e4,a=e.position.getValue(Cesium.JulianDate.now()),c=Cesium.Cartographic.fromCartesian(a),l=s-c.height;c.height=s;var p=Cesium.Cartesian3.fromRadians(c.longitude,c.latitude,c.height);i.cameraFlyTo({duration:r,destination:p,complete:function(){i.viewer.trackedEntity=e,setTimeout((function(){l>0?i.camera.zoomOut(l):i.camera.zoomIn(l)}),0),o()}})}else i.viewer.trackedEntity=e,o()}))},t.prototype.untrackEntity=function(){this.trackEntity()},t}();C.PERFORMANCE_2D_ALTITUDE=25e6,C.ɵfac=function(e){return new(e||C)},C.ɵprov=d.ɵɵdefineInjectable({token:C,factory:C.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(C,[{type:t.Injectable}],(function(){return[]}),null),e.CesiumEvent=void 0,(E=e.CesiumEvent||(e.CesiumEvent={}))[E.MOUSE_MOVE=Cesium.ScreenSpaceEventType.MOUSE_MOVE]="MOUSE_MOVE",E[E.LEFT_CLICK=Cesium.ScreenSpaceEventType.LEFT_CLICK]="LEFT_CLICK",E[E.LEFT_DOUBLE_CLICK=Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK]="LEFT_DOUBLE_CLICK",E[E.LEFT_DOWN=Cesium.ScreenSpaceEventType.LEFT_DOWN]="LEFT_DOWN",E[E.LEFT_UP=Cesium.ScreenSpaceEventType.LEFT_UP]="LEFT_UP",E[E.MIDDLE_CLICK=Cesium.ScreenSpaceEventType.MIDDLE_CLICK]="MIDDLE_CLICK",E[E.MIDDLE_DOUBLE_CLICK=Cesium.ScreenSpaceEventType.MIDDLE_DOUBLE_CLICK]="MIDDLE_DOUBLE_CLICK",E[E.MIDDLE_DOWN=Cesium.ScreenSpaceEventType.MIDDLE_DOWN]="MIDDLE_DOWN",E[E.MIDDLE_UP=Cesium.ScreenSpaceEventType.MIDDLE_UP]="MIDDLE_UP",E[E.PINCH_START=Cesium.ScreenSpaceEventType.PINCH_START]="PINCH_START",E[E.PINCH_END=Cesium.ScreenSpaceEventType.PINCH_END]="PINCH_END",E[E.PINCH_MOVE=Cesium.ScreenSpaceEventType.PINCH_MOVE]="PINCH_MOVE",E[E.RIGHT_CLICK=Cesium.ScreenSpaceEventType.RIGHT_CLICK]="RIGHT_CLICK",E[E.RIGHT_DOUBLE_CLICK=Cesium.ScreenSpaceEventType.RIGHT_DOUBLE_CLICK]="RIGHT_DOUBLE_CLICK",E[E.RIGHT_DOWN=Cesium.ScreenSpaceEventType.RIGHT_DOWN]="RIGHT_DOWN",E[E.RIGHT_UP=Cesium.ScreenSpaceEventType.RIGHT_UP]="RIGHT_UP",E[E.WHEEL=Cesium.ScreenSpaceEventType.WHEEL]="WHEEL",E[E.LONG_LEFT_PRESS=110]="LONG_LEFT_PRESS",E[E.LONG_RIGHT_PRESS=111]="LONG_RIGHT_PRESS",E[E.LONG_MIDDLE_PRESS=112]="LONG_MIDDLE_PRESS",E[E.LEFT_CLICK_DRAG=113]="LEFT_CLICK_DRAG",E[E.RIGHT_CLICK_DRAG=114]="RIGHT_CLICK_DRAG",E[E.MIDDLE_CLICK_DRAG=115]="MIDDLE_CLICK_DRAG",e.PickOptions=void 0,(P=e.PickOptions||(e.PickOptions={}))[P.NO_PICK=0]="NO_PICK",P[P.PICK_FIRST=1]="PICK_FIRST",P[P.PICK_ONE=2]="PICK_ONE",P[P.PICK_ALL=3]="PICK_ALL";var M=function(){function i(){this._showContextMenu=!1,this._contextMenuChangeNotifier=new t.EventEmitter,this._onOpen=new t.EventEmitter,this._onClose=new t.EventEmitter,this._defaultContextMenuOptions={closeOnLeftCLick:!0,closeOnLeftClickPriority:10}}return Object.defineProperty(i.prototype,"contextMenuChangeNotifier",{get:function(){return this._contextMenuChangeNotifier},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"showContextMenu",{get:function(){return this._showContextMenu},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"options",{get:function(){return this._options},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"position",{get:function(){return this._position},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"content",{get:function(){return this._content},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"onOpen",{get:function(){return this._onOpen},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"onClose",{get:function(){return this._onClose},enumerable:!1,configurable:!0}),i.prototype.init=function(e){this.mapEventsManager=e},i.prototype.open=function(t,i,n){var o=this;void 0===n&&(n={}),this.close(),this._content=t,this._position=i,this._options=Object.assign({},this._defaultContextMenuOptions,n),this._showContextMenu=!0,this.mapEventsManager&&this._options.closeOnLeftCLick&&(this.leftClickRegistration=this.mapEventsManager.register({event:e.CesiumEvent.LEFT_CLICK,pick:e.PickOptions.NO_PICK,priority:this._options.closeOnLeftClickPriority}),this.leftClickSubscription=this.leftClickRegistration.subscribe((function(){o.leftClickSubscription.unsubscribe(),o.close()}))),this._contextMenuChangeNotifier.emit(),this._onOpen.emit()},i.prototype.close=function(){this._content=void 0,this._position=void 0,this._options=void 0,this._showContextMenu=!1,this.leftClickRegistration&&(this.leftClickRegistration.dispose(),this.leftClickRegistration=void 0),this.leftClickSubscription&&(this.leftClickSubscription.unsubscribe(),this.leftClickSubscription=void 0),this._contextMenuChangeNotifier.emit(),this._onClose.emit()},i}();M.ɵfac=function(e){return new(e||M)},M.ɵprov=d.ɵɵdefineInjectable({token:M,factory:M.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(M,[{type:t.Injectable}],null,null);var I=h.LatLonVectors;window.geodesy=h;var D=function(){function e(e){this.cesiumService=e}return e.cartesian3ToLatLon=function(e,t){var i=Cesium.Cartographic.fromCartesian(e,t);return{lon:Cesium.Math.toDegrees(i.longitude),lat:Cesium.Math.toDegrees(i.latitude),height:i.height}},e.prototype.screenToCartesian3=function(e,t){if(this.cesiumService){var i=Object.assign({},e);if(t){var n=this.cesiumService.getViewer().canvas.getBoundingClientRect();i.x+=n.left,i.y+=n.top}return this.cesiumService.getViewer().camera.pickEllipsoid(i)}throw new Error("ANGULAR2-CESIUM - Cesium service should be provided in order to do screen position calculations")},e.prototype.screenToCartographic=function(e,t){return this.cartesian3ToCartographic(this.screenToCartesian3(e),t)},e.prototype.cartesian3ToCartographic=function(e,t){return Cesium.Cartographic.fromCartesian(e,t)},e.prototype.degreesToCartographic=function(e,t,i){return Cesium.Cartographic.fromDegrees(e,t,i)},e.prototype.radiansToCartographic=function(e,t,i){return Cesium.Cartographic.fromRadians(e,t,i)},e.prototype.degreesToUTM=function(e,t){return new n.LatLonEllipsoidal(t,e).toUtm()},e.prototype.UTMToDegrees=function(e,t,i,o){return this.geodesyToCesiumObject(new n.Utm(e,t,i,o).toLatLonE())},e.prototype.geodesyToCesiumObject=function(e){return{longitude:e.lon,latitude:e.lat,height:e.height?e.height:0}},e.prototype.midPointToCartesian3=function(e,t){var i=function(e){return Cesium.Math.toDegrees(e)},n=new I(i(e.latitude),i(e.longitude)),o=new I(i(t.latitude),i(t.longitude)),r=n.midpointTo(o);return Cesium.Cartesian3.fromDegrees(r.lon,r.lat)},e.prototype.middlePointByScreen=function(e,t){var i=this.cesiumService.getScene(),n=Cesium.SceneTransforms.wgs84ToWindowCoordinates(i,e),o=Cesium.SceneTransforms.wgs84ToWindowCoordinates(i,t),r=new Cesium.Cartesian2((o.x+n.x)/2,(o.y+n.y)/2);return i.pickPosition(r)},e.prototype.bearingTo=function(e,t){var i=function(e){return Cesium.Math.toDegrees(e)},n=new I(i(e.latitude),i(e.longitude)),o=new I(i(t.latitude),i(t.longitude));return n.bearingTo(o)},e.prototype.bearingToCartesian=function(e,t){var i=Cesium.Cartographic.fromCartesian(e),n=Cesium.Cartographic.fromCartesian(t);return this.bearingTo(i,n)},e}();D.ɵfac=function(e){return new(e||D)(d.ɵɵinject(b,8))},D.ɵprov=d.ɵɵdefineInjectable({token:D,factory:D.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(D,[{type:t.Injectable}],(function(){return[{type:b,decorators:[{type:t.Optional}]}]}),null);var _=function(e,t){return _=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},_(e,t)};function S(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}_(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}Object.create;function T(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var n,o,r=i.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(n=r.next()).done;)s.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(o)throw o.error}}return s}function O(e,t,i){if(i||2===arguments.length)for(var n,o=0,r=t.length;o<r;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}Object.create;"function"==typeof SuppressedError&&SuppressedError;var w=function(){function e(){}return e.prototype.setPropsAssigner=function(e){this._propsAssigner=e},e}(),A=function(e){function t(t,i){var n=e.call(this)||this;return n.drawerType=t,n.cesiumService=i,n._show=!0,n}return S(t,e),t.prototype.init=function(){var e=this.cesiumService.getScene();this._cesiumCollection=new this.drawerType({scene:e}),this._primitiveCollectionWrap=new Cesium.PrimitiveCollection,this._primitiveCollectionWrap.add(this._cesiumCollection),e.primitives.add(this._primitiveCollectionWrap)},t.prototype.add=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return this._cesiumCollection.add(e)},t.prototype.update=function(e,t){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];this._propsAssigner?this._propsAssigner(e,t):Object.assign(e,t)},t.prototype.remove=function(e){this._cesiumCollection.remove(e)},t.prototype.removeAll=function(){this._cesiumCollection.removeAll()},t.prototype.setShow=function(e){this._show=e,this._primitiveCollectionWrap.show=e},t.prototype.getShow=function(){return this._show},t}(w),L=function(){function e(e){this.cesiumService=e}return e.pointByLocationDistanceAndAzimuth=function(t,i,n,o){for(var r,s,a=i/Cesium.Ellipsoid.WGS84.maximumRadius,c=t instanceof Cesium.Cartesian3?Cesium.Cartographic.fromCartesian(t):t,l=t instanceof Cesium.Cartesian3?t:Cesium.Cartesian3.fromRadians(t.longitude,t.latitude,t.height),p=0,d=.1,u=-.1;0===p||p<16&&Math.max(s,i)/Math.min(s,i)>1.000001;){var h=u+(d-u)/2;r=e._pointByLocationDistanceAndAzimuth(c,a*(1+h),n),(s=this.distance(l,r))>i?d=u+(d-u)/2:u+=(d-u)/2,p++}return r},e._pointByLocationDistanceAndAzimuth=function(e,t,i){var n=e.latitude,o=e.longitude,r=Math.asin(Math.sin(n)*Math.cos(t)+Math.cos(n)*Math.sin(t)*Math.cos(i)),s=o+Math.atan2(Math.sin(i)*Math.sin(t)*Math.cos(n),Math.cos(t)-Math.sin(n)*Math.sin(r));return s=(s+3*Math.PI)%(2*Math.PI)-Math.PI,Cesium.Cartesian3.fromRadians(s,r)},e.distance=function(e,t){return Cesium.Cartesian3.distance(e,t)},e.getPositionsDelta=function(e,t){return{x:t.x-e.x,y:t.y-e.y,z:t.z-e.z}},e.addDeltaToPosition=function(e,t,i){if(void 0===i&&(i=!1),i){e.x+=t.x,e.y+=t.y,e.z+=t.z,(o=Cesium.Cartographic.fromCartesian(e)).height=0;var n=Cesium.Cartesian3.fromRadians(o.longitude,o.latitude,o.height);return e.x=n.x,e.y=n.y,e.z=n.z,e}var o;n=new Cesium.Cartesian3(e.x+t.x,e.y+t.y,e.z+t.z);return(o=Cesium.Cartographic.fromCartesian(n)).height=0,Cesium.Cartesian3.fromRadians(o.longitude,o.latitude,o.height)},e.middleCartesian3Point=function(e,t){return new Cesium.Cartesian3(t.x-e.x/2,t.y-e.y/2,t.z-e.z/2)},e.prototype.screenPositionToCartesian3=function(e){return this.cesiumService.getViewer().camera.pickEllipsoid(e)},e}();L.ɵfac=function(e){return new(e||L)(d.ɵɵinject(b))},L.ɵprov=d.ɵɵdefineInjectable({token:L,factory:L.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(L,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var R,j=function(e){function t(t){return e.call(this,Cesium.PolylineCollection,t)||this}return S(t,e),t.prototype._calculateArcPositions=function(e){for(var t=e.quality||18,i=e.delta/t,n=[],o=0;o<t+1;++o){var r=L.pointByLocationDistanceAndAzimuth(e.center,e.radius,e.angle+i*o,!0);n.push(r)}return n},t.prototype._calculateTriangle=function(e){return[e.center,L.pointByLocationDistanceAndAzimuth(e.center,e.radius,e.angle,!0)]},t.prototype._calculateArc=function(e){var t=this._calculateArcPositions(e);return e.drawEdges?t.concat(this._calculateTriangle(e)):t},t.prototype.add=function(e){if(e.positions=this._calculateArc(e),e.color){var t=Cesium.Material.fromType("Color");t.uniforms.color=e.color,e.material=t}return this._cesiumCollection.add(e)},t.prototype.update=function(e,t){return t.constantColor||!t.color||e.material.uniforms.color.equals(t.color)||(e.material.uniforms.color=t.color),e.width=void 0!==t.width?t.width:e.width,e.show=void 0!==t.show?t.show:e.show,e.distanceDisplayCondition=void 0!==t.distanceDisplayCondition?t.distanceDisplayCondition:e.distanceDisplayCondition,e.positions=this._calculateArc(t),e},t}(A);j.ɵfac=function(e){return new(e||j)(d.ɵɵinject(b))},j.ɵprov=d.ɵɵdefineInjectable({token:j,factory:j.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(j,[{type:t.Injectable}],(function(){return[{type:b}]}),null),function(e){e[e.ellipse=Cesium.EllipseGraphics]="ellipse",e[e.ellipsoid=Cesium.EllipsoidGraphics]="ellipsoid",e[e.polygon=Cesium.PolygonGraphics]="polygon",e[e.polyline=Cesium.PolylineGraphics]="polyline",e[e.polylineVolume=Cesium.PolylineVolumeGraphics]="polylineVolume",e[e.box=Cesium.BoxGraphics]="box",e[e.corridor=Cesium.CorridorGraphics]="corridor",e[e.cylinder=Cesium.CylinderGraphics]="cylinder",e[e.label=Cesium.LabelGraphics]="label",e[e.billboard=Cesium.BillboardGraphics]="billboard",e[e.model=Cesium.ModelGraphics]="model",e[e.path=Cesium.PathGraphics]="path",e[e.point=Cesium.PointGraphics]="point",e[e.rectangle=Cesium.RectangleGraphics]="rectangle",e[e.wall=Cesium.WallGraphics]="wall"}(R||(R={}));var x=function(){function e(e,t,i){void 0===t&&(t=-1),void 0===i&&(i=-1),this.entityCollection=e,this._isSuspended=!1,this._isHardSuspend=!1,this._updateRate=i,this._collectionSize=t}return e.prototype.setShow=function(e){this.entityCollection.show=e},Object.defineProperty(e.prototype,"isSuspended",{get:function(){return this._isSuspended},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateRate",{get:function(){return this._updateRate},set:function(e){this._updateRate=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"collectionSize",{get:function(){return this._collectionSize},set:function(e){this._collectionSize=e},enumerable:!1,configurable:!0}),e.prototype.collection=function(){return this.entityCollection},e.prototype.isFree=function(){return this._collectionSize<1||this.entityCollection.values.length<this._collectionSize},e.prototype.add=function(e){return this.suspend(),this.entityCollection.add(e)},e.prototype.remove=function(e){return this.suspend(),this.entityCollection.remove(e)},e.prototype.removeNoSuspend=function(e){this.entityCollection.remove(e)},e.prototype.removeAll=function(){this.suspend(),this.entityCollection.removeAll()},e.prototype.onEventSuspension=function(e,t){var i=this;return void 0===t&&(t=!1),this._onEventSuspensionCallback={callback:e,once:t},function(){i._onEventSuspensionCallback=void 0}},e.prototype.onEventResume=function(e,t){var i=this;return void 0===t&&(t=!1),this._onEventResumeCallback={callback:e,once:t},this._isSuspended||this.triggerEventResume(),function(){i._onEventResumeCallback=void 0}},e.prototype.triggerEventSuspension=function(){if(void 0!==this._onEventSuspensionCallback){var e=this._onEventSuspensionCallback.callback;this._onEventSuspensionCallback.once&&(this._onEventSuspensionCallback=void 0),e()}},e.prototype.triggerEventResume=function(){if(void 0!==this._onEventResumeCallback){var e=this._onEventResumeCallback.callback;this._onEventResumeCallback.once&&(this._onEventResumeCallback=void 0),e()}},e.prototype.suspend=function(){var e=this;this._updateRate<0||this._isHardSuspend||this._isSuspended||(this._isSuspended=!0,this.entityCollection.suspendEvents(),this.triggerEventSuspension(),this._suspensionTimeout=setTimeout((function(){e.entityCollection.resumeEvents(),e.triggerEventResume(),e._isSuspended=!1,e._suspensionTimeout=void 0}),this._updateRate))},e.prototype.hardSuspend=function(){this.entityCollection.suspendEvents(),this._isHardSuspend=!0},e.prototype.hardResume=function(){this.entityCollection.resumeEvents(),this._isHardSuspend=!1},e}(),k=function(e){function t(t,i,n){void 0===n&&(n={collectionMaxSize:-1,collectionSuspensionTime:-1,collectionsNumber:1});var o=e.call(this)||this;for(var r in o.cesiumService=t,o.graphicsType=i,o.defaultOptions=n,o.entityCollections=new Map,o.graphicsTypeName=R[o.graphicsType],R)R[r]===o.graphicsType&&(o.graphicsTypeName=r);return o}return S(t,e),t.prototype.getFreeEntitiesCollection=function(){var e=null;return this.entityCollections.forEach((function(t){t.isFree()&&(e=t)})),e},t.prototype.init=function(e){for(var t=e||this.defaultOptions,i=[],n=0;n<t.collectionsNumber;n++){var o=new Cesium.CustomDataSource(this.graphicsTypeName);i.push(o),this.cesiumService.getViewer().dataSources.add(o),this.entityCollections.set(o.entities,new x(o.entities,t.collectionMaxSize,t.collectionSuspensionTime))}return i},t.prototype.add=function(e){var t,i=this.getFreeEntitiesCollection();if(null===i)throw new Error("No more free entity collections");var n=((t={position:void 0!==e.position?e.position:void 0,description:void 0!==e.description?e.description:void 0,orientation:void 0!==e.orientation?e.orientation:void 0,viewFrom:void 0!==e.viewFrom?e.viewFrom:void 0})[this.graphicsTypeName]=e,t);return void 0!==e.name&&(n.name=e.name),void 0!==e.availability&&(n.availability=e.availability),i.add(n)},t.prototype.update=function(e,t){this.suspendEntityCollection(e),e.position instanceof Cesium.CallbackProperty&&e.position._isConstant&&(e.position=t.position),e.position=void 0!==t.position?t.position:void 0,e.name=void 0!==t.name?t.name:e.name,e.description=void 0!==t.description?t.description:e.description,e.orientation=void 0!==t.orientation?t.orientation:e.orientation,e.viewFrom=void 0!==t.viewFrom?t.viewFrom:e.viewFrom,e.availability=(t.availability,t.availability),this._propsAssigner?this._propsAssigner(e[this.graphicsTypeName],t):Object.assign(e[this.graphicsTypeName],t)},t.prototype.remove=function(e){this.entityCollections.get(e.entityCollection).remove(e)},t.prototype.removeAll=function(){this.entityCollections.forEach((function(e){e.removeAll()}))},t.prototype.setShow=function(e){this.entityCollections.forEach((function(t){t.setShow(e)}))},t.prototype.suspendEntityCollection=function(e){var t=e.entityCollection;if(!this.entityCollections.has(t))throw new Error("No EntityCollection for entity.entityCollection");this.entityCollections.get(t).suspend()},t}(w),F=function(e){function t(t){return e.call(this,t,R.billboard)||this}return S(t,e),t}(k);F.ɵfac=function(e){return new(e||F)(d.ɵɵinject(b))},F.ɵprov=d.ɵɵdefineInjectable({token:F,factory:F.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(F,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var N=function(e){function t(t){var i=e.call(this)||this;return i.cesiumService=t,i}return S(t,e),t.prototype.init=function(e){var t=[];return this.czmlStream=new Cesium.CzmlDataSource("czml"),t.push(this.czmlStream),this.cesiumService.getViewer().dataSources.add(this.czmlStream),t},t.prototype.add=function(e){return this.czmlStream.process(e.czmlPacket),e},t.prototype.update=function(e,t){this.czmlStream.process(t.czmlPacket)},t.prototype.remove=function(e){this.czmlStream.entities.removeById(e.acEntity.id)},t.prototype.removeAll=function(){this.czmlStream.entities.removeAll()},t.prototype.setShow=function(e){this.czmlStream.entities.show=e},t}(w);N.ɵfac=function(e){return new(e||N)(d.ɵɵinject(b))},N.ɵprov=d.ɵɵdefineInjectable({token:N,factory:N.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(N,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var H=function(e){function t(t){return e.call(this,t,R.ellipse)||this}return S(t,e),t}(k);H.ɵfac=function(e){return new(e||H)(d.ɵɵinject(b))},H.ɵprov=d.ɵɵdefineInjectable({token:H,factory:H.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(H,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var B=function(e){function t(t){return e.call(this,t,R.label)||this}return S(t,e),t}(k);B.ɵfac=function(e){return new(e||B)(d.ɵɵinject(b))},B.ɵprov=d.ɵɵdefineInjectable({token:B,factory:B.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(B,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var V=function(e){function t(t){return e.call(this,t,R.point)||this}return S(t,e),t}(k);V.ɵfac=function(e){return new(e||V)(d.ɵɵinject(b))},V.ɵprov=d.ɵɵdefineInjectable({token:V,factory:V.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(V,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var G=function(e){function t(t){return e.call(this,t,R.polygon)||this}return S(t,e),t}(k);G.ɵfac=function(e){return new(e||G)(d.ɵɵinject(b))},G.ɵprov=d.ɵɵdefineInjectable({token:G,factory:G.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(G,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var U=function(e){function t(t){return e.call(this,t,R.polyline)||this}return S(t,e),t}(k);U.ɵfac=function(e){return new(e||U)(d.ɵɵinject(b))},U.ɵprov=d.ɵɵdefineInjectable({token:U,factory:U.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(U,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var z,W,K=function(e){function t(t){return e.call(this,Cesium.PolylineCollection,t)||this}return S(t,e),t.prototype.add=function(e){return this._cesiumCollection.add(this.withColorMaterial(e))},t.prototype.update=function(t,i){i.material instanceof Cesium.Color&&(t.material&&t.material.uniforms&&t.material.uniforms.color instanceof Cesium.Color?this.withColorMaterial(i):t.material.uniforms.color.equals(i.material)||(t.material.uniforms.color=i.material)),e.prototype.update.call(this,t,i)},t.prototype.withColorMaterial=function(e){if(e.material instanceof Cesium.Color){var t=Cesium.Material.fromType("Color");t.uniforms.color=e.material,e.material=t}return e},t}(A);K.ɵfac=function(e){return new(e||K)(d.ɵɵinject(b))},K.ɵprov=d.ɵɵdefineInjectable({token:K,factory:K.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(K,[{type:t.Injectable}],(function(){return[{type:b}]}),null),e.KeyboardAction=void 0,(z=e.KeyboardAction||(e.KeyboardAction={}))[z.CAMERA_FORWARD=0]="CAMERA_FORWARD",z[z.CAMERA_BACKWARD=1]="CAMERA_BACKWARD",z[z.CAMERA_RIGHT=2]="CAMERA_RIGHT",z[z.CAMERA_LEFT=3]="CAMERA_LEFT",z[z.CAMERA_UP=4]="CAMERA_UP",z[z.CAMERA_DOWN=5]="CAMERA_DOWN",z[z.CAMERA_LOOK_RIGHT=6]="CAMERA_LOOK_RIGHT",z[z.CAMERA_LOOK_LEFT=7]="CAMERA_LOOK_LEFT",z[z.CAMERA_LOOK_UP=8]="CAMERA_LOOK_UP",z[z.CAMERA_LOOK_DOWN=9]="CAMERA_LOOK_DOWN",z[z.CAMERA_TWIST_RIGHT=10]="CAMERA_TWIST_RIGHT",z[z.CAMERA_TWIST_LEFT=11]="CAMERA_TWIST_LEFT",z[z.CAMERA_ROTATE_RIGHT=12]="CAMERA_ROTATE_RIGHT",z[z.CAMERA_ROTATE_LEFT=13]="CAMERA_ROTATE_LEFT",z[z.CAMERA_ROTATE_UP=14]="CAMERA_ROTATE_UP",z[z.CAMERA_ROTATE_DOWN=15]="CAMERA_ROTATE_DOWN",z[z.CAMERA_ZOOM_IN=16]="CAMERA_ZOOM_IN",z[z.CAMERA_ZOOM_OUT=17]="CAMERA_ZOOM_OUT";var $,Q=100,Y=.01,q=.01,Z=((W={})[e.KeyboardAction.CAMERA_FORWARD]=function(e,t){var i=e.getViewer().camera,n=e.getScene().globe.ellipsoid.cartesianToCartographic(i.position).height/(t.moveRate||Q);i.moveForward(n)},W[e.KeyboardAction.CAMERA_BACKWARD]=function(e,t){var i=e.getViewer().camera,n=e.getScene().globe.ellipsoid.cartesianToCartographic(i.position).height/(t.moveRate||Q);i.moveBackward(n)},W[e.KeyboardAction.CAMERA_UP]=function(e,t){var i=e.getViewer().camera,n=e.getScene().globe.ellipsoid.cartesianToCartographic(i.position).height/(t.moveRate||Q);i.moveUp(n)},W[e.KeyboardAction.CAMERA_DOWN]=function(e,t){var i=e.getViewer().camera,n=e.getScene().globe.ellipsoid.cartesianToCartographic(i.position).height/(t.moveRate||Q);i.moveDown(n)},W[e.KeyboardAction.CAMERA_RIGHT]=function(e,t){var i=e.getViewer().camera,n=e.getScene().globe.ellipsoid.cartesianToCartographic(i.position).height/(t.moveRate||Q);i.moveRight(n)},W[e.KeyboardAction.CAMERA_LEFT]=function(e,t){var i=e.getViewer().camera,n=e.getScene().globe.ellipsoid.cartesianToCartographic(i.position).height/(t.moveRate||Q);i.moveLeft(n)},W[e.KeyboardAction.CAMERA_LOOK_RIGHT]=function(e,t){var i=e.getViewer().camera,n=i.positionCartographic,o=t.lookFactor||Y;i.lookRight(n.latitude*o)},W[e.KeyboardAction.CAMERA_LOOK_LEFT]=function(e,t){var i=e.getViewer().camera,n=i.positionCartographic,o=t.lookFactor||Y;i.lookLeft(n.latitude*o)},W[e.KeyboardAction.CAMERA_LOOK_UP]=function(e,t){var i=e.getViewer().camera,n=i.positionCartographic,o=t.lookFactor||Y;i.lookUp(n.longitude*(-1*o))},W[e.KeyboardAction.CAMERA_LOOK_DOWN]=function(e,t){var i=e.getViewer().camera,n=i.positionCartographic,o=t.lookFactor||Y;i.lookDown(n.longitude*(-1*o))},W[e.KeyboardAction.CAMERA_TWIST_RIGHT]=function(e,t){var i=e.getViewer().camera,n=t.amount||.01;i.twistRight(n)},W[e.KeyboardAction.CAMERA_TWIST_LEFT]=function(e,t){var i=e.getViewer().camera,n=t.amount||.01;i.twistLeft(n)},W[e.KeyboardAction.CAMERA_ROTATE_RIGHT]=function(e,t){var i=e.getViewer().camera,n=t.angle||q;i.rotateRight(n)},W[e.KeyboardAction.CAMERA_ROTATE_LEFT]=function(e,t){var i=e.getViewer().camera,n=t.angle||q;i.rotateLeft(n)},W[e.KeyboardAction.CAMERA_ROTATE_UP]=function(e,t){var i=e.getViewer().camera,n=t.angle||q;i.rotateUp(n)},W[e.KeyboardAction.CAMERA_ROTATE_DOWN]=function(e,t){var i=e.getViewer().camera,n=t.angle||q;i.rotateDown(n)},W[e.KeyboardAction.CAMERA_ZOOM_IN]=function(e,t){var i=e.getViewer().camera,n=t.amount;i.zoomIn(n)},W[e.KeyboardAction.CAMERA_ZOOM_OUT]=function(e,t){var i=e.getViewer().camera,n=t.amount;i.zoomOut(n)},W);!function(e){e[e.IGNORED=0]="IGNORED",e[e.NOT_PRESSED=1]="NOT_PRESSED",e[e.PRESSED=2]="PRESSED"}($||($={}));var X=function(){function e(e,t,i){this.ngZone=e,this.cesiumService=t,this.document=i,this._currentDefinitions=null,this._activeDefinitions={},this._keyMappingFn=this.defaultKeyMappingFn}return e.prototype.init=function(){var e=this.cesiumService.getCanvas();e.addEventListener("click",(function(){e.focus()})),this.handleKeydown=this.handleKeydown.bind(this),this.handleKeyup=this.handleKeyup.bind(this),this.handleTick=this.handleTick.bind(this)},e.prototype.setKeyboardControls=function(e,t,i){var n=this;if(void 0===i&&(i=!1),!e)return this.removeKeyboardControls();this._currentDefinitions||this.registerEvents(i),this._currentDefinitions=e,this._keyMappingFn=t||this.defaultKeyMappingFn,Object.keys(this._currentDefinitions).forEach((function(e){n._activeDefinitions[e]={state:$.NOT_PRESSED,action:null,keyboardEvent:null}}))},e.prototype.removeKeyboardControls=function(){this.unregisterEvents(),this._currentDefinitions=null},e.prototype.getAction=function(e){return this._currentDefinitions[e]||null},e.prototype.defaultKeyMappingFn=function(e){return String.fromCharCode(e.keyCode)},e.prototype.handleKeydown=function(e){var t=this._keyMappingFn(e),i=this.getAction(t);if(i&&this._activeDefinitions[t].state!==$.IGNORED){var n=!0,o=this.getParams(i.params,e);i.validation&&(n=i.validation(this.cesiumService,o,e)),!0===n&&(this._activeDefinitions[t]={state:$.PRESSED,action:i,keyboardEvent:e})}},e.prototype.handleKeyup=function(e){var t=this._keyMappingFn(e),i=this.getAction(t);i&&(this._activeDefinitions[t]={state:$.NOT_PRESSED,action:null,keyboardEvent:e},i.done&&"function"==typeof i.done&&i.done(this.cesiumService,e))},e.prototype.handleTick=function(){var e=this;Object.keys(this._activeDefinitions).forEach((function(t){var i=e._activeDefinitions[t];null!==i&&null!==i.action&&i.state===$.PRESSED&&e.executeAction(i.action,t,i.keyboardEvent)}))},e.prototype.getParams=function(e,t){return e?"function"==typeof e?e(this.cesiumService,t):e:{}},e.prototype.executeAction=function(e,t,i){if(this._currentDefinitions){var n=this.getParams(e.params,i);if("number"==typeof e.action){var o=Z[e.action];o&&o(this.cesiumService,n,i)}else if("function"==typeof e.action){!1===e.action(this.cesiumService,n,i)&&(this._activeDefinitions[t]={state:$.IGNORED,action:null,keyboardEvent:null})}}},e.prototype.registerEvents=function(e){var t=this,i=function(){t.document.addEventListener("keydown",t.handleKeydown),t.document.addEventListener("keyup",t.handleKeyup),t.cesiumService.getViewer().clock.onTick.addEventListener(t.handleTick)};e?this.ngZone.runOutsideAngular(i):i()},e.prototype.unregisterEvents=function(){this.document.removeEventListener("keydown",this.handleKeydown),this.document.removeEventListener("keyup",this.handleKeyup),this.cesiumService.getViewer().clock.onTick.removeEventListener(this.handleTick)},e}();X.ɵfac=function(e){return new(e||X)(d.ɵɵinject(d.NgZone),d.ɵɵinject(b),d.ɵɵinject(i.DOCUMENT))},X.ɵprov=d.ɵɵdefineInjectable({token:X,factory:X.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(X,[{type:t.Injectable}],(function(){return[{type:d.NgZone},{type:b},{type:void 0,decorators:[{type:t.Inject,args:[i.DOCUMENT]}]}]}),null);var J=function(){function e(e,t){this.event=e,this.modifier=t}return e.prototype.init=function(e){var t=this;return this.observer=r.Observable.create((function(i){e.setInputAction((function(e){e.position&&(e.startPosition=e.position,e.endPosition=e.position),i.next(e)}),t.event,t.modifier)})),this.observer},e}(),ee=function(t){function i(e,i,n){var o=t.call(this,e,i)||this;return o.event=e,o.modifier=i,o.eventFactory=n,o}return S(i,t),i.prototype.init=function(){var t,n;this.event===e.CesiumEvent.LONG_LEFT_PRESS?(t=e.CesiumEvent.LEFT_DOWN,n=e.CesiumEvent.LEFT_UP):this.event===e.CesiumEvent.LONG_RIGHT_PRESS?(t=e.CesiumEvent.RIGHT_DOWN,n=e.CesiumEvent.RIGHT_UP):this.event===e.CesiumEvent.LONG_MIDDLE_PRESS&&(t=e.CesiumEvent.MIDDLE_DOWN,n=e.CesiumEvent.MIDDLE_UP);var s=null,a=this.eventFactory.get(t,this.modifier).pipe(o.tap((function(e){return s=e.endPosition}))),c=this.eventFactory.get(e.CesiumEvent.MOUSE_MOVE).pipe(o.filter((function(e){return Math.abs(e.endPosition.x-s.x)>i.LONG_PRESS_EVENTS_MIN_DISTANCE_PX||Math.abs(e.endPosition.y-s.y)>i.LONG_PRESS_EVENTS_MIN_DISTANCE_PX}))),l=r.merge(this.eventFactory.get(n,this.modifier),c);return o.publish()(a.pipe(o.mergeMap((function(e){return r.of(e).pipe(o.delay(i.LONG_PRESS_EVENTS_DURATION),o.takeUntil(l))}))))},i}(J);ee.LONG_PRESS_EVENTS_DURATION=250,ee.LONG_PRESS_EVENTS_MIN_DISTANCE_PX=10;var te=function(){function e(e){this.cesiumService=e,this.cesiumEventsObservables=new Map}return e.getEventFullName=function(e,t){return t?e+"_"+t:e.toString()},e.prototype.init=function(){this.eventsHandler=this.cesiumService.getViewer().screenSpaceEventHandler},e.prototype.get=function(t,i){var n=e.getEventFullName(t,i);if(this.cesiumEventsObservables.has(n))return this.cesiumEventsObservables.get(n);var o=this.createCesiumEventObservable(t,i);return this.cesiumEventsObservables.set(n,o),o},e.prototype.createCesiumEventObservable=function(t,i){var n;return(n=e.longPressEvents.has(t)?this.createSpecialCesiumEventObservable(t,i):o.publish()(new J(t,i).init(this.eventsHandler))).connect(),n},e.prototype.createSpecialCesiumEventObservable=function(e,t){return new ee(e,t,this).init()},e}();te.longPressEvents=new Set([e.CesiumEvent.LONG_LEFT_PRESS,e.CesiumEvent.LONG_RIGHT_PRESS,e.CesiumEvent.LONG_MIDDLE_PRESS]),te.ɵfac=function(e){return new(e||te)(d.ɵɵinject(b))},te.ɵprov=d.ɵɵdefineInjectable({token:te,factory:te.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(te,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var ie=function(e){return e.reduce((function(e,t){return e.indexOf(t)<0&&e.push(t),e}),[])},ne=function(){function t(){}return t.getDragEventTypes=function(t){var i,n;return t===e.CesiumEvent.LEFT_CLICK_DRAG?(i=e.CesiumEvent.LEFT_DOWN,n=e.CesiumEvent.LEFT_UP):t===e.CesiumEvent.RIGHT_CLICK_DRAG?(i=e.CesiumEvent.RIGHT_DOWN,n=e.CesiumEvent.RIGHT_UP):t===e.CesiumEvent.MIDDLE_CLICK_DRAG&&(i=e.CesiumEvent.MIDDLE_DOWN,n=e.CesiumEvent.MIDDLE_UP),{mouseDownEvent:i,mouseUpEvent:n}},t}();ne.dragEvents=new Set([e.CesiumEvent.LEFT_CLICK_DRAG,e.CesiumEvent.RIGHT_CLICK_DRAG,e.CesiumEvent.MIDDLE_CLICK_DRAG]);var oe=function(){function e(){this._entitesToPlonter=[],this._plonterChangeNotifier=new t.EventEmitter,this._plonterObserver=new r.Subject}return Object.defineProperty(e.prototype,"plonterChangeNotifier",{get:function(){return this._plonterChangeNotifier},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"plonterShown",{get:function(){return this._plonterShown},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"entitesToPlonter",{get:function(){return this._entitesToPlonter},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"plonterClickPosition",{get:function(){return this._eventResult.movement},enumerable:!1,configurable:!0}),e.prototype.plonterIt=function(e){return this._eventResult=e,this._entitesToPlonter=e.entities,this._plonterShown=!0,this._plonterChangeNotifier.emit(),this._plonterObserver},e.prototype.resolvePlonter=function(e){this._plonterShown=!1,this._eventResult.entities=[e],this._plonterChangeNotifier.emit(),this._plonterObserver.next(this._eventResult)},e}();oe.ɵfac=function(e){return new(e||oe)},oe.ɵprov=d.ɵɵdefineInjectable({token:oe,factory:oe.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(oe,[{type:t.Injectable}],(function(){return[]}),null);var re=function(e,t,i,n){this.observable=e,this.stopper=t,this.priority=i,this.isPaused=n},se=function(){function t(e,t,i){this.cesiumService=e,this.eventBuilder=t,this.plonterService=i,this.eventRegistrations=new Map}return t.prototype.init=function(){this.eventBuilder.init(),this.scene=this.cesiumService.getScene()},t.prototype.register=function(t){var i=this;if(void 0===this.scene)throw new Error("CesiumService has not been initialized yet - MapEventsManagerService must be injected  under ac-map");if(t.pick=t.pick||e.PickOptions.NO_PICK,t.priority=t.priority||0,t.pickConfig=t.pickConfig||{},t.entityType&&t.pick===e.PickOptions.NO_PICK)throw new Error("MapEventsManagerService: can't register an event with entityType and PickOptions.NO_PICK - It doesn't make sense ");var n=te.getEventFullName(t.event,t.modifier);this.eventRegistrations.has(n)||this.eventRegistrations.set(n,[]);var o=this.createEventRegistration(t),r=o.observable;return r.dispose=function(){return i.disposeObservable(o,n)},this.eventRegistrations.get(n).push(o),this.sortRegistrationsByPriority(n),r},t.prototype.disposeObservable=function(e,t){e.stopper.next(1);var i=this.eventRegistrations.get(t),n=i.indexOf(e);-1!==n&&i.splice(n,1),this.sortRegistrationsByPriority(t)},t.prototype.sortRegistrationsByPriority=function(e){var t=this.eventRegistrations.get(e);if(t.sort((function(e,t){return t.priority-e.priority})),0!==t.length){var i=t[0].priority;t.forEach((function(e){e.isPaused=e.priority<i}))}},t.prototype.createEventRegistration=function(e){var t,i=this,n=e.event,s=e.modifier,a=e.entityType,c=e.pick,l=e.priority,p=e.pickFilter,d=e.pickConfig,u=this.eventBuilder.get(n,s),h=new r.Subject,f=new re(void 0,h,l,!1);return t=ne.dragEvents.has(n)?this.createDragEvent({event:n,modifier:s,entityType:a,pick:c,priority:l,pickFilter:p,pickConfig:d}).pipe(o.takeUntil(h)):u.pipe(o.filter((function(){return!f.isPaused})),o.map((function(e){return i.triggerPick(e,c,d)})),o.filter((function(e){return null!==e.cesiumEntities||void 0===a})),o.map((function(e){return i.addEntities(e,a,c,p)})),o.filter((function(e){return null!==e.entities||void 0===a&&!p})),o.switchMap((function(e){return i.plonter(e,c)})),o.takeUntil(h)),f.observable=t,f},t.prototype.createDragEvent=function(t){var i=t.event,n=t.modifier,s=t.entityType,a=t.pick,c=t.priority,l=t.pickFilter,p=t.pickConfig,d=ne.getDragEventTypes(i),u=d.mouseDownEvent,h=d.mouseUpEvent,f=this.eventBuilder.get(h),g=this.eventBuilder.get(e.CesiumEvent.MOUSE_MOVE),y=this.createEventRegistration({event:u,modifier:n,entityType:s,pick:a,priority:c,pickFilter:l,pickConfig:p}),v=new r.Subject,m=y.observable.pipe(o.mergeMap((function(e){var t=null,i=e.movement.startPosition.x,n=e.movement.startPosition.y;return g.pipe(o.map((function(o){return t={movement:{drop:!1,startPosition:{x:i,y:n},endPosition:o.endPosition},entities:e.entities,cesiumEntities:e.cesiumEntities}})),o.takeUntil(f),o.tap({complete:function(){if(t){var e=Object.assign({},t);e.movement.drop=!0,v.next(e)}}}))})));return r.merge(m,v)},t.prototype.triggerPick=function(t,i,n){var o=[];switch(i){case e.PickOptions.PICK_ONE:case e.PickOptions.PICK_ALL:o=0===(o=this.scene.drillPick(t.endPosition,n.drillPickLimit,n.pickWidth,n.pickHeight)).length?null:o;break;case e.PickOptions.PICK_FIRST:var r=this.scene.pick(t.endPosition,n.pickWidth,n.pickHeight);o=void 0===r?null:[r];case e.PickOptions.NO_PICK:}return o&&(o=o.map((function(e){return e.id&&e.id instanceof Cesium.Entity?e.id:e.primitive}))),{movement:t,cesiumEntities:o}},t.prototype.addEntities=function(t,i,n,o){if(null===t.cesiumEntities)return t.entities=null,t;var r=[];return n!==e.PickOptions.NO_PICK&&(r=i?t.cesiumEntities.map((function(e){return e.acEntity})).filter((function(e){return e&&e instanceof i})):t.cesiumEntities.map((function(e){return e.acEntity})),r=ie(r),0===(r=o&&r?r.filter(o):r).length&&(r=null)),t.entities=r,t},t.prototype.plonter=function(t,i){return i===e.PickOptions.PICK_ONE&&null!==t.entities&&t.entities.length>1?this.plonterService.plonterIt(t):r.of(t)},t}();se.ɵfac=function(e){return new(e||se)(d.ɵɵinject(b),d.ɵɵinject(te),d.ɵɵinject(oe))},se.ɵprov=d.ɵɵdefineInjectable({token:se,factory:se.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(se,[{type:t.Injectable}],(function(){return[{type:b},{type:te},{type:oe}]}),null);var ae=function(){function e(e){this.cesiumService=e,this.layersDataSources=[]}return e.prototype.registerLayerDataSources=function(e,t){var i=this;e.forEach((function(e){e.zIndex=t,i.layersDataSources.push(e)}))},e.prototype.drawAllLayers=function(){var e=this;this.layersDataSources.sort((function(e,t){return e.zIndex-t.zIndex})),this.layersDataSources.forEach((function(t){e.cesiumService.getViewer().dataSources.add(t)}))},e.prototype.updateAndRefresh=function(e,t){var i=this;e&&e.length&&(e.forEach((function(e){var n=i.layersDataSources.indexOf(e);-1!==n&&(i.layersDataSources[n].zIndex=t)})),this.cesiumService.getViewer().dataSources.removeAll(),this.drawAllLayers())},e.prototype.removeDataSources=function(e){var t=this;e.forEach((function(e){var i=t.layersDataSources.indexOf(e);-1!==i&&(t.layersDataSources.splice(i,1),t.cesiumService.getViewer().dataSources.remove(e,!0))}))},e}();ae.ɵfac=function(e){return new(e||ae)(d.ɵɵinject(b))},ae.ɵprov=d.ɵɵdefineInjectable({token:ae,factory:ae.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ae,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var ce=function(){function e(e){this.cesiumService=e}return e.prototype.getMapScreenshotDataUrlBase64=function(){return this.cesiumService.getCanvas().toDataURL()},e.prototype.downloadMapScreenshot=function(e){void 0===e&&(e="map.png");var t=this.getMapScreenshotDataUrlBase64();this.downloadURI(t,e)},e.prototype.downloadURI=function(e,t){var i=document.createElement("a");i.download=t,i.href=e,document.body.appendChild(i),i.click(),document.body.removeChild(i)},e}();ce.ɵfac=function(e){return new(e||ce)(d.ɵɵinject(b))},ce.ɵprov=d.ɵɵdefineInjectable({token:ce,factory:ce.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ce,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var le=function(){function e(){this.defaultIdCounter=0,this._Maps=new Map,this.eventRemoveCallbacks=[]}return e.prototype.getMap=function(e){return e?this._Maps.get(e):this.firstMap},e.prototype._registerMap=function(e,t){this.firstMap||(this.firstMap=t);var i=e||this.generateDefaultId();if(this._Maps.has(i))throw new Error("Map with id: "+i+" already exist");return this._Maps.set(i,t),i},e.prototype._removeMapById=function(e){return this._Maps.delete(e)},e.prototype.generateDefaultId=function(){return this.defaultIdCounter++,"default-map-id-"+this.defaultIdCounter},e.prototype.sync2DMapsCameras=function(e){var t=this;this.unsyncMapsCameras();var i=e.map((function(e){var i=t.getMap(e.id);if(!i)throw new Error("Couldn't find map with id: "+e.id);return{map:i,options:{sensitivity:e.sensitivity,bindZoom:e.bindZoom}}}));i.forEach((function(e){var n=e.map,o=e.options,r=n.getCameraService().getCamera(),s=r.positionCartographic;r.percentageChanged=o.sensitivity||.01;var a=r.changed.addEventListener((function(){i.forEach((function(e){var t=e.map,i=e.options;if(t!==n){var o=t.getCameraService().getCamera(),r=o.positionCartographic,a=Cesium.Ellipsoid.WGS84.cartographicToCartesian({longitude:s.longitude,latitude:s.latitude,height:i.bindZoom?s.height:r.height});t.getCesiumViewer().scene.mode!==Cesium.SceneMode.MORPHING&&o.setView({destination:a,orientation:{heading:o.heading,pitch:o.pitch}})}}))}));t.eventRemoveCallbacks.push(a)}))},e.prototype.unsyncMapsCameras=function(){this.eventRemoveCallbacks.forEach((function(e){return e()})),this.eventRemoveCallbacks=[]},e}();le.ɵfac=function(e){return new(e||le)},le.ɵprov=d.ɵɵdefineInjectable({token:le,factory:le.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(le,[{type:t.Injectable}],(function(){return[]}),null);var pe=Cesium.AssociativeArray,de=Cesium.Color,ue=Cesium.ColorGeometryInstanceAttribute,he=Cesium.defined,fe=Cesium.DistanceDisplayCondition,ge=Cesium.DistanceDisplayConditionGeometryInstanceAttribute,ye=Cesium.ShowGeometryInstanceAttribute,ve=Cesium.Primitive,me=Cesium.ShadowMode,be=Cesium.BoundingSphereState,Ee=Cesium.ColorMaterialProperty,Pe=Cesium.MaterialProperty,Ce=Cesium.Property,Me=new de,Ie=new fe,De=new fe;function _e(e,t,i,n,o,r,s){var a;this.translucent=t,this.appearanceType=i,this.depthFailAppearanceType=n,this.depthFailMaterialProperty=o,this.depthFailMaterial=void 0,this.closed=r,this.shadows=s,this.primitives=e,this.createPrimitive=!1,this.waitingOnCreate=!1,this.primitive=void 0,this.oldPrimitive=void 0,this.geometry=new pe,this.updaters=new pe,this.updatersWithAttributes=new pe,this.attributes=new pe,this.subscriptions=new pe,this.showsUpdated=new pe,this.itemsToRemove=[],this.invalidated=!1,he(o)&&(a=o.definitionChanged.addEventListener(_e.prototype.onMaterialChanged,this)),this.removeMaterialSubscription=a}_e.prototype.onMaterialChanged=function(){this.invalidated=!0},_e.prototype.isMaterial=function(e){var t=this.depthFailMaterialProperty,i=e.depthFailMaterialProperty;return i===t||!!he(t)&&t.equals(i)},_e.prototype.add=function(e,t){var i=e.id;if(this.createPrimitive=!0,this.geometry.set(i,t),this.updaters.set(i,e),e.hasConstantFill&&e.fillMaterialProperty.isConstant&&Ce.isConstant(e.distanceDisplayConditionProperty)){var n=this;this.subscriptions.set(i,e.entity.definitionChanged.addEventListener((function(t,i,o,r){"isShowing"===i&&n.showsUpdated.set(e.id,e)})))}else this.updatersWithAttributes.set(i,e)},_e.prototype.remove=function(e){var t=e.id;if(this.createPrimitive=this.geometry.remove(t)||this.createPrimitive,this.updaters.remove(t)){this.updatersWithAttributes.remove(t);var i=this.subscriptions.get(t);he(i)&&(i(),this.subscriptions.remove(t))}},_e.prototype.update=function(e){var t,i,n=!0,o=0,r=this.primitive,s=this.primitives;if(this.createPrimitive){var a=this.geometry.values,c=a.length;if(c>0){for(he(r)&&(he(this.oldPrimitive)?s.remove(r):this.oldPrimitive=r),i=0;i<c;i++){var l=a[i],p=l.attributes;t=this.attributes.get(l.id.id),he(t)&&(he(p.show)&&(p.show.value=t.show),he(p.color)&&(p.color.value=t.color),he(p.depthFailColor)&&(p.depthFailColor.value=t.depthFailColor))}var d;he(this.depthFailAppearanceType)&&(he(this.depthFailMaterialProperty)&&(this.depthFailMaterial=Pe.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial)),d=new this.depthFailAppearanceType({material:this.depthFailMaterial,translucent:this.translucent,closed:this.closed})),r=new ve({show:!1,asynchronous:!0,geometryInstances:a,appearance:new this.appearanceType({flat:this.shadows===me.DISABLED||this.shadows===me.CAST_ONLY,translucent:this.translucent,closed:this.closed}),depthFailAppearance:d,shadows:this.shadows}),s.add(r),n=!1}else{he(r)&&(s.remove(r),r=void 0);var u=this.oldPrimitive;he(u)&&(s.remove(u),this.oldPrimitive=void 0)}this.attributes.removeAll(),this.primitive=r,this.createPrimitive=!1,this.waitingOnCreate=!0}else if(he(r)&&r.ready){r.show=!0,he(this.oldPrimitive)&&(s.remove(this.oldPrimitive),this.oldPrimitive=void 0),!he(this.depthFailAppearanceType)||this.depthFailMaterialProperty instanceof Ee||(this.depthFailMaterial=Pe.getValue(e,this.depthFailMaterialProperty,this.depthFailMaterial),this.primitive.depthFailAppearance.material=this.depthFailMaterial);var h=this.updatersWithAttributes.values,f=h.length,g=this.waitingOnCreate;for(i=0;i<f;i++){var y=h[i],v=this.geometry.get(y.id);if(t=this.attributes.get(v.id.id),he(t)||(t=r.getGeometryInstanceAttributes(v.id),this.attributes.set(v.id.id,t)),!y.fillMaterialProperty.isConstant||g){var m=y.fillMaterialProperty.color,b=Ce.getValueOrDefault(m,e,de.WHITE,Me);de.equals(t._lastColor,b)||(t._lastColor=de.clone(b,t._lastColor),t.color=ue.toValue(b,t.color),(this.translucent&&255===t.color[3]||!this.translucent&&255!==t.color[3])&&(this.itemsToRemove[o++]=y))}if(he(this.depthFailAppearanceType)&&y.depthFailMaterialProperty instanceof Ee&&(!y.depthFailMaterialProperty.isConstant||g)){var E=y.depthFailMaterialProperty.color,P=Ce.getValueOrDefault(E,e,de.WHITE,Me);de.equals(t._lastDepthFailColor,P)||(t._lastDepthFailColor=de.clone(P,t._lastDepthFailColor),t.depthFailColor=ue.toValue(P,t.depthFailColor))}var C=y.entity.isShowing&&(y.hasConstantFill||y.isFilled(e));C!==(1===t.show[0])&&(t.show=ye.toValue(C,t.show));var M=y.distanceDisplayConditionProperty;if(!Ce.isConstant(M)){var I=Ce.getValueOrDefault(M,e,De,Ie);fe.equals(I,t._lastDistanceDisplayCondition)||(t._lastDistanceDisplayCondition=fe.clone(I,t._lastDistanceDisplayCondition),t.distanceDisplayCondition=ge.toValue(I,t.distanceDisplayCondition))}}this.updateShows(r),this.waitingOnCreate=!1}else he(r)&&!r.ready&&(n=!1);return this.itemsToRemove.length=o,n},_e.prototype.updateShows=function(e){for(var t=this.showsUpdated.values,i=t.length,n=0;n<i;n++){var o=t[n],r=this.geometry.get(o.id),s=this.attributes.get(r.id.id);he(s)||(s=e.getGeometryInstanceAttributes(r.id),this.attributes.set(r.id.id,s));var a=o.entity.isShowing;a!==(1===s.show[0])&&(s.show=ye.toValue(a,s.show))}this.showsUpdated.removeAll()},_e.prototype.contains=function(e){return this.updaters.contains(e.id)},_e.prototype.getBoundingSphere=function(e,t){var i=this.primitive;if(!i.ready)return be.PENDING;var n=i.getGeometryInstanceAttributes(e.entity);return!he(n)||!he(n.boundingSphere)||he(n.show)&&0===n.show[0]?be.FAILED:(n.boundingSphere.clone(t),be.DONE)},_e.prototype.removeAllPrimitives=function(){var e=this.primitives,t=this.primitive;he(t)&&(e.remove(t),this.primitive=void 0,this.geometry.removeAll(),this.updaters.removeAll());var i=this.oldPrimitive;he(i)&&(e.remove(i),this.oldPrimitive=void 0)},_e.prototype.destroy=function(){var e=this.primitive,t=this.primitives;he(e)&&t.remove(e);var i=this.oldPrimitive;he(i)&&t.remove(i),he(this.removeMaterialSubscription)&&this.removeMaterialSubscription()};var Se=!1;var Te=new t.InjectionToken("ANGULAR_CESIUM_CONFIG"),Oe=function(e){this.config=e,!1!==(!e||e.fixEntitiesShadows)&&(Se||(Cesium.StaticGeometryColorBatch.prototype.add=function(e,t){var i,n,o=t.createFillGeometryInstance(e);255===o.attributes.color.value[3]?(i=this._solidItems,n=!1):(i=this._translucentItems,n=!0);for(var r=i.length,s=0;s<r;s++){var a=i[s];if(a.isMaterial(t))return void a.add(t,o)}var c=new _e(this._primitives,n,this._appearanceType,this._depthFailAppearanceType,t.depthFailMaterialProperty,this._closed,this._shadows);c.add(t,o),i.push(c)},Se=!0))};function we(e,t){1&e&&d.ɵɵelement(0,"ac-default-plonter")}Oe.ɵfac=function(e){return new(e||Oe)(d.ɵɵinject(Te,8))},Oe.ɵprov=d.ɵɵdefineInjectable({token:Oe,factory:Oe.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Oe,[{type:t.Injectable}],(function(){return[{type:void 0,decorators:[{type:t.Optional},{type:t.Inject,args:[Te]}]}]}),null);var Ae=function(){function e(e,t,i,n,o,r,s,a,c,l,p,d,u,h,f,g,y,v,m,b){this._cesiumService=e,this._cameraService=t,this._elemRef=i,this.document=n,this.mapsManagerService=o,this.billboardDrawerService=r,this.labelDrawerService=s,this.ellipseDrawerService=a,this.polylineDrawerService=c,this.polygonDrawerService=l,this.arcDrawerService=p,this.pointDrawerService=d,this.czmlDrawerService=u,this.mapEventsManager=h,this.keyboardControlService=f,this.mapLayersService=g,this.configurationService=y,this.screenshotService=v,this.contextMenuService=m,this.coordinateConverter=b,this.disableDefaultPlonter=!1,this.mapContainer=this.document.createElement("div"),this.mapContainer.style.width="100%",this.mapContainer.style.height="100%",this.mapContainer.className="map-container",this._cesiumService.init(this.mapContainer,this),this._cameraService.init(this._cesiumService),this.mapEventsManager.init(),this.billboardDrawerService.init(),this.labelDrawerService.init(),this.ellipseDrawerService.init(),this.polylineDrawerService.init(),this.polygonDrawerService.init(),this.arcDrawerService.init(),this.pointDrawerService.init(),this.czmlDrawerService.init(),this.keyboardControlService.init(),this.contextMenuService.init(this.mapEventsManager)}return e.prototype.ngOnInit=function(){this.mapId=this.mapsManagerService._registerMap(this.mapId,this),this.containerId||this._elemRef.nativeElement.appendChild(this.mapContainer)},e.prototype.ngOnChanges=function(e){if(e.sceneMode&&this._cameraService.setSceneMode(e.sceneMode.currentValue),e.flyTo&&this._cameraService.cameraFlyTo(e.flyTo.currentValue),e.containerId&&!e.containerId.firstChange){var t=this.document.getElementById(e.containerId.currentValue);if(!t)throw new Error("No element found with id: "+e.containerId.currentValue);t.appendChild(this.mapContainer)}},e.prototype.ngAfterViewInit=function(){var e=this;this.mapLayersService.drawAllLayers(),this.containerId&&setTimeout((function(){var t=e.document.getElementById(e.containerId);if(!t)throw new Error("No element found with id: "+e.containerId);t.appendChild(e.mapContainer)}),0)},e.prototype.ngOnDestroy=function(){this.mapContainer.remove(),this.mapsManagerService._removeMapById(this.mapId)},e.prototype.getCesiumService=function(){return this._cesiumService},e.prototype.getCesiumViewer=function(){return this._cesiumService.getViewer()},e.prototype.getCameraService=function(){return this._cameraService},e.prototype.getId=function(){return this.mapId},e.prototype.getMapContainer=function(){return this.mapContainer},e.prototype.getMapEventsManager=function(){return this.mapEventsManager},e.prototype.getContextMenuService=function(){return this.contextMenuService},e.prototype.getScreenshotService=function(){return this.screenshotService},e.prototype.getKeyboardControlService=function(){return this.keyboardControlService},e.prototype.getCoordinateConverter=function(){return this.coordinateConverter},e}();Ae.ɵfac=function(e){return new(e||Ae)(d.ɵɵdirectiveInject(b),d.ɵɵdirectiveInject(C),d.ɵɵdirectiveInject(d.ElementRef),d.ɵɵdirectiveInject(i.DOCUMENT),d.ɵɵdirectiveInject(le),d.ɵɵdirectiveInject(F),d.ɵɵdirectiveInject(B),d.ɵɵdirectiveInject(H),d.ɵɵdirectiveInject(U),d.ɵɵdirectiveInject(G),d.ɵɵdirectiveInject(j),d.ɵɵdirectiveInject(V),d.ɵɵdirectiveInject(N),d.ɵɵdirectiveInject(se),d.ɵɵdirectiveInject(X),d.ɵɵdirectiveInject(ae),d.ɵɵdirectiveInject(Oe),d.ɵɵdirectiveInject(ce),d.ɵɵdirectiveInject(M),d.ɵɵdirectiveInject(D))},Ae.ɵcmp=d.ɵɵdefineComponent({type:Ae,selectors:[["ac-map"]],inputs:{disableDefaultPlonter:"disableDefaultPlonter",mapId:"mapId",flyTo:"flyTo",sceneMode:"sceneMode",containerId:"containerId"},features:[d.ɵɵProvidersFeature([b,F,te,X,se,oe,B,U,K,H,V,j,N,G,ae,C,ce,M,D]),d.ɵɵNgOnChangesFeature],ngContentSelectors:["*"],decls:3,vars:1,consts:[[4,"ngIf"]],template:function(e,t){1&e&&(d.ɵɵprojectionDef(),d.ɵɵtemplate(0,we,1,0,"ac-default-plonter",0),d.ɵɵelement(1,"ac-context-menu-wrapper"),d.ɵɵprojection(2)),2&e&&d.ɵɵproperty("ngIf",!t.disableDefaultPlonter)},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ae,[{type:t.Component,args:[{selector:"ac-map",template:'\n    <ac-default-plonter *ngIf="!disableDefaultPlonter"></ac-default-plonter>\n    <ac-context-menu-wrapper></ac-context-menu-wrapper>\n    <ng-content></ng-content>\n  ',providers:[b,F,te,X,se,oe,B,U,K,H,V,j,N,G,ae,C,ce,M,D]}]}],(function(){return[{type:b},{type:C},{type:d.ElementRef},{type:void 0,decorators:[{type:t.Inject,args:[i.DOCUMENT]}]},{type:le},{type:F},{type:B},{type:H},{type:U},{type:G},{type:j},{type:V},{type:N},{type:se},{type:X},{type:ae},{type:Oe},{type:ce},{type:M},{type:D}]}),{disableDefaultPlonter:[{type:t.Input}],mapId:[{type:t.Input}],flyTo:[{type:t.Input}],sceneMode:[{type:t.Input}],containerId:[{type:t.Input}]});var Le,Re=function(){function e(){this._cache=!0,this.descriptions=[],this.layerUpdate=new t.EventEmitter}return Object.defineProperty(e.prototype,"cache",{get:function(){return this._cache},set:function(e){this._cache=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zIndex",{get:function(){return this._zIndex},set:function(e){e!==this._zIndex&&this.layerUpdate.emit(),this._zIndex=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"show",{get:function(){return this._show},set:function(e){e!==this._show&&this.layerUpdate.emit(),this._show=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this._options},set:function(e){this._options=e,this.layerUpdate.emit()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"context",{get:function(){return this._context},set:function(e){this._context=e,this.layerUpdate.emit()},enumerable:!1,configurable:!0}),e.prototype.setEntityName=function(e){this._entityName=e},e.prototype.getEntityName=function(){return this._entityName},e.prototype.registerDescription=function(e){this.descriptions.indexOf(e)<0&&this.descriptions.push(e)},e.prototype.unregisterDescription=function(e){var t=this.descriptions.indexOf(e);t>-1&&this.descriptions.splice(t,1)},e.prototype.getDescriptions=function(){return this.descriptions},e.prototype.layerUpdates=function(){return this.layerUpdate},e}();Re.ɵfac=function(e){return new(e||Re)},Re.ɵprov=d.ɵɵdefineInjectable({token:Re,factory:Re.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Re,[{type:t.Injectable}],null,null),e.ActionType=void 0,(Le=e.ActionType||(e.ActionType={}))[Le.ADD_UPDATE=0]="ADD_UPDATE",Le[Le.DELETE=1]="DELETE";var je=function(){function e(){this._cache=new Map}return e.prototype.get=function(e,t){if(this._cache.has(e))return this._cache.get(e);var i=t();return this._cache.set(e,i),i},e.prototype.clear=function(){this._cache.clear()},e}();je.ɵfac=function(e){return new(e||je)},je.ɵprov=d.ɵɵdefineInjectable({token:je,factory:je.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(je,[{type:t.Injectable}],null,null);var xe=function(){function e(){}return e.throwIfAnyNotPresent=function(t,i){i.forEach((function(i){return e.throwIfNotPresent(t,i)}))},e.throwIfNotPresent=function(t,i){if(!e.present(t[i]))throw new Error("Error: "+i+" was not given.")},e.present=function(e){return null!=e},e}(),ke=function(e){function t(t){return e.call(this,Cesium.PrimitiveCollection,t)||this}return S(t,e),t.prototype.add=function(t){return xe.throwIfAnyNotPresent(t,["center","semiMajorAxis","semiMinorAxis"]),e.prototype.add.call(this,new s.EllipsePrimitive(t))},t.prototype.update=function(e,t){return e.updateLocationData(t),e},t}(A);ke.ɵfac=function(e){return new(e||ke)(d.ɵɵinject(b))},ke.ɵprov=d.ɵɵdefineInjectable({token:ke,factory:ke.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ke,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Fe=function(e){function t(t){return e.call(this,Cesium.PolylineCollection,t)||this}return S(t,e),t}(A);Fe.ɵfac=function(e){return new(e||Fe)(d.ɵɵinject(b))},Fe.ɵprov=d.ɵɵdefineInjectable({token:Fe,factory:Fe.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Fe,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Ne=function(e){function t(t,i){var n=e.call(this,Cesium.PrimitiveCollection,i)||this;return n.geometryType=t,n}return S(t,e),t.prototype.add=function(t,i,n){if(0===Object.keys(i).length)throw new Error("instanceProps object is empty");i.geometry=new this.geometryType(t),n.geometryInstances=new Cesium.GeometryInstance(i),n.asynchronous=!1;var o=new Cesium.Primitive(n);return e.prototype.add.call(this,o)},t.prototype.update=function(t,i,n,o){return n.geometry=new this.geometryType(i),o.geometryInstances=new Cesium.GeometryInstance(n),this._cesiumCollection.remove(t),e.prototype.add.call(this,new Cesium.Primitive(o))},t}(A),He=function(e){function t(t){return e.call(this,Cesium.CircleGeometry,t)||this}return S(t,e),t}(Ne);He.ɵfac=function(e){return new(e||He)(d.ɵɵinject(b))},He.ɵprov=d.ɵɵdefineInjectable({token:He,factory:He.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(He,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Be=function(e){function t(t){return e.call(this,Cesium.PolylineGeometry,t)||this}return S(t,e),t.prototype.update=function(e,t,i,n){var o=i.attributes.color.value;return e.ready?e.getGeometryInstanceAttributes().color=o:Cesium.when(e.readyPromise).then((function(e){e.getGeometryInstanceAttributes().color.value=o})),e},t}(Ne);Be.ɵfac=function(e){return new(e||Be)(d.ɵɵinject(b))},Be.ɵprov=d.ɵɵdefineInjectable({token:Be,factory:Be.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Be,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Ve=function(e){function t(t){return e.call(this,Cesium.PolygonGeometry,t)||this}return S(t,e),t}(Ne);Ve.ɵfac=function(e){return new(e||Ve)(d.ɵɵinject(b))},Ve.ɵprov=d.ɵɵdefineInjectable({token:Ve,factory:Ve.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ve,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Ge=function(e){function t(t){return e.call(this,Cesium.EllipseGeometry,t)||this}return S(t,e),t}(Ne);Ge.ɵfac=function(e){return new(e||Ge)(d.ɵɵinject(b))},Ge.ɵprov=d.ɵɵdefineInjectable({token:Ge,factory:Ge.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ge,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Ue=function(e){function t(t){return e.call(this,t,R.model)||this}return S(t,e),t}(k);Ue.ɵfac=function(e){return new(e||Ue)(d.ɵɵinject(b))},Ue.ɵprov=d.ɵɵdefineInjectable({token:Ue,factory:Ue.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ue,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var ze=function(e){function t(t){return e.call(this,t,R.box)||this}return S(t,e),t}(k);ze.ɵfac=function(e){return new(e||ze)(d.ɵɵinject(b))},ze.ɵprov=d.ɵɵdefineInjectable({token:ze,factory:ze.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ze,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var We=function(e){function t(t){return e.call(this,t,R.corridor)||this}return S(t,e),t}(k);We.ɵfac=function(e){return new(e||We)(d.ɵɵinject(b))},We.ɵprov=d.ɵɵdefineInjectable({token:We,factory:We.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(We,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Ke=function(e){function t(t){return e.call(this,t,R.cylinder)||this}return S(t,e),t}(k);Ke.ɵfac=function(e){return new(e||Ke)(d.ɵɵinject(b))},Ke.ɵprov=d.ɵɵdefineInjectable({token:Ke,factory:Ke.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ke,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var $e=function(e){function t(t){return e.call(this,t,R.ellipsoid)||this}return S(t,e),t}(k);$e.ɵfac=function(e){return new(e||$e)(d.ɵɵinject(b))},$e.ɵprov=d.ɵɵdefineInjectable({token:$e,factory:$e.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata($e,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Qe=function(e){function t(t){return e.call(this,t,R.polylineVolume)||this}return S(t,e),t}(k);Qe.ɵfac=function(e){return new(e||Qe)(d.ɵɵinject(b))},Qe.ɵprov=d.ɵɵdefineInjectable({token:Qe,factory:Qe.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Qe,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Ye=function(e){function t(t){return e.call(this,t,R.wall)||this}return S(t,e),t}(k);Ye.ɵfac=function(e){return new(e||Ye)(d.ɵɵinject(b))},Ye.ɵprov=d.ɵɵdefineInjectable({token:Ye,factory:Ye.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ye,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var qe=function(e){function t(t){return e.call(this,t,R.rectangle)||this}return S(t,e),t}(k);qe.ɵfac=function(e){return new(e||qe)(d.ɵɵinject(b))},qe.ɵprov=d.ɵɵdefineInjectable({token:qe,factory:qe.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(qe,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Ze=function(e){function t(t){return e.call(this,Cesium.LabelCollection,t)||this}return S(t,e),t}(A);Ze.ɵfac=function(e){return new(e||Ze)(d.ɵɵinject(b))},Ze.ɵprov=d.ɵɵdefineInjectable({token:Ze,factory:Ze.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ze,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Xe=function(e){function t(t){return e.call(this,Cesium.BillboardCollection,t)||this}return S(t,e),t}(A);Xe.ɵfac=function(e){return new(e||Xe)(d.ɵɵinject(b))},Xe.ɵprov=d.ɵɵdefineInjectable({token:Xe,factory:Xe.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Xe,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var Je=function(e){function t(t){return e.call(this,Cesium.PointPrimitiveCollection,t)||this}return S(t,e),t}(A);Je.ɵfac=function(e){return new(e||Je)(d.ɵɵinject(b))},Je.ɵprov=d.ɵɵdefineInjectable({token:Je,factory:Je.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Je,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var et=function(e){function t(t){var i=e.call(this,Cesium.HtmlCollection,t)||this;return i._cesiumService=t,i}return S(t,e),t.prototype.add=function(t){return t.scene=this._cesiumService.getScene(),t.mapContainer=this._cesiumService.getMap().getMapContainer(),e.prototype.add.call(this,t)},t}(A);et.ɵfac=function(e){return new(e||et)(d.ɵɵinject(b))},et.ɵprov=d.ɵɵdefineInjectable({token:et,factory:et.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(et,[{type:t.Injectable}],(function(){return[{type:b}]}),null);var tt=function(){function t(e,t,i,n,o,s,a,c,l,p,d,u,h,f,g,y,v,m,b,E,P,C,M,I,D,_,S,T,O,w){this.layerService=e,this._computationCache=t,this.mapLayersService=i,this.show=!0,this.store=!1,this.zIndex=0,this.debug=!1,this.acForRgx=/^let\s+.+\s+of\s+.+$/,this.stopObservable=new r.Subject,this._updateStream=new r.Subject,this.entitiesStore=new Map,this.layerDrawerDataSources=[],this._drawerList=new Map([["billboard",n],["label",o],["ellipse",s],["polyline",a],["polygon",c],["arc",l],["point",p],["model",d],["box",u],["corridor",h],["cylinder",f],["ellipsoid",g],["polylineVolume",y],["rectangle",m],["wall",v],["polylinePrimitive",D],["labelPrimitive",_],["billboardPrimitive",S],["pointPrimitive",T],["html",O],["czml",w],["dynamicEllipse",b],["dynamicPolyline",E],["staticCircle",P],["staticPolyline",C],["staticPolygon",M],["staticEllipse",I]])}return t.prototype.init=function(){var t=this;this.initValidParams(),r.merge(this._updateStream,this.observable).pipe(o.takeUntil(this.stopObservable)).subscribe((function(i){t._computationCache.clear(),t.debug&&console.log("AcLayer received notification:",i);var n=i.entity;t.store&&(n=t.updateStore(i)),t.context[t.entityName]=n,t.layerService.getDescriptions().forEach((function(o){switch(i.actionType){case e.ActionType.ADD_UPDATE:o.draw(t.context,i.id,n);break;case e.ActionType.DELETE:o.remove(i.id);break;default:console.error("[ac-layer] unknown AcNotification.actionType for notification: "+i)}}))}))},t.prototype.updateStore=function(t){if(t.actionType!==e.ActionType.DELETE){if(this.entitiesStore.has(t.id)){var i=this.entitiesStore.get(t.id);return Object.assign(i,t.entity),i}return this.entitiesStore.set(t.id,t.entity),t.entity}this.entitiesStore.delete(t.id)},t.prototype.initValidParams=function(){if(!this.context)throw new Error("ac-layer: must initialize [context] ");if(!this.acForRgx.test(this.acFor))throw new Error('ac-layer: Invalid [acFor] syntax. Expected: [acFor]="let item of observable" .Instead received: '+this.acFor);var e=this.acFor.split(" ");if(this.observable=this.context[e[3]],this.entityName=e[1],!this.isObservable(this.observable))throw new Error("ac-layer: must initailize [acFor] with rx observable, instead received: "+this.observable);this.layerService.context=this.context,this.layerService.setEntityName(this.entityName)},t.prototype.isObservable=function(e){return e&&"function"==typeof e.subscribe},t.prototype.ngAfterContentInit=function(){this.init()},t.prototype.ngOnInit=function(){var e=this;this.layerService.context=this.context,this.layerService.options=this.options,this.layerService.show=this.show,this.layerService.zIndex=this.zIndex,this._drawerList.forEach((function(t,i){var n,o=e.options?e.options[i]:void 0,r=t.init(o);r&&(n=e.layerDrawerDataSources).push.apply(n,O([],T(r))),t.setShow(e.show)}))},t.prototype.ngOnChanges=function(e){if(e.show&&!e.show.firstChange){var t=e.show.currentValue;this.layerService.show=t,this._drawerList.forEach((function(e){return e.setShow(t)}))}if(e.zIndex&&!e.zIndex.firstChange){var i=e.zIndex.currentValue;this.layerService.zIndex=i,this.mapLayersService.updateAndRefresh(this.layerDrawerDataSources,i)}},t.prototype.ngOnDestroy=function(){this.mapLayersService.removeDataSources(this.layerDrawerDataSources),this.stopObservable.next(!0),this.removeAll()},t.prototype.getLayerService=function(){return this.layerService},t.prototype.getLayerDrawerDataSources=function(){return this.layerDrawerDataSources},t.prototype.getDrawerDataSourcesByName=function(e){return this.layerDrawerDataSources.filter((function(t){return t.name===e}))},t.prototype.getStore=function(){return this.entitiesStore},t.prototype.removeAll=function(){this.layerService.getDescriptions().forEach((function(e){return e.removeAll()})),this.entitiesStore.clear()},t.prototype.remove=function(t){this._updateStream.next({id:t,actionType:e.ActionType.DELETE}),this.entitiesStore.delete(t)},t.prototype.updateNotification=function(e){this._updateStream.next(e)},t.prototype.update=function(t,i){this._updateStream.next({entity:t,id:i,actionType:e.ActionType.ADD_UPDATE})},t.prototype.refreshAll=function(e){var t=this;r.from(e).subscribe((function(e){return t._updateStream.next(e)}))},t}();tt.ɵfac=function(e){return new(e||tt)(d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(ae),d.ɵɵdirectiveInject(F),d.ɵɵdirectiveInject(B),d.ɵɵdirectiveInject(H),d.ɵɵdirectiveInject(U),d.ɵɵdirectiveInject(G),d.ɵɵdirectiveInject(j),d.ɵɵdirectiveInject(V),d.ɵɵdirectiveInject(Ue),d.ɵɵdirectiveInject(ze),d.ɵɵdirectiveInject(We),d.ɵɵdirectiveInject(Ke),d.ɵɵdirectiveInject($e),d.ɵɵdirectiveInject(Qe),d.ɵɵdirectiveInject(Ye),d.ɵɵdirectiveInject(qe),d.ɵɵdirectiveInject(ke),d.ɵɵdirectiveInject(Fe),d.ɵɵdirectiveInject(He),d.ɵɵdirectiveInject(Be),d.ɵɵdirectiveInject(Ve),d.ɵɵdirectiveInject(Ge),d.ɵɵdirectiveInject(K),d.ɵɵdirectiveInject(Ze),d.ɵɵdirectiveInject(Xe),d.ɵɵdirectiveInject(Je),d.ɵɵdirectiveInject(et),d.ɵɵdirectiveInject(N))},tt.ɵcmp=d.ɵɵdefineComponent({type:tt,selectors:[["ac-layer"]],inputs:{show:"show",acFor:"acFor",context:"context",store:"store",options:"options",zIndex:"zIndex",debug:"debug"},features:[d.ɵɵProvidersFeature([Re,je,F,B,H,U,j,V,G,Ue,ze,We,Ke,$e,Qe,Ye,qe,K,Ze,Xe,Je,et,N,ke,Fe,He,Be,Ve,Ge]),d.ɵɵNgOnChangesFeature],ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(d.ɵɵprojectionDef(),d.ɵɵprojection(0))},encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(tt,[{type:t.Component,args:[{selector:"ac-layer",template:"<ng-content></ng-content>",providers:[Re,je,F,B,H,U,j,V,G,Ue,ze,We,Ke,$e,Qe,Ye,qe,K,Ze,Xe,Je,et,N,ke,Fe,He,Be,Ve,Ge],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:Re},{type:je},{type:ae},{type:F},{type:B},{type:H},{type:U},{type:G},{type:j},{type:V},{type:Ue},{type:ze},{type:We},{type:Ke},{type:$e},{type:Qe},{type:Ye},{type:qe},{type:ke},{type:Fe},{type:He},{type:Be},{type:Ve},{type:Ge},{type:K},{type:Ze},{type:Xe},{type:Je},{type:et},{type:N}]}),{show:[{type:t.Input}],acFor:[{type:t.Input}],context:[{type:t.Input}],store:[{type:t.Input}],options:[{type:t.Input}],zIndex:[{type:t.Input}],debug:[{type:t.Input}]});var it=function(){function e(e,t){this._drawer=e,this.mapLayers=t}return e.prototype.ngOnInit=function(){this.selfPrimitiveIsDraw=!1;var e=this._drawer.init();e&&(this.dataSources=e),this.drawOnMap()},e.prototype.ngOnChanges=function(e){var t=e.props;t.currentValue!==t.previousValue&&this.updateOnMap()},e.prototype.drawOnMap=function(){return this.selfPrimitiveIsDraw=!0,this.selfPrimitive=this._drawer.add(this.props)},e.prototype.removeFromMap=function(){return this.selfPrimitiveIsDraw=!1,this._drawer.remove(this.selfPrimitive)},e.prototype.updateOnMap=function(){if(this.selfPrimitiveIsDraw)return this._drawer.update(this.selfPrimitive,this.props)},e.prototype.ngOnDestroy=function(){this.mapLayers.removeDataSources(this.dataSources),this.removeFromMap()},e}();it.ɵfac=function(e){return new(e||it)(d.ɵɵdirectiveInject(w),d.ɵɵdirectiveInject(ae))},it.ɵdir=d.ɵɵdefineDirective({type:it,inputs:{props:"props"},features:[d.ɵɵNgOnChangesFeature]}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(it,[{type:t.Directive}],(function(){return[{type:w},{type:ae}]}),{props:[{type:t.Input}]});var nt=function(e){function t(t,i){return e.call(this,t,i)||this}return S(t,e),t}(it);nt.ɵfac=function(e){return new(e||nt)(d.ɵɵdirectiveInject(F),d.ɵɵdirectiveInject(ae))},nt.ɵcmp=d.ɵɵdefineComponent({type:nt,selectors:[["ac-billboard"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(nt,[{type:t.Component,args:[{selector:"ac-billboard",template:""}]}],(function(){return[{type:F},{type:ae}]}),null);var ot=function(){function e(){}return e.create=function(e,t){void 0===e&&(e=[]),void 0===t&&(t=!0);var i="";e.forEach((function(e){i+=t?"if(!(obj1['"+e+"'] instanceof Cesium.CallbackProperty))obj1['"+e+"'] = obj2['"+e+"']; ":"if (!(obj1['"+e+"'] instanceof Cesium.CallbackProperty) && obj2['"+e+"'] !== undefined) { obj1['"+e+"'] = obj2['"+e+"']; } "})),i+="return obj1";var n=new Function("obj1","obj2",i);return function(e,t){return n(e,t)}},e}(),rt=function(){function e(){this._mapper=new c.JsonStringMapper}return e.prototype.map=function(e){return this._mapper.map(e)},e}();rt.ɵfac=function(e){return new(e||rt)},rt.ɵprov=d.ɵɵdefineInjectable({token:rt,factory:rt.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(rt,[{type:t.Injectable}],(function(){return[]}),null);var st=function(){function e(e,t){this._parser=e,this._jsonMapper=t,this._assignersCache=new Map,this._evaluatorsCache=new Map}return e.prototype._compile=function(e,t){var i=this;void 0===t&&(t=!0);var n={},o=new Map;this._jsonMapper.map(e).forEach((function(e,t){return o.set(t,{expression:e,get:i._parser.eval(e)})})),o.forEach((function(e,i){n[i||"undefined"]=t?"cache.get(`"+e.expression+"`, () => propsMap.get('"+i+"').get(context))":"propsMap.get('"+i+"').get(context)"}));var r="return "+JSON.stringify(n).replace(/"/g,"")+";",s=new Function("propsMap","cache","context",r);return function(e,t){return s(o,e,t)}},e.prototype._build=function(e){var t=Array.from(this._jsonMapper.map(e).keys()),i=ot.create(t);return function(e,t){return i(e,t)}},e.prototype.createEvaluator=function(e,t,i){if(void 0===t&&(t=!0),void 0===i&&(i=!1),!i&&this._evaluatorsCache.has(e))return this._evaluatorsCache.get(e);var n=this._compile(e,t);return this._evaluatorsCache.set(e,n),n},e.prototype.createAssigner=function(e){if(this._assignersCache.has(e))return this._assignersCache.get(e);var t=this._build(e);return this._assignersCache.set(e,t),t},e}();st.ɵfac=function(e){return new(e||st)(d.ɵɵinject(f.Parse),d.ɵɵinject(rt))},st.ɵprov=d.ɵɵdefineInjectable({token:st,factory:st.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(st,[{type:t.Injectable}],(function(){return[{type:f.Parse},{type:rt}]}),null);var at=function(){function e(e,i,n,o){this._drawer=e,this._layerService=i,this._computationCache=n,this._cesiumProperties=o,this.onDraw=new t.EventEmitter,this.onRemove=new t.EventEmitter,this._cesiumObjectsMap=new Map}return e.prototype._propsEvaluator=function(e){return this._propsEvaluateFn(this._computationCache,e)},e.prototype._getPropsAssigner=function(){var e=this;return function(t,i){return e._propsAssignerFn(t,i)}},e.prototype.getLayerService=function(){return this._layerService},e.prototype.setLayerService=function(e){this._layerService.unregisterDescription(this),this._layerService=e,this._layerService.registerDescription(this),this._propsEvaluateFn=this._cesiumProperties.createEvaluator(this.props,this._layerService.cache,!0),this._propsAssignerFn=this._cesiumProperties.createAssigner(this.props)},e.prototype.ngOnInit=function(){this.props||console.error("ac-desc components error: [props] input is mandatory"),this._layerService.registerDescription(this),this._propsEvaluateFn=this._cesiumProperties.createEvaluator(this.props,this._layerService.cache),this._propsAssignerFn=this._cesiumProperties.createAssigner(this.props)},e.prototype.getCesiumObjectsMap=function(){return this._cesiumObjectsMap},e.prototype.draw=function(e,t,i){var n=this._propsEvaluator(e);if(this._cesiumObjectsMap.has(t)){o=this._cesiumObjectsMap.get(t);this.onDraw.emit({acEntity:i,cesiumEntity:o,entityId:t}),o.acEntity=i,this._drawer.setPropsAssigner(this._getPropsAssigner()),this._drawer.update(o,n)}else{var o=this._drawer.add(n);this.onDraw.emit({acEntity:i,cesiumEntity:o,entityId:t}),o.acEntity=i,this._cesiumObjectsMap.set(t,o)}},e.prototype.remove=function(e){var t=this._cesiumObjectsMap.get(e);t&&(this.onRemove.emit({acEntity:t.acEntity,cesiumEntity:t,entityId:e}),this._drawer.remove(t),this._cesiumObjectsMap.delete(e))},e.prototype.removeAll=function(){this._cesiumObjectsMap.clear(),this._drawer.removeAll()},e.prototype.ngOnDestroy=function(){this._layerService.unregisterDescription(this),this.removeAll()},e}();at.ɵfac=function(e){return new(e||at)(d.ɵɵdirectiveInject(w),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},at.ɵdir=d.ɵɵdefineDirective({type:at,inputs:{props:"props"},outputs:{onDraw:"onDraw",onRemove:"onRemove"}}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(at,[{type:t.Directive}],(function(){return[{type:w},{type:Re},{type:je},{type:st}]}),{props:[{type:t.Input}],onDraw:[{type:t.Output}],onRemove:[{type:t.Output}]});var ct=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);ct.ɵfac=function(e){return new(e||ct)(d.ɵɵdirectiveInject(F),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},ct.ɵcmp=d.ɵɵdefineComponent({type:ct,selectors:[["ac-billboard-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return ct}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ct,[{type:t.Component,args:[{selector:"ac-billboard-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return ct}))}]}]}],(function(){return[{type:F},{type:Re},{type:je},{type:st}]}),null);var lt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);lt.ɵfac=function(e){return new(e||lt)(d.ɵɵdirectiveInject(H),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},lt.ɵcmp=d.ɵɵdefineComponent({type:lt,selectors:[["ac-ellipse-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return lt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(lt,[{type:t.Component,args:[{selector:"ac-ellipse-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return lt}))}]}]}],(function(){return[{type:H},{type:Re},{type:je},{type:st}]}),null);var pt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);pt.ɵfac=function(e){return new(e||pt)(d.ɵɵdirectiveInject(U),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},pt.ɵcmp=d.ɵɵdefineComponent({type:pt,selectors:[["ac-polyline-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return pt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(pt,[{type:t.Component,args:[{selector:"ac-polyline-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return pt}))}]}]}],(function(){return[{type:U},{type:Re},{type:je},{type:st}]}),null);var dt=function(){function e(){}return e.prototype.transform=function(e,t){return new Cesium.Cartesian2(e[0],e[1])},e}();dt.ɵfac=function(e){return new(e||dt)},dt.ɵpipe=d.ɵɵdefinePipe({name:"pixelOffset",type:dt,pure:!0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(dt,[{type:t.Pipe,args:[{name:"pixelOffset"}]}],null,null);var ut=function(){function e(){}return e.prototype.transform=function(e,t){return(360-Math.round(180*e/Math.PI))%360},e}();ut.ɵfac=function(e){return new(e||ut)},ut.ɵpipe=d.ɵɵdefinePipe({name:"radiansToDegrees",type:ut,pure:!0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ut,[{type:t.Pipe,args:[{name:"radiansToDegrees"}]}],null,null);var ht=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);ht.ɵfac=function(e){return new(e||ht)(d.ɵɵdirectiveInject(B),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},ht.ɵcmp=d.ɵɵdefineComponent({type:ht,selectors:[["ac-label-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return ht}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ht,[{type:t.Component,args:[{selector:"ac-label-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return ht}))}]}]}],(function(){return[{type:B},{type:Re},{type:je},{type:st}]}),null);var ft=function(){};ft.ɵfac=function(e){return new(e||ft)},ft.ɵmod=d.ɵɵdefineNgModule({type:ft}),ft.ɵinj=d.ɵɵdefineInjector({providers:[],imports:[[i.CommonModule]]}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ft,[{type:t.NgModule,args:[{imports:[i.CommonModule],providers:[]}]}],null,null),("undefined"==typeof ngJitMode||ngJitMode)&&d.ɵɵsetNgModuleScope(ft,{imports:[i.CommonModule]});var gt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t.prototype._propsEvaluator=function(t){var i=e.prototype._propsEvaluator.call(this,t);return i.semiMajorAxis=i.radius,i.semiMinorAxis=i.radius,delete i.radius,i},t.prototype._getPropsAssigner=function(){return function(e,t){return Object.assign(e,t)}},t}(at);gt.ɵfac=function(e){return new(e||gt)(d.ɵɵdirectiveInject(H),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},gt.ɵcmp=d.ɵɵdefineComponent({type:gt,selectors:[["ac-circle-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return gt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(gt,[{type:t.Component,args:[{selector:"ac-circle-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return gt}))}]}]}],(function(){return[{type:H},{type:Re},{type:je},{type:st}]}),null);var yt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);yt.ɵfac=function(e){return new(e||yt)(d.ɵɵdirectiveInject(j),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},yt.ɵcmp=d.ɵɵdefineComponent({type:yt,selectors:[["ac-arc-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return yt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(yt,[{type:t.Component,args:[{selector:"ac-arc-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return yt}))}]}]}],(function(){return[{type:j},{type:Re},{type:je},{type:st}]}),null);var vt,mt,bt=function(){function e(e){Object.assign(this,e)}return e.create=function(t){return t?Object.assign(new e,t):new e},e}(),Et=function(){};e.MapLayerProviderOptions=void 0,(vt=e.MapLayerProviderOptions||(e.MapLayerProviderOptions={}))[vt.ArcGisMapServer=Cesium.ArcGisMapServerImageryProvider]="ArcGisMapServer",vt[vt.WebMapTileService=Cesium.WebMapTileServiceImageryProvider]="WebMapTileService",vt[vt.MapTileService=Cesium.TileMapServiceImageryProvider]="MapTileService",vt[vt.WebMapService=Cesium.WebMapServiceImageryProvider]="WebMapService",vt[vt.SingleTileImagery=Cesium.SingleTileImageryProvider]="SingleTileImagery",vt[vt.OpenStreetMap=Cesium.OpenStreetMapImageryProvider]="OpenStreetMap",vt[vt.BingMaps=Cesium.BingMapsImageryProvider]="BingMaps",vt[vt.GoogleEarthEnterpriseMaps=Cesium.GoogleEarthEnterpriseMapsProvider]="GoogleEarthEnterpriseMaps",vt[vt.MapBox=Cesium.MapboxImageryProvider]="MapBox",vt[vt.MapboxStyleImageryProvider=Cesium.MapboxStyleImageryProvider]="MapboxStyleImageryProvider",vt[vt.UrlTemplateImagery=Cesium.UrlTemplateImageryProvider]="UrlTemplateImagery",vt[vt.OFFLINE=null]="OFFLINE",e.MapTerrainProviderOptions=void 0,(mt=e.MapTerrainProviderOptions||(e.MapTerrainProviderOptions={}))[mt.CesiumTerrain=Cesium.CesiumTerrainProvider]="CesiumTerrain",mt[mt.ArcGISTiledElevation=Cesium.ArcGISTiledElevationTerrainProvider]="ArcGISTiledElevation",mt[mt.GoogleEarthEnterprise=Cesium.GoogleEarthEnterpriseTerrainProvider]="GoogleEarthEnterprise",mt[mt.VRTheWorld=Cesium.VRTheWorldTerrainProvider]="VRTheWorld",mt[mt.Ellipsoid=Cesium.EllipsoidTerrainProvider]="Ellipsoid",mt[mt.WorldTerrain=Cesium.createWorldTerrain]="WorldTerrain";var Pt=function(){function t(t){this.cesiumService=t,this.options={},this.provider=e.MapLayerProviderOptions.OFFLINE,this.show=!0,this.alpha=1,this.brightness=1,this.contrast=1,this.imageryLayersCollection=this.cesiumService.getScene().imageryLayers}return t.prototype.createOfflineMapProvider=function(){return Cesium.createTileMapServiceImageryProvider({url:Cesium.buildModuleUrl("Assets/Textures/NaturalEarthII")})},t.prototype.ngOnInit=function(){if(!xe.present(this.options.url)&&this.provider!==e.MapLayerProviderOptions.OFFLINE)throw new Error("options must have a url");switch(this.provider){case e.MapLayerProviderOptions.WebMapService:case e.MapLayerProviderOptions.WebMapTileService:case e.MapLayerProviderOptions.ArcGisMapServer:case e.MapLayerProviderOptions.SingleTileImagery:case e.MapLayerProviderOptions.BingMaps:case e.MapLayerProviderOptions.GoogleEarthEnterpriseMaps:case e.MapLayerProviderOptions.MapBox:case e.MapLayerProviderOptions.MapboxStyleImageryProvider:case e.MapLayerProviderOptions.UrlTemplateImagery:case e.MapLayerProviderOptions.MapTileService:case e.MapLayerProviderOptions.OpenStreetMap:this.layerProvider=new this.provider(this.options);break;case e.MapLayerProviderOptions.OFFLINE:this.layerProvider=this.createOfflineMapProvider();break;default:console.log("ac-map-layer-provider: [provider] wasn't found. setting OFFLINE provider as default"),this.layerProvider=this.createOfflineMapProvider()}this.show&&(this.imageryLayer=this.imageryLayersCollection.addImageryProvider(this.layerProvider,this.index),this.imageryLayer.alpha=this.alpha,this.imageryLayer.contrast=this.contrast,this.imageryLayer.brightness=this.brightness)},t.prototype.ngOnChanges=function(e){e.show&&!e.show.isFirstChange()&&(e.show.currentValue?this.imageryLayer?this.imageryLayersCollection.add(this.imageryLayer,this.index):(this.imageryLayer=this.imageryLayersCollection.addImageryProvider(this.layerProvider,this.index),this.imageryLayer.alpha=this.alpha,this.imageryLayer.contrast=this.contrast,this.imageryLayer.brightness=this.brightness):this.imageryLayer&&this.imageryLayersCollection.remove(this.imageryLayer,!1));e.alpha&&!e.alpha.isFirstChange()&&this.imageryLayer&&(this.imageryLayer.alpha=this.alpha),e.contrast&&!e.contrast.isFirstChange()&&this.imageryLayer&&(this.imageryLayer.contrast=this.contrast),e.brightness&&!e.brightness.isFirstChange()&&this.imageryLayer&&(this.imageryLayer.brightness=this.brightness)},t.prototype.ngOnDestroy=function(){this.imageryLayer&&this.imageryLayersCollection.remove(this.imageryLayer,!0)},t}();Pt.ɵfac=function(e){return new(e||Pt)(d.ɵɵdirectiveInject(b))},Pt.ɵcmp=d.ɵɵdefineComponent({type:Pt,selectors:[["ac-map-layer-provider"]],inputs:{options:"options",provider:"provider",index:"index",show:"show",alpha:"alpha",brightness:"brightness",contrast:"contrast"},features:[d.ɵɵNgOnChangesFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Pt,[{type:t.Component,args:[{selector:"ac-map-layer-provider",template:""}]}],(function(){return[{type:b}]}),{options:[{type:t.Input}],provider:[{type:t.Input}],index:[{type:t.Input}],show:[{type:t.Input}],alpha:[{type:t.Input}],brightness:[{type:t.Input}],contrast:[{type:t.Input}]});var Ct=function(){function t(e){this.cesiumService=e,this.options={},this.show=!0}return t.prototype.ngOnInit=function(){if(!xe.present(this.options.url)&&this.provider!==e.MapTerrainProviderOptions.Ellipsoid&&this.provider!==e.MapTerrainProviderOptions.WorldTerrain)throw new Error("options must have a url");switch(this.defaultTerrainProvider=this.cesiumService.getViewer().terrainProvider,this.provider){case e.MapTerrainProviderOptions.CesiumTerrain:case e.MapTerrainProviderOptions.ArcGISTiledElevation:case e.MapTerrainProviderOptions.GoogleEarthEnterprise:case e.MapTerrainProviderOptions.VRTheWorld:case e.MapTerrainProviderOptions.Ellipsoid:this.terrainProvider=new this.provider(this.options);break;case e.MapTerrainProviderOptions.WorldTerrain:this.terrainProvider=this.provider(this.options);break;default:console.log("ac-map-terrain-provider: [provider] wasn't found. setting OFFLINE provider as default"),this.terrainProvider=this.defaultTerrainProvider}this.show&&(this.cesiumService.getViewer().terrainProvider=this.terrainProvider)},t.prototype.ngOnChanges=function(e){e.show&&!e.show.isFirstChange()&&(e.show.currentValue?this.terrainProvider&&(this.cesiumService.getViewer().terrainProvider=this.terrainProvider):this.cesiumService.getViewer().terrainProvider=this.defaultTerrainProvider)},t.prototype.ngOnDestroy=function(){this.cesiumService.getViewer().terrainProvider=this.defaultTerrainProvider},t}();Ct.ɵfac=function(e){return new(e||Ct)(d.ɵɵdirectiveInject(b))},Ct.ɵcmp=d.ɵɵdefineComponent({type:Ct,selectors:[["ac-map-terrain-provider"]],inputs:{options:"options",provider:"provider",show:"show"},features:[d.ɵɵNgOnChangesFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ct,[{type:t.Component,args:[{selector:"ac-map-terrain-provider",template:""}]}],(function(){return[{type:b}]}),{options:[{type:t.Input}],provider:[{type:t.Input}],show:[{type:t.Input}]});var Mt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Mt.ɵfac=function(e){return new(e||Mt)(d.ɵɵdirectiveInject(V),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Mt.ɵcmp=d.ɵɵdefineComponent({type:Mt,selectors:[["ac-point-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return Mt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Mt,[{type:t.Component,args:[{selector:"ac-point-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return Mt}))}]}]}],(function(){return[{type:V},{type:Re},{type:je},{type:st}]}),null);var It=function(e){function t(t,i){return e.call(this,t,i)||this}return S(t,e),t}(it);It.ɵfac=function(e){return new(e||It)(d.ɵɵdirectiveInject(B),d.ɵɵdirectiveInject(ae))},It.ɵcmp=d.ɵɵdefineComponent({type:It,selectors:[["ac-label"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(It,[{type:t.Component,args:[{selector:"ac-label",template:""}]}],(function(){return[{type:B},{type:ae}]}),null);var Dt=function(e){function t(t,i){return e.call(this,t,i)||this}return S(t,e),t}(it);Dt.ɵfac=function(e){return new(e||Dt)(d.ɵɵdirectiveInject(U),d.ɵɵdirectiveInject(ae))},Dt.ɵcmp=d.ɵɵdefineComponent({type:Dt,selectors:[["ac-polyline"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Dt,[{type:t.Component,args:[{selector:"ac-polyline",template:""}]}],(function(){return[{type:U},{type:ae}]}),null);var _t=function(e){function t(t,i){return e.call(this,t,i)||this}return S(t,e),t}(it);_t.ɵfac=function(e){return new(e||_t)(d.ɵɵdirectiveInject(H),d.ɵɵdirectiveInject(ae))},_t.ɵcmp=d.ɵɵdefineComponent({type:_t,selectors:[["ac-ellipse"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(_t,[{type:t.Component,args:[{selector:"ac-ellipse",template:""}]}],(function(){return[{type:H},{type:ae}]}),null);var St=function(e){function t(t,i){return e.call(this,t,i)||this}return S(t,e),t}(it);St.ɵfac=function(e){return new(e||St)(d.ɵɵdirectiveInject(V),d.ɵɵdirectiveInject(ae))},St.ɵcmp=d.ɵɵdefineComponent({type:St,selectors:[["ac-point"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(St,[{type:t.Component,args:[{selector:"ac-point",template:""}]}],(function(){return[{type:V},{type:ae}]}),null);var Tt=function(){function e(e,t,i){this.cesiumService=e,this.elementRef=t,this.renderer=i,this.isDraw=!1}return e.prototype.setScreenPosition=function(e){e&&(this.renderer.setStyle(this.elementRef.nativeElement,"top",e.y+"px"),this.renderer.setStyle(this.elementRef.nativeElement,"left",e.x+"px"))},e.prototype.ngOnInit=function(){this.cesiumService.getMap().getMapContainer().appendChild(this.elementRef.nativeElement),!1===this.props.show&&this.hideElement()},e.prototype.remove=function(){this.isDraw&&(this.isDraw=!1,this.cesiumService.getScene().preRender.removeEventListener(this.preRenderEventListener),this.hideElement())},e.prototype.hideElement=function(){this.renderer.setStyle(this.elementRef.nativeElement,"display","none")},e.prototype.add=function(){var e=this;this.isDraw||(this.isDraw=!0,this.preRenderEventListener=function(){var t=Cesium.SceneTransforms.wgs84ToWindowCoordinates(e.cesiumService.getScene(),e.props.position);e.setScreenPosition(t)},this.renderer.setStyle(this.elementRef.nativeElement,"display","block"),this.cesiumService.getScene().preRender.addEventListener(this.preRenderEventListener))},e.prototype.ngDoCheck=function(){void 0===this.props.show||this.props.show?this.add():this.remove()},e.prototype.ngOnDestroy=function(){this.remove()},e}();Tt.ɵfac=function(e){return new(e||Tt)(d.ɵɵdirectiveInject(b),d.ɵɵdirectiveInject(d.ElementRef),d.ɵɵdirectiveInject(d.Renderer2))},Tt.ɵcmp=d.ɵɵdefineComponent({type:Tt,selectors:[["ac-html"]],inputs:{props:"props"},ngContentSelectors:["*"],decls:1,vars:0,template:function(e,t){1&e&&(d.ɵɵprojectionDef(),d.ɵɵprojection(0))},styles:["[_nghost-%COMP%] {\n                position: absolute;\n                z-index: 100;\n\t\t\t\t}"]}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Tt,[{type:t.Component,args:[{selector:"ac-html",template:"<ng-content></ng-content>",styles:[":host {\n                position: absolute;\n                z-index: 100;\n\t\t\t\t}"]}]}],(function(){return[{type:b},{type:d.ElementRef},{type:d.Renderer2}]}),{props:[{type:t.Input}]});var Ot=function(e){function t(t,i){return e.call(this,t,i)||this}return S(t,e),t.prototype.updateEllipseProps=function(){this.props.semiMajorAxis=this.props.radius,this.props.semiMinorAxis=this.props.radius,this.props.rotation=0},t.prototype.drawOnMap=function(){this.updateEllipseProps(),e.prototype.drawOnMap.call(this)},t.prototype.updateOnMap=function(){this.updateEllipseProps(),e.prototype.updateOnMap.call(this)},t}(it);Ot.ɵfac=function(e){return new(e||Ot)(d.ɵɵdirectiveInject(H),d.ɵɵdirectiveInject(ae))},Ot.ɵcmp=d.ɵɵdefineComponent({type:Ot,selectors:[["ac-circle"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ot,[{type:t.Component,args:[{selector:"ac-circle",template:""}]}],(function(){return[{type:H},{type:ae}]}),null);var wt=function(e){function t(t,i){return e.call(this,t,i)||this}return S(t,e),t.prototype.updateOnMap=function(){this.selfPrimitiveIsDraw&&(this.removeFromMap(),this.drawOnMap())},t.prototype.drawOnMap=function(){return this.selfPrimitiveIsDraw=!0,this.selfPrimitive=this._drawer.add(this.geometryProps,this.instanceProps,this.primitiveProps)},t.prototype.ngOnChanges=function(e){var t=e.geometryProps,i=e.instanceProps,n=e.primitiveProps;t.currentValue===t.previousValue&&i.currentValue===i.previousValue&&n.currentValue===n.previousValue||this.updateOnMap()},t}(it);wt.ɵfac=function(e){return new(e||wt)(d.ɵɵdirectiveInject(j),d.ɵɵdirectiveInject(ae))},wt.ɵcmp=d.ɵɵdefineComponent({type:wt,selectors:[["ac-arc"]],inputs:{geometryProps:"geometryProps",instanceProps:"instanceProps",primitiveProps:"primitiveProps"},features:[d.ɵɵInheritDefinitionFeature,d.ɵɵNgOnChangesFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(wt,[{type:t.Component,args:[{selector:"ac-arc",template:""}]}],(function(){return[{type:j},{type:ae}]}),{geometryProps:[{type:t.Input}],instanceProps:[{type:t.Input}],primitiveProps:[{type:t.Input}]});var At=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);function Lt(e,t){if(1&e){var i=d.ɵɵgetCurrentView();d.ɵɵelementStart(0,"div"),d.ɵɵelementStart(1,"div",4),d.ɵɵlistener("click",(function(){var e=d.ɵɵrestoreView(i).$implicit;return d.ɵɵnextContext(2).chooseEntity(e)})),d.ɵɵtext(2),d.ɵɵelementEnd(),d.ɵɵelementEnd()}if(2&e){var n=t.$implicit;d.ɵɵadvance(2),d.ɵɵtextInterpolate1("",(null==n?null:n.name)||(null==n?null:n.id)," ")}}At.ɵfac=function(e){return new(e||At)(d.ɵɵdirectiveInject(G),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},At.ɵcmp=d.ɵɵdefineComponent({type:At,selectors:[["ac-polygon-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return At}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(At,[{type:t.Component,args:[{selector:"ac-polygon-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return At}))}]}]}],(function(){return[{type:G},{type:Re},{type:je},{type:st}]}),null);var Rt=function(e){return{position:e}};function jt(e,t){if(1&e&&(d.ɵɵelementStart(0,"ac-html",1),d.ɵɵelementStart(1,"div",2),d.ɵɵtemplate(2,Lt,3,1,"div",3),d.ɵɵelementEnd(),d.ɵɵelementEnd()),2&e){var i=d.ɵɵnextContext();d.ɵɵproperty("props",d.ɵɵpureFunction1(2,Rt,i.plonterPosition)),d.ɵɵadvance(2),d.ɵɵproperty("ngForOf",i.plonterService.entitesToPlonter)}}var xt=function(){function e(e,t,i){this.plonterService=e,this.cd=t,this.geoConverter=i}return e.prototype.ngOnInit=function(){var e=this;this.plonterService.plonterChangeNotifier.subscribe((function(){return e.cd.detectChanges()}))},Object.defineProperty(e.prototype,"plonterPosition",{get:function(){if(this.plonterService.plonterShown){var e=this.plonterService.plonterClickPosition.endPosition;return this.geoConverter.screenToCartesian3(e)}},enumerable:!1,configurable:!0}),e.prototype.chooseEntity=function(e){this.plonterService.resolvePlonter(e)},e}();xt.ɵfac=function(e){return new(e||xt)(d.ɵɵdirectiveInject(oe),d.ɵɵdirectiveInject(d.ChangeDetectorRef),d.ɵɵdirectiveInject(D))},xt.ɵcmp=d.ɵɵdefineComponent({type:xt,selectors:[["ac-default-plonter"]],features:[d.ɵɵProvidersFeature([D])],decls:1,vars:1,consts:[[3,"props",4,"ngIf"],[3,"props"],[1,"plonter-context-menu"],[4,"ngFor","ngForOf"],[1,"plonter-item",3,"click"]],template:function(e,t){1&e&&d.ɵɵtemplate(0,jt,3,4,"ac-html",0),2&e&&d.ɵɵproperty("ngIf",t.plonterService.plonterShown)},directives:[u.NgIf,Tt,u.NgForOf],styles:[".plonter-context-menu[_ngcontent-%COMP%] {\n            background-color: rgba(250, 250, 250, 0.8);\n            box-shadow: 1px 1px 5px 0px rgba(0, 0, 0, 0.15);\n        }\n\n        .plonter-item[_ngcontent-%COMP%] {\n            cursor: pointer;\n            padding: 2px 15px;\n            text-align: start;\n        }\n\n        .plonter-item[_ngcontent-%COMP%]:hover {\n            background-color: rgba(0, 0, 0, 0.15);\n        }"],changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(xt,[{type:t.Component,args:[{selector:"ac-default-plonter",template:'\n      <ac-html *ngIf="plonterService.plonterShown" [props]="{\n        position: plonterPosition\n      }">\n        <div class="plonter-context-menu">\n          <div *ngFor="let entity of plonterService.entitesToPlonter">\n            <div class="plonter-item" (click)="chooseEntity(entity)">{{ entity?.name || entity?.id }}\n            </div>\n          </div>\n        </div>\n      </ac-html>\n    ',styles:["\n        .plonter-context-menu {\n            background-color: rgba(250, 250, 250, 0.8);\n            box-shadow: 1px 1px 5px 0px rgba(0, 0, 0, 0.15);\n        }\n\n        .plonter-item {\n            cursor: pointer;\n            padding: 2px 15px;\n            text-align: start;\n        }\n\n        .plonter-item:hover {\n            background-color: rgba(0, 0, 0, 0.15);\n        }\n\n    "],changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[D]}]}],(function(){return[{type:oe},{type:d.ChangeDetectorRef},{type:D}]}),null);var kt=function(e){function t(t,i){return e.call(this,t,i)||this}return S(t,e),t}(it);kt.ɵfac=function(e){return new(e||kt)(d.ɵɵdirectiveInject(G),d.ɵɵdirectiveInject(ae))},kt.ɵcmp=d.ɵɵdefineComponent({type:kt,selectors:[["ac-polygon"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(kt,[{type:t.Component,args:[{selector:"ac-polygon",template:""}]}],(function(){return[{type:G},{type:ae}]}),null);var Ft=function(e){function t(t,i,n,o){var r=e.call(this,t,i,n,o)||this;return r._staticPrimitiveDrawer=t,r}return S(t,e),t.prototype.ngOnInit=function(){this._layerService.registerDescription(this),this._geometryPropsEvaluator=this._cesiumProperties.createEvaluator(this.geometryProps),this._instancePropsEvaluator=this._cesiumProperties.createEvaluator(this.instanceProps),this._primitivePropsEvaluator=this._cesiumProperties.createEvaluator(this.primitiveProps)},t.prototype.draw=function(e,t,i){var n=this._geometryPropsEvaluator(this._computationCache,e),o=this._instancePropsEvaluator(this._computationCache,e),r=this._primitivePropsEvaluator(this._computationCache,e);if(this._cesiumObjectsMap.has(t)){s=this._cesiumObjectsMap.get(t);this._staticPrimitiveDrawer.update(s,n,o,r)}else{var s;(s=this._staticPrimitiveDrawer.add(n,o,r)).acEntity=i,this._cesiumObjectsMap.set(t,s)}},t}(at);Ft.ɵfac=function(e){return new(e||Ft)(d.ɵɵdirectiveInject(Ne),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Ft.ɵdir=d.ɵɵdefineDirective({type:Ft,inputs:{geometryProps:"geometryProps",instanceProps:"instanceProps",primitiveProps:"primitiveProps"},features:[d.ɵɵInheritDefinitionFeature]}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ft,[{type:t.Directive}],(function(){return[{type:Ne},{type:Re},{type:je},{type:st}]}),{geometryProps:[{type:t.Input}],instanceProps:[{type:t.Input}],primitiveProps:[{type:t.Input}]});var Nt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(Ft);Nt.ɵfac=function(e){return new(e||Nt)(d.ɵɵdirectiveInject(Ge),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Nt.ɵcmp=d.ɵɵdefineComponent({type:Nt,selectors:[["ac-static-ellipse-desc"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Nt,[{type:t.Component,args:[{selector:"ac-static-ellipse-desc",template:""}]}],(function(){return[{type:Ge},{type:Re},{type:je},{type:st}]}),null);var Ht=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Ht.ɵfac=function(e){return new(e||Ht)(d.ɵɵdirectiveInject(ke),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Ht.ɵcmp=d.ɵɵdefineComponent({type:Ht,selectors:[["ac-dynamic-ellipse-desc"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ht,[{type:t.Component,args:[{selector:"ac-dynamic-ellipse-desc",template:""}]}],(function(){return[{type:ke},{type:Re},{type:je},{type:st}]}),null);var Bt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Bt.ɵfac=function(e){return new(e||Bt)(d.ɵɵdirectiveInject(Fe),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Bt.ɵcmp=d.ɵɵdefineComponent({type:Bt,selectors:[["ac-dynamic-polyline-desc"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Bt,[{type:t.Component,args:[{selector:"ac-dynamic-polyline-desc",template:""}]}],(function(){return[{type:Fe},{type:Re},{type:je},{type:st}]}),null);var Vt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(Ft);Vt.ɵfac=function(e){return new(e||Vt)(d.ɵɵdirectiveInject(Ve),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Vt.ɵcmp=d.ɵɵdefineComponent({type:Vt,selectors:[["ac-static-polygon-desc"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Vt,[{type:t.Component,args:[{selector:"ac-static-polygon-desc",template:""}]}],(function(){return[{type:Ve},{type:Re},{type:je},{type:st}]}),null);var Gt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(Ft);Gt.ɵfac=function(e){return new(e||Gt)(d.ɵɵdirectiveInject(He),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Gt.ɵcmp=d.ɵɵdefineComponent({type:Gt,selectors:[["ac-static-circle"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Gt,[{type:t.Component,args:[{selector:"ac-static-circle",template:""}]}],(function(){return[{type:He},{type:Re},{type:je},{type:st}]}),null);var Ut=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t.prototype._propsEvaluator=function(t){var i=e.prototype._propsEvaluator.call(this,t);return i.semiMajorAxis=i.radius,i.semiMinorAxis=i.radius,i},t}(at);Ut.ɵfac=function(e){return new(e||Ut)(d.ɵɵdirectiveInject(ke),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Ut.ɵcmp=d.ɵɵdefineComponent({type:Ut,selectors:[["ac-dynamic-circle-desc"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ut,[{type:t.Component,args:[{selector:"ac-dynamic-circle-desc",template:""}]}],(function(){return[{type:ke},{type:Re},{type:je},{type:st}]}),null);var zt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(Ft);zt.ɵfac=function(e){return new(e||zt)(d.ɵɵdirectiveInject(Be),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},zt.ɵcmp=d.ɵɵdefineComponent({type:zt,selectors:[["ac-static-polyline-desc"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(zt,[{type:t.Component,args:[{selector:"ac-static-polyline-desc",template:""}]}],(function(){return[{type:Be},{type:Re},{type:je},{type:st}]}),null);var Wt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Wt.ɵfac=function(e){return new(e||Wt)(d.ɵɵdirectiveInject(Ue),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Wt.ɵcmp=d.ɵɵdefineComponent({type:Wt,selectors:[["ac-model-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return Wt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Wt,[{type:t.Component,args:[{selector:"ac-model-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return Wt}))}]}]}],(function(){return[{type:Ue},{type:Re},{type:je},{type:st}]}),null);var Kt=function(){function e(e){this.cesiumService=e,this.options={},this.show=!0,this.tilesetInstance=null}return e.prototype.ngOnInit=function(){if(!xe.present(this.options.url))throw new Error("Options must have a url");this._3dtilesCollection=new Cesium.PrimitiveCollection,this.cesiumService.getScene().primitives.add(this._3dtilesCollection),this.show&&(this.tilesetInstance=this._3dtilesCollection.add(new Cesium.Cesium3DTileset(this.options),this.index),this.style&&(this.tilesetInstance.style=new Cesium.Cesium3DTileStyle(this.style)))},e.prototype.ngOnChanges=function(e){e.show&&!e.show.isFirstChange()&&(e.show.currentValue?this.tilesetInstance?this._3dtilesCollection.add(this.tilesetInstance,this.index):(this.tilesetInstance=this._3dtilesCollection.add(new Cesium.Cesium3DTileset(this.options),this.index),this.style&&(this.tilesetInstance.style=new Cesium.Cesium3DTileStyle(this.style))):this.tilesetInstance&&this._3dtilesCollection.remove(this.tilesetInstance,!1));if(e.style&&!e.style.isFirstChange()){e.style.currentValue;this.tilesetInstance&&(this.tilesetInstance.style=new Cesium.Cesium3DTileStyle(this.style))}},e.prototype.ngOnDestroy=function(){this.tilesetInstance&&this._3dtilesCollection.remove(this.tilesetInstance,!1)},e}();Kt.ɵfac=function(e){return new(e||Kt)(d.ɵɵdirectiveInject(b))},Kt.ɵcmp=d.ɵɵdefineComponent({type:Kt,selectors:[["ac-3d-tile-layer"]],inputs:{options:"options",index:"index",show:"show",style:"style"},features:[d.ɵɵNgOnChangesFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Kt,[{type:t.Component,args:[{selector:"ac-3d-tile-layer",template:""}]}],(function(){return[{type:b}]}),{options:[{type:t.Input}],index:[{type:t.Input}],show:[{type:t.Input}],style:[{type:t.Input}]});var $t=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);$t.ɵfac=function(e){return new(e||$t)(d.ɵɵdirectiveInject(ze),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},$t.ɵcmp=d.ɵɵdefineComponent({type:$t,selectors:[["ac-box-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return $t}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata($t,[{type:t.Component,args:[{selector:"ac-box-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return $t}))}]}]}],(function(){return[{type:ze},{type:Re},{type:je},{type:st}]}),null);var Qt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Qt.ɵfac=function(e){return new(e||Qt)(d.ɵɵdirectiveInject(Ke),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Qt.ɵcmp=d.ɵɵdefineComponent({type:Qt,selectors:[["ac-cylinder-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return Qt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Qt,[{type:t.Component,args:[{selector:"ac-cylinder-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return Qt}))}]}]}],(function(){return[{type:Ke},{type:Re},{type:je},{type:st}]}),null);var Yt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Yt.ɵfac=function(e){return new(e||Yt)(d.ɵɵdirectiveInject(We),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Yt.ɵcmp=d.ɵɵdefineComponent({type:Yt,selectors:[["ac-corridor-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return Yt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Yt,[{type:t.Component,args:[{selector:"ac-corridor-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return Yt}))}]}]}],(function(){return[{type:We},{type:Re},{type:je},{type:st}]}),null);var qt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);qt.ɵfac=function(e){return new(e||qt)(d.ɵɵdirectiveInject($e),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},qt.ɵcmp=d.ɵɵdefineComponent({type:qt,selectors:[["ac-ellipsoid-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return qt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(qt,[{type:t.Component,args:[{selector:"ac-ellipsoid-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return qt}))}]}]}],(function(){return[{type:$e},{type:Re},{type:je},{type:st}]}),null);var Zt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Zt.ɵfac=function(e){return new(e||Zt)(d.ɵɵdirectiveInject(Qe),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Zt.ɵcmp=d.ɵɵdefineComponent({type:Zt,selectors:[["ac-polyline-volume-desc"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Zt,[{type:t.Component,args:[{selector:"ac-polyline-volume-desc",template:""}]}],(function(){return[{type:Qe},{type:Re},{type:je},{type:st}]}),null);var Xt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Xt.ɵfac=function(e){return new(e||Xt)(d.ɵɵdirectiveInject(Ye),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Xt.ɵcmp=d.ɵɵdefineComponent({type:Xt,selectors:[["ac-wall-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return Xt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Xt,[{type:t.Component,args:[{selector:"ac-wall-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return Xt}))}]}]}],(function(){return[{type:Ye},{type:Re},{type:je},{type:st}]}),null);var Jt=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Jt.ɵfac=function(e){return new(e||Jt)(d.ɵɵdirectiveInject(qe),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Jt.ɵcmp=d.ɵɵdefineComponent({type:Jt,selectors:[["ac-rectangle-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return Jt}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Jt,[{type:t.Component,args:[{selector:"ac-rectangle-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return Jt}))}]}]}],(function(){return[{type:qe},{type:Re},{type:je},{type:st}]}),null);var ei=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);ei.ɵfac=function(e){return new(e||ei)(d.ɵɵdirectiveInject(Xe),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},ei.ɵcmp=d.ɵɵdefineComponent({type:ei,selectors:[["ac-billboard-primitive-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return ei}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ei,[{type:t.Component,args:[{selector:"ac-billboard-primitive-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return ei}))}]}]}],(function(){return[{type:Xe},{type:Re},{type:je},{type:st}]}),null);var ti=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);ti.ɵfac=function(e){return new(e||ti)(d.ɵɵdirectiveInject(Ze),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},ti.ɵcmp=d.ɵɵdefineComponent({type:ti,selectors:[["ac-label-primitive-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return ti}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ti,[{type:t.Component,args:[{selector:"ac-label-primitive-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return ti}))}]}]}],(function(){return[{type:Ze},{type:Re},{type:je},{type:st}]}),null);var ii=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);ii.ɵfac=function(e){return new(e||ii)(d.ɵɵdirectiveInject(K),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},ii.ɵcmp=d.ɵɵdefineComponent({type:ii,selectors:[["ac-polyline-primitive-desc"]],features:[d.ɵɵProvidersFeature([{provide:at,useExisting:t.forwardRef((function(){return ii}))}]),d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ii,[{type:t.Component,args:[{selector:"ac-polyline-primitive-desc",template:"",providers:[{provide:at,useExisting:t.forwardRef((function(){return ii}))}]}]}],(function(){return[{type:K},{type:Re},{type:je},{type:st}]}),null);var ni=function(){function e(e,t){if(void 0===t&&(t=null),"object"!=typeof e)throw new Error("HtmlPrimitive ERROR: invalid html options!");this.scene=e.scene,this._mapContainer=e.mapContainer,this.show=e.show||!0,this.position=e.position,this.pixelOffset=e.pixelOffset,this.element=e.element,this.collection=t}return Object.defineProperty(e.prototype,"scene",{set:function(e){this._scene=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"show",{get:function(){return this._show},set:function(e){this._show=e,Cesium.defined(this.element)&&(this._element.style.display=e?"block":"none")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelOffset",{get:function(){return this._pixelOffset},set:function(e){this._pixelOffset=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"element",{get:function(){return this._element},set:function(e){this._element=e,Cesium.defined(e)&&(this._mapContainer.appendChild(e),this._element.style.position="absolute",this._element.style.zIndex=Number.MAX_VALUE.toString())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"collection",{get:function(){return this._collection},set:function(e){this._collection=e},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(Cesium.defined(this._show)&&Cesium.defined(this._element)){var e=Cesium.SceneTransforms.wgs84ToWindowCoordinates(this._scene,this._position);Cesium.defined(e)?Cesium.defined(this._pixelOffset)&&Cesium.defined(this._pixelOffset.x)&&Cesium.defined(this._pixelOffset.y)&&(e.y+=this._pixelOffset.y,e.x+=this._pixelOffset.x):e=new Cesium.Cartesian2(-1e3,-1e3),this._lastPosition&&this._lastPosition.equals(e)||(this._element.style.top=e.y+"px",this._element.style.left=e.x+"px",this._lastPosition=e)}},e.prototype.remove=function(){this._element&&this._element.remove()},e}(),oi=function(){function e(){this._collection=[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this._collection.length},enumerable:!1,configurable:!0}),e.prototype.get=function(e){return this._collection[e]},e.prototype.add=function(e){var t=new ni(e,this);return this._collection.push(t),t},e.prototype.remove=function(e){var t=this._collection.indexOf(e);return-1!==t&&(this._collection[t].remove(),this._collection.splice(t,1),!0)},e.prototype.update=function(){for(var e=0,t=this._collection.length;e<t;e++)this._collection[e].update()},e.prototype.removeAll=function(){for(;this._collection.length>0;){this._collection.pop().remove()}},e.prototype.contains=function(e){return Cesium.defined(e)&&e.collection===this},e.prototype.destroy=function(){this.removeAll()},e}(),ri=function(){function e(){}return e.extend=function(){Cesium.HtmlPrimitive=ni,Cesium.HtmlCollection=oi},e}(),si=function(){function e(){this._entities=new Map}return e.prototype.has=function(e){return this._entities.has(e)},e.prototype.get=function(e){return this._entities.get(e)},e.prototype.addOrUpdate=function(e,t){this._entities.set(e,t)},e.prototype.remove=function(e){this._entities.delete(e)},e.prototype.forEach=function(e){this._entities.forEach(e)},e}();si.ɵfac=function(e){return new(e||si)},si.ɵprov=d.ɵɵdefineInjectable({token:si,factory:si.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(si,[{type:t.Injectable}],(function(){return[]}),null);var ai=function(e,t){this.id=e,this.context=t},ci=function(){function e(e,t,i,n,o){this._templateRef=e,this._viewContainerRef=t,this._changeDetector=i,this._layerService=n,this._acHtmlManager=o,this._views=new Map}return e.prototype.ngOnInit=function(){},e.prototype._handleView=function(e,t,i){if(!this._views.has(e)&&t.show){var n=new ai(e,{$implicit:i}),o=this._viewContainerRef.createEmbeddedView(this._templateRef,n);this._views.set(e,{viewRef:o,context:n}),this._changeDetector.detectChanges()}else this._views.has(e)&&t.show&&this._changeDetector.detectChanges()},e.prototype.addOrUpdate=function(e,t){var i=this._layerService.context[this._layerService.getEntityName()];this._views.has(e)&&(this._views.get(e).context.context.$implicit=i),this._acHtmlManager.addOrUpdate(e,{entity:i,primitive:t}),this._handleView(e,t,i)},e.prototype.remove=function(e,t){if(this._views.has(e)){var i=this._views.get(e).viewRef;this._viewContainerRef.remove(this._viewContainerRef.indexOf(i)),this._views.delete(e),this._acHtmlManager.remove(e),t.element=null}},e}();ci.ɵfac=function(e){return new(e||ci)(d.ɵɵdirectiveInject(d.TemplateRef),d.ɵɵdirectiveInject(d.ViewContainerRef),d.ɵɵdirectiveInject(d.ChangeDetectorRef),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(si))},ci.ɵdir=d.ɵɵdefineDirective({type:ci,selectors:[["","acHtml",""]]}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ci,[{type:t.Directive,args:[{selector:"[acHtml]"}]}],(function(){return[{type:d.TemplateRef},{type:d.ViewContainerRef},{type:d.ChangeDetectorRef},{type:Re},{type:si}]}),null);var li=function(){function e(e,t){this._element=e,this._acHtmlManager=t}return Object.defineProperty(e.prototype,"acHtmlContainer",{set:function(e){this._id=e},enumerable:!1,configurable:!0}),e.prototype.ngOnInit=function(){if(void 0===this._id)throw new Error("AcHtml container ERROR: entity id not defined");this._acHtmlManager.get(this._id).primitive.element=this._element.nativeElement},e}();function pi(e,t){}function di(e,t){if(1&e&&(d.ɵɵelementStart(0,"div"),d.ɵɵelementStart(1,"div",1),d.ɵɵtemplate(2,pi,0,0,"ng-template",2),d.ɵɵelementEnd(),d.ɵɵelementEnd()),2&e){var i=t.id,n=t.context,o=d.ɵɵnextContext();d.ɵɵadvance(1),d.ɵɵproperty("acHtmlContainer",i),d.ɵɵadvance(1),d.ɵɵproperty("ngTemplateOutlet",o.acHtmlTemplate)("ngTemplateOutletContext",n)}}li.ɵfac=function(e){return new(e||li)(d.ɵɵdirectiveInject(d.ElementRef),d.ɵɵdirectiveInject(si))},li.ɵdir=d.ɵɵdefineDirective({type:li,selectors:[["","acHtmlContainer",""]],inputs:{acHtmlContainer:"acHtmlContainer"}}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(li,[{type:t.Directive,args:[{selector:"[acHtmlContainer]"}]}],(function(){return[{type:d.ElementRef},{type:si}]}),{acHtmlContainer:[{type:t.Input}]});var ui=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t.prototype.ngOnInit=function(){if(e.prototype.ngOnInit.call(this),!this.acHtmlCreator)throw new Error("AcHtml desc ERROR: ac html directive not found.");if(!this.acHtmlTemplate)throw new Error("AcHtml desc ERROR: html template not found.")},t.prototype.draw=function(e,t){var i=this._propsEvaluator(e);if(this._cesiumObjectsMap.has(t)){n=this._cesiumObjectsMap.get(t);this._drawer.update(n,i),this.acHtmlCreator.addOrUpdate(t,n)}else{var n=this._drawer.add(i);this._cesiumObjectsMap.set(t,n),this.acHtmlCreator.addOrUpdate(t,n)}},t.prototype.remove=function(e){var t=this._cesiumObjectsMap.get(e);this._drawer.remove(t),this._cesiumObjectsMap.delete(e),this.acHtmlCreator.remove(e,t)},t.prototype.removeAll=function(){var e=this;this._cesiumObjectsMap.forEach((function(t,i){e.acHtmlCreator.remove(i,t)})),this._cesiumObjectsMap.clear(),this._drawer.removeAll()},t}(at);ui.ɵfac=function(e){return new(e||ui)(d.ɵɵdirectiveInject(et),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},ui.ɵcmp=d.ɵɵdefineComponent({type:ui,selectors:[["ac-html-desc"]],contentQueries:function(e,i,n){if(1&e&&d.ɵɵcontentQuery(n,t.TemplateRef,7),2&e){var o;d.ɵɵqueryRefresh(o=d.ɵɵloadQuery())&&(i.acHtmlTemplate=o.first)}},viewQuery:function(e,t){if(1&e&&d.ɵɵviewQuery(ci,7),2&e){var i;d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.acHtmlCreator=i.first)}},features:[d.ɵɵProvidersFeature([si]),d.ɵɵInheritDefinitionFeature],decls:1,vars:0,consts:[[4,"acHtml"],[3,"acHtmlContainer"],[3,"ngTemplateOutlet","ngTemplateOutletContext"]],template:function(e,t){1&e&&d.ɵɵtemplate(0,di,3,3,"div",0)},directives:[ci,li,u.NgTemplateOutlet],encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ui,[{type:t.Component,args:[{selector:"ac-html-desc",providers:[si],template:'\n      <div *acHtml="let acHtmlEntityId = id; let acHtmlContext = context">\n          <div [acHtmlContainer]="acHtmlEntityId">\n              <ng-template [ngTemplateOutlet]="acHtmlTemplate"\n                           [ngTemplateOutletContext]="acHtmlContext"></ng-template>\n          </div>\n      </div>'}]}],(function(){return[{type:et},{type:Re},{type:je},{type:st}]}),{acHtmlCreator:[{type:t.ViewChild,args:[ci,{static:!0}]}],acHtmlTemplate:[{type:t.ContentChild,args:[t.TemplateRef,{static:!0}]}]});var hi=["contextMenuContainer"];function fi(e,t){}var gi=function(e){return{position:e}};function yi(e,t){if(1&e&&(d.ɵɵelementStart(0,"ac-html",1),d.ɵɵtemplate(1,fi,0,0,"ng-template",null,2,d.ɵɵtemplateRefExtractor),d.ɵɵelementEnd()),2&e){var i=d.ɵɵnextContext();d.ɵɵproperty("props",d.ɵɵpureFunction1(1,gi,i.contextMenuService.position))}}var vi=function(){function e(e,t,i){this.contextMenuService=e,this.cd=t,this.componentFactoryResolver=i}return e.prototype.ngOnInit=function(){var e=this;this.contextMenuChangeSubscription=this.contextMenuService.contextMenuChangeNotifier.subscribe((function(){return e.cd.detectChanges()})),this.contextMenuOpenSubscription=this.contextMenuService.onOpen.subscribe((function(){var t=e.componentFactoryResolver.resolveComponentFactory(e.contextMenuService.content);e.viewContainerRef.clear(),e.viewContainerRef.createComponent(t).instance.data=e.contextMenuService.options.data,e.cd.detectChanges()}))},e.prototype.ngOnDestroy=function(){this.contextMenuChangeSubscription&&this.contextMenuChangeSubscription.unsubscribe(),this.contextMenuOpenSubscription&&this.contextMenuOpenSubscription.unsubscribe()},e}();vi.ɵfac=function(e){return new(e||vi)(d.ɵɵdirectiveInject(M),d.ɵɵdirectiveInject(d.ChangeDetectorRef),d.ɵɵdirectiveInject(d.ComponentFactoryResolver))},vi.ɵcmp=d.ɵɵdefineComponent({type:vi,selectors:[["ac-context-menu-wrapper"]],viewQuery:function(e,i){if(1&e&&d.ɵɵviewQuery(hi,5,t.ViewContainerRef),2&e){var n;d.ɵɵqueryRefresh(n=d.ɵɵloadQuery())&&(i.viewContainerRef=n.first)}},decls:1,vars:1,consts:[[3,"props",4,"ngIf"],[3,"props"],["contextMenuContainer",""]],template:function(e,t){1&e&&d.ɵɵtemplate(0,yi,3,3,"ac-html",0),2&e&&d.ɵɵproperty("ngIf",t.contextMenuService.showContextMenu)},directives:[u.NgIf,Tt],encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(vi,[{type:t.Component,args:[{selector:"ac-context-menu-wrapper",template:'\n    <ac-html *ngIf="contextMenuService.showContextMenu" [props]="{position: contextMenuService.position}">\n      <ng-template #contextMenuContainer></ng-template>\n    </ac-html>\n  ',styles:[],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:M},{type:d.ChangeDetectorRef},{type:d.ComponentFactoryResolver}]}),{viewContainerRef:[{type:t.ViewChild,args:["contextMenuContainer",{read:t.ViewContainerRef}]}]});var mi=["layer"],bi=function(){function e(e,t){this.layerService=e,this.cd=t,this.show=!0,this.entitiesMap=new Map,this.id=0,this.acForRgx=/^let\s+.+\s+of\s+.+$/,this.arrayObservable$=new r.Subject}return e.prototype.ngOnChanges=function(e){if(e.acFor.firstChange){var t=e.acFor.currentValue;if(!this.acForRgx.test(t))throw new Error('ac-layer: Invalid [acFor] syntax. Expected: [acFor]="let item of observable" .Instead received: '+t);var i=e.acFor.currentValue.split(" ");this.arrayPath=i[3],this.entityName=i[1]}},e.prototype.ngOnInit=function(){var e=this;this.layer&&(this.layer.getLayerService().cache=!1),this.layerServiceSubscription=this.layerService.layerUpdates().subscribe((function(){e.cd.detectChanges()}))},e.prototype.ngAfterContentInit=function(){var e=this;this.layerService.context.arrayObservable$=this.arrayObservable$,this.layerService.registerDescription(this),this.basicDescs._results.forEach((function(t){t.setLayerService(e.layer.getLayerService())})),this.arrayDescs._results.splice(0,1),this.arrayDescs._results.forEach((function(t){e.layerService.unregisterDescription(t),e.layer.getLayerService().registerDescription(t),t.layerService=e.layer.getLayerService(),t.setLayerService(e.layer.getLayerService())}))},e.prototype.ngOnDestroy=function(){this.layerServiceSubscription&&this.layerServiceSubscription.unsubscribe()},e.prototype.setLayerService=function(e){this.layerService=e},e.prototype.draw=function(e,t,i){var n=this,o=g(e,this.arrayPath);if(o){var r=this.entitiesMap.get(t),s=[];if(this.entitiesMap.set(t,s),o.forEach((function(e,o){n.layerService.context[n.entityName]=e;var r=n.generateCombinedId(t,e,o);s.push(r),n.layer.update(i,r)})),r){var a=this.idGetter?r.filter((function(e){return s.indexOf(e)<0})):r;a&&a.forEach((function(e){return n.layer.remove(e)}))}}},e.prototype.remove=function(e){var t=this,i=this.entitiesMap.get(e);i&&i.forEach((function(e){return t.layer.remove(e)})),this.entitiesMap.delete(e)},e.prototype.removeAll=function(){this.layer.removeAll(),this.entitiesMap.clear()},e.prototype.getAcForString=function(){return"let "+this.entityName+"___temp of arrayObservable$"},e.prototype.generateCombinedId=function(e,t,i){return e+(this.idGetter?this.idGetter(t,i):this.id++%Number.MAX_SAFE_INTEGER)},e}();bi.ɵfac=function(e){return new(e||bi)(d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(d.ChangeDetectorRef))},bi.ɵcmp=d.ɵɵdefineComponent({type:bi,selectors:[["ac-array-desc"]],contentQueries:function(e,t,i){if(1&e&&(d.ɵɵcontentQuery(i,at,4),d.ɵɵcontentQuery(i,bi,4)),2&e){var n=void 0;d.ɵɵqueryRefresh(n=d.ɵɵloadQuery())&&(t.basicDescs=n),d.ɵɵqueryRefresh(n=d.ɵɵloadQuery())&&(t.arrayDescs=n)}},viewQuery:function(e,t){if(1&e&&d.ɵɵviewQuery(mi,7),2&e){var i;d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.layer=i.first)}},inputs:{acFor:"acFor",idGetter:"idGetter",show:"show"},features:[d.ɵɵNgOnChangesFeature],ngContentSelectors:["*"],decls:3,vars:5,consts:[[3,"acFor","context","options","show","zIndex"],["layer",""]],template:function(e,t){1&e&&(d.ɵɵprojectionDef(),d.ɵɵelementStart(0,"ac-layer",0,1),d.ɵɵprojection(2,0,["#content",""]),d.ɵɵelementEnd()),2&e&&d.ɵɵproperty("acFor",t.getAcForString())("context",t.layerService.context)("options",t.layerService.options)("show",t.layerService.show&&t.show)("zIndex",t.layerService.zIndex)},directives:[tt],encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(bi,[{type:t.Component,args:[{selector:"ac-array-desc",template:'\n    <ac-layer #layer [acFor]="getAcForString()"\n              [context]="layerService.context"\n              [options]="layerService.options"\n              [show]="layerService.show && show"\n              [zIndex]="layerService.zIndex">\n      <ng-content #content></ng-content>\n    </ac-layer>\n  ',changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:Re},{type:d.ChangeDetectorRef}]}),{acFor:[{type:t.Input}],idGetter:[{type:t.Input}],show:[{type:t.Input}],layer:[{type:t.ViewChild,args:["layer",{static:!0}]}],basicDescs:[{type:t.ContentChildren,args:[at,{descendants:!1}]}],arrayDescs:[{type:t.ContentChildren,args:[bi,{descendants:!1}]}]});var Ei=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Ei.ɵfac=function(e){return new(e||Ei)(d.ɵɵdirectiveInject(Je),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Ei.ɵcmp=d.ɵɵdefineComponent({type:Ei,selectors:[["ac-point-primitive-desc"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ei,[{type:t.Component,args:[{selector:"ac-point-primitive-desc",template:""}]}],(function(){return[{type:Je},{type:Re},{type:je},{type:st}]}),null);var Pi=function(e){function t(t,i){return e.call(this,t,i)||this}return S(t,e),t}(it);Pi.ɵfac=function(e){return new(e||Pi)(d.ɵɵdirectiveInject(K),d.ɵɵdirectiveInject(ae))},Pi.ɵcmp=d.ɵɵdefineComponent({type:Pi,selectors:[["ac-primitive-polyline"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Pi,[{type:t.Component,args:[{selector:"ac-primitive-polyline",template:""}]}],(function(){return[{type:K},{type:ae}]}),null);var Ci=[{pipeName:"pixelOffset",pipeInstance:new dt},{pipeName:"radiansToDegrees",pipeInstance:new ut}],Mi=function(e){function t(t,i,n,o){return e.call(this,t,i,n,o)||this}return S(t,e),t}(at);Mi.ɵfac=function(e){return new(e||Mi)(d.ɵɵdirectiveInject(N),d.ɵɵdirectiveInject(Re),d.ɵɵdirectiveInject(je),d.ɵɵdirectiveInject(st))},Mi.ɵcmp=d.ɵɵdefineComponent({type:Mi,selectors:[["ac-czml-desc"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Mi,[{type:t.Component,args:[{selector:"ac-czml-desc",template:""}]}],(function(){return[{type:N},{type:Re},{type:je},{type:st}]}),null);var Ii=function(e){function t(t,i){return e.call(this,t,i)||this}return S(t,e),t}(it);Ii.ɵfac=function(e){return new(e||Ii)(d.ɵɵdirectiveInject(qe),d.ɵɵdirectiveInject(ae))},Ii.ɵcmp=d.ɵɵdefineComponent({type:Ii,selectors:[["ac-rectangle"]],features:[d.ɵɵInheritDefinitionFeature],decls:0,vars:0,template:function(e,t){},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ii,[{type:t.Component,args:[{selector:"ac-rectangle",template:""}]}],(function(){return[{type:qe},{type:ae}]}),null);var Di=function(){function e(){ri.extend()}return e.forRoot=function(t){return{ngModule:e,providers:[rt,st,L,y,le,Oe,{provide:Te,useValue:t},{provide:a.PIPES_CONFIG,multi:!0,useValue:t&&t.customPipes||[]},{provide:a.PIPES_CONFIG,multi:!0,useValue:Ci}]}},e}();Di.ɵfac=function(e){return new(e||Di)},Di.ɵmod=d.ɵɵdefineNgModule({type:Di}),Di.ɵinj=d.ɵɵdefineInjector({imports:[[i.CommonModule,a.Angular2ParseModule,ft]]}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Di,[{type:t.NgModule,args:[{imports:[i.CommonModule,a.Angular2ParseModule,ft],declarations:[Ae,tt,nt,ct,ei,ht,ti,lt,pt,ii,dt,ut,gt,yt,Pt,Ct,Mt,It,Dt,Pi,_t,St,nt,Tt,Ot,wt,At,kt,xt,Wt,Kt,$t,Qt,Yt,qt,Zt,Xt,Jt,vi,Ei,ui,ci,li,bi,Mi,Nt,Ht,Bt,zt,Ut,Gt,Vt,Ii],exports:[Ae,nt,ct,ei,ht,ti,lt,pt,ii,tt,gt,yt,Pt,Ct,Mt,It,Dt,Pi,_t,St,nt,Tt,Ot,wt,At,kt,xt,Wt,Kt,$t,Qt,Yt,qt,Zt,Xt,Jt,Ei,ui,bi,Mi,Ii,Nt,Ht,Bt,zt,Ut,Gt,Vt]}]}],(function(){return[]}),null),("undefined"==typeof ngJitMode||ngJitMode)&&d.ɵɵsetNgModuleScope(Di,{declarations:[Ae,tt,nt,ct,ei,ht,ti,lt,pt,ii,dt,ut,gt,yt,Pt,Ct,Mt,It,Dt,Pi,_t,St,nt,Tt,Ot,wt,At,kt,xt,Wt,Kt,$t,Qt,Yt,qt,Zt,Xt,Jt,vi,Ei,ui,ci,li,bi,Mi,Nt,Ht,Bt,zt,Ut,Gt,Vt,Ii],imports:[i.CommonModule,a.Angular2ParseModule,ft],exports:[Ae,nt,ct,ei,ht,ti,lt,pt,ii,tt,gt,yt,Pt,Ct,Mt,It,Dt,Pi,_t,St,nt,Tt,Ot,wt,At,kt,xt,Wt,Kt,$t,Qt,Yt,qt,Zt,Xt,Jt,Ei,ui,bi,Mi,Ii,Nt,Ht,Bt,zt,Ut,Gt,Vt]}),d.ɵɵsetComponentScope(Ae,[u.NgIf,xt,vi],[]);var _i,Si=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t}(r.Observable);e.CesiumEventModifier=void 0,(_i=e.CesiumEventModifier||(e.CesiumEventModifier={}))[_i.ALT=Cesium.KeyboardEventModifier.ALT]="ALT",_i[_i.CTRL=Cesium.KeyboardEventModifier.CTRL]="CTRL",_i[_i.SHIFT=Cesium.KeyboardEventModifier.SHIFT]="SHIFT";var Ti,Oi,wi=function(){function t(e){this.mapsManager=e,this.selectedEntitiesItems$=new r.BehaviorSubject([]),this.selectedEntitySubject$=new r.Subject}return t.prototype.selectedEntities$=function(){return this.selectedEntitiesItems$.asObservable()},t.prototype.selectedEntities=function(){return this.selectedEntitiesItems$.getValue()},t.prototype.selectedEntity$=function(){return this.selectedEntitySubject$},t.prototype.toggleSelection=function(e,t){-1===this.selectedEntities().indexOf(e)?this.addToSelected(e,t):this.removeSelected(e,t)},t.prototype.addToSelected=function(e,t){t&&(e.selected=!0);var i=this.selectedEntities();this.selectedEntitySubject$.next(e),this.selectedEntitiesItems$.next(O(O([],T(i)),[e]))},t.prototype.removeSelected=function(e,t){t&&(e.selected=!1);var i=this.selectedEntities(),n=i.indexOf(e);-1!==n&&(i.splice(n,1),this.selectedEntitiesItems$.next(i),this.selectedEntitySubject$.next(e))},t.prototype.initSelection=function(t,i,n,r){var s=this;void 0===i&&(i=!0);var a=this.mapsManager.getMap(r);a&&(this.mapEventsManagerService=a.getMapEventsManager(),t||Object.assign(t,{event:e.CesiumEvent.LEFT_CLICK}),this.mapEventsManagerService.register({event:t.event,pick:e.PickOptions.PICK_ONE,modifier:t.modifier,entityType:t.entityType,priority:n}).pipe(o.map((function(e){return e.entities})),o.filter((function(e){return e&&e.length>0}))).subscribe((function(e){var t=e[0];s.toggleSelection(t,i)})))},t}();wi.ɵfac=function(e){return new(e||wi)(d.ɵɵinject(le))},wi.ɵprov=d.ɵɵdefineInjectable({token:wi,factory:wi.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(wi,[{type:t.Injectable}],(function(){return[{type:le}]}),null),e.EditModes=void 0,(Ti=e.EditModes||(e.EditModes={}))[Ti.CREATE=0]="CREATE",Ti[Ti.EDIT=1]="EDIT",Ti[Ti.CREATE_OR_EDIT=2]="CREATE_OR_EDIT",e.EditActions=void 0,(Oi=e.EditActions||(e.EditActions={}))[Oi.INIT=0]="INIT",Oi[Oi.MOUSE_MOVE=1]="MOUSE_MOVE",Oi[Oi.ADD_POINT=2]="ADD_POINT",Oi[Oi.ADD_LAST_POINT=3]="ADD_LAST_POINT",Oi[Oi.CHANGE_TO_EDIT=4]="CHANGE_TO_EDIT",Oi[Oi.REMOVE_POINT=5]="REMOVE_POINT",Oi[Oi.DRAG_POINT=6]="DRAG_POINT",Oi[Oi.DRAG_POINT_FINISH=7]="DRAG_POINT_FINISH",Oi[Oi.DRAG_SHAPE=8]="DRAG_SHAPE",Oi[Oi.DRAG_SHAPE_FINISH=9]="DRAG_SHAPE_FINISH",Oi[Oi.DONE=10]="DONE",Oi[Oi.DISABLE=11]="DISABLE",Oi[Oi.ENABLE=12]="ENABLE",Oi[Oi.DISPOSE=13]="DISPOSE",Oi[Oi.SET_EDIT_LABELS_RENDER_CALLBACK=14]="SET_EDIT_LABELS_RENDER_CALLBACK",Oi[Oi.UPDATE_EDIT_LABELS=15]="UPDATE_EDIT_LABELS",Oi[Oi.SET_MANUALLY=16]="SET_MANUALLY",Oi[Oi.TRANSFORM=17]="TRANSFORM";var Ai=function(e){function t(t,i,n,o){void 0===o&&(o=!1);var r=e.call(this)||this;return r._show=!0,r.editedEntityId=t,r.position=i,r.id=r.generateId(),r.pointProps=Object.assign({},n),r._virtualEditPoint=o,r}return S(t,e),Object.defineProperty(t.prototype,"show",{get:function(){return this._show},set:function(e){this._show=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"props",{get:function(){return this.pointProps},set:function(e){this.pointProps=e},enumerable:!1,configurable:!0}),t.prototype.isVirtualEditPoint=function(){return this._virtualEditPoint},t.prototype.setVirtualEditPoint=function(e){this._virtualEditPoint=e},t.prototype.getEditedEntityId=function(){return this.editedEntityId},t.prototype.getPosition=function(){return this.position.clone()},t.prototype.getPositionCallbackProperty=function(){return new Cesium.CallbackProperty(this.getPosition.bind(this),!1)},t.prototype.setPosition=function(e){this.position.x=e.x,this.position.y=e.y,this.position.z=e.z},t.prototype.getId=function(){return this.id},t.prototype.generateId=function(){return"edit-point-"+t.counter++},t}(bt);Ai.counter=0;var Li={backgroundColor:new Cesium.Color(.165,.165,.165,.7),backgroundPadding:new Cesium.Cartesian2(25,20),distanceDisplayCondition:void 0,fillColor:Cesium.Color.WHITE,font:"30px sans-serif",heightReference:Cesium.HeightReference.NONE,horizontalOrigin:Cesium.HorizontalOrigin.LEFT,outlineColor:Cesium.Color.BLACK,outlineWidth:1,pixelOffset:Cesium.Cartesian2.ZERO,pixelOffsetScaleByDistance:void 0,scale:1,scaleByDistance:void 0,show:!0,showBackground:!1,style:Cesium.LabelStyle.FILL,text:"",translucencyByDistance:void 0,verticalOrigin:Cesium.VerticalOrigin.BASELINE,eyeOffset:Cesium.Cartesian3.ZERO,disableDepthTestDistance:0},Ri=function(e){function t(t,i,n,o,r){var s=e.call(this)||this;return s.id=t,s.pointLayer=i,s.coordinateConverter=n,s.editOptions=o,s._enableEdit=!0,s._labels=[],s._props=Object.assign({},o.pointProps),r&&s.createFromExisting(r),s}return S(t,e),Object.defineProperty(t.prototype,"labels",{get:function(){return this._labels},set:function(e){if(e){var t=this.point.getPosition();this._labels=e.map((function(e,i){return e.position||(e.position=t),Object.assign({},Li,e)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"props",{get:function(){return this._props},set:function(e){this._props=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEdit",{get:function(){return this._enableEdit},set:function(e){this._enableEdit=e,e?this.point.props.color=Cesium.Color.WHITE:(this.point.props.color=Cesium.Color.DIMGREY,this.point.props.pixelSize=10),this.updatePointLayer()},enumerable:!1,configurable:!0}),t.prototype.createFromExisting=function(e){this.point=new Ai(this.id,e,this._props),this.updatePointLayer()},t.prototype.hasPosition=function(e){return!!e.position},t.prototype.setManually=function(e,t){if(!this.enableEdit)throw new Error("Update manually only in edit mode, after point is created");var i=t;this.hasPosition(e)?(i=e.pointProp?e.pointProp:t,this.point.setPosition(e.position)):this.point.setPosition(e),this.point.props=i,this.updatePointLayer()},t.prototype.addLastPoint=function(e){this.point.setPosition(e),this.updatePointLayer()},t.prototype.movePoint=function(e){this.point?this.point.setPosition(e):this.point=new Ai(this.id,e,this._props),this.updatePointLayer()},t.prototype.getCurrentPoint=function(){return this.point},t.prototype.getPosition=function(){return this.point.getPosition()},t.prototype.getPositionCallbackProperty=function(){return new Cesium.CallbackProperty(this.getPosition.bind(this),!1)},t.prototype.updatePointLayer=function(){this.pointLayer.update(this.point,this.point.getId())},t.prototype.update=function(){this.updatePointLayer()},t.prototype.dispose=function(){this.pointLayer.remove(this.point.getId())},t.prototype.getId=function(){return this.id},t}(bt),ji=function(){function e(){this.points=new Map}return e.prototype.createEditablePoint=function(e,t,i,n,o){var r=new Ri(e,t,i,n,o);this.points.set(e,r)},e.prototype.enableAll=function(){this.points.forEach((function(e){return e.enableEdit=!0}))},e.prototype.disableAll=function(){this.points.forEach((function(e){return e.enableEdit=!1}))},e.prototype.dispose=function(e){var t=this.points.get(e);t.getCurrentPoint()&&t.dispose(),this.points.delete(e)},e.prototype.get=function(e){return this.points.get(e)},e.prototype.clear=function(){this.points.forEach((function(e){return e.dispose()})),this.points.clear()},e}();function xi(e){void 0===e&&(e=12);for(var t="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=0;n<e;n++)t+=i.charAt(Math.floor(62*Math.random()));return t}function ki(e,t){var i;return function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];var r=this;clearTimeout(i),i=setTimeout((function(){return e.apply(r,n)}),t)}}ji.ɵfac=function(e){return new(e||ji)},ji.ɵprov=d.ɵɵdefineInjectable({token:ji,factory:ji.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(ji,[{type:t.Injectable}],null,null);var Fi={addLastPointEvent:e.CesiumEvent.LEFT_CLICK,removePointEvent:e.CesiumEvent.RIGHT_CLICK,dragPointEvent:e.CesiumEvent.LEFT_CLICK_DRAG,allowDrag:!0,pointProps:{color:Cesium.Color.WHITE.withAlpha(.95),outlineColor:Cesium.Color.BLACK.withAlpha(.5),outlineWidth:1,pixelSize:10,show:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY}},Ni=function(){function t(){this.updateSubject=new r.Subject,this.updatePublisher=o.publish()(this.updateSubject),this.observablesMap=new Map}return t.prototype.init=function(e,t,i,n,o){this.mapEventsManager=e,this.coordinateConverter=t,this.cameraService=i,this.pointManager=n,this.updatePublisher.connect(),this.cesiumScene=o.getScene()},t.prototype.onUpdate=function(){return this.updatePublisher},t.prototype.screenToPosition=function(e){var t=this.coordinateConverter.screenToCartesian3(e);if(t){var i=this.cameraService.getCamera().getPickRay(e);return this.cesiumScene.globe.pick(i,this.cesiumScene)}return t},t.prototype.create=function(t,i){var n=this;void 0===t&&(t=Fi),void 0===i&&(i=100);var o=xi(),s=this.setOptions(t),a=new r.BehaviorSubject({id:o,editAction:null,editMode:e.EditModes.CREATE});this.updateSubject.next({id:o,editMode:e.EditModes.CREATE,editAction:e.EditActions.INIT,pointOptions:s});var c=function(e){return n.switchToEditMode(o,a,e,i,s,d,!0)},l=this.mapEventsManager.register({event:e.CesiumEvent.MOUSE_MOVE,pick:e.PickOptions.NO_PICK,priority:i,pickConfig:t.pickConfiguration}),p=this.mapEventsManager.register({event:s.addLastPointEvent,modifier:s.addLastPointModifier,pick:e.PickOptions.NO_PICK,priority:i,pickConfig:t.pickConfiguration});this.observablesMap.set(o,[l,p]);var d=this.createEditorObservable(a,o,c);return l.subscribe((function(t){var i=t.movement.endPosition,r=n.screenToPosition(i);r&&n.updateSubject.next({id:o,position:r,editMode:e.EditModes.CREATE,updatedPosition:r,editAction:e.EditActions.MOUSE_MOVE})})),p.subscribe((function(e){var t=e.movement.endPosition,i=n.screenToPosition(t);c(i)})),d},t.prototype.switchToEditMode=function(t,i,n,o,r,s,a){var c={id:t,position:n,editMode:e.EditModes.CREATE_OR_EDIT,updatedPosition:n,editAction:e.EditActions.ADD_LAST_POINT};this.updateSubject.next(c),i.next(Object.assign(Object.assign({},c),{position:n,point:this.getPoint(t)}));var l={id:t,editMode:e.EditModes.CREATE,editAction:e.EditActions.CHANGE_TO_EDIT};return this.updateSubject.next(l),i.next(l),this.observablesMap.has(t)&&this.observablesMap.get(t).forEach((function(e){return e.dispose()})),this.observablesMap.delete(t),this.editPoint(t,n,o,i,r,s),true},t.prototype.edit=function(t,i,n){void 0===i&&(i=Fi),void 0===n&&(n=100);var o=xi(),s=this.setOptions(i),a=new r.BehaviorSubject({id:o,editAction:null,editMode:e.EditModes.EDIT}),c={id:o,position:t,editMode:e.EditModes.EDIT,editAction:e.EditActions.INIT,pointOptions:s};return this.updateSubject.next(c),a.next(Object.assign(Object.assign({},c),{position:t,point:this.getPoint(o)})),this.editPoint(o,t,n,a,s)},t.prototype.editPoint=function(t,i,n,r,s,a){var c=this,l=this.mapEventsManager.register({event:s.dragPointEvent,entityType:Ai,pick:e.PickOptions.PICK_FIRST,pickConfig:s.pickConfiguration,priority:n,pickFilter:function(e){return t===e.editedEntityId}}),p=this.mapEventsManager.register({event:s.removePointEvent,modifier:s.removePointModifier,entityType:Ai,pick:e.PickOptions.PICK_FIRST,pickConfig:s.pickConfiguration,priority:n,pickFilter:function(e){return t===e.editedEntityId}});l.pipe(o.tap((function(e){var t=e.movement.drop;return c.cameraService.enableInputs(t)}))).subscribe((function(i){var n=i.movement,o=n.endPosition,s=n.drop,a=(i.entities,c.screenToPosition(o));if(a){var l={id:t,editMode:e.EditModes.EDIT,updatedPosition:a,editAction:s?e.EditActions.DRAG_POINT_FINISH:e.EditActions.DRAG_POINT};c.updateSubject.next(l),r.next(Object.assign(Object.assign({},l),{position:a,point:c.getPoint(t)}))}}));var d=[l,p];return this.observablesMap.set(t,d),this.createEditorObservable(r,t)},t.prototype.setOptions=function(e){var t=JSON.parse(JSON.stringify(Fi)),i=Object.assign(t,e);return i.pointProps=Object.assign(Object.assign({},Fi.pointProps),e.pointProps),i.pointProps=Object.assign(Object.assign({},Fi.pointProps),e.pointProps),i},t.prototype.createEditorObservable=function(t,i,n){var o=this;return t.dispose=function(){var t=o.observablesMap.get(i);t&&t.forEach((function(e){return e.dispose()})),o.observablesMap.delete(i),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.DISPOSE})},t.enable=function(){o.updateSubject.next({id:i,position:o.getPosition(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.ENABLE})},t.disable=function(){o.updateSubject.next({id:i,position:o.getPosition(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.DISABLE})},t.setManually=function(t,n){o.pointManager.get(i).setManually(t,n),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_MANUALLY})},t.setLabelsRenderFn=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK,labelsRenderFn:t})},t.updateLabels=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.UPDATE_EDIT_LABELS,updateLabels:t})},t.finishCreation=function(){if(!n)throw new Error("Points editor error edit(): cannot call finishCreation() on edit");return n(null)},t.getCurrentPoint=function(){return o.getPoint(i)},t.getEditValue=function(){return t.getValue()},t.getLabels=function(){return o.pointManager.get(i).labels},t},t.prototype.getPosition=function(e){return this.pointManager.get(e).getPosition()},t.prototype.getPoint=function(e){var t=this.pointManager.get(e);if(t)return t.getCurrentPoint()},t}();Ni.ɵfac=function(e){return new(e||Ni)},Ni.ɵprov=d.ɵɵdefineInjectable({token:Ni,factory:Ni.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ni,[{type:t.Injectable}],null,null);var Hi=["editPointLayer"],Bi=["pointLabelsLayer"],Vi=function(){function t(e,t,i,n,o,s){this.pointsEditor=e,this.coordinateConverter=t,this.mapEventsManager=i,this.cameraService=n,this.pointsManager=o,this.cesiumService=s,this.Cesium=Cesium,this.editPoint$=new r.Subject,this.pointLabels$=new r.Subject,this.pointsEditor.init(this.mapEventsManager,this.coordinateConverter,this.cameraService,o,this.cesiumService),this.startListeningToEditorUpdates()}return t.prototype.startListeningToEditorUpdates=function(){var t=this;this.editorUpdatesSubscription=this.pointsEditor.onUpdate().subscribe((function(i){i.editMode===e.EditModes.CREATE||i.editMode===e.EditModes.CREATE_OR_EDIT?t.handleCreateUpdates(i):i.editMode===e.EditModes.EDIT&&t.handleEditUpdates(i)}))},t.prototype.getLabelId=function(e,t){return t.toString()},t.prototype.renderEditLabels=function(e,t,i){if(i)return e.labels=i,void this.pointLabelsLayer.update(e,e.getId());this.editLabelsRenderFn&&(t.position=e.getPosition(),t.point=e.getCurrentPoint(),e.labels=this.editLabelsRenderFn(t,e.labels),this.pointLabelsLayer.update(e,e.getId()))},t.prototype.removeEditLabels=function(e){e.labels=[],this.pointLabelsLayer.remove(e.getId())},t.prototype.handleCreateUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.pointsManager.createEditablePoint(t.id,this.editPointLayer,this.coordinateConverter,t.pointOptions,t.position);break;case e.EditActions.ADD_LAST_POINT:var i=this.pointsManager.get(t.id);t.updatedPosition&&(i.addLastPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.MOUSE_MOVE:i=this.pointsManager.get(t.id);t.updatedPosition&&(i.movePoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DISPOSE:(i=this.pointsManager.get(t.id))&&i.getCurrentPoint()&&this.removeEditLabels(i),this.pointsManager.dispose(t.id),this.editLabelsRenderFn=void 0;break;case e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK:i=this.pointsManager.get(t.id);this.editLabelsRenderFn=t.labelsRenderFn,this.renderEditLabels(i,t);break;case e.EditActions.UPDATE_EDIT_LABELS:i=this.pointsManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;case e.EditActions.SET_MANUALLY:i=this.pointsManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;default:return}},t.prototype.handleEditUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.pointsManager.createEditablePoint(t.id,this.editPointLayer,this.coordinateConverter,t.pointOptions,t.position);break;case e.EditActions.DRAG_POINT:case e.EditActions.DRAG_POINT_FINISH:(i=this.pointsManager.get(t.id))&&i.enableEdit&&(i.movePoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DISABLE:(i=this.pointsManager.get(t.id))&&(i.enableEdit=!1,this.renderEditLabels(i,t));break;case e.EditActions.ENABLE:var i;(i=this.pointsManager.get(t.id))&&(i.enableEdit=!0,this.renderEditLabels(i,t));break;default:return}},t.prototype.ngOnDestroy=function(){this.editorUpdatesSubscription.unsubscribe(),this.pointsManager.clear()},t.prototype.getPointSize=function(e){return e.isVirtualEditPoint()?e.props.virtualPointPixelSize:e.props.pixelSize},t.prototype.getPointShow=function(e){return e.show&&(e.isVirtualEditPoint()?e.props.showVirtual:e.props.show)},t}();Vi.ɵfac=function(e){return new(e||Vi)(d.ɵɵdirectiveInject(Ni),d.ɵɵdirectiveInject(D),d.ɵɵdirectiveInject(se),d.ɵɵdirectiveInject(C),d.ɵɵdirectiveInject(ji),d.ɵɵdirectiveInject(b))},Vi.ɵcmp=d.ɵɵdefineComponent({type:Vi,selectors:[["points-editor"]],viewQuery:function(e,t){if(1&e&&(d.ɵɵviewQuery(Hi,5),d.ɵɵviewQuery(Bi,5)),2&e){var i=void 0;d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editPointLayer=i.first),d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.pointLabelsLayer=i.first)}},features:[d.ɵɵProvidersFeature([D,ji])],decls:7,vars:3,consts:[["acFor","let point of editPoint$",3,"context"],["editPointLayer",""],["props","{\n        position: point.getPositionCallbackProperty(),\n        pixelSize: getPointSize(point),\n        color: point.props.color,\n        outlineColor: point.props.outlineColor,\n        outlineWidth: point.props.outlineWidth,\n        show: getPointShow(point),\n        disableDepthTestDistance: point.props.disableDepthTestDistance,\n        heightReference: point.props.heightReference,\n    }"],["acFor","let pointLabels of pointLabels$",3,"context"],["pointLabelsLayer",""],["acFor","let label of pointLabels.labels",3,"idGetter"],["props","{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"]],template:function(e,t){1&e&&(d.ɵɵelementStart(0,"ac-layer",0,1),d.ɵɵelement(2,"ac-point-desc",2),d.ɵɵelementEnd(),d.ɵɵelementStart(3,"ac-layer",3,4),d.ɵɵelementStart(5,"ac-array-desc",5),d.ɵɵelement(6,"ac-label-primitive-desc",6),d.ɵɵelementEnd(),d.ɵɵelementEnd()),2&e&&(d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("context",t),d.ɵɵadvance(2),d.ɵɵproperty("idGetter",t.getLabelId))},directives:[tt,Mt,bi,ti],encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Vi,[{type:t.Component,args:[{selector:"points-editor",template:'\n    <ac-layer #editPointLayer acFor="let point of editPoint$" [context]="this">\n      <ac-point-desc\n        props="{\n        position: point.getPositionCallbackProperty(),\n        pixelSize: getPointSize(point),\n        color: point.props.color,\n        outlineColor: point.props.outlineColor,\n        outlineWidth: point.props.outlineWidth,\n        show: getPointShow(point),\n        disableDepthTestDistance: point.props.disableDepthTestDistance,\n        heightReference: point.props.heightReference,\n    }"\n      ></ac-point-desc>\n    </ac-layer>\n\n    <ac-layer #pointLabelsLayer acFor="let pointLabels of pointLabels$" [context]="this">\n      <ac-array-desc acFor="let label of pointLabels.labels" [idGetter]="getLabelId">\n        <ac-label-primitive-desc\n          props="{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"\n        >\n        </ac-label-primitive-desc>\n      </ac-array-desc>\n    </ac-layer>\n  ',providers:[D,ji],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:Ni},{type:D},{type:se},{type:C},{type:ji},{type:b}]}),{editPointLayer:[{type:t.ViewChild,args:["editPointLayer"]}],pointLabelsLayer:[{type:t.ViewChild,args:["pointLabelsLayer"]}]});var Gi=function(e){function t(t,i,n,o){var r=e.call(this)||this;return r.editedEntityId=t,r.id=r.generateId(),r.positions=[i,n],r._polylineProps=Object.assign({},o),r}return S(t,e),Object.defineProperty(t.prototype,"props",{get:function(){return this._polylineProps},set:function(e){this._polylineProps=e},enumerable:!1,configurable:!0}),t.prototype.getEditedEntityId=function(){return this.editedEntityId},t.prototype.getPositions=function(){return this.positions.map((function(e){return e.clone()}))},t.prototype.getPositionsCallbackProperty=function(){return new Cesium.CallbackProperty(this.getPositions.bind(this),!1)},t.prototype.validatePositions=function(){return void 0!==this.positions[0]&&void 0!==this.positions[1]},t.prototype.getStartPosition=function(){return this.positions[0]},t.prototype.getEndPosition=function(){return this.positions[1]},t.prototype.setStartPosition=function(e){this.positions[0]=e},t.prototype.setEndPosition=function(e){this.positions[1]=e},t.prototype.getId=function(){return this.id},t.prototype.generateId=function(){return"edit-polyline-"+t.counter++},t}(bt);Gi.counter=0;var Ui=function(e){function t(t,i,n,o,r,s,a,c){var l=e.call(this)||this;return l.id=t,l.polygonsLayer=i,l.pointsLayer=n,l.polylinesLayer=o,l.coordinateConverter=r,l.scene=s,l.polygonOptions=a,l.positions=[],l.polylines=[],l.doneCreation=!1,l._enableEdit=!0,l._labels=[],l._outlineInstance=null,l.polygonProps=Object.assign({},a.polygonProps),l.defaultPointProps=Object.assign({},a.pointProps),l.defaultPolylineProps=Object.assign({},a.polylineProps),c&&c.length>=3&&l.createFromExisting(c),l}return S(t,e),Object.defineProperty(t.prototype,"labels",{get:function(){return this._labels},set:function(e){if(e){var t=this.getRealPositions();this._labels=e.map((function(e,i){return e.position||(e.position=t[i]),Object.assign({},Li,e)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultPolylineProps",{get:function(){return this._defaultPolylineProps},set:function(e){this._defaultPolylineProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultPointProps",{get:function(){return this._defaultPointProps},set:function(e){this._defaultPointProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polygonProps",{get:function(){return this._polygonProps},set:function(e){this._polygonProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEdit",{get:function(){return this._enableEdit},set:function(e){var t=this;this._enableEdit=e,this.positions.forEach((function(i){i.show=e,t.updatePointsLayer(!1,i)}))},enumerable:!1,configurable:!0}),t.prototype.createFromExisting=function(e){var t=this;e.forEach((function(e){t.addPointFromExisting(e)})),this.addAllVirtualEditPoints(),this.updatePolygonsLayer(),this.doneCreation=!0},t.prototype.setPointsManually=function(e,t){var i=this;if(!this.doneCreation)throw new Error("Update manually only in edit mode, after polygon is created");this.positions.forEach((function(e){return i.pointsLayer.remove(e.getId())}));for(var n=[],o=0;o<e.length;o++){var r=e[o],s=null;s=r.pointProps?new Ai(this.id,r.position,r.pointProps):new Ai(this.id,r,this.defaultPointProps),n.push(s)}this.positions=n,this.polygonProps=t||this.polygonProps,this.updatePointsLayer.apply(this,O([!0],T(this.positions))),this.addAllVirtualEditPoints(),this.updatePolygonsLayer()},t.prototype.addAllVirtualEditPoints=function(){var e=this,t=O([],T(this.positions));t.forEach((function(i,n){var o=i,r=(n+1)%t.length,s=t[r],a=e.setMiddleVirtualPoint(o,s);e.updatePointsLayer(!1,a)}))},t.prototype.setMiddleVirtualPoint=function(e,t){var i=Cesium.Cartesian3.lerp(e.getPosition(),t.getPosition(),.5,new Cesium.Cartesian3),n=new Ai(this.id,i,this.defaultPointProps);n.setVirtualEditPoint(!0);var o=this.positions.indexOf(e);return this.positions.splice(o+1,0,n),n},t.prototype.updateMiddleVirtualPoint=function(e,t,i){var n=Cesium.Cartesian3.lerp(t.getPosition(),i.getPosition(),.5,new Cesium.Cartesian3);e.setPosition(n)},t.prototype.changeVirtualPointToRealPoint=function(e){e.setVirtualEditPoint(!1);var t=this.positions.length,i=this.positions.indexOf(e),n=(i+1)%t,o=(i-1+t)%t,r=this.positions[n],s=this.positions[o],a=this.setMiddleVirtualPoint(s,e),c=this.setMiddleVirtualPoint(e,r);this.updatePointsLayer(!0,a,c,e),this.updatePolygonsLayer()},t.prototype.renderPolylines=function(){var e=this,t=this.positions.filter((function(e){return!e.isVirtualEditPoint()}));if(this.defaultPolylineProps.useGroundPrimitiveOutline){if(t.length<2)return;this.scene.groundPrimitives.remove(this._outlineInstance);var i=new Cesium.GeometryInstance({geometry:new Cesium.GroundPolylineGeometry({positions:this.positions.map((function(e){return e.getPosition()})),width:this.defaultPolylineProps.width,loop:!0}),id:"edit-ground-primitive-"+this.id,attributes:{color:Cesium.ColorGeometryInstanceAttribute.fromColor(this.defaultPolylineProps.material())}});this._outlineInstance=this.scene.groundPrimitives.add(new Cesium.GroundPolylinePrimitive({geometryInstances:i,asynchronous:!1,appearance:new Cesium.PolylineColorAppearance}))}else this.polylines.forEach((function(t){return e.polylinesLayer.remove(t.getId())})),this.polylines=[],t.forEach((function(i,n){var o=(n+1)%t.length,r=t[o],s=new Gi(e.id,i.getPosition(),r.getPosition(),e.defaultPolylineProps);e.polylines.push(s),e.polylinesLayer.update(s,s.getId())}))},t.prototype.addPointFromExisting=function(e){var t=new Ai(this.id,e,this.defaultPointProps);this.positions.push(t),this.updatePointsLayer(!0,t)},t.prototype.addPoint=function(e){if(!this.doneCreation){if(!this.positions.length){var t=new Ai(this.id,e,this.defaultPointProps);this.positions.push(t),this.updatePointsLayer(!0,t)}this.movingPoint=new Ai(this.id,e.clone(),this.defaultPointProps),this.positions.push(this.movingPoint),this.updatePointsLayer(!0,this.movingPoint),this.updatePolygonsLayer()}},t.prototype.movePointFinish=function(e){this.polygonOptions.clampHeightTo3D&&(e.props.disableDepthTestDistance=Number.POSITIVE_INFINITY,this.updatePointsLayer(!1,e))},t.prototype.movePoint=function(e,t){if(t.setPosition(e),this.doneCreation){if(t.props.disableDepthTestDistance&&this.polygonOptions.clampHeightTo3D)return void(t.props.disableDepthTestDistance=void 0);t.isVirtualEditPoint()&&this.changeVirtualPointToRealPoint(t);var i=this.positions.length,n=this.positions.indexOf(t),o=this.positions[(n+1)%i],r=this.positions[(n+2)%i],s=this.positions[(n-1+i)%i],a=this.positions[(n-2+i)%i];this.updateMiddleVirtualPoint(o,t,r),this.updateMiddleVirtualPoint(s,t,a)}this.updatePolygonsLayer(),this.updatePointsLayer(!0,t)},t.prototype.moveTempMovingPoint=function(e){this.movingPoint&&this.movePoint(e,this.movingPoint)},t.prototype.movePolygon=function(e,t){var i=this;if(this.doneCreation){this.lastDraggedToPosition||(this.lastDraggedToPosition=e);var n=L.getPositionsDelta(this.lastDraggedToPosition,t);this.positions.forEach((function(e){var t=L.addDeltaToPosition(e.getPosition(),n,!0);e.setPosition(t)})),this.updatePointsLayer(),this.lastDraggedToPosition=t,this.positions.forEach((function(e){return i.updatePointsLayer(!0,e)}))}},t.prototype.endMovePolygon=function(){this.lastDraggedToPosition=void 0},t.prototype.removePoint=function(e){var t=this;this.removePosition(e),this.positions.filter((function(e){return e.isVirtualEditPoint()})).forEach((function(e){return t.removePosition(e)})),this.addAllVirtualEditPoints(),this.renderPolylines(),this.getPointsCount()>=3&&this.polygonsLayer.update(this,this.id)},t.prototype.addLastPoint=function(e){this.doneCreation=!0,this.removePosition(this.movingPoint),this.movingPoint=null,this.updatePolygonsLayer(),this.addAllVirtualEditPoints()},t.prototype.getRealPositions=function(){return this.getRealPoints().map((function(e){return e.getPosition()}))},t.prototype.getRealPoints=function(){var e=this;return this.positions.filter((function(t){return!t.isVirtualEditPoint()&&t!==e.movingPoint}))},t.prototype.getPoints=function(){var e=this;return this.positions.filter((function(t){return t!==e.movingPoint}))},t.prototype.getPositionsHierarchy=function(){var e=this.positions.filter((function(e){return!e.isVirtualEditPoint()})).map((function(e){return e.getPosition().clone()}));return new Cesium.PolygonHierarchy(e)},t.prototype.getPositionsHierarchyCallbackProperty=function(){return new Cesium.CallbackProperty(this.getPositionsHierarchy.bind(this),!1)},t.prototype.removePosition=function(e){var t=this.positions.findIndex((function(t){return t===e}));t<0||(this.positions.splice(t,1),this.pointsLayer.remove(e.getId()))},t.prototype.updatePolygonsLayer=function(){this.getPointsCount()>=3&&this.polygonsLayer.update(this,this.id)},t.prototype.updatePointsLayer=function(e){var t=this;void 0===e&&(e=!0);for(var i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];e&&this.renderPolylines(),i.forEach((function(e){return t.pointsLayer.update(e,e.getId())}))},t.prototype.dispose=function(){var e=this;this.polygonsLayer.remove(this.id),this.scene.groundPrimitives.remove(this._outlineInstance),this.positions.forEach((function(t){e.pointsLayer.remove(t.getId())})),this.polylines.forEach((function(t){return e.polylinesLayer.remove(t.getId())})),this.movingPoint&&(this.pointsLayer.remove(this.movingPoint.getId()),this.movingPoint=void 0),this.positions.length=0},t.prototype.getPointsCount=function(){return this.positions.length},t.prototype.getId=function(){return this.id},t}(bt),zi=function(){function e(){this.polygons=new Map}return e.prototype.createEditablePolygon=function(e,t,i,n,o,r,s,a){var c=new Ui(e,t,i,n,o,r,s,a);this.polygons.set(e,c)},e.prototype.dispose=function(e){this.polygons.get(e).dispose(),this.polygons.delete(e)},e.prototype.get=function(e){return this.polygons.get(e)},e.prototype.clear=function(){this.polygons.forEach((function(e){return e.dispose()})),this.polygons.clear()},e}();zi.ɵfac=function(e){return new(e||zi)},zi.ɵprov=d.ɵɵdefineInjectable({token:zi,factory:zi.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(zi,[{type:t.Injectable}],null,null);var Wi={addPointEvent:e.CesiumEvent.LEFT_CLICK,addLastPointEvent:e.CesiumEvent.LEFT_DOUBLE_CLICK,removePointEvent:e.CesiumEvent.RIGHT_CLICK,dragPointEvent:e.CesiumEvent.LEFT_CLICK_DRAG,dragShapeEvent:e.CesiumEvent.LEFT_CLICK_DRAG,allowDrag:!0,pointProps:{color:Cesium.Color.WHITE.withAlpha(.95),outlineColor:Cesium.Color.BLACK.withAlpha(.2),outlineWidth:1,pixelSize:13,virtualPointPixelSize:8,show:!0,showVirtual:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY},polygonProps:{material:Cesium.Color.CORNFLOWERBLUE.withAlpha(.4),fill:!0,classificationType:Cesium.ClassificationType.BOTH,zIndex:0},polylineProps:{material:function(){return Cesium.Color.WHITE},width:3,clampToGround:!1,zIndex:0,classificationType:Cesium.ClassificationType.BOTH},clampHeightTo3D:!1,clampHeightTo3DOptions:{clampToTerrain:!1,clampMostDetailed:!0,clampToHeightPickWidth:2}},Ki=function(){function t(){var e=this;this.updateSubject=new r.Subject,this.updatePublisher=o.publish()(this.updateSubject),this.observablesMap=new Map,this.clampPointsDebounced=ki((function(t,i,n){e.clampPoints(t,i,n)}),300)}return t.prototype.init=function(e,t,i,n,o){this.mapEventsManager=e,this.coordinateConverter=t,this.cameraService=i,this.polygonsManager=n,this.updatePublisher.connect(),this.cesiumScene=o.getScene()},t.prototype.onUpdate=function(){return this.updatePublisher},t.prototype.clampPoints=function(e,t,i){var n=this,o=i.clampToTerrain,r=i.clampMostDetailed,s=i.clampToHeightPickWidth;if(t&&r){var a=this.polygonsManager.get(e).getPoints();if(o){var c=a.map((function(e){return n.coordinateConverter.cartesian3ToCartographic(e.getPosition())})),l=Cesium.sampleTerrain(this.cesiumScene.terrainProvider,11,c);Cesium.when(l,(function(e){a.forEach((function(t,i){t.setPosition(Cesium.Cartographic.toCartesian(e[i]))}))}))}else a.forEach((function(e){e.setPosition(n.cesiumScene.clampToHeight(e.getPosition(),void 0,s))}))}},t.prototype.screenToPosition=function(e,t,i){var n=this,o=i.clampToHeightPickWidth,r=i.clampToTerrain,s=this.coordinateConverter.screenToCartesian3(e);if(t&&s){var a=function(){var t=n.cameraService.getCamera().getPickRay(e);return n.cesiumScene.globe.pick(t,n.cesiumScene)};if(r)return a();var c=this.cesiumScene.pickPosition(e);return D.cartesian3ToLatLon(c).height<0?a():this.cesiumScene.clampToHeight(c,void 0,o)}return s},t.prototype.create=function(t,i){var n=this;void 0===t&&(t=Wi),void 0===i&&(i=100);var o=[],s=xi(),a=this.setOptions(t),c=new r.BehaviorSubject({id:s,editAction:null,editMode:e.EditModes.CREATE}),l=!1;this.updateSubject.next({id:s,positions:o,editMode:e.EditModes.CREATE,editAction:e.EditActions.INIT,polygonOptions:a});var p=function(e){return n.switchToEditMode(s,e,c,o,i,a,f,l)},d=this.mapEventsManager.register({event:e.CesiumEvent.MOUSE_MOVE,pick:e.PickOptions.NO_PICK,pickConfig:t.pickConfiguration,priority:i}),u=this.mapEventsManager.register({event:a.addPointEvent,modifier:a.addPointModifier,pick:e.PickOptions.NO_PICK,pickConfig:t.pickConfiguration,priority:i}),h=this.mapEventsManager.register({event:a.addLastPointEvent,modifier:a.addLastPointModifier,pick:e.PickOptions.NO_PICK,pickConfig:t.pickConfiguration,priority:i});this.observablesMap.set(s,[d,u,h]);var f=this.createEditorObservable(c,s,p);return d.subscribe((function(t){var i=t.movement.endPosition,o=n.screenToPosition(i,a.clampHeightTo3D,a.clampHeightTo3DOptions);o&&n.updateSubject.next({id:s,positions:n.getPositions(s),editMode:e.EditModes.CREATE,updatedPosition:o,editAction:e.EditActions.MOUSE_MOVE})})),u.subscribe((function(t){var i=t.movement.endPosition;if(!l){var o=n.screenToPosition(i,a.clampHeightTo3D,a.clampHeightTo3DOptions);if(o){var r=n.getPositions(s);if(!r.find((function(e){return e.equals(o)}))){var d={id:s,positions:r,editMode:e.EditModes.CREATE,updatedPosition:o,editAction:e.EditActions.ADD_POINT};n.updateSubject.next(d),c.next(Object.assign(Object.assign({},d),{positions:n.getPositions(s),points:n.getPoints(s)})),a.maximumNumberOfPoints&&r.length+1===a.maximumNumberOfPoints&&(l=p(o))}}}})),h.subscribe((function(t){var i=t.movement.endPosition,o=n.screenToPosition(i,a.clampHeightTo3D,a.clampHeightTo3DOptions);if(o){var r=n.getPositions(s);if(!r.find((function(e){return e.equals(o)}))){var d={id:s,positions:r,editMode:e.EditModes.CREATE,updatedPosition:o,editAction:e.EditActions.ADD_POINT};n.updateSubject.next(d),c.next(Object.assign(Object.assign({},d),{positions:n.getPositions(s),points:n.getPoints(s)}))}l=p(o)}})),f},t.prototype.switchToEditMode=function(t,i,n,o,r,s,a,c){var l={id:t,positions:this.getPositions(t),editMode:e.EditModes.CREATE,updatedPosition:i,editAction:e.EditActions.ADD_LAST_POINT};this.updateSubject.next(l),n.next(Object.assign(Object.assign({},l),{positions:this.getPositions(t),points:this.getPoints(t)}));var p={id:t,editMode:e.EditModes.CREATE,editAction:e.EditActions.CHANGE_TO_EDIT};return this.updateSubject.next(p),n.next(p),this.observablesMap.has(t)&&this.observablesMap.get(t).forEach((function(e){return e.dispose()})),this.observablesMap.delete(t),this.editPolygon(t,o,r,n,s,a),true},t.prototype.edit=function(t,i,n){if(void 0===i&&(i=Wi),void 0===n&&(n=100),t.length<3)throw new Error("Polygons editor error edit(): polygon should have at least 3 positions");var o=xi(),s=this.setOptions(i),a=new r.BehaviorSubject({id:o,editAction:null,editMode:e.EditModes.EDIT}),c={id:o,positions:t,editMode:e.EditModes.EDIT,editAction:e.EditActions.INIT,polygonOptions:s};return this.updateSubject.next(c),a.next(Object.assign(Object.assign({},c),{positions:this.getPositions(o),points:this.getPoints(o)})),this.editPolygon(o,t,n,a,s)},t.prototype.editPolygon=function(t,i,n,r,s,a){var c=this;this.clampPoints(t,s.clampHeightTo3D,s.clampHeightTo3DOptions);var l,p=this.mapEventsManager.register({event:s.dragPointEvent,entityType:Ai,pick:e.PickOptions.PICK_FIRST,pickConfig:s.pickConfiguration,priority:n,pickFilter:function(e){return t===e.editedEntityId}});s.allowDrag&&(l=this.mapEventsManager.register({event:s.dragShapeEvent,entityType:Ui,pick:e.PickOptions.PICK_FIRST,pickConfig:s.pickConfiguration,priority:n,pickFilter:function(e){return t===e.id}}));var d=this.mapEventsManager.register({event:s.removePointEvent,entityType:Ai,modifier:s.removePointModifier,pick:e.PickOptions.PICK_FIRST,pickConfig:s.pickConfiguration,priority:n,pickFilter:function(e){return t===e.editedEntityId}});p.pipe(o.tap((function(e){var i=e.movement.drop;return c.polygonsManager.get(t).enableEdit&&c.cameraService.enableInputs(i)}))).subscribe((function(i){var n=i.movement,o=n.endPosition,a=n.drop,l=i.entities,p=c.screenToPosition(o,s.clampHeightTo3D,s.clampHeightTo3DOptions);if(p){var d=l[0],u={id:t,positions:c.getPositions(t),editMode:e.EditModes.EDIT,updatedPosition:p,updatedPoint:d,editAction:a?e.EditActions.DRAG_POINT_FINISH:e.EditActions.DRAG_POINT};c.updateSubject.next(u),r.next(Object.assign(Object.assign({},u),{positions:c.getPositions(t),points:c.getPoints(t)})),c.clampPointsDebounced(t,s.clampHeightTo3D,s.clampHeightTo3DOptions)}})),l&&l.pipe(o.tap((function(e){var i=e.movement.drop;return c.polygonsManager.get(t).enableEdit&&c.cameraService.enableInputs(i)}))).subscribe((function(i){var n=i.movement,o=n.startPosition,a=n.endPosition,l=n.drop,p=(i.entities,c.screenToPosition(a,!1,s.clampHeightTo3DOptions)),d=c.screenToPosition(o,!1,s.clampHeightTo3DOptions);if(p){var u={id:t,positions:c.getPositions(t),editMode:e.EditModes.EDIT,updatedPosition:p,draggedPosition:d,editAction:l?e.EditActions.DRAG_SHAPE_FINISH:e.EditActions.DRAG_SHAPE};c.updateSubject.next(u),r.next(Object.assign(Object.assign({},u),{positions:c.getPositions(t),points:c.getPoints(t)}))}})),d.subscribe((function(i){var n=i.entities[0],o=O([],T(c.getPositions(t)));if(!(o.length<4)&&!(o.findIndex((function(e){return n.getPosition().equals(e)}))<0)){var a={id:t,positions:o,editMode:e.EditModes.EDIT,updatedPoint:n,editAction:e.EditActions.REMOVE_POINT};c.updateSubject.next(a),r.next(Object.assign(Object.assign({},a),{positions:c.getPositions(t),points:c.getPoints(t)})),c.clampPoints(t,s.clampHeightTo3D,s.clampHeightTo3DOptions)}}));var u=[p,d];return l&&u.push(l),this.observablesMap.set(t,u),a||this.createEditorObservable(r,t)},t.prototype.setOptions=function(e){e.maximumNumberOfPoints&&e.maximumNumberOfPoints<3&&(console.warn("Warn: PolygonEditor invalid option. maximumNumberOfPoints smaller then 3, maximumNumberOfPoints changed to 3"),e.maximumNumberOfPoints=3);var t=JSON.parse(JSON.stringify(Wi)),i=Object.assign(t,e);if(i.pointProps=Object.assign(Object.assign({},Wi.pointProps),e.pointProps),i.polygonProps=Object.assign(Object.assign({},Wi.polygonProps),e.polygonProps),i.polylineProps=Object.assign(Object.assign({},Wi.polylineProps),e.polylineProps),i.clampHeightTo3DOptions=Object.assign(Object.assign({},Wi.clampHeightTo3DOptions),e.clampHeightTo3DOptions),e.clampHeightTo3D){if(!this.cesiumScene.pickPositionSupported||!this.cesiumScene.clampToHeightSupported)throw new Error("Cesium pickPosition and clampToHeight must be supported to use clampHeightTo3D");this.cesiumScene.pickTranslucentDepth&&console.warn("Cesium scene.pickTranslucentDepth must be false in order to make the editors work properly on 3D"),1!==i.pointProps.color.alpha&&1!==i.pointProps.outlineColor.alpha||console.warn("Point color and outline color must have alpha in order to make the editor work properly on 3D"),i.allowDrag=!!e.allowDrag,i.polylineProps.clampToGround=!0,i.pointProps.heightReference=i.clampHeightTo3DOptions.clampToTerrain?Cesium.HeightReference.CLAMP_TO_GROUND:Cesium.HeightReference.RELATIVE_TO_GROUND,i.pointProps.disableDepthTestDistance=Number.POSITIVE_INFINITY}return i},t.prototype.createEditorObservable=function(t,i,n){var o=this;return t.dispose=function(){var t=o.observablesMap.get(i);t&&t.forEach((function(e){return e.dispose()})),o.observablesMap.delete(i),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.DISPOSE})},t.enable=function(){o.updateSubject.next({id:i,positions:o.getPositions(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.ENABLE})},t.disable=function(){o.updateSubject.next({id:i,positions:o.getPositions(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.DISABLE})},t.setManually=function(t,n){o.polygonsManager.get(i).setPointsManually(t,n),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_MANUALLY})},t.setLabelsRenderFn=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK,labelsRenderFn:t})},t.updateLabels=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.UPDATE_EDIT_LABELS,updateLabels:t})},t.finishCreation=function(){if(!n)throw new Error("Polygons editor error edit(): cannot call finishCreation() on edit");return n(null)},t.getCurrentPoints=function(){return o.getPoints(i)},t.getEditValue=function(){return t.getValue()},t.getLabels=function(){return o.polygonsManager.get(i).labels},t},t.prototype.getPositions=function(e){return this.polygonsManager.get(e).getRealPositions()},t.prototype.getPoints=function(e){return this.polygonsManager.get(e).getRealPoints()},t}();Ki.ɵfac=function(e){return new(e||Ki)},Ki.ɵprov=d.ɵɵdefineInjectable({token:Ki,factory:Ki.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ki,[{type:t.Injectable}],null,null);var $i=["editPolygonsLayer"],Qi=["editPointsLayer"],Yi=["editPolylinesLayer"],qi=function(){function t(e,t,i,n,o,s){this.polygonsEditor=e,this.coordinateConverter=t,this.mapEventsManager=i,this.cameraService=n,this.polygonsManager=o,this.cesiumService=s,this.Cesium=Cesium,this.editPoints$=new r.Subject,this.editPolylines$=new r.Subject,this.editPolygons$=new r.Subject,this.polygonsEditor.init(this.mapEventsManager,this.coordinateConverter,this.cameraService,this.polygonsManager,this.cesiumService),this.startListeningToEditorUpdates()}return t.prototype.startListeningToEditorUpdates=function(){var t=this;this.editorUpdatesSubscription=this.polygonsEditor.onUpdate().subscribe((function(i){i.editMode===e.EditModes.CREATE||i.editMode===e.EditModes.CREATE_OR_EDIT?t.handleCreateUpdates(i):i.editMode===e.EditModes.EDIT&&t.handleEditUpdates(i)}))},t.prototype.getLabelId=function(e,t){return t.toString()},t.prototype.renderEditLabels=function(e,t,i){if(t.positions=e.getRealPositions(),t.points=e.getRealPoints(),i)return e.labels=i,void this.editPolygonsLayer.update(e,e.getId());this.editLabelsRenderFn&&(e.labels=this.editLabelsRenderFn(t,e.labels),this.editPolygonsLayer.update(e,e.getId()))},t.prototype.removeEditLabels=function(e){e.labels=[],this.editPolygonsLayer.update(e,e.getId())},t.prototype.handleCreateUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.polygonsManager.createEditablePolygon(t.id,this.editPolygonsLayer,this.editPointsLayer,this.editPolylinesLayer,this.coordinateConverter,this.cesiumService.getScene(),t.polygonOptions);break;case e.EditActions.MOUSE_MOVE:var i=this.polygonsManager.get(t.id);t.updatedPosition&&(i.moveTempMovingPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.ADD_POINT:i=this.polygonsManager.get(t.id);t.updatedPosition&&(i.moveTempMovingPoint(t.updatedPosition),i.addPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.ADD_LAST_POINT:i=this.polygonsManager.get(t.id);t.updatedPosition&&(i.addLastPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DISPOSE:(i=this.polygonsManager.get(t.id))&&(i.dispose(),this.removeEditLabels(i),this.editLabelsRenderFn=void 0);break;case e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK:i=this.polygonsManager.get(t.id);this.editLabelsRenderFn=t.labelsRenderFn,this.renderEditLabels(i,t);break;case e.EditActions.UPDATE_EDIT_LABELS:i=this.polygonsManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;case e.EditActions.SET_MANUALLY:i=this.polygonsManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;default:return}},t.prototype.handleEditUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.polygonsManager.createEditablePolygon(t.id,this.editPolygonsLayer,this.editPointsLayer,this.editPolylinesLayer,this.coordinateConverter,this.cesiumService.getScene(),t.polygonOptions,t.positions);break;case e.EditActions.DRAG_POINT:(i=this.polygonsManager.get(t.id))&&i.enableEdit&&(i.movePoint(t.updatedPosition,t.updatedPoint),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_POINT_FINISH:(i=this.polygonsManager.get(t.id))&&i.enableEdit&&(i.movePointFinish(t.updatedPoint),t.updatedPoint.isVirtualEditPoint()&&(i.changeVirtualPointToRealPoint(t.updatedPoint),this.renderEditLabels(i,t)));break;case e.EditActions.REMOVE_POINT:(i=this.polygonsManager.get(t.id))&&i.enableEdit&&(i.removePoint(t.updatedPoint),this.renderEditLabels(i,t));break;case e.EditActions.DISABLE:(i=this.polygonsManager.get(t.id))&&(i.enableEdit=!1,this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE:(i=this.polygonsManager.get(t.id))&&i.enableEdit&&(i.movePolygon(t.draggedPosition,t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE_FINISH:(i=this.polygonsManager.get(t.id))&&i.enableEdit&&(i.endMovePolygon(),this.renderEditLabels(i,t));break;case e.EditActions.ENABLE:var i;(i=this.polygonsManager.get(t.id))&&(i.enableEdit=!0,this.renderEditLabels(i,t));break;default:return}},t.prototype.ngOnDestroy=function(){this.editorUpdatesSubscription.unsubscribe(),this.polygonsManager.clear()},t.prototype.getPointSize=function(e){return e.isVirtualEditPoint()?e.props.virtualPointPixelSize:e.props.pixelSize},t.prototype.getPointShow=function(e){return e.show&&(e.isVirtualEditPoint()?e.props.showVirtual:e.props.show)},t}();qi.ɵfac=function(e){return new(e||qi)(d.ɵɵdirectiveInject(Ki),d.ɵɵdirectiveInject(D),d.ɵɵdirectiveInject(se),d.ɵɵdirectiveInject(C),d.ɵɵdirectiveInject(zi),d.ɵɵdirectiveInject(b))},qi.ɵcmp=d.ɵɵdefineComponent({type:qi,selectors:[["polygons-editor"]],viewQuery:function(e,t){if(1&e&&(d.ɵɵviewQuery($i,5),d.ɵɵviewQuery(Qi,5),d.ɵɵviewQuery(Yi,5)),2&e){var i=void 0;d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editPolygonsLayer=i.first),d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editPointsLayer=i.first),d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editPolylinesLayer=i.first)}},features:[d.ɵɵProvidersFeature([D,zi])],decls:11,vars:4,consts:[["acFor","let polyline of editPolylines$",3,"context"],["editPolylinesLayer",""],["props","{\n        positions: polyline.getPositionsCallbackProperty(),\n        width: polyline.props.width,\n        material: polyline.props.material(),\n        clampToGround: polyline.props.clampToGround,\n        zIndex: polyline.props.zIndex,\n        classificationType: polyline.props.classificationType,\n      }"],["acFor","let point of editPoints$",3,"context"],["editPointsLayer",""],["props","{\n        position: point.getPositionCallbackProperty(),\n        pixelSize: getPointSize(point),\n        color: point.props.color,\n        outlineColor: point.props.outlineColor,\n        outlineWidth: point.props.outlineWidth,\n        show: getPointShow(point),\n        disableDepthTestDistance: point.props.disableDepthTestDistance,\n        heightReference: point.props.heightReference,\n    }"],["acFor","let polygon of editPolygons$",3,"context"],["editPolygonsLayer",""],["props","{\n          hierarchy: polygon.getPositionsHierarchyCallbackProperty(),\n          material: polygon.polygonProps.material,\n          fill: polygon.polygonProps.fill,\n          classificationType: polygon.polygonProps.classificationType,\n          zIndex: polygon.polygonProps.zIndex,\n        }"],["acFor","let label of polygon.labels",3,"idGetter"],["props","{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"]],template:function(e,t){1&e&&(d.ɵɵelementStart(0,"ac-layer",0,1),d.ɵɵelement(2,"ac-polyline-desc",2),d.ɵɵelementEnd(),d.ɵɵelementStart(3,"ac-layer",3,4),d.ɵɵelement(5,"ac-point-desc",5),d.ɵɵelementEnd(),d.ɵɵelementStart(6,"ac-layer",6,7),d.ɵɵelement(8,"ac-polygon-desc",8),d.ɵɵelementStart(9,"ac-array-desc",9),d.ɵɵelement(10,"ac-label-primitive-desc",10),d.ɵɵelementEnd(),d.ɵɵelementEnd()),2&e&&(d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("idGetter",t.getLabelId))},directives:[tt,pt,Mt,At,bi,ti],encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(qi,[{type:t.Component,args:[{selector:"polygons-editor",template:'\n    <ac-layer #editPolylinesLayer acFor="let polyline of editPolylines$" [context]="this">\n      <ac-polyline-desc\n        props="{\n        positions: polyline.getPositionsCallbackProperty(),\n        width: polyline.props.width,\n        material: polyline.props.material(),\n        clampToGround: polyline.props.clampToGround,\n        zIndex: polyline.props.zIndex,\n        classificationType: polyline.props.classificationType,\n      }"\n      >\n      </ac-polyline-desc>\n    </ac-layer>\n\n    <ac-layer #editPointsLayer acFor="let point of editPoints$" [context]="this">\n      <ac-point-desc\n        props="{\n        position: point.getPositionCallbackProperty(),\n        pixelSize: getPointSize(point),\n        color: point.props.color,\n        outlineColor: point.props.outlineColor,\n        outlineWidth: point.props.outlineWidth,\n        show: getPointShow(point),\n        disableDepthTestDistance: point.props.disableDepthTestDistance,\n        heightReference: point.props.heightReference,\n    }"\n      >\n      </ac-point-desc>\n    </ac-layer>\n\n    <ac-layer #editPolygonsLayer acFor="let polygon of editPolygons$" [context]="this">\n      <ac-polygon-desc\n        props="{\n          hierarchy: polygon.getPositionsHierarchyCallbackProperty(),\n          material: polygon.polygonProps.material,\n          fill: polygon.polygonProps.fill,\n          classificationType: polygon.polygonProps.classificationType,\n          zIndex: polygon.polygonProps.zIndex,\n        }"\n      >\n      </ac-polygon-desc>\n      <ac-array-desc acFor="let label of polygon.labels" [idGetter]="getLabelId">\n        <ac-label-primitive-desc\n          props="{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"\n        >\n        </ac-label-primitive-desc>\n      </ac-array-desc>\n    </ac-layer>\n  ',providers:[D,zi],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:Ki},{type:D},{type:se},{type:C},{type:zi},{type:b}]}),{editPolygonsLayer:[{type:t.ViewChild,args:["editPolygonsLayer"]}],editPointsLayer:[{type:t.ViewChild,args:["editPointsLayer"]}],editPolylinesLayer:[{type:t.ViewChild,args:["editPolylinesLayer"]}]});var Zi=function(e){function t(t,i,n,o,r,s){var a=e.call(this)||this;return a._arcProps=s,a.id=a.generateId(),a.editedEntityId=t,a._center=i,a._radius=n,a._delta=o,a._angle=r,a}return S(t,e),Object.defineProperty(t.prototype,"props",{get:function(){return this._arcProps},set:function(e){this._arcProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"delta",{get:function(){return this._delta},set:function(e){this._delta=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"center",{get:function(){return this._center},set:function(e){this._center=e},enumerable:!1,configurable:!0}),t.prototype.updateCenter=function(e){this._center.x=e.x,this._center.y=e.y,this._center.z=e.z},t.prototype.getId=function(){return this.id},t.prototype.generateId=function(){return"edit-arc-"+t.counter++},t}(bt);Zi.counter=0;var Xi=function(e){function t(t,i,n,o,r){var s=e.call(this)||this;return s.id=t,s.circlesLayer=i,s.pointsLayer=n,s.arcsLayer=o,s.options=r,s.doneCreation=!1,s._enableEdit=!0,s._labels=[],s._circleProps=Object.assign({},r.circleProps),s._pointProps=Object.assign({},r.pointProps),s._polylineProps=Object.assign({},r.polylineProps),s}return S(t,e),Object.defineProperty(t.prototype,"labels",{get:function(){return this._labels},set:function(e){var t=this;e&&this._center&&this._radiusPoint&&(this._labels=e.map((function(i,n){return i.position||(n!==e.length-1?i.position=t._center.getPosition():i.position=t._radiusPoint.getPosition()),Object.assign({},Li,i)})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polylineProps",{get:function(){return this._polylineProps},set:function(e){this._polylineProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointProps",{get:function(){return this._pointProps},set:function(e){this._pointProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"circleProps",{get:function(){return this._circleProps},set:function(e){this._circleProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"center",{get:function(){return this._center},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"radiusPoint",{get:function(){return this._radiusPoint},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEdit",{get:function(){return this._enableEdit},set:function(e){this._enableEdit=e,this._center.show=e,this._radiusPoint.show=e,this.updatePointsLayer()},enumerable:!1,configurable:!0}),t.prototype.setManually=function(e,t,i,n,o){void 0===i&&(i=this.pointProps),void 0===n&&(n=this.pointProps),void 0===o&&(o=this.circleProps),this._center?this._center.setPosition(e):this._center=new Ai(this.id,e,i),this._radiusPoint?this._radiusPoint.setPosition(t):this._radiusPoint=new Ai(this.id,t,n),this._outlineArc?this._outlineArc.radius=this.getRadius():this.createOutlineArc(),this.circleProps=o,this.doneCreation=!0,this.updateArcsLayer(),this.updatePointsLayer(),this.updateCirclesLayer()},t.prototype.addPoint=function(e){this.doneCreation||(this._center||(this._center=new Ai(this.id,e,this.pointProps),this._radiusPoint=new Ai(this.id,e.clone(),this.pointProps),this._outlineArc||this.createOutlineArc()),this.updateArcsLayer(),this.updatePointsLayer(),this.updateCirclesLayer())},t.prototype.addLastPoint=function(e){!this.doneCreation&&this._center&&this._radiusPoint&&(this._radiusPoint.setPosition(e),this.doneCreation=!0,this.updatePointsLayer(),this.updateCirclesLayer())},t.prototype.movePoint=function(e){this._center&&this._radiusPoint&&(this._radiusPoint.setPosition(e),this._outlineArc.radius=this.getRadius(),this.updateArcsLayer(),this.updatePointsLayer(),this.updateCirclesLayer())},t.prototype.moveCircle=function(e,t){if(this.doneCreation){this.lastDraggedToPosition||(this.lastDraggedToPosition=e);var i=this.getRadius(),n=L.getPositionsDelta(this.lastDraggedToPosition,t),o=L.addDeltaToPosition(this.getCenter(),n,!0);this._center.setPosition(o),this.radiusPoint.setPosition(L.pointByLocationDistanceAndAzimuth(this.getCenter(),i,Math.PI/2,!0)),this._outlineArc.radius=this.getRadius(),this._outlineArc.center=this._center.getPosition(),this.updateArcsLayer(),this.updatePointsLayer(),this.updateCirclesLayer(),this.lastDraggedToPosition=t}},t.prototype.endMovePolygon=function(){this.lastDraggedToPosition=void 0},t.prototype.getRadius=function(){return this._center&&this._radiusPoint?L.distance(this._center.getPosition(),this._radiusPoint.getPosition()):0},t.prototype.getRadiusCallbackProperty=function(){return new Cesium.CallbackProperty(this.getRadius.bind(this),!1)},t.prototype.getCenter=function(){return this._center?this._center.getPosition():void 0},t.prototype.getCenterCallbackProperty=function(){return new Cesium.CallbackProperty(this.getCenter.bind(this),!1)},t.prototype.getRadiusPoint=function(){return this._radiusPoint?this._radiusPoint.getPosition():void 0},t.prototype.dispose=function(){this._center&&this.pointsLayer.remove(this._center.getId()),this._radiusPoint&&this.pointsLayer.remove(this._radiusPoint.getId()),this._outlineArc&&this.arcsLayer.remove(this._outlineArc.getId()),this.circlesLayer.remove(this.id)},t.prototype.getId=function(){return this.id},t.prototype.updateCirclesLayer=function(){this.circlesLayer.update(this,this.id)},t.prototype.updatePointsLayer=function(){this._center&&this.pointsLayer.update(this._center,this._center.getId()),this._radiusPoint&&this.pointsLayer.update(this._radiusPoint,this._radiusPoint.getId())},t.prototype.updateArcsLayer=function(){this._outlineArc&&this.arcsLayer.update(this._outlineArc,this._outlineArc.getId())},t.prototype.createOutlineArc=function(){this._center&&this._radiusPoint&&(this._outlineArc=new Zi(this.id,this.getCenter(),this.getRadius(),2*Math.PI,0,this.polylineProps))},t}(bt),Ji=function(){function e(){this.circles=new Map}return e.prototype.createEditableCircle=function(e,t,i,n,o){var r=new Xi(e,t,i,n,o);return this.circles.set(e,r),r},e.prototype.dispose=function(e){var t=this.circles.get(e);t&&t.dispose(),this.circles.delete(e)},e.prototype.get=function(e){return this.circles.get(e)},e.prototype.clear=function(){this.circles.forEach((function(e){return e.dispose()})),this.circles.clear()},e}();Ji.ɵfac=function(e){return new(e||Ji)},Ji.ɵprov=d.ɵɵdefineInjectable({token:Ji,factory:Ji.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ji,[{type:t.Injectable}],null,null);var en={addPointEvent:e.CesiumEvent.LEFT_CLICK,dragPointEvent:e.CesiumEvent.LEFT_CLICK_DRAG,dragShapeEvent:e.CesiumEvent.LEFT_CLICK_DRAG,allowDrag:!0,circleProps:{material:Cesium.Color.CORNFLOWERBLUE.withAlpha(.4),fill:!0,outline:!1,outlineWidth:1,outlineColor:Cesium.Color.WHITE.withAlpha(.8),classificationType:Cesium.ClassificationType.BOTH,zIndex:0,shadows:Cesium.ShadowMode.DISABLED},pointProps:{color:Cesium.Color.WHITE,outlineColor:Cesium.Color.BLACK.withAlpha(.2),outlineWidth:1,pixelSize:13,virtualPointPixelSize:8,show:!0,showVirtual:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY},polylineProps:{width:1,material:function(){return Cesium.Color.WHITE.withAlpha(.8)}}},tn=function(){function t(){this.updateSubject=new r.Subject,this.updatePublisher=o.publish()(this.updateSubject),this.observablesMap=new Map}return t.prototype.init=function(e,t,i,n){this.mapEventsManager=e,this.coordinateConverter=t,this.cameraService=i,this.circlesManager=n,this.updatePublisher.connect()},t.prototype.onUpdate=function(){return this.updatePublisher},t.prototype.create=function(t,i){var n,o=this;void 0===t&&(t=en),void 0===i&&(i=100);var s=xi(),a=this.setOptions(t),c=new r.BehaviorSubject({id:s,editAction:null,editMode:e.EditModes.CREATE}),l=!1;this.updateSubject.next({id:s,editMode:e.EditModes.CREATE,editAction:e.EditActions.INIT,circleOptions:a});var p=function(t){var r={id:s,center:n,radiusPoint:t,editMode:e.EditModes.CREATE,editAction:e.EditActions.ADD_LAST_POINT};o.updateSubject.next(r),c.next(Object.assign(Object.assign({},r),o.getCircleProperties(s)));var p={id:s,center:n,radiusPoint:t,editMode:e.EditModes.CREATE,editAction:e.EditActions.CHANGE_TO_EDIT};return o.updateSubject.next(p),c.next(Object.assign(Object.assign({},r),o.getCircleProperties(s))),o.observablesMap.has(s)&&o.observablesMap.get(s).forEach((function(e){return e.dispose()})),o.observablesMap.delete(s),o.editCircle(s,i,c,a,h),l=!0},d=this.mapEventsManager.register({event:e.CesiumEvent.MOUSE_MOVE,pick:e.PickOptions.NO_PICK,pickConfig:t.pickConfiguration,priority:i}),u=this.mapEventsManager.register({event:e.CesiumEvent.LEFT_CLICK,pick:e.PickOptions.NO_PICK,pickConfig:t.pickConfiguration,priority:i});this.observablesMap.set(s,[d,u]);var h=this.createEditorObservable(c,s,p);return u.subscribe((function(t){var i=t.movement.endPosition;if(!l){var r=o.coordinateConverter.screenToCartesian3(i);if(r)if(n)l=p(r);else{var a={id:s,center:r,editMode:e.EditModes.CREATE,editAction:e.EditActions.ADD_POINT};o.updateSubject.next(a),c.next(Object.assign(Object.assign({},a),o.getCircleProperties(s))),n=r}}})),d.subscribe((function(t){var i=t.movement.endPosition;if(n){var r=o.coordinateConverter.screenToCartesian3(i);if(r){var a={id:s,center:n,radiusPoint:r,editMode:e.EditModes.CREATE,editAction:e.EditActions.MOUSE_MOVE};o.updateSubject.next(a),c.next(Object.assign(Object.assign({},a),o.getCircleProperties(s)))}}})),h},t.prototype.edit=function(t,i,n,o){void 0===n&&(n=en),void 0===o&&(o=100);var s=xi(),a=this.setOptions(n),c=new r.BehaviorSubject({id:s,editAction:null,editMode:e.EditModes.EDIT}),l={id:s,center:t,radiusPoint:L.pointByLocationDistanceAndAzimuth(t,i,Math.PI/2,!0),editMode:e.EditModes.EDIT,editAction:e.EditActions.INIT,circleOptions:a};return this.updateSubject.next(l),c.next(Object.assign(Object.assign({},l),this.getCircleProperties(s))),this.editCircle(s,o,c,a)},t.prototype.editCircle=function(t,i,n,r,s){var a,c=this,l=this.mapEventsManager.register({event:e.CesiumEvent.LEFT_CLICK_DRAG,entityType:Ai,pickConfig:r.pickConfiguration,pick:e.PickOptions.PICK_FIRST,priority:i,pickFilter:function(e){return t===e.editedEntityId}});r.allowDrag&&(a=this.mapEventsManager.register({event:e.CesiumEvent.LEFT_CLICK_DRAG,entityType:Xi,pickConfig:r.pickConfiguration,pick:e.PickOptions.PICK_FIRST,priority:i,pickFilter:function(e){return t===e.id}})),l.pipe(o.tap((function(e){var t=e.movement.drop;return c.cameraService.enableInputs(t)}))).subscribe((function(i){var o=i.movement,s=o.endPosition,a=o.startPosition,l=o.drop,p=i.entities,d=c.coordinateConverter.screenToCartesian3(a),u=c.coordinateConverter.screenToCartesian3(s);if(u){var h,f=p[0]===c.getCenterPoint(t);if(h=l?f?e.EditActions.DRAG_SHAPE_FINISH:e.EditActions.DRAG_POINT_FINISH:f?e.EditActions.DRAG_SHAPE:e.EditActions.DRAG_POINT,r.allowDrag||h!==e.EditActions.DRAG_SHAPE&&h!==e.EditActions.DRAG_SHAPE_FINISH){var g={id:t,center:c.getCenterPosition(t),radiusPoint:c.getRadiusPosition(t),startDragPosition:d,endDragPosition:u,editMode:e.EditModes.EDIT,editAction:h};c.updateSubject.next(g),n.next(Object.assign(Object.assign({},g),c.getCircleProperties(t)))}else c.cameraService.enableInputs(!0)}})),a&&a.pipe(o.tap((function(e){var t=e.movement.drop;return c.cameraService.enableInputs(t)}))).subscribe((function(i){var o=i.movement,r=o.startPosition,s=o.endPosition,a=o.drop,l=c.coordinateConverter.screenToCartesian3(r),p=c.coordinateConverter.screenToCartesian3(s);if(p&&l){var d={id:t,center:c.getCenterPosition(t),radiusPoint:c.getRadiusPosition(t),startDragPosition:l,endDragPosition:p,editMode:e.EditModes.EDIT,editAction:a?e.EditActions.DRAG_SHAPE_FINISH:e.EditActions.DRAG_SHAPE};c.updateSubject.next(d),n.next(Object.assign(Object.assign({},d),c.getCircleProperties(t)))}}));var p=[l];return a&&p.push(a),this.observablesMap.set(t,p),s||this.createEditorObservable(n,t)},t.prototype.createEditorObservable=function(t,i,n){var o=this;return t.dispose=function(){var t=o.observablesMap.get(i);t&&t.forEach((function(e){return e.dispose()})),o.observablesMap.delete(i),o.updateSubject.next({id:i,center:o.getCenterPosition(i),radiusPoint:o.getRadiusPosition(i),editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.DISPOSE})},t.enable=function(){o.updateSubject.next({id:i,center:o.getCenterPosition(i),radiusPoint:o.getRadiusPosition(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.ENABLE})},t.disable=function(){o.updateSubject.next({id:i,center:o.getCenterPosition(i),radiusPoint:o.getRadiusPosition(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.DISABLE})},t.setManually=function(t,n,r,s,a){var c=L.pointByLocationDistanceAndAzimuth(t,n,Math.PI/2,!0);o.circlesManager.get(i).setManually(t,c,r,s,a),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_MANUALLY})},t.setLabelsRenderFn=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK,labelsRenderFn:t})},t.updateLabels=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.UPDATE_EDIT_LABELS,updateLabels:t})},t.finishCreation=function(){if(!n)throw new Error("Circles editor error edit(): cannot call finishCreation() on edit");return n(null)},t.getEditValue=function(){return t.getValue()},t.getLabels=function(){return o.circlesManager.get(i).labels},t.getCenter=function(){return o.getCenterPosition(i)},t.getRadius=function(){return o.getRadius(i)},t},t.prototype.setOptions=function(e){var t=JSON.parse(JSON.stringify(en)),i=Object.assign(t,e);return i.pointProps=Object.assign({},en.pointProps,e.pointProps),i.circleProps=Object.assign({},en.circleProps,e.circleProps),i.polylineProps=Object.assign({},en.polylineProps,e.polylineProps),i},t.prototype.getCenterPosition=function(e){return this.circlesManager.get(e).getCenter()},t.prototype.getCenterPoint=function(e){return this.circlesManager.get(e).center},t.prototype.getRadiusPosition=function(e){return this.circlesManager.get(e).getRadiusPoint()},t.prototype.getRadius=function(e){return this.circlesManager.get(e).getRadius()},t.prototype.getCircleProperties=function(e){var t=this.circlesManager.get(e);return{center:t.getCenter(),radiusPoint:t.getRadiusPoint(),radius:t.getRadius()}},t}();tn.ɵfac=function(e){return new(e||tn)},tn.ɵprov=d.ɵɵdefineInjectable({token:tn,factory:tn.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(tn,[{type:t.Injectable}],null,null);var nn=["editCirclesLayer"],on=["editArcsLayer"],rn=["editPointsLayer"],sn=function(){function t(e,t,i,n,o){this.circlesEditor=e,this.coordinateConverter=t,this.mapEventsManager=i,this.cameraService=n,this.circlesManager=o,this.Cesium=Cesium,this.editPoints$=new r.Subject,this.editCircles$=new r.Subject,this.editArcs$=new r.Subject,this.circlesEditor.init(this.mapEventsManager,this.coordinateConverter,this.cameraService,this.circlesManager),this.startListeningToEditorUpdates()}return t.prototype.startListeningToEditorUpdates=function(){var t=this;this.editorUpdatesSubscription=this.circlesEditor.onUpdate().subscribe((function(i){i.editMode===e.EditModes.CREATE||i.editMode===e.EditModes.CREATE_OR_EDIT?t.handleCreateUpdates(i):i.editMode===e.EditModes.EDIT&&t.handleEditUpdates(i)}))},t.prototype.getLabelId=function(e,t){return t.toString()},t.prototype.renderEditLabels=function(e,t,i){if(t.center=e.getCenter(),t.radiusPoint=e.getRadiusPoint(),t.radius=e.getRadius(),i)return e.labels=i,void this.editCirclesLayer.update(e,e.getId());this.editLabelsRenderFn&&(e.labels=this.editLabelsRenderFn(t,e.labels),this.editCirclesLayer.update(e,e.getId()))},t.prototype.removeEditLabels=function(e){e.labels=[],this.editCirclesLayer.update(e,e.getId())},t.prototype.handleCreateUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.circlesManager.createEditableCircle(t.id,this.editCirclesLayer,this.editPointsLayer,this.editArcsLayer,t.circleOptions);break;case e.EditActions.MOUSE_MOVE:var i=this.circlesManager.get(t.id);t.radiusPoint&&(i.movePoint(t.radiusPoint),this.renderEditLabels(i,t));break;case e.EditActions.ADD_POINT:i=this.circlesManager.get(t.id);t.center&&(i.addPoint(t.center),this.renderEditLabels(i,t));break;case e.EditActions.ADD_LAST_POINT:i=this.circlesManager.get(t.id);t.radiusPoint&&(i.addLastPoint(t.radiusPoint),this.renderEditLabels(i,t));break;case e.EditActions.DISPOSE:(i=this.circlesManager.get(t.id))&&(this.removeEditLabels(i),this.circlesManager.dispose(t.id));break;case e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK:i=this.circlesManager.get(t.id);this.editLabelsRenderFn=t.labelsRenderFn,this.renderEditLabels(i,t);break;case e.EditActions.UPDATE_EDIT_LABELS:i=this.circlesManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;case e.EditActions.SET_MANUALLY:i=this.circlesManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;default:return}},t.prototype.handleEditUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:(i=this.circlesManager.createEditableCircle(t.id,this.editCirclesLayer,this.editPointsLayer,this.editArcsLayer,t.circleOptions)).setManually(t.center,t.radiusPoint);break;case e.EditActions.DRAG_POINT_FINISH:case e.EditActions.DRAG_POINT:(i=this.circlesManager.get(t.id))&&i.enableEdit&&(i.movePoint(t.endDragPosition),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE:(i=this.circlesManager.get(t.id))&&i.enableEdit&&(i.moveCircle(t.startDragPosition,t.endDragPosition),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE_FINISH:(i=this.circlesManager.get(t.id))&&i.enableEdit&&(i.endMovePolygon(),this.renderEditLabels(i,t));break;case e.EditActions.DISABLE:(i=this.circlesManager.get(t.id))&&(i.enableEdit=!1,this.renderEditLabels(i,t));break;case e.EditActions.ENABLE:var i;(i=this.circlesManager.get(t.id))&&(i.enableEdit=!0,this.renderEditLabels(i,t));break;default:return}},t.prototype.ngOnDestroy=function(){this.editorUpdatesSubscription.unsubscribe(),this.circlesManager.clear()},t.prototype.getPointSize=function(e){return e.isVirtualEditPoint()?e.props.virtualPointPixelSize:e.props.pixelSize},t.prototype.getPointShow=function(e){return e.show&&(e.isVirtualEditPoint()?e.props.showVirtual:e.props.show)},t}();sn.ɵfac=function(e){return new(e||sn)(d.ɵɵdirectiveInject(tn),d.ɵɵdirectiveInject(D),d.ɵɵdirectiveInject(se),d.ɵɵdirectiveInject(C),d.ɵɵdirectiveInject(Ji))},sn.ɵcmp=d.ɵɵdefineComponent({type:sn,selectors:[["circles-editor"]],viewQuery:function(e,t){if(1&e&&(d.ɵɵviewQuery(nn,5),d.ɵɵviewQuery(on,5),d.ɵɵviewQuery(rn,5)),2&e){var i=void 0;d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editCirclesLayer=i.first),d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editArcsLayer=i.first),d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editPointsLayer=i.first)}},features:[d.ɵɵProvidersFeature([D,Ji])],decls:11,vars:5,consts:[["acFor","let arc of editArcs$",3,"context"],["editArcsLayer",""],["props","{\n        angle: arc.angle,\n        delta: arc.delta,\n        center: arc.center,\n        radius: arc.radius,\n        quality: 30,\n        color: arc.props.material()\n    }"],["acFor","let point of editPoints$",3,"context"],["editPointsLayer",""],["props","{\n                    position: point.getPositionCallbackProperty(),\n                    pixelSize: getPointSize(point),\n                    color: point.props.color,\n                    outlineColor: point.props.outlineColor,\n                    outlineWidth: point.props.outlineWidth,\n                    show: getPointShow(point),\n                    disableDepthTestDistance: point.props.disableDepthTestDistance,\n                    heightReference: point.props.heightReference,\n    }"],["acFor","let circle of editCircles$",3,"context","zIndex"],["editCirclesLayer",""],["props","{\n                  position: circle.getCenterCallbackProperty(),\n                  semiMajorAxis: circle.getRadiusCallbackProperty(),\n                  semiMinorAxis: circle.getRadiusCallbackProperty(),\n                  material: circle.circleProps.material,\n                  outline: circle.circleProps.outline,\n                  height: 0\n                  outlineWidth: circle.circleProps.outlineWidth,\n                  outlineColor: circle.circleProps.outlineColor,\n                  fill: circle.circleProps.fill,\n                  classificationType: circle.circleProps.classificationType,\n                  zIndex: circle.circleProps.zIndex,\n                  shadows: circle.circleProps.shadows,\n    }"],["acFor","let label of circle.labels",3,"idGetter"],["props","{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"]],template:function(e,t){1&e&&(d.ɵɵelementStart(0,"ac-layer",0,1),d.ɵɵelement(2,"ac-arc-desc",2),d.ɵɵelementEnd(),d.ɵɵelementStart(3,"ac-layer",3,4),d.ɵɵelement(5,"ac-point-desc",5),d.ɵɵelementEnd(),d.ɵɵelementStart(6,"ac-layer",6,7),d.ɵɵelement(8,"ac-ellipse-desc",8),d.ɵɵelementStart(9,"ac-array-desc",9),d.ɵɵelement(10,"ac-label-primitive-desc",10),d.ɵɵelementEnd(),d.ɵɵelementEnd()),2&e&&(d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("context",t)("zIndex",0),d.ɵɵadvance(3),d.ɵɵproperty("idGetter",t.getLabelId))},directives:[tt,yt,Mt,lt,bi,ti],encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(sn,[{type:t.Component,args:[{selector:"circles-editor",template:'\n      <ac-layer #editArcsLayer acFor="let arc of editArcs$" [context]="this">\n          <ac-arc-desc\n                  props="{\n        angle: arc.angle,\n        delta: arc.delta,\n        center: arc.center,\n        radius: arc.radius,\n        quality: 30,\n        color: arc.props.material()\n    }"\n          >\n          </ac-arc-desc>\n      </ac-layer>\n\n      <ac-layer #editPointsLayer acFor="let point of editPoints$" [context]="this">\n          <ac-point-desc\n                  props="{\n                    position: point.getPositionCallbackProperty(),\n                    pixelSize: getPointSize(point),\n                    color: point.props.color,\n                    outlineColor: point.props.outlineColor,\n                    outlineWidth: point.props.outlineWidth,\n                    show: getPointShow(point),\n                    disableDepthTestDistance: point.props.disableDepthTestDistance,\n                    heightReference: point.props.heightReference,\n    }"\n          >\n          </ac-point-desc>\n      </ac-layer>\n\n      <ac-layer #editCirclesLayer acFor="let circle of editCircles$" [context]="this" [zIndex]="0">\n          <ac-ellipse-desc\n                  props="{\n                  position: circle.getCenterCallbackProperty(),\n                  semiMajorAxis: circle.getRadiusCallbackProperty(),\n                  semiMinorAxis: circle.getRadiusCallbackProperty(),\n                  material: circle.circleProps.material,\n                  outline: circle.circleProps.outline,\n                  height: 0\n                  outlineWidth: circle.circleProps.outlineWidth,\n                  outlineColor: circle.circleProps.outlineColor,\n                  fill: circle.circleProps.fill,\n                  classificationType: circle.circleProps.classificationType,\n                  zIndex: circle.circleProps.zIndex,\n                  shadows: circle.circleProps.shadows,\n    }"\n          >\n          </ac-ellipse-desc>\n\n          <ac-array-desc acFor="let label of circle.labels" [idGetter]="getLabelId">\n              <ac-label-primitive-desc\n                      props="{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"\n              >\n              </ac-label-primitive-desc>\n          </ac-array-desc>\n      </ac-layer>\n  ',providers:[D,Ji],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:tn},{type:D},{type:se},{type:C},{type:Ji}]}),{editCirclesLayer:[{type:t.ViewChild,args:["editCirclesLayer"]}],editArcsLayer:[{type:t.ViewChild,args:["editArcsLayer"]}],editPointsLayer:[{type:t.ViewChild,args:["editPointsLayer"]}]});var an=function(e){function t(t,i,n,o,r){var s=e.call(this)||this;return s.id=t,s.ellipsesLayer=i,s.pointsLayer=n,s.coordinateConverter=o,s.options=r,s._rotation=0,s.doneCreation=!1,s._enableEdit=!0,s._minorRadiusPoints=[],s._labels=[],s._ellipseProps=Object.assign({},r.ellipseProps),s._pointProps=Object.assign({},r.pointProps),s}return S(t,e),Object.defineProperty(t.prototype,"labels",{get:function(){return this._labels},set:function(e){var t=this;e&&this._center&&(this._labels=e.map((function(e,i){return e.position||(0===i?e.position=t._center.getPosition():1===i?e.position=t._majorRadiusPoint?Cesium.Cartesian3.midpoint(t.getCenter(),t._majorRadiusPoint.getPosition(),new Cesium.Cartesian3):new Cesium.Cartesian3:2===i&&(e.position=t._minorRadiusPoints.length>0&&t._minorRadius?Cesium.Cartesian3.midpoint(t.getCenter(),t.getMinorRadiusPointPosition(),new Cesium.Cartesian3):new Cesium.Cartesian3)),Object.assign({},Li,e)})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polylineProps",{get:function(){return this._polylineProps},set:function(e){this._polylineProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointProps",{get:function(){return this._pointProps},set:function(e){this._pointProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ellipseProps",{get:function(){return this._ellipseProps},set:function(e){this._ellipseProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"center",{get:function(){return this._center},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"majorRadiusPoint",{get:function(){return this._majorRadiusPoint},enumerable:!1,configurable:!0}),t.prototype.getMajorRadiusPointPosition=function(){if(this._majorRadiusPoint)return this._majorRadiusPoint.getPosition()},t.prototype.getMinorRadiusPointPosition=function(){if(!(this._minorRadiusPoints.length<1))return this._minorRadiusPoints[0].getPosition()},Object.defineProperty(t.prototype,"enableEdit",{get:function(){return this._enableEdit},set:function(e){this._enableEdit=e,this._center.show=e,this._majorRadiusPoint.show=e,this.updatePointsLayer()},enumerable:!1,configurable:!0}),t.prototype.setManually=function(e,t,i,n,o,r,s){if(void 0===i&&(i=Math.PI/2),void 0===o&&(o=this.pointProps),void 0===r&&(r=this.pointProps),void 0===s&&(s=this.ellipseProps),t<n)throw new Error("Major radius muse be equal or greater than minor radius");this._rotation=i,this._majorRadius=t,this._center?this._center.setPosition(e):this._center=new Ai(this.id,e,o);var a=L.pointByLocationDistanceAndAzimuth(this.center.getPosition(),t,i);this._majorRadiusPoint?this._majorRadiusPoint.setPosition(a):this._majorRadiusPoint=new Ai(this.id,a,r),n&&(this._minorRadius=n),this.ellipseProps=s,this.doneCreation=!0,this.updateMinorRadiusEditPoints(),this.updatePointsLayer(),this.updateEllipsesLayer()},t.prototype.addPoint=function(e){this.doneCreation||(this._center||(this._center=new Ai(this.id,e,this.pointProps),this._majorRadiusPoint=new Ai(this.id,e.clone(),this.pointProps),this._majorRadius=0),this.updateRotation(),this.updateMinorRadiusEditPoints(),this.updatePointsLayer(),this.updateEllipsesLayer())},t.prototype.transformToEllipse=function(){this._minorRadius||(this._minorRadius=this.getMajorRadius(),this.updateMinorRadiusEditPoints(),this.updatePointsLayer(),this.updateEllipsesLayer())},t.prototype.addLastPoint=function(e){if(!this.doneCreation&&this._center&&this._majorRadiusPoint){var t=L.distance(this._center.getPosition(),e);this._majorRadiusPoint.setPosition(e),this._majorRadius=t,this.doneCreation=!0,this.options.circleToEllipseTransformation||(this._minorRadius=this._majorRadius),this.updateRotation(),this.updateMinorRadiusEditPoints(),this.updatePointsLayer(),this.updateEllipsesLayer()}},t.prototype.movePoint=function(e,t){if(this._center&&this._majorRadiusPoint){var i=L.distance(this._center.getPosition(),e);this.majorRadiusPoint===t?i<this._minorRadius?(this._majorRadius=this._minorRadius,this._majorRadiusPoint.setPosition(L.pointByLocationDistanceAndAzimuth(this.getCenter(),this._minorRadius,this._rotation))):(this.majorRadiusPoint.setPosition(e),this._majorRadius=i):i>this._majorRadius?this._minorRadius=this._majorRadius:this._minorRadius=i,this.updateRotation(),this.updateMinorRadiusEditPoints(),this.updatePointsLayer(),this.updateEllipsesLayer()}},t.prototype.moveEllipse=function(e,t){if(this.doneCreation){this.lastDraggedToPosition||(this.lastDraggedToPosition=e);var i=this.getMajorRadius(),n=this.getRotation(),o=L.getPositionsDelta(this.lastDraggedToPosition,t),r=L.addDeltaToPosition(this.getCenter(),o,!0);this._center.setPosition(r),this.majorRadiusPoint.setPosition(L.pointByLocationDistanceAndAzimuth(this.getCenter(),i,n)),this.updatePointsLayer(),this.updateMinorRadiusEditPoints(),this.updateEllipsesLayer(),this.lastDraggedToPosition=t}},t.prototype.endMoveEllipse=function(){this.lastDraggedToPosition=void 0},t.prototype.updateMinorRadiusEditPoints=function(){void 0!==this._minorRadius&&(0===this._minorRadiusPoints.length&&(this._minorRadiusPoints.push(new Ai(this.id,new Cesium.Cartesian3,this.pointProps,!0)),this._minorRadiusPoints.push(new Ai(this.id,new Cesium.Cartesian3,this.pointProps,!0))),this._minorRadiusPoints[0].setPosition(L.pointByLocationDistanceAndAzimuth(this._center.getPosition(),this._minorRadius,this.getRotation()-Math.PI/2)),this._minorRadiusPoints[1].setPosition(L.pointByLocationDistanceAndAzimuth(this._center.getPosition(),this._minorRadius,this.getRotation()+Math.PI/2)))},t.prototype.getMajorRadius=function(){return this._majorRadius||0},t.prototype.getMinorRadius=function(){return void 0===this._minorRadius?this.getMajorRadius():this._minorRadius},t.prototype.getRotation=function(){return this._rotation||0},t.prototype.updateRotation=function(){if(!this._majorRadiusPoint)return 0;var e=this.coordinateConverter.bearingToCartesian(this.getCenter(),this._majorRadiusPoint.getPosition());return this._rotation=Cesium.Math.toRadians(e),this._rotation},t.prototype.getRotationCallbackProperty=function(){var e=this;return new Cesium.CallbackProperty((function(){return Math.PI/2-e.getRotation()}),!1)},t.prototype.getMinorRadiusCallbackProperty=function(){var e=this;return new Cesium.CallbackProperty((function(){return e.getMinorRadius()}),!1)},t.prototype.getMajorRadiusCallbackProperty=function(){var e=this;return new Cesium.CallbackProperty((function(){return e.getMajorRadius()}),!1)},t.prototype.getCenter=function(){return this._center?this._center.getPosition():void 0},t.prototype.getCenterCallbackProperty=function(){var e=this;return new Cesium.CallbackProperty((function(){return e.getCenter()}),!1)},t.prototype.dispose=function(){var e=this;this._center&&this.pointsLayer.remove(this._center.getId()),this._majorRadiusPoint&&this.pointsLayer.remove(this._majorRadiusPoint.getId()),this._minorRadiusPoints&&this._minorRadiusPoints.forEach((function(t){return e.pointsLayer.remove(t.getId())})),this.ellipsesLayer.remove(this.id)},t.prototype.getId=function(){return this.id},t.prototype.updateEllipsesLayer=function(){this.ellipsesLayer.update(this,this.id)},t.prototype.updatePointsLayer=function(){this._center&&this.pointsLayer.update(this._center,this._center.getId()),this._majorRadiusPoint&&this.pointsLayer.update(this._majorRadiusPoint,this._majorRadiusPoint.getId()),this._minorRadiusPoints.length>0&&(this.pointsLayer.update(this._minorRadiusPoints[0],this._minorRadiusPoints[0].getId()),this.pointsLayer.update(this._minorRadiusPoints[1],this._minorRadiusPoints[1].getId()))},t}(bt),cn=function(){function e(){this.ellipses=new Map}return e.prototype.createEditableEllipse=function(e,t,i,n,o){var r=new an(e,t,i,n,o);return this.ellipses.set(e,r),r},e.prototype.dispose=function(e){this.ellipses.get(e).dispose(),this.ellipses.delete(e)},e.prototype.get=function(e){return this.ellipses.get(e)},e.prototype.clear=function(){this.ellipses.forEach((function(e){return e.dispose()})),this.ellipses.clear()},e}();cn.ɵfac=function(e){return new(e||cn)},cn.ɵprov=d.ɵɵdefineInjectable({token:cn,factory:cn.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(cn,[{type:t.Injectable}],null,null);var ln={addPointEvent:e.CesiumEvent.LEFT_CLICK,dragPointEvent:e.CesiumEvent.LEFT_CLICK_DRAG,dragShapeEvent:e.CesiumEvent.LEFT_CLICK_DRAG,circleToEllipseTransformEvent:e.CesiumEvent.LEFT_CLICK,circleToEllipseTransformEventModifier:e.CesiumEventModifier.ALT,allowDrag:!0,ellipseProps:{material:Cesium.Color.CORNFLOWERBLUE.withAlpha(.4),fill:!0,outline:!0,outlineWidth:1,outlineColor:Cesium.Color.WHITE.withAlpha(.8),classificationType:Cesium.ClassificationType.BOTH,zIndex:0,shadows:Cesium.ShadowMode.DISABLED},pointProps:{color:Cesium.Color.WHITE,outlineColor:Cesium.Color.BLACK.withAlpha(.2),outlineWidth:1,pixelSize:13,virtualPointPixelSize:8,show:!0,showVirtual:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY},polylineProps:{width:1,material:function(){return Cesium.Color.WHITE}},circleToEllipseTransformation:!1},pn=function(){function t(){this.updateSubject=new r.Subject,this.updatePublisher=o.publish()(this.updateSubject),this.observablesMap=new Map}return t.prototype.init=function(e,t,i,n,o){this.mapEventsManager=e,this.coordinateConverter=t,this.cameraService=i,this.ellipsesManager=n,this.updatePublisher.connect(),this.cesiumScene=o.getScene()},t.prototype.onUpdate=function(){return this.updatePublisher},t.prototype.create=function(t,i){var n,o=this;void 0===t&&(t=ln),void 0===i&&(i=100);var s=xi(),a=this.setOptions(t),c=new r.BehaviorSubject({id:s,editAction:null,editMode:e.EditModes.CREATE}),l=!1;this.updateSubject.next({id:s,editMode:e.EditModes.CREATE,editAction:e.EditActions.INIT,ellipseOptions:a});var p=function(t){var r={id:s,center:n,updatedPosition:t,editMode:e.EditModes.CREATE,editAction:e.EditActions.ADD_LAST_POINT};o.updateSubject.next(r),c.next(Object.assign({},r));var p={id:s,center:n,editMode:e.EditModes.CREATE,editAction:e.EditActions.CHANGE_TO_EDIT};return o.updateSubject.next(p),c.next(Object.assign({},r)),o.observablesMap.has(s)&&o.observablesMap.get(s).forEach((function(e){return e.dispose()})),o.observablesMap.delete(s),o.editEllipse(s,i,c,a,h),l=!0},d=this.mapEventsManager.register({event:e.CesiumEvent.MOUSE_MOVE,pick:e.PickOptions.NO_PICK,pickConfig:t.pickConfiguration,priority:i}),u=this.mapEventsManager.register({event:a.addPointEvent,pick:e.PickOptions.NO_PICK,pickConfig:t.pickConfiguration,priority:i});this.observablesMap.set(s,[d,u]);var h=this.createEditorObservable(c,s,p);return u.subscribe((function(t){var i=t.movement.endPosition;if(!l){var r=o.coordinateConverter.screenToCartesian3(i);if(r)if(n)l=p(r);else{var a={id:s,center:r,editMode:e.EditModes.CREATE,editAction:e.EditActions.ADD_POINT};o.updateSubject.next(a),c.next(Object.assign({},a)),n=r}}})),d.subscribe((function(t){var i=t.movement.endPosition;if(n){var r=o.coordinateConverter.screenToCartesian3(i);if(r){var a={id:s,center:n,updatedPosition:r,editMode:e.EditModes.CREATE,editAction:e.EditActions.MOUSE_MOVE};o.updateSubject.next(a),c.next(Object.assign({},a))}}})),h},t.prototype.edit=function(t,i,n,o,s,a){void 0===n&&(n=Math.PI/2),void 0===s&&(s=ln),void 0===a&&(a=100);var c=xi(),l=this.setOptions(s),p=new r.BehaviorSubject({id:c,editAction:null,editMode:e.EditModes.EDIT}),d={id:c,center:t,majorRadius:i,rotation:n,minorRadius:o,editMode:e.EditModes.EDIT,editAction:e.EditActions.INIT,ellipseOptions:l};return this.updateSubject.next(d),p.next(Object.assign({},d)),this.editEllipse(c,a,p,l)},t.prototype.editEllipse=function(t,i,n,r,s){var a,c,l=this,p=this.mapEventsManager.register({event:r.dragPointEvent,entityType:Ai,pickConfig:r.pickConfiguration,pick:e.PickOptions.PICK_FIRST,priority:i,pickFilter:function(e){return t===e.editedEntityId}});r.circleToEllipseTransformation&&(a=this.mapEventsManager.register({event:r.circleToEllipseTransformEvent,modifier:r.circleToEllipseTransformEventModifier,entityType:an,pickConfig:r.pickConfiguration,pick:e.PickOptions.PICK_FIRST,priority:i,pickFilter:function(e){return t===e.id}})),r.allowDrag&&(c=this.mapEventsManager.register({event:r.dragShapeEvent,entityType:an,pickConfig:r.pickConfiguration,pick:e.PickOptions.PICK_FIRST,priority:i,pickFilter:function(e){return t===e.id}})),p.pipe(o.tap((function(e){var i=e.movement.drop;return l.ellipsesManager.get(t).enableEdit&&l.cameraService.enableInputs(i)}))).subscribe((function(i){var o=i.movement,s=o.endPosition,a=o.startPosition,c=o.drop,p=i.entities,d=l.coordinateConverter.screenToCartesian3(a),u=l.coordinateConverter.screenToCartesian3(s);if(u){var h,f=p[0],g=f===l.getCenterPoint(t);if(h=c?g?e.EditActions.DRAG_SHAPE_FINISH:e.EditActions.DRAG_POINT_FINISH:g?e.EditActions.DRAG_SHAPE:e.EditActions.DRAG_POINT,r.allowDrag||!l.ellipsesManager.get(t).enableEdit||h!==e.EditActions.DRAG_SHAPE&&h!==e.EditActions.DRAG_SHAPE_FINISH){var y=Object.assign({id:t,updatedPoint:f,startDragPosition:d,endDragPosition:u,editMode:e.EditModes.EDIT,editAction:h},l.getEllipseProperties(t));l.updateSubject.next(y),n.next(Object.assign({},y))}else l.cameraService.enableInputs(!0)}})),a&&a.subscribe((function(i){var o=i.movement,r=(o.endPosition,o.startPosition,o.drop,i.entities,Object.assign({id:t,editMode:e.EditModes.EDIT,editAction:e.EditActions.TRANSFORM},l.getEllipseProperties(t)));l.updateSubject.next(r),n.next(Object.assign({},r))})),c&&c.pipe(o.tap((function(e){var i=e.movement.drop;return l.ellipsesManager.get(t).enableEdit&&l.cameraService.enableInputs(i)}))).subscribe((function(i){var o=i.movement,r=o.startPosition,s=o.endPosition,a=o.drop,c=l.coordinateConverter.screenToCartesian3(r),p=l.coordinateConverter.screenToCartesian3(s);if(p&&c){var d=Object.assign({id:t,startDragPosition:c,endDragPosition:p,editMode:e.EditModes.EDIT,editAction:a?e.EditActions.DRAG_SHAPE_FINISH:e.EditActions.DRAG_SHAPE},l.getEllipseProperties(t));l.updateSubject.next(d),n.next(Object.assign({},d))}}));var d=[p];return c&&d.push(c),a&&d.push(a),this.observablesMap.set(t,d),s||this.createEditorObservable(n,t)},t.prototype.createEditorObservable=function(t,i,n){var o=this;return t.dispose=function(){var t=o.observablesMap.get(i);t&&t.forEach((function(e){return e.dispose()})),o.observablesMap.delete(i),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.DISPOSE})},t.enable=function(){o.updateSubject.next(Object.assign({id:i,editMode:e.EditModes.EDIT,editAction:e.EditActions.ENABLE},o.getEllipseProperties(i)))},t.disable=function(){o.updateSubject.next(Object.assign({id:i,editMode:e.EditModes.EDIT,editAction:e.EditActions.DISABLE},o.getEllipseProperties(i)))},t.setManually=function(t,n,r,s,a,c,l){o.ellipsesManager.get(i).setManually(t,n,r,s,a,c,l),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_MANUALLY})},t.setLabelsRenderFn=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK,labelsRenderFn:t})},t.updateLabels=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.UPDATE_EDIT_LABELS,updateLabels:t})},t.finishCreation=function(){if(!n)throw new Error("Ellipses editor error edit(): cannot call finishCreation() on edit");return n(null)},t.getEditValue=function(){return t.getValue()},t.getLabels=function(){return o.ellipsesManager.get(i).labels},t.getCenter=function(){return o.getCenterPosition(i)},t.getMajorRadius=function(){return o.getMajorRadius(i)},t.getMinorRadius=function(){return o.getMinorRadius(i)},t},t.prototype.setOptions=function(e){var t=JSON.parse(JSON.stringify(ln)),i=Object.assign(t,e);return i.pointProps=Object.assign({},ln.pointProps,e.pointProps),i.ellipseProps=Object.assign({},ln.ellipseProps,e.ellipseProps),i.polylineProps=Object.assign({},ln.polylineProps,e.polylineProps),i},t.prototype.getCenterPosition=function(e){return this.ellipsesManager.get(e).getCenter()},t.prototype.getCenterPoint=function(e){return this.ellipsesManager.get(e).center},t.prototype.getMajorRadius=function(e){return this.ellipsesManager.get(e).getMajorRadius()},t.prototype.getMinorRadius=function(e){return this.ellipsesManager.get(e).getMinorRadius()},t.prototype.getEllipseProperties=function(e){var t=this.ellipsesManager.get(e);return{center:t.getCenter(),rotation:t.getRotation(),minorRadius:t.getMinorRadius(),majorRadius:t.getMajorRadius(),minorRadiusPointPosition:t.getMinorRadiusPointPosition(),majorRadiusPointPosition:t.getMajorRadiusPointPosition()}},t}();pn.ɵfac=function(e){return new(e||pn)},pn.ɵprov=d.ɵɵdefineInjectable({token:pn,factory:pn.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(pn,[{type:t.Injectable}],null,null);var dn=["editEllipsesLayer"],un=["editPointsLayer"],hn=function(){function t(e,t,i,n,o,s){this.ellipsesEditor=e,this.coordinateConverter=t,this.mapEventsManager=i,this.cameraService=n,this.ellipsesManager=o,this.cesiumService=s,this.Cesium=Cesium,this.editPoints$=new r.Subject,this.editEllipses$=new r.Subject,this.ellipsesEditor.init(this.mapEventsManager,this.coordinateConverter,this.cameraService,this.ellipsesManager,this.cesiumService),this.startListeningToEditorUpdates()}return t.prototype.startListeningToEditorUpdates=function(){var t=this;this.editorUpdatesSubscription=this.ellipsesEditor.onUpdate().subscribe((function(i){i.editMode===e.EditModes.CREATE||i.editMode===e.EditModes.CREATE_OR_EDIT?t.handleCreateUpdates(i):i.editMode===e.EditModes.EDIT&&t.handleEditUpdates(i)}))},t.prototype.getLabelId=function(e,t){return t.toString()},t.prototype.renderEditLabels=function(e,t,i){if(t.center=e.getCenter(),t.majorRadius=e.getMajorRadius(),t.minorRadius=e.getMinorRadius(),t.rotation=e.getRotation(),i)return e.labels=i,void this.editEllipsesLayer.update(e,e.getId());this.editLabelsRenderFn&&(e.labels=this.editLabelsRenderFn(t,e.labels),this.editEllipsesLayer.update(e,e.getId()))},t.prototype.removeEditLabels=function(e){e.labels=[],this.editEllipsesLayer.update(e,e.getId())},t.prototype.handleCreateUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.ellipsesManager.createEditableEllipse(t.id,this.editEllipsesLayer,this.editPointsLayer,this.coordinateConverter,t.ellipseOptions);break;case e.EditActions.MOUSE_MOVE:var i=this.ellipsesManager.get(t.id);t.updatedPosition&&(i.movePoint(t.updatedPosition,i.majorRadiusPoint),this.renderEditLabels(i,t));break;case e.EditActions.ADD_POINT:i=this.ellipsesManager.get(t.id);t.center&&(i.addPoint(t.center),this.renderEditLabels(i,t));break;case e.EditActions.ADD_LAST_POINT:i=this.ellipsesManager.get(t.id);t.updatedPosition&&(i.addLastPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DISPOSE:(i=this.ellipsesManager.get(t.id))&&(this.removeEditLabels(i),this.ellipsesManager.dispose(t.id));break;case e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK:i=this.ellipsesManager.get(t.id);this.editLabelsRenderFn=t.labelsRenderFn,this.renderEditLabels(i,t);break;case e.EditActions.UPDATE_EDIT_LABELS:i=this.ellipsesManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;case e.EditActions.SET_MANUALLY:i=this.ellipsesManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;default:return}},t.prototype.handleEditUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:(i=this.ellipsesManager.createEditableEllipse(t.id,this.editEllipsesLayer,this.editPointsLayer,this.coordinateConverter,t.ellipseOptions)).setManually(t.center,t.majorRadius,t.rotation,t.minorRadius,t.ellipseOptions&&t.ellipseOptions.pointProps||void 0,t.ellipseOptions&&t.ellipseOptions.pointProps||void 0,t.ellipseOptions&&t.ellipseOptions.ellipseProps||void 0),this.renderEditLabels(i,t);break;case e.EditActions.DRAG_POINT_FINISH:case e.EditActions.DRAG_POINT:(i=this.ellipsesManager.get(t.id))&&i.enableEdit&&(i.movePoint(t.endDragPosition,t.updatedPoint),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE:(i=this.ellipsesManager.get(t.id))&&i.enableEdit&&(i.moveEllipse(t.startDragPosition,t.endDragPosition),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE_FINISH:(i=this.ellipsesManager.get(t.id))&&i.enableEdit&&(i.endMoveEllipse(),this.renderEditLabels(i,t));break;case e.EditActions.TRANSFORM:(i=this.ellipsesManager.get(t.id))&&i.enableEdit&&(i.transformToEllipse(),this.renderEditLabels(i,t));break;case e.EditActions.DISABLE:(i=this.ellipsesManager.get(t.id))&&(i.enableEdit=!1,this.renderEditLabels(i,t));break;case e.EditActions.ENABLE:var i;(i=this.ellipsesManager.get(t.id))&&(i.enableEdit=!0,this.renderEditLabels(i,t));break;default:return}},t.prototype.ngOnDestroy=function(){this.editorUpdatesSubscription.unsubscribe(),this.ellipsesManager.clear()},t.prototype.getPointSize=function(e){return e.isVirtualEditPoint()?e.props.virtualPointPixelSize:e.props.pixelSize},t.prototype.getPointShow=function(e){return e.show&&(e.isVirtualEditPoint()?e.props.showVirtual:e.props.show)},t}();hn.ɵfac=function(e){return new(e||hn)(d.ɵɵdirectiveInject(pn),d.ɵɵdirectiveInject(D),d.ɵɵdirectiveInject(se),d.ɵɵdirectiveInject(C),d.ɵɵdirectiveInject(cn),d.ɵɵdirectiveInject(b))},hn.ɵcmp=d.ɵɵdefineComponent({type:hn,selectors:[["ellipses-editor"]],viewQuery:function(e,t){if(1&e&&(d.ɵɵviewQuery(dn,5),d.ɵɵviewQuery(un,5)),2&e){var i=void 0;d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editEllipsesLayer=i.first),d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editPointsLayer=i.first)}},features:[d.ɵɵProvidersFeature([D,cn])],decls:8,vars:4,consts:[["acFor","let point of editPoints$",3,"context"],["editPointsLayer",""],["props","{\n                    position: point.getPositionCallbackProperty(),\n                    pixelSize: getPointSize(point),\n                    color: point.props.color,\n                    outlineColor: point.props.outlineColor,\n                    outlineWidth: point.props.outlineWidth,\n                    show: getPointShow(point),\n                    disableDepthTestDistance: point.props.disableDepthTestDistance,\n                    heightReference: point.props.heightReference,\n    }"],["acFor","let ellipse of editEllipses$",3,"context","zIndex"],["editEllipsesLayer",""],["props","{\n                    position: ellipse.getCenterCallbackProperty(),\n                    semiMajorAxis: ellipse.getMajorRadiusCallbackProperty(),\n                    semiMinorAxis: ellipse.getMinorRadiusCallbackProperty(),\n                    rotation: ellipse.getRotationCallbackProperty(),\n                    material: ellipse.ellipseProps.material,\n                    outline: ellipse.ellipseProps.outline,\n                    outlineWidth: ellipse.ellipseProps.outlineWidth,\n                    outlineColor: ellipse.ellipseProps.outlineColor,\n                    height: 0,\n                    fill: ellipse.ellipseProps.fill,\n                    classificationType: ellipse.ellipseProps.classificationType,\n                    zIndex: ellipse.ellipseProps.zIndex,\n                    shadows: ellipse.ellipseProps.shadows,\n    }"],["acFor","let label of ellipse.labels",3,"idGetter"],["props","{\n                        position: label.position,\n                        text: label.text,\n                        backgroundColor: label.backgroundColor,\n                        backgroundPadding: label.backgroundPadding,\n                        distanceDisplayCondition: label.distanceDisplayCondition,\n                        eyeOffset: label.eyeOffset,\n                        fillColor: label.fillColor,\n                        font: label.font,\n                        heightReference: label.heightReference,\n                        horizontalOrigin: label.horizontalOrigin,\n                        outlineColor: label.outlineColor,\n                        outlineWidth: label.outlineWidth,\n                        pixelOffset: label.pixelOffset,\n                        pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n                        scale: label.scale,\n                        scaleByDistance: label.scaleByDistance,\n                        show: label.show,\n                        showBackground: label.showBackground,\n                        style: label.style,\n                        translucencyByDistance: label.translucencyByDistance,\n                        verticalOrigin: label.verticalOrigin,\n                        disableDepthTestDistance: label.disableDepthTestDistance,\n        }"]],template:function(e,t){1&e&&(d.ɵɵelementStart(0,"ac-layer",0,1),d.ɵɵelement(2,"ac-point-desc",2),d.ɵɵelementEnd(),d.ɵɵelementStart(3,"ac-layer",3,4),d.ɵɵelement(5,"ac-ellipse-desc",5),d.ɵɵelementStart(6,"ac-array-desc",6),d.ɵɵelement(7,"ac-label-primitive-desc",7),d.ɵɵelementEnd(),d.ɵɵelementEnd()),2&e&&(d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("context",t)("zIndex",0),d.ɵɵadvance(3),d.ɵɵproperty("idGetter",t.getLabelId))},directives:[tt,Mt,lt,bi,ti],encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(hn,[{type:t.Component,args:[{selector:"ellipses-editor",template:'\n      <ac-layer #editPointsLayer acFor="let point of editPoints$" [context]="this">\n          <ac-point-desc\n                  props="{\n                    position: point.getPositionCallbackProperty(),\n                    pixelSize: getPointSize(point),\n                    color: point.props.color,\n                    outlineColor: point.props.outlineColor,\n                    outlineWidth: point.props.outlineWidth,\n                    show: getPointShow(point),\n                    disableDepthTestDistance: point.props.disableDepthTestDistance,\n                    heightReference: point.props.heightReference,\n    }"\n          >\n          </ac-point-desc>\n      </ac-layer>\n\n      <ac-layer #editEllipsesLayer acFor="let ellipse of editEllipses$" [context]="this" [zIndex]="0">\n          <ac-ellipse-desc\n                  props="{\n                    position: ellipse.getCenterCallbackProperty(),\n                    semiMajorAxis: ellipse.getMajorRadiusCallbackProperty(),\n                    semiMinorAxis: ellipse.getMinorRadiusCallbackProperty(),\n                    rotation: ellipse.getRotationCallbackProperty(),\n                    material: ellipse.ellipseProps.material,\n                    outline: ellipse.ellipseProps.outline,\n                    outlineWidth: ellipse.ellipseProps.outlineWidth,\n                    outlineColor: ellipse.ellipseProps.outlineColor,\n                    height: 0,\n                    fill: ellipse.ellipseProps.fill,\n                    classificationType: ellipse.ellipseProps.classificationType,\n                    zIndex: ellipse.ellipseProps.zIndex,\n                    shadows: ellipse.ellipseProps.shadows,\n    }"\n          >\n          </ac-ellipse-desc>\n\n          <ac-array-desc acFor="let label of ellipse.labels" [idGetter]="getLabelId">\n              <ac-label-primitive-desc\n                      props="{\n                        position: label.position,\n                        text: label.text,\n                        backgroundColor: label.backgroundColor,\n                        backgroundPadding: label.backgroundPadding,\n                        distanceDisplayCondition: label.distanceDisplayCondition,\n                        eyeOffset: label.eyeOffset,\n                        fillColor: label.fillColor,\n                        font: label.font,\n                        heightReference: label.heightReference,\n                        horizontalOrigin: label.horizontalOrigin,\n                        outlineColor: label.outlineColor,\n                        outlineWidth: label.outlineWidth,\n                        pixelOffset: label.pixelOffset,\n                        pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n                        scale: label.scale,\n                        scaleByDistance: label.scaleByDistance,\n                        show: label.show,\n                        showBackground: label.showBackground,\n                        style: label.style,\n                        translucencyByDistance: label.translucencyByDistance,\n                        verticalOrigin: label.verticalOrigin,\n                        disableDepthTestDistance: label.disableDepthTestDistance,\n        }"\n              >\n              </ac-label-primitive-desc>\n          </ac-array-desc>\n      </ac-layer>\n  ',providers:[D,cn],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:pn},{type:D},{type:se},{type:C},{type:cn},{type:b}]}),{editEllipsesLayer:[{type:t.ViewChild,args:["editEllipsesLayer"]}],editPointsLayer:[{type:t.ViewChild,args:["editPointsLayer"]}]});var fn=function(e){function t(t,i,n,o,r,s,a){var c=e.call(this)||this;return c.id=t,c.pointsLayer=i,c.polylinesLayer=n,c.coordinateConverter=o,c.scene=r,c.editOptions=s,c.positions=[],c.polylines=[],c.doneCreation=!1,c._enableEdit=!0,c._labels=[],c._outlineInstance=null,c._pointProps=Object.assign({},s.pointProps),c.props=Object.assign({},s.polylineProps),a&&a.length>=2&&c.createFromExisting(a),c}return S(t,e),Object.defineProperty(t.prototype,"labels",{get:function(){return this._labels},set:function(e){if(e){var t=this.getRealPositions();this._labels=e.map((function(e,i){return e.position||(e.position=t[i]),Object.assign({},Li,e)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"props",{get:function(){return this.polylineProps},set:function(e){this.polylineProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pointProps",{get:function(){return this._pointProps},set:function(e){this._pointProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEdit",{get:function(){return this._enableEdit},set:function(e){var t=this;this._enableEdit=e,this.positions.forEach((function(i){i.show=e,t.updatePointsLayer(!1,i)}))},enumerable:!1,configurable:!0}),t.prototype.createFromExisting=function(e){var t=this;e.forEach((function(e){t.addPointFromExisting(e)})),this.addAllVirtualEditPoints(),this.doneCreation=!0},t.prototype.setManually=function(e,t){var i=this;if(!this.doneCreation)throw new Error("Update manually only in edit mode, after polyline is created");this.positions.forEach((function(e){return i.pointsLayer.remove(e.getId())}));for(var n=[],o=0;o<e.length;o++){var r=e[o],s=null;s=r.pointProps?new Ai(this.id,r.position,r.pointProps):new Ai(this.id,r,this._pointProps),n.push(s)}this.positions=n,this.polylineProps=t||this.polylineProps,this.updatePointsLayer.apply(this,O([!0],T(this.positions))),this.addAllVirtualEditPoints()},t.prototype.addAllVirtualEditPoints=function(){var e=this,t=O([],T(this.positions));t.forEach((function(i,n){if(n!==t.length-1){var o=i,r=(n+1)%t.length,s=t[r],a=e.setMiddleVirtualPoint(o,s);e.updatePointsLayer(!1,a)}}))},t.prototype.setMiddleVirtualPoint=function(e,t){var i=Cesium.Cartesian3.lerp(e.getPosition(),t.getPosition(),.5,new Cesium.Cartesian3),n=new Ai(this.id,i,this._pointProps);n.setVirtualEditPoint(!0);var o=this.positions.indexOf(e);return this.positions.splice(o+1,0,n),n},t.prototype.updateMiddleVirtualPoint=function(e,t,i){var n=Cesium.Cartesian3.lerp(t.getPosition(),i.getPosition(),.5,new Cesium.Cartesian3);e.setPosition(n)},t.prototype.changeVirtualPointToRealPoint=function(e){e.setVirtualEditPoint(!1);var t=this.positions.length,i=this.positions.indexOf(e),n=(i+1)%t,o=(i-1+t)%t,r=this.positions[n],s=this.positions[o],a=this.setMiddleVirtualPoint(s,e),c=this.setMiddleVirtualPoint(e,r);this.updatePointsLayer(!1,a,c,e)},t.prototype.renderPolylines=function(){var e=this,t=this.positions.filter((function(e){return!e.isVirtualEditPoint()}));if(this.polylineProps.useGroundPrimitiveOutline){if(t.length<2)return;this.scene.groundPrimitives.remove(this._outlineInstance);var i=new Cesium.GeometryInstance({geometry:new Cesium.GroundPolylineGeometry({positions:this.positions.map((function(e){return e.getPosition()})),width:this.polylineProps.width,loop:!1}),id:"edit-polygon-outline-"+this.id,attributes:{color:Cesium.ColorGeometryInstanceAttribute.fromColor(this.polylineProps.material())}});this._outlineInstance=this.scene.groundPrimitives.add(new Cesium.GroundPolylinePrimitive({geometryInstances:i,asynchronous:!1,appearance:new Cesium.PolylineColorAppearance}))}else this.polylines.forEach((function(t){return e.polylinesLayer.remove(t.getId())})),this.polylines=[],t.forEach((function(i,n){if(n!==t.length-1){var o=t[n+1],r=new Gi(e.id,i.getPosition(),o.getPosition(),e.polylineProps);e.polylines.push(r),e.polylinesLayer.update(r,r.getId())}}))},t.prototype.addPointFromExisting=function(e){var t=new Ai(this.id,e,this._pointProps);this.positions.push(t),this.updatePointsLayer(!0,t)},t.prototype.addPoint=function(e){if(!this.doneCreation){if(!this.positions.length){var t=new Ai(this.id,e,this._pointProps);this.positions.push(t),this.updatePointsLayer(!0,t)}this.movingPoint=new Ai(this.id,e.clone(),this._pointProps),this.positions.push(this.movingPoint),this.updatePointsLayer(!0,this.movingPoint)}},t.prototype.movePointFinish=function(e){this.editOptions.clampHeightTo3D&&(e.props.disableDepthTestDistance=Number.POSITIVE_INFINITY,this.updatePointsLayer(!1,e))},t.prototype.movePoint=function(e,t){if(t.setPosition(e),this.doneCreation){if(t.props.disableDepthTestDistance&&this.editOptions.clampHeightTo3D)return void(t.props.disableDepthTestDistance=void 0);t.isVirtualEditPoint()&&this.changeVirtualPointToRealPoint(t);var i=this.positions.length,n=this.positions.indexOf(t);if(n<this.positions.length-1){var o=this.positions[(n+1)%i],r=this.positions[(n+2)%i];this.updateMiddleVirtualPoint(o,t,r)}if(n>0){var s=this.positions[(n-1+i)%i],a=this.positions[(n-2+i)%i];this.updateMiddleVirtualPoint(s,t,a)}}this.updatePointsLayer(!0,t)},t.prototype.moveTempMovingPoint=function(e){this.movingPoint&&this.movePoint(e,this.movingPoint)},t.prototype.moveShape=function(e,t){if(this.doneCreation){this.lastDraggedToPosition||(this.lastDraggedToPosition=e);var i=L.getPositionsDelta(this.lastDraggedToPosition,t);this.positions.forEach((function(e){var t=L.addDeltaToPosition(e.getPosition(),i,!0);e.setPosition(t)})),this.updatePointsLayer.apply(this,O([!0],T(this.positions))),this.lastDraggedToPosition=t}},t.prototype.endMoveShape=function(){this.lastDraggedToPosition=void 0,this.updatePointsLayer.apply(this,O([!0],T(this.positions)))},t.prototype.removePoint=function(e){var t=this;this.removePosition(e),this.positions.filter((function(e){return e.isVirtualEditPoint()})).forEach((function(e){return t.removePosition(e)})),this.addAllVirtualEditPoints(),this.renderPolylines()},t.prototype.addLastPoint=function(e){this.doneCreation=!0,this.removePosition(this.movingPoint),this.movingPoint=null,this.addAllVirtualEditPoints()},t.prototype.getRealPositions=function(){return this.getRealPoints().map((function(e){return e.getPosition()}))},t.prototype.getRealPoints=function(){var e=this;return this.positions.filter((function(t){return!t.isVirtualEditPoint()&&t!==e.movingPoint}))},t.prototype.getPoints=function(){var e=this;return this.positions.filter((function(t){return t!==e.movingPoint}))},t.prototype.getPositions=function(){return this.positions.map((function(e){return e.getPosition()}))},t.prototype.getPositionsCallbackProperty=function(){return new Cesium.CallbackProperty(this.getPositions.bind(this),!1)},t.prototype.removePosition=function(e){var t=this.positions.findIndex((function(t){return t===e}));t<0||(this.positions.splice(t,1),this.pointsLayer.remove(e.getId()))},t.prototype.updatePointsLayer=function(e){var t=this;void 0===e&&(e=!0);for(var i=[],n=1;n<arguments.length;n++)i[n-1]=arguments[n];e&&this.renderPolylines(),i.forEach((function(e){return t.pointsLayer.update(e,e.getId())}))},t.prototype.update=function(){this.updatePointsLayer()},t.prototype.dispose=function(){var e=this;this.scene.groundPrimitives.remove(this._outlineInstance),this.positions.forEach((function(t){e.pointsLayer.remove(t.getId())})),this.polylines.forEach((function(t){return e.polylinesLayer.remove(t.getId())})),this.movingPoint&&(this.pointsLayer.remove(this.movingPoint.getId()),this.movingPoint=void 0),this.positions.length=0},t.prototype.getPointsCount=function(){return this.positions.length},t.prototype.getId=function(){return this.id},t}(bt),gn=function(){function e(){this.polylines=new Map}return e.prototype.createEditablePolyline=function(e,t,i,n,o,r,s){var a=new fn(e,t,i,n,o,r,s);this.polylines.set(e,a)},e.prototype.get=function(e){return this.polylines.get(e)},e.prototype.clear=function(){this.polylines.forEach((function(e){return e.dispose()})),this.polylines.clear()},e}();gn.ɵfac=function(e){return new(e||gn)},gn.ɵprov=d.ɵɵdefineInjectable({token:gn,factory:gn.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(gn,[{type:t.Injectable}],null,null);var yn=function(e){function t(t,i,n,o,r,s){var a=e.call(this)||this;if(a.id=t,a.pointsLayer=i,a.rectangleLayer=n,a.coordinateConverter=o,a.positions=[],a.done=!1,a._enableEdit=!0,a._labels=[],a.defaultPointProps=Object.assign({},r.pointProps),a.rectangleProps=Object.assign({},r.rectangleProps),s&&2===s.length)a.createFromExisting(s);else if(s)throw new Error("Rectangle consist of 2 points but provided "+s.length);return a}return S(t,e),Object.defineProperty(t.prototype,"labels",{get:function(){return this._labels},set:function(e){if(e){var t=this.getRealPositions();this._labels=e.map((function(e,i){return e.position||(e.position=t[i]),Object.assign({},Li,e)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rectangleProps",{get:function(){return this._rectangleProps},set:function(e){this._rectangleProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultPointProps",{get:function(){return this._defaultPointProps},set:function(e){this._defaultPointProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEdit",{get:function(){return this._enableEdit},set:function(e){var t=this;this._enableEdit=e,this.positions.forEach((function(i){i.show=e,t.updatePointsLayer(i)}))},enumerable:!1,configurable:!0}),t.prototype.createFromExisting=function(e){var t=this;e.forEach((function(e){t.addPointFromExisting(e)})),this.updateRectangleLayer(),this.updatePointsLayer.apply(this,O([],T(this.positions))),this.done=!0},t.prototype.setPointsManually=function(e,t){var i=this;if(!this.done)throw new Error("Update manually only in edit mode, after rectangle is created");this.positions.forEach((function(e){return i.pointsLayer.remove(e.getId())})),this.positions=e,this.updatePointsLayer.apply(this,O([],T(e))),this.updateRectangleLayer()},t.prototype.addPointFromExisting=function(e){var t=new Ai(this.id,e,this.defaultPointProps);this.positions.push(t),this.updatePointsLayer(t)},t.prototype.addPoint=function(e){if(!this.done)if(!this.positions.length){var t=new Ai(this.id,e,this.defaultPointProps);this.positions.push(t),this.movingPoint=new Ai(this.id,e.clone(),this.defaultPointProps),this.positions.push(this.movingPoint),this.updatePointsLayer(t)}else this.updatePointsLayer.apply(this,O([],T(this.positions))),this.updateRectangleLayer(),this.done=!0,this.movingPoint=null},t.prototype.movePoint=function(e,t){t.isVirtualEditPoint()||(t.setPosition(e),this.updatePointsLayer.apply(this,O([],T(this.positions))),this.updateRectangleLayer())},t.prototype.moveShape=function(e,t){this.lastDraggedToPosition||(this.lastDraggedToPosition=e);var i=Cesium.Cartographic.fromCartesian(this.lastDraggedToPosition),n=Cesium.Cartographic.fromCartesian(t);this.getRealPoints().forEach((function(e){var t=Cesium.Cartographic.fromCartesian(e.getPosition());t.longitude+=n.longitude-i.longitude,t.latitude+=n.latitude-i.latitude,e.setPosition(Cesium.Cartesian3.fromRadians(t.longitude,t.latitude,0))})),this.updatePointsLayer.apply(this,O([],T(this.positions))),this.updateRectangleLayer(),this.lastDraggedToPosition=t},t.prototype.endMoveShape=function(){var e=this;this.lastDraggedToPosition=void 0,this.positions.forEach((function(t){return e.updatePointsLayer(t)})),this.updateRectangleLayer()},t.prototype.endMovePoint=function(){this.updatePointsLayer.apply(this,O([],T(this.positions)))},t.prototype.moveTempMovingPoint=function(e){this.movingPoint&&this.movePoint(e,this.movingPoint)},t.prototype.removePoint=function(e){var t=this;this.removePosition(e),this.positions.filter((function(e){return e.isVirtualEditPoint()})).forEach((function(e){return t.removePosition(e)}))},t.prototype.addLastPoint=function(e){this.done=!0,this.removePosition(this.movingPoint),this.movingPoint=null},t.prototype.getRealPositions=function(){return this.getRealPoints().map((function(e){return e.getPosition()}))},t.prototype.getRealPositionsCallbackProperty=function(){return new Cesium.CallbackProperty(this.getRealPositions.bind(this),!1)},t.prototype.getRealPoints=function(){return this.positions.filter((function(e){return!e.isVirtualEditPoint()}))},t.prototype.getPositions=function(){return this.positions.map((function(e){return e.getPosition()}))},t.prototype.getRectangle=function(){var e=this.getPositions().map((function(e){return Cesium.Cartographic.fromCartesian(e)})),t=e.map((function(e){return e.longitude})),i=e.map((function(e){return e.latitude}));return new Cesium.Rectangle(Math.min.apply(Math,O([],T(t))),Math.min.apply(Math,O([],T(i))),Math.max.apply(Math,O([],T(t))),Math.max.apply(Math,O([],T(i))))},t.prototype.getRectangleCallbackProperty=function(){return new Cesium.CallbackProperty(this.getRectangle.bind(this),!1)},t.prototype.removePosition=function(e){var t=this.positions.findIndex((function(t){return t===e}));t<0||(this.positions.splice(t,1),this.pointsLayer.remove(e.getId()))},t.prototype.updatePointsLayer=function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];t.forEach((function(t){return e.pointsLayer.update(t,t.getId())}))},t.prototype.updateRectangleLayer=function(){this.rectangleLayer.update(this,this.id)},t.prototype.dispose=function(){var e=this;this.rectangleLayer.remove(this.id),this.positions.forEach((function(t){e.pointsLayer.remove(t.getId())})),this.movingPoint&&(this.pointsLayer.remove(this.movingPoint.getId()),this.movingPoint=void 0),this.positions.length=0},t.prototype.getPointsCount=function(){return this.positions.length},t.prototype.getId=function(){return this.id},t}(bt),vn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t}(r.Observable),mn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t}(vn),bn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t}(vn),En=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t}(vn),Pn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t}(vn),Cn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t}(vn),Mn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t}(vn),In=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return S(t,e),t}(vn),Dn=function(e){function t(t,i,n,o,r,s){var a=e.call(this)||this;if(a.id=t,a.pointsLayer=i,a.hippodromeLayer=n,a.coordinateConverter=o,a.positions=[],a.done=!1,a._enableEdit=!0,a._labels=[],a.defaultPointProps=Object.assign({},r.pointProps),a.hippodromeProps=Object.assign({},r.hippodromeProps),s&&2===s.length)a.createFromExisting(s);else if(s)throw new Error("Hippodrome consist of 2 points but provided "+s.length);return a}return S(t,e),Object.defineProperty(t.prototype,"labels",{get:function(){return this._labels},set:function(e){if(e){var t=this.getRealPositions();this._labels=e.map((function(e,i){return e.position||(e.position=t[i]),Object.assign({},Li,e)}))}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hippodromeProps",{get:function(){return this._hippodromeProps},set:function(e){this._hippodromeProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"defaultPointProps",{get:function(){return this._defaultPointProps},set:function(e){this._defaultPointProps=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"enableEdit",{get:function(){return this._enableEdit},set:function(e){var t=this;this._enableEdit=e,this.positions.forEach((function(i){i.show=e,t.updatePointsLayer(i)}))},enumerable:!1,configurable:!0}),t.prototype.createFromExisting=function(e){var t=this;e.forEach((function(e){t.addPointFromExisting(e)})),this.createHeightEditPoints(),this.updateHippdromeLayer(),this.updatePointsLayer.apply(this,O([],T(this.positions))),this.done=!0},t.prototype.setPointsManually=function(e,t){var i=this;if(!this.done)throw new Error("Update manually only in edit mode, after polyline is created");this.hippodromeProps.width=t||this.hippodromeProps.width,this.positions.forEach((function(e){return i.pointsLayer.remove(e.getId())})),this.positions=e,this.createHeightEditPoints(),this.updatePointsLayer.apply(this,O([],T(e))),this.updateHippdromeLayer()},t.prototype.addPointFromExisting=function(e){var t=new Ai(this.id,e,this.defaultPointProps);this.positions.push(t),this.updatePointsLayer(t)},t.prototype.addPoint=function(e){if(!this.done)if(!this.positions.length){var t=new Ai(this.id,e,this.defaultPointProps);this.positions.push(t),this.movingPoint=new Ai(this.id,e.clone(),this.defaultPointProps),this.positions.push(this.movingPoint),this.updatePointsLayer(t)}else this.createHeightEditPoints(),this.updatePointsLayer.apply(this,O([],T(this.positions))),this.updateHippdromeLayer(),this.done=!0,this.movingPoint=null},t.prototype.createHeightEditPoints=function(){var e=this;this.positions.filter((function(e){return e.isVirtualEditPoint()})).forEach((function(t){return e.removePosition(t)}));var t=this.getRealPoints()[0],i=this.getRealPoints()[1],n=Cesium.Cartesian3.lerp(t.getPosition(),i.getPosition(),.5,new Cesium.Cartesian3),o=this.coordinateConverter.bearingToCartesian(t.getPosition(),i.getPosition()),r=Cesium.Math.toRadians(o)-Math.PI/2;this.createMiddleEditablePoint(n,r);var s=Cesium.Math.toRadians(o)+Math.PI/2;this.createMiddleEditablePoint(n,s)},t.prototype.createMiddleEditablePoint=function(e,t){var i=L.pointByLocationDistanceAndAzimuth(e,this.hippodromeProps.width/2,t,!0),n=new Ai(this.id,i,this.defaultPointProps);n.setVirtualEditPoint(!0),this.positions.push(n)},t.prototype.movePoint=function(e,t){t.isVirtualEditPoint()?this.changeWidthByNewPoint(e):(t.setPosition(e),this.createHeightEditPoints(),this.updatePointsLayer.apply(this,O([],T(this.positions))),this.updateHippdromeLayer())},t.prototype.changeWidthByNewPoint=function(e){var t=this.getRealPoints()[0],i=this.getRealPoints()[1],n=Cesium.Cartesian3.lerp(t.getPosition(),i.getPosition(),.5,new Cesium.Cartesian3),o=this.coordinateConverter.bearingToCartesian(n,e),r=o;o>270?r=o-270:o>180&&(r=o-180);var s=this.coordinateConverter.bearingToCartesian(t.getPosition(),i.getPosition());s>180&&(s=this.coordinateConverter.bearingToCartesian(i.getPosition(),t.getPosition()));var a=s>r?s-r:r-s;o>270&&(a=o-s);var c=Math.abs(L.distance(n,e)),l=Math.sin(Cesium.Math.toRadians(a))*c;this.hippodromeProps.width=2*Math.abs(l),this.createHeightEditPoints(),this.updatePointsLayer.apply(this,O([],T(this.positions))),this.updateHippdromeLayer()},t.prototype.moveShape=function(e,t){this.lastDraggedToPosition||(this.lastDraggedToPosition=e);var i=L.getPositionsDelta(this.lastDraggedToPosition,t);this.getRealPoints().forEach((function(e){var t=L.addDeltaToPosition(e.getPosition(),i,!0);e.setPosition(t)})),this.createHeightEditPoints(),this.updatePointsLayer.apply(this,O([],T(this.positions))),this.updateHippdromeLayer(),this.lastDraggedToPosition=t},t.prototype.endMoveShape=function(){var e=this;this.lastDraggedToPosition=void 0,this.createHeightEditPoints(),this.positions.forEach((function(t){return e.updatePointsLayer(t)})),this.updateHippdromeLayer()},t.prototype.endMovePoint=function(){this.createHeightEditPoints(),this.updatePointsLayer.apply(this,O([],T(this.positions)))},t.prototype.moveTempMovingPoint=function(e){this.movingPoint&&this.movePoint(e,this.movingPoint)},t.prototype.removePoint=function(e){var t=this;this.removePosition(e),this.positions.filter((function(e){return e.isVirtualEditPoint()})).forEach((function(e){return t.removePosition(e)}))},t.prototype.addLastPoint=function(e){this.done=!0,this.removePosition(this.movingPoint),this.movingPoint=null},t.prototype.getRealPositions=function(){return this.getRealPoints().map((function(e){return e.getPosition()}))},t.prototype.getRealPositionsCallbackProperty=function(){return new Cesium.CallbackProperty(this.getRealPositions.bind(this),!1)},t.prototype.getRealPoints=function(){return this.positions.filter((function(e){return!e.isVirtualEditPoint()}))},t.prototype.getWidth=function(){return this.hippodromeProps.width},t.prototype.getPositions=function(){return this.positions.map((function(e){return e.getPosition()}))},t.prototype.removePosition=function(e){var t=this.positions.findIndex((function(t){return t===e}));t<0||(this.positions.splice(t,1),this.pointsLayer.remove(e.getId()))},t.prototype.updatePointsLayer=function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];t.forEach((function(t){return e.pointsLayer.update(t,t.getId())}))},t.prototype.updateHippdromeLayer=function(){this.hippodromeLayer.update(this,this.id)},t.prototype.dispose=function(){var e=this;this.hippodromeLayer.remove(this.id),this.positions.forEach((function(t){e.pointsLayer.remove(t.getId())})),this.movingPoint&&(this.pointsLayer.remove(this.movingPoint.getId()),this.movingPoint=void 0),this.positions.length=0},t.prototype.getPointsCount=function(){return this.positions.length},t.prototype.getId=function(){return this.id},t}(bt),_n={addPointEvent:e.CesiumEvent.LEFT_CLICK,addLastPointEvent:e.CesiumEvent.LEFT_DOUBLE_CLICK,removePointEvent:e.CesiumEvent.RIGHT_CLICK,dragPointEvent:e.CesiumEvent.LEFT_CLICK_DRAG,dragShapeEvent:e.CesiumEvent.LEFT_CLICK_DRAG,allowDrag:!0,pointProps:{color:Cesium.Color.WHITE.withAlpha(.95),outlineColor:Cesium.Color.BLACK.withAlpha(.5),outlineWidth:1,pixelSize:15,virtualPointPixelSize:8,show:!0,showVirtual:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY},polylineProps:{material:function(){return Cesium.Color.BLACK},width:3,clampToGround:!1,zIndex:0,classificationType:Cesium.ClassificationType.BOTH,useGroundPrimitiveOutline:!1},clampHeightTo3D:!1,clampHeightTo3DOptions:{clampToTerrain:!1,clampMostDetailed:!0,clampToHeightPickWidth:2}},Sn=function(){function t(){var e=this;this.updateSubject=new r.Subject,this.updatePublisher=o.publish()(this.updateSubject),this.observablesMap=new Map,this.clampPointsDebounced=ki((function(t,i,n){e.clampPoints(t,i,n)}),300)}return t.prototype.init=function(e,t,i,n,o){this.mapEventsManager=e,this.coordinateConverter=t,this.cameraService=i,this.polylinesManager=n,this.updatePublisher.connect(),this.cesiumScene=o.getScene()},t.prototype.onUpdate=function(){return this.updatePublisher},t.prototype.clampPoints=function(e,t,i){var n=this,o=i.clampToTerrain,r=i.clampMostDetailed,s=i.clampToHeightPickWidth;if(t&&r){var a=this.polylinesManager.get(e).getPoints();if(o){var c=a.map((function(e){return n.coordinateConverter.cartesian3ToCartographic(e.getPosition())})),l=Cesium.sampleTerrain(this.cesiumScene.terrainProvider,11,c);Cesium.when(l,(function(e){a.forEach((function(t,i){t.setPosition(Cesium.Cartographic.toCartesian(e[i]))}))}))}else a.forEach((function(e){e.setPosition(n.cesiumScene.clampToHeight(e.getPosition(),void 0,s))}))}},t.prototype.screenToPosition=function(e,t,i){var n=this,o=i.clampToHeightPickWidth,r=i.clampToTerrain,s=this.coordinateConverter.screenToCartesian3(e);if(t&&s){var a=function(){var t=n.cameraService.getCamera().getPickRay(e);return n.cesiumScene.globe.pick(t,n.cesiumScene)};if(r)return a();var c=this.cesiumScene.pickPosition(e);return D.cartesian3ToLatLon(c).height<0?a():this.cesiumScene.clampToHeight(c,void 0,o)}return s},t.prototype.create=function(t,i){var n=this;void 0===t&&(t=_n),void 0===i&&(i=100);var o=[],s=xi(),a=this.setOptions(t),c=new r.BehaviorSubject({id:s,editAction:null,editMode:e.EditModes.CREATE}),l=!1;this.updateSubject.next({id:s,positions:o,editMode:e.EditModes.CREATE,editAction:e.EditActions.INIT,polylineOptions:a});var p=function(e){return n.switchToEditMode(s,e,c,o,i,a,f,l)},d=this.mapEventsManager.register({event:e.CesiumEvent.MOUSE_MOVE,pick:e.PickOptions.NO_PICK,priority:i,pickConfig:t.pickConfiguration}),u=this.mapEventsManager.register({event:a.addPointEvent,modifier:a.addPointModifier,pick:e.PickOptions.NO_PICK,priority:i,pickConfig:t.pickConfiguration}),h=this.mapEventsManager.register({event:a.addLastPointEvent,modifier:a.addLastPointModifier,pick:e.PickOptions.NO_PICK,priority:i,pickConfig:t.pickConfiguration});this.observablesMap.set(s,[d,u,h]);var f=this.createEditorObservable(c,s,p);return d.subscribe((function(t){var i=t.movement.endPosition,o=n.screenToPosition(i,a.clampHeightTo3D,a.clampHeightTo3DOptions);o&&n.updateSubject.next({id:s,positions:n.getPositions(s),editMode:e.EditModes.CREATE,updatedPosition:o,editAction:e.EditActions.MOUSE_MOVE})})),u.subscribe((function(t){var i=t.movement.endPosition;if(!l){var o=n.screenToPosition(i,a.clampHeightTo3D,a.clampHeightTo3DOptions);if(o){var r=n.getPositions(s);if(!r.find((function(e){return e.equals(o)}))){var d={id:s,positions:r,editMode:e.EditModes.CREATE,updatedPosition:o,editAction:e.EditActions.ADD_POINT};n.updateSubject.next(d),c.next(Object.assign(Object.assign({},d),{positions:n.getPositions(s),points:n.getPoints(s)})),a.maximumNumberOfPoints&&r.length+1===a.maximumNumberOfPoints&&(l=p(o))}}}})),h.subscribe((function(t){var i=t.movement.endPosition,o=n.screenToPosition(i,a.clampHeightTo3D,a.clampHeightTo3DOptions);if(o){var r=n.getPositions(s);if(!r.find((function(e){return e.equals(o)}))){var d={id:s,positions:r,editMode:e.EditModes.CREATE,updatedPosition:o,editAction:e.EditActions.ADD_POINT};n.updateSubject.next(d),c.next(Object.assign(Object.assign({},d),{positions:n.getPositions(s),points:n.getPoints(s)}))}l=p(o)}})),f},t.prototype.switchToEditMode=function(t,i,n,o,r,s,a,c){var l={id:t,positions:this.getPositions(t),editMode:e.EditModes.CREATE,updatedPosition:i,editAction:e.EditActions.ADD_LAST_POINT};this.updateSubject.next(l),n.next(Object.assign(Object.assign({},l),{positions:this.getPositions(t),points:this.getPoints(t)}));var p={id:t,editMode:e.EditModes.CREATE,editAction:e.EditActions.CHANGE_TO_EDIT};return this.updateSubject.next(p),n.next(p),this.observablesMap.has(t)&&this.observablesMap.get(t).forEach((function(e){return e.dispose()})),this.observablesMap.delete(t),this.editPolyline(t,o,r,n,s,a),true},t.prototype.edit=function(t,i,n){if(void 0===i&&(i=_n),void 0===n&&(n=100),t.length<2)throw new Error("Polylines editor error edit(): polyline should have at least 2 positions");var o=xi(),s=this.setOptions(i),a=new r.BehaviorSubject({id:o,editAction:null,editMode:e.EditModes.EDIT}),c={id:o,positions:t,editMode:e.EditModes.EDIT,editAction:e.EditActions.INIT,polylineOptions:s};return this.updateSubject.next(c),a.next(Object.assign(Object.assign({},c),{positions:this.getPositions(o),points:this.getPoints(o)})),this.editPolyline(o,t,n,a,s)},t.prototype.editPolyline=function(t,i,n,r,s,a){var c=this;this.clampPoints(t,s.clampHeightTo3D,s.clampHeightTo3DOptions);var l,p=this.mapEventsManager.register({event:s.dragPointEvent,entityType:Ai,pick:e.PickOptions.PICK_FIRST,pickConfig:s.pickConfiguration,priority:n,pickFilter:function(e){return t===e.editedEntityId}}),d=this.mapEventsManager.register({event:s.removePointEvent,modifier:s.removePointModifier,entityType:Ai,pick:e.PickOptions.PICK_FIRST,pickConfig:s.pickConfiguration,priority:n,pickFilter:function(e){return t===e.editedEntityId}});s.allowDrag&&(l=this.mapEventsManager.register({event:s.dragShapeEvent,entityType:Gi,pick:e.PickOptions.PICK_FIRST,pickConfig:s.pickConfiguration,priority:n,pickFilter:function(e){return t===e.editedEntityId}})),l&&l.pipe(o.tap((function(e){var i=e.movement.drop;return c.polylinesManager.get(t).enableEdit&&c.cameraService.enableInputs(i)}))).subscribe((function(i){var n=i.movement,o=n.startPosition,a=n.endPosition,l=n.drop,p=(i.entities,c.screenToPosition(a,!1,s.clampHeightTo3DOptions)),d=c.screenToPosition(o,!1,s.clampHeightTo3DOptions);if(p){var u={id:t,positions:c.getPositions(t),editMode:e.EditModes.EDIT,updatedPosition:p,draggedPosition:d,editAction:l?e.EditActions.DRAG_SHAPE_FINISH:e.EditActions.DRAG_SHAPE};c.updateSubject.next(u),r.next(Object.assign(Object.assign({},u),{positions:c.getPositions(t),points:c.getPoints(t)}))}})),p.pipe(o.tap((function(e){var i=e.movement.drop;return c.polylinesManager.get(t).enableEdit&&c.cameraService.enableInputs(i)}))).subscribe((function(i){var n=i.movement,o=n.endPosition,a=n.drop,l=i.entities,p=c.screenToPosition(o,s.clampHeightTo3D,s.clampHeightTo3DOptions);if(p){var d=l[0],u={id:t,positions:c.getPositions(t),editMode:e.EditModes.EDIT,updatedPosition:p,updatedPoint:d,editAction:a?e.EditActions.DRAG_POINT_FINISH:e.EditActions.DRAG_POINT};c.updateSubject.next(u),r.next(Object.assign(Object.assign({},u),{positions:c.getPositions(t),points:c.getPoints(t)})),c.clampPointsDebounced(t,s.clampHeightTo3D,s.clampHeightTo3DOptions)}})),d.subscribe((function(i){var n=i.entities[0],o=O([],T(c.getPositions(t)));if(!(o.length<3)&&!(o.findIndex((function(e){return n.getPosition().equals(e)}))<0)){var a={id:t,positions:o,editMode:e.EditModes.EDIT,updatedPoint:n,editAction:e.EditActions.REMOVE_POINT};c.updateSubject.next(a),r.next(Object.assign(Object.assign({},a),{positions:c.getPositions(t),points:c.getPoints(t)})),c.clampPoints(t,s.clampHeightTo3D,s.clampHeightTo3DOptions)}}));var u=[p,d];return l&&u.push(l),this.observablesMap.set(t,u),this.createEditorObservable(r,t)},t.prototype.setOptions=function(e){var t=JSON.parse(JSON.stringify(_n)),i=Object.assign(t,e);if(i.pointProps=Object.assign(Object.assign({},_n.pointProps),e.pointProps),i.polylineProps=Object.assign(Object.assign({},_n.polylineProps),e.polylineProps),i.clampHeightTo3DOptions=Object.assign(Object.assign({},_n.clampHeightTo3DOptions),e.clampHeightTo3DOptions),e.clampHeightTo3D){if(!this.cesiumScene.pickPositionSupported||!this.cesiumScene.clampToHeightSupported)throw new Error("Cesium pickPosition and clampToHeight must be supported to use clampHeightTo3D");this.cesiumScene.pickTranslucentDepth&&console.warn("Cesium scene.pickTranslucentDepth must be false in order to make the editors work properly on 3D"),1!==i.pointProps.color.alpha&&1!==i.pointProps.outlineColor.alpha||console.warn("Point color and outline color must have alpha in order to make the editor work properly on 3D"),i.allowDrag=!!e.allowDrag,i.polylineProps.clampToGround=!0,i.pointProps.heightReference=i.clampHeightTo3DOptions.clampToTerrain?Cesium.HeightReference.CLAMP_TO_GROUND:Cesium.HeightReference.RELATIVE_TO_GROUND,i.pointProps.disableDepthTestDistance=Number.POSITIVE_INFINITY}return i},t.prototype.createEditorObservable=function(t,i,n){var o=this;return t.dispose=function(){var t=o.observablesMap.get(i);t&&t.forEach((function(e){return e.dispose()})),o.observablesMap.delete(i),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.DISPOSE})},t.enable=function(){o.updateSubject.next({id:i,positions:o.getPositions(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.ENABLE})},t.disable=function(){o.updateSubject.next({id:i,positions:o.getPositions(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.DISABLE})},t.setManually=function(t,n){o.polylinesManager.get(i).setManually(t,n),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_MANUALLY})},t.setLabelsRenderFn=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK,labelsRenderFn:t})},t.updateLabels=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.UPDATE_EDIT_LABELS,updateLabels:t})},t.finishCreation=function(){if(!n)throw new Error("Polylines editor error edit(): cannot call finishCreation() on edit");return n(null)},t.getCurrentPoints=function(){return o.getPoints(i)},t.getEditValue=function(){return t.getValue()},t.getLabels=function(){return o.polylinesManager.get(i).labels},t},t.prototype.getPositions=function(e){return this.polylinesManager.get(e).getRealPositions()},t.prototype.getPoints=function(e){return this.polylinesManager.get(e).getRealPoints()},t}();Sn.ɵfac=function(e){return new(e||Sn)},Sn.ɵprov=d.ɵɵdefineInjectable({token:Sn,factory:Sn.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Sn,[{type:t.Injectable}],null,null);var Tn=["editPointsLayer"],On=["editPolylinesLayer"],wn=["polylineLabelsLayer"],An=function(){function t(e,t,i,n,o,s){this.polylinesEditor=e,this.coordinateConverter=t,this.mapEventsManager=i,this.cameraService=n,this.polylinesManager=o,this.cesiumService=s,this.Cesium=Cesium,this.editPoints$=new r.Subject,this.editPolylines$=new r.Subject,this.polylineLabels$=new r.Subject,this.polylinesEditor.init(this.mapEventsManager,this.coordinateConverter,this.cameraService,o,this.cesiumService),this.startListeningToEditorUpdates()}return t.prototype.startListeningToEditorUpdates=function(){var t=this;this.editorUpdatesSubscription=this.polylinesEditor.onUpdate().subscribe((function(i){i.editMode===e.EditModes.CREATE||i.editMode===e.EditModes.CREATE_OR_EDIT?t.handleCreateUpdates(i):i.editMode===e.EditModes.EDIT&&t.handleEditUpdates(i)}))},t.prototype.getLabelId=function(e,t){return t.toString()},t.prototype.renderEditLabels=function(e,t,i){if(t.positions=e.getRealPositions(),t.points=e.getRealPoints(),i)return e.labels=i,void this.polylineLabelsLayer.update(e,e.getId());this.editLabelsRenderFn&&(e.labels=this.editLabelsRenderFn(t,e.labels),this.polylineLabelsLayer.update(e,e.getId()))},t.prototype.removeEditLabels=function(e){e.labels=[],this.polylineLabelsLayer.remove(e.getId())},t.prototype.handleCreateUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.polylinesManager.createEditablePolyline(t.id,this.editPointsLayer,this.editPolylinesLayer,this.coordinateConverter,this.cesiumService.getScene(),t.polylineOptions);break;case e.EditActions.MOUSE_MOVE:var i=this.polylinesManager.get(t.id);t.updatedPosition&&(i.moveTempMovingPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.ADD_POINT:i=this.polylinesManager.get(t.id);t.updatedPosition&&(i.moveTempMovingPoint(t.updatedPosition),i.addPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.ADD_LAST_POINT:i=this.polylinesManager.get(t.id);t.updatedPosition&&(i.addLastPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DISPOSE:(i=this.polylinesManager.get(t.id))&&(i.dispose(),this.removeEditLabels(i),this.editLabelsRenderFn=void 0);break;case e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK:i=this.polylinesManager.get(t.id);this.editLabelsRenderFn=t.labelsRenderFn,this.renderEditLabels(i,t);break;case e.EditActions.UPDATE_EDIT_LABELS:i=this.polylinesManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;case e.EditActions.SET_MANUALLY:i=this.polylinesManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;default:return}},t.prototype.handleEditUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.polylinesManager.createEditablePolyline(t.id,this.editPointsLayer,this.editPolylinesLayer,this.coordinateConverter,this.cesiumService.getScene(),t.polylineOptions,t.positions);break;case e.EditActions.DRAG_POINT:(i=this.polylinesManager.get(t.id))&&i.enableEdit&&(i.movePoint(t.updatedPosition,t.updatedPoint),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_POINT_FINISH:(i=this.polylinesManager.get(t.id))&&i.enableEdit&&(i.movePointFinish(t.updatedPoint),t.updatedPoint.isVirtualEditPoint()&&(i.changeVirtualPointToRealPoint(t.updatedPoint),this.renderEditLabels(i,t)));break;case e.EditActions.REMOVE_POINT:(i=this.polylinesManager.get(t.id))&&i.enableEdit&&(i.removePoint(t.updatedPoint),this.renderEditLabels(i,t));break;case e.EditActions.DISABLE:(i=this.polylinesManager.get(t.id))&&(i.enableEdit=!1,this.renderEditLabels(i,t));break;case e.EditActions.ENABLE:(i=this.polylinesManager.get(t.id))&&(i.enableEdit=!0,this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE:(i=this.polylinesManager.get(t.id))&&i.enableEdit&&(i.moveShape(t.draggedPosition,t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE_FINISH:var i;(i=this.polylinesManager.get(t.id))&&i.enableEdit&&(i.endMoveShape(),this.renderEditLabels(i,t));break;default:return}},t.prototype.ngOnDestroy=function(){this.editorUpdatesSubscription.unsubscribe(),this.polylinesManager.clear()},t.prototype.getPointSize=function(e){return e.isVirtualEditPoint()?e.props.virtualPointPixelSize:e.props.pixelSize},t.prototype.getPointShow=function(e){return e.show&&(e.isVirtualEditPoint()?e.props.showVirtual:e.props.show)},t}();An.ɵfac=function(e){return new(e||An)(d.ɵɵdirectiveInject(Sn),d.ɵɵdirectiveInject(D),d.ɵɵdirectiveInject(se),d.ɵɵdirectiveInject(C),d.ɵɵdirectiveInject(gn),d.ɵɵdirectiveInject(b))},An.ɵcmp=d.ɵɵdefineComponent({type:An,selectors:[["polylines-editor"]],viewQuery:function(e,t){if(1&e&&(d.ɵɵviewQuery(Tn,5),d.ɵɵviewQuery(On,5),d.ɵɵviewQuery(wn,5)),2&e){var i=void 0;d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editPointsLayer=i.first),d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editPolylinesLayer=i.first),d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.polylineLabelsLayer=i.first)}},features:[d.ɵɵProvidersFeature([D,gn])],decls:10,vars:4,consts:[["acFor","let polyline of editPolylines$",3,"context"],["editPolylinesLayer",""],["props","{\n        positions: polyline.getPositionsCallbackProperty(),\n        width: polyline.props.width,\n        material: polyline.props.material(),\n        clampToGround: polyline.props.clampToGround,\n        zIndex: polyline.props.zIndex,\n        classificationType: polyline.props.classificationType,\n      }"],["acFor","let point of editPoints$",3,"context"],["editPointsLayer",""],["props","{\n        position: point.getPositionCallbackProperty(),\n        pixelSize: getPointSize(point),\n        color: point.props.color,\n        outlineColor: point.props.outlineColor,\n        outlineWidth: point.props.outlineWidth,\n        show: getPointShow(point),\n        disableDepthTestDistance: point.props.disableDepthTestDistance,\n        heightReference: point.props.heightReference,\n    }"],["acFor","let polylineLabels of polylineLabels$",3,"context"],["polylineLabelsLayer",""],["acFor","let label of polylineLabels.labels",3,"idGetter"],["props","{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"]],template:function(e,t){1&e&&(d.ɵɵelementStart(0,"ac-layer",0,1),d.ɵɵelement(2,"ac-polyline-desc",2),d.ɵɵelementEnd(),d.ɵɵelementStart(3,"ac-layer",3,4),d.ɵɵelement(5,"ac-point-desc",5),d.ɵɵelementEnd(),d.ɵɵelementStart(6,"ac-layer",6,7),d.ɵɵelementStart(8,"ac-array-desc",8),d.ɵɵelement(9,"ac-label-primitive-desc",9),d.ɵɵelementEnd(),d.ɵɵelementEnd()),2&e&&(d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("context",t),d.ɵɵadvance(2),d.ɵɵproperty("idGetter",t.getLabelId))},directives:[tt,pt,Mt,bi,ti],encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(An,[{type:t.Component,args:[{selector:"polylines-editor",template:'\n    <ac-layer #editPolylinesLayer acFor="let polyline of editPolylines$" [context]="this">\n      <ac-polyline-desc\n        props="{\n        positions: polyline.getPositionsCallbackProperty(),\n        width: polyline.props.width,\n        material: polyline.props.material(),\n        clampToGround: polyline.props.clampToGround,\n        zIndex: polyline.props.zIndex,\n        classificationType: polyline.props.classificationType,\n      }"\n      >\n      </ac-polyline-desc>\n    </ac-layer>\n\n    <ac-layer #editPointsLayer acFor="let point of editPoints$" [context]="this">\n      <ac-point-desc\n        props="{\n        position: point.getPositionCallbackProperty(),\n        pixelSize: getPointSize(point),\n        color: point.props.color,\n        outlineColor: point.props.outlineColor,\n        outlineWidth: point.props.outlineWidth,\n        show: getPointShow(point),\n        disableDepthTestDistance: point.props.disableDepthTestDistance,\n        heightReference: point.props.heightReference,\n    }"\n      ></ac-point-desc>\n    </ac-layer>\n\n    <ac-layer #polylineLabelsLayer acFor="let polylineLabels of polylineLabels$" [context]="this">\n      <ac-array-desc acFor="let label of polylineLabels.labels" [idGetter]="getLabelId">\n        <ac-label-primitive-desc\n          props="{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"\n        >\n        </ac-label-primitive-desc>\n      </ac-array-desc>\n    </ac-layer>\n  ',providers:[D,gn],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:Sn},{type:D},{type:se},{type:C},{type:gn},{type:b}]}),{editPointsLayer:[{type:t.ViewChild,args:["editPointsLayer"]}],editPolylinesLayer:[{type:t.ViewChild,args:["editPolylinesLayer"]}],polylineLabelsLayer:[{type:t.ViewChild,args:["polylineLabelsLayer"]}]});var Ln=function(){function e(){this.hippodromes=new Map}return e.prototype.createEditableHippodrome=function(e,t,i,n,o,r){var s=new Dn(e,t,i,n,o,r);this.hippodromes.set(e,s)},e.prototype.get=function(e){return this.hippodromes.get(e)},e.prototype.clear=function(){this.hippodromes.forEach((function(e){return e.dispose()})),this.hippodromes.clear()},e}();Ln.ɵfac=function(e){return new(e||Ln)},Ln.ɵprov=d.ɵɵdefineInjectable({token:Ln,factory:Ln.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Ln,[{type:t.Injectable}],null,null);var Rn={addPointEvent:e.CesiumEvent.LEFT_CLICK,dragPointEvent:e.CesiumEvent.LEFT_CLICK_DRAG,dragShapeEvent:e.CesiumEvent.LEFT_CLICK_DRAG,allowDrag:!0,hippodromeProps:{fill:!0,material:Cesium.Color.CORNFLOWERBLUE.withAlpha(.4),outline:!0,width:2e5,outlineWidth:1,outlineColor:Cesium.Color.WHITE.withAlpha(.8),classificationType:Cesium.ClassificationType.BOTH,zIndex:0,shadows:Cesium.ShadowMode.DISABLED},pointProps:{color:Cesium.Color.WHITE,outlineColor:Cesium.Color.BLACK.withAlpha(.2),outlineWidth:1,pixelSize:13,virtualPointPixelSize:8,show:!0,showVirtual:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY}},jn=function(){function t(){this.updateSubject=new r.Subject,this.updatePublisher=o.publish()(this.updateSubject),this.observablesMap=new Map}return t.prototype.init=function(e,t,i,n){this.mapEventsManager=e,this.coordinateConverter=t,this.cameraService=i,this.hippodromeManager=n,this.updatePublisher.connect()},t.prototype.onUpdate=function(){return this.updatePublisher},t.prototype.create=function(t,i){var n=this;void 0===t&&(t=Rn),void 0===i&&(i=100);var o=xi(),s=this.setOptions(t),a=new r.BehaviorSubject({id:o,editAction:null,editMode:e.EditModes.CREATE}),c=!1;this.updateSubject.next({id:o,positions:[],editMode:e.EditModes.CREATE,editAction:e.EditActions.INIT,hippodromeOptions:s});var l=function(){var t={id:o,editMode:e.EditModes.CREATE,editAction:e.EditActions.CHANGE_TO_EDIT};return n.updateSubject.next(t),a.next(t),n.observablesMap.has(o)&&n.observablesMap.get(o).forEach((function(e){return e.dispose()})),n.observablesMap.delete(o),n.editHippodrome(o,i,a,s,u),c=!0},p=this.mapEventsManager.register({event:e.CesiumEvent.MOUSE_MOVE,pickConfig:t.pickConfiguration,pick:e.PickOptions.NO_PICK,priority:i}),d=this.mapEventsManager.register({event:s.addPointEvent,pickConfig:t.pickConfiguration,pick:e.PickOptions.NO_PICK,priority:i});this.observablesMap.set(o,[p,d]);var u=this.createEditorObservable(a,o,l);return p.subscribe((function(t){var i=t.movement.endPosition,r=n.coordinateConverter.screenToCartesian3(i);r&&n.updateSubject.next({id:o,positions:n.getPositions(o),editMode:e.EditModes.CREATE,updatedPosition:r,editAction:e.EditActions.MOUSE_MOVE})})),d.subscribe((function(t){var i=t.movement.endPosition;if(!c){var r=n.coordinateConverter.screenToCartesian3(i);if(r){var s=n.getPositions(o),p=0===n.getPositions(o).length,d={id:o,positions:s,editMode:e.EditModes.CREATE,updatedPosition:r,editAction:e.EditActions.ADD_POINT};n.updateSubject.next(d),a.next(Object.assign(Object.assign({},d),{positions:n.getPositions(o),points:n.getPoints(o),width:n.getWidth(o)})),p||(c=l())}}})),u},t.prototype.edit=function(t,i,n){if(void 0===i&&(i=Rn),void 0===n&&(n=100),2!==t.length)throw new Error("Hippodrome editor error edit(): polygon should have 2 positions but received "+t);var o=xi(),s=this.setOptions(i),a=new r.BehaviorSubject({id:o,editAction:null,editMode:e.EditModes.EDIT}),c={id:o,positions:t,editMode:e.EditModes.EDIT,editAction:e.EditActions.INIT,hippodromeOptions:s};return this.updateSubject.next(c),a.next(Object.assign(Object.assign({},c),{positions:this.getPositions(o),points:this.getPoints(o),width:this.getWidth(o)})),this.editHippodrome(o,n,a,s)},t.prototype.editHippodrome=function(t,i,n,r,s){var a,c=this;r.allowDrag&&(a=this.mapEventsManager.register({event:r.dragShapeEvent,entityType:Dn,pick:e.PickOptions.PICK_FIRST,pickConfig:r.pickConfiguration,priority:i,pickFilter:function(e){return t===e.id}}));var l=this.mapEventsManager.register({event:r.dragPointEvent,entityType:Ai,pick:e.PickOptions.PICK_FIRST,pickConfig:r.pickConfiguration,priority:i,pickFilter:function(e){return t===e.editedEntityId}});l.pipe(o.tap((function(e){var i=e.movement.drop;return c.hippodromeManager.get(t).enableEdit&&c.cameraService.enableInputs(i)}))).subscribe((function(i){var o=i.movement,r=o.endPosition,s=o.drop,a=i.entities,l=c.coordinateConverter.screenToCartesian3(r);if(l){var p=a[0],d={id:t,positions:c.getPositions(t),editMode:e.EditModes.EDIT,updatedPosition:l,updatedPoint:p,editAction:s?e.EditActions.DRAG_POINT_FINISH:e.EditActions.DRAG_POINT};c.updateSubject.next(d),n.next(Object.assign(Object.assign({},d),{positions:c.getPositions(t),points:c.getPoints(t),width:c.getWidth(t)}))}})),a&&a.pipe(o.tap((function(e){var i=e.movement.drop;return c.hippodromeManager.get(t).enableEdit&&c.cameraService.enableInputs(i)}))).subscribe((function(i){var o=i.movement,r=o.startPosition,s=o.endPosition,a=o.drop,l=(i.entities,c.coordinateConverter.screenToCartesian3(s)),p=c.coordinateConverter.screenToCartesian3(r);if(l){var d={id:t,positions:c.getPositions(t),editMode:e.EditModes.EDIT,updatedPosition:l,draggedPosition:p,editAction:a?e.EditActions.DRAG_SHAPE_FINISH:e.EditActions.DRAG_SHAPE};c.updateSubject.next(d),n.next(Object.assign(Object.assign({},d),{positions:c.getPositions(t),points:c.getPoints(t),width:c.getWidth(t)}))}}));var p=[l];return a&&p.push(a),this.observablesMap.set(t,p),this.createEditorObservable(n,t)},t.prototype.setOptions=function(e){var t=JSON.parse(JSON.stringify(Rn)),i=Object.assign(t,e);return i.hippodromeProps=Object.assign({},Rn.hippodromeProps,e.hippodromeProps),i.pointProps=Object.assign({},Rn.pointProps,e.pointProps),i},t.prototype.createEditorObservable=function(t,i,n){var o=this;return t.dispose=function(){var t=o.observablesMap.get(i);t&&t.forEach((function(e){return e.dispose()})),o.observablesMap.delete(i),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.DISPOSE})},t.enable=function(){o.updateSubject.next({id:i,positions:o.getPositions(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.ENABLE})},t.disable=function(){o.updateSubject.next({id:i,positions:o.getPositions(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.DISABLE})},t.setManually=function(t,n,r,s,a){var c=new Ai(i,t,s||Rn.pointProps),l=new Ai(i,n,a||Rn.pointProps);o.hippodromeManager.get(i).setPointsManually([c,l],r),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_MANUALLY})},t.setLabelsRenderFn=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK,labelsRenderFn:t})},t.updateLabels=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.UPDATE_EDIT_LABELS,updateLabels:t})},t.finishCreation=function(){if(!n)throw new Error("Hippodrome editor error edit(): cannot call finishCreation() on edit");return n()},t.getCurrentPoints=function(){return o.getPoints(i)},t.getEditValue=function(){return t.getValue()},t.getLabels=function(){return o.hippodromeManager.get(i).labels},t.getCurrentWidth=function(){return o.getWidth(i)},t},t.prototype.getPositions=function(e){return this.hippodromeManager.get(e).getRealPositions()},t.prototype.getPoints=function(e){return this.hippodromeManager.get(e).getRealPoints()},t.prototype.getWidth=function(e){return this.hippodromeManager.get(e).getWidth()},t}();jn.ɵfac=function(e){return new(e||jn)},jn.ɵprov=d.ɵɵdefineInjectable({token:jn,factory:jn.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(jn,[{type:t.Injectable}],null,null);var xn=["editPointsLayer"],kn=["editHippodromesLayer"],Fn=function(){function t(e,t,i,n,o){this.hippodromesEditor=e,this.coordinateConverter=t,this.mapEventsManager=i,this.cameraService=n,this.hippodromesManager=o,this.Cesium=Cesium,this.editPoints$=new r.Subject,this.editHippodromes$=new r.Subject,this.hippodromesEditor.init(this.mapEventsManager,this.coordinateConverter,this.cameraService,o),this.startListeningToEditorUpdates()}return t.prototype.startListeningToEditorUpdates=function(){var t=this;this.editorUpdatesSubscription=this.hippodromesEditor.onUpdate().subscribe((function(i){i.editMode===e.EditModes.CREATE||i.editMode===e.EditModes.CREATE_OR_EDIT?t.handleCreateUpdates(i):i.editMode===e.EditModes.EDIT&&t.handleEditUpdates(i)}))},t.prototype.getLabelId=function(e,t){return t.toString()},t.prototype.renderEditLabels=function(e,t,i){if(t.positions=e.getRealPositions(),t.points=e.getRealPoints(),i)return e.labels=i,void this.editHippodromesLayer.update(e,e.getId());this.editLabelsRenderFn&&(e.labels=this.editLabelsRenderFn(t,e.labels),this.editHippodromesLayer.update(e,e.getId()))},t.prototype.removeEditLabels=function(e){e.labels=[],this.editHippodromesLayer.update(e,e.getId())},t.prototype.handleCreateUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.hippodromesManager.createEditableHippodrome(t.id,this.editPointsLayer,this.editHippodromesLayer,this.coordinateConverter,t.hippodromeOptions);break;case e.EditActions.MOUSE_MOVE:var i=this.hippodromesManager.get(t.id);t.updatedPosition&&(i.moveTempMovingPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.ADD_POINT:i=this.hippodromesManager.get(t.id);t.updatedPosition&&(i.moveTempMovingPoint(t.updatedPosition),i.addPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DISPOSE:(i=this.hippodromesManager.get(t.id))&&(i.dispose(),this.removeEditLabels(i));break;case e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK:i=this.hippodromesManager.get(t.id);this.editLabelsRenderFn=t.labelsRenderFn,this.renderEditLabels(i,t);break;case e.EditActions.UPDATE_EDIT_LABELS:i=this.hippodromesManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;case e.EditActions.SET_MANUALLY:i=this.hippodromesManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;default:return}},t.prototype.handleEditUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.hippodromesManager.createEditableHippodrome(t.id,this.editPointsLayer,this.editHippodromesLayer,this.coordinateConverter,t.hippodromeOptions,t.positions);break;case e.EditActions.DRAG_POINT:(i=this.hippodromesManager.get(t.id))&&i.enableEdit&&(i.movePoint(t.updatedPosition,t.updatedPoint),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_POINT_FINISH:(i=this.hippodromesManager.get(t.id))&&i.enableEdit&&(i.endMovePoint(),this.renderEditLabels(i,t));break;case e.EditActions.DISABLE:(i=this.hippodromesManager.get(t.id))&&(i.enableEdit=!1,this.renderEditLabels(i,t));break;case e.EditActions.ENABLE:(i=this.hippodromesManager.get(t.id))&&(i.enableEdit=!0,this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE:(i=this.hippodromesManager.get(t.id))&&i.enableEdit&&(i.moveShape(t.draggedPosition,t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE_FINISH:var i;(i=this.hippodromesManager.get(t.id))&&i.enableEdit&&(i.endMoveShape(),this.renderEditLabels(i,t));break;default:return}},t.prototype.ngOnDestroy=function(){this.editorUpdatesSubscription.unsubscribe(),this.hippodromesManager.clear()},t.prototype.getPointSize=function(e){return e.isVirtualEditPoint()?e.props.virtualPointPixelSize:e.props.pixelSize},t.prototype.getPointShow=function(e){return e.show&&(e.isVirtualEditPoint()?e.props.showVirtual:e.props.show)},t}();Fn.ɵfac=function(e){return new(e||Fn)(d.ɵɵdirectiveInject(jn),d.ɵɵdirectiveInject(D),d.ɵɵdirectiveInject(se),d.ɵɵdirectiveInject(C),d.ɵɵdirectiveInject(Ln))},Fn.ɵcmp=d.ɵɵdefineComponent({type:Fn,selectors:[["hippodrome-editor"]],viewQuery:function(e,t){if(1&e&&(d.ɵɵviewQuery(xn,5),d.ɵɵviewQuery(kn,5)),2&e){var i=void 0;d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editPointsLayer=i.first),d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editHippodromesLayer=i.first)}},features:[d.ɵɵProvidersFeature([D,Ln])],decls:8,vars:3,consts:[["acFor","let hippodrome of editHippodromes$",3,"context"],["editHippodromesLayer",""],["props","{\n            positions: hippodrome.getRealPositionsCallbackProperty(),\n            cornerType: Cesium.CornerType.ROUNDED,\n            material: hippodrome.hippodromeProps.material,\n            width : hippodrome.hippodromeProps.width,\n            outline: hippodrome.hippodromeProps.outline,\n            outlineColor: hippodrome.hippodromeProps.outlineColor,\n            outlineWidth: hippodrome.hippodromeProps.outlineWidth,\n            height: 0,\n            classificationType: hippodrome.hippodromeProps.classificationType,\n            zIndex: hippodrome.hippodromeProps.zIndex,\n            shadows: hippodrome.hippodromeProps.shadows,\n    }"],["acFor","let label of hippodrome.labels",3,"idGetter"],["props","{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"],["acFor","let point of editPoints$",3,"context"],["editPointsLayer",""],["props","{\n         position: point.getPositionCallbackProperty(),\n         pixelSize: getPointSize(point),\n         color: point.props.color,\n         outlineColor: point.props.outlineColor,\n         outlineWidth: point.props.outlineWidth,\n         show: getPointShow(point),\n         disableDepthTestDistance: point.props.disableDepthTestDistance,\n         heightReference: point.props.heightReference,\n    }"]],template:function(e,t){1&e&&(d.ɵɵelementStart(0,"ac-layer",0,1),d.ɵɵelement(2,"ac-corridor-desc",2),d.ɵɵelementStart(3,"ac-array-desc",3),d.ɵɵelement(4,"ac-label-primitive-desc",4),d.ɵɵelementEnd(),d.ɵɵelementEnd(),d.ɵɵelementStart(5,"ac-layer",5,6),d.ɵɵelement(7,"ac-point-desc",7),d.ɵɵelementEnd()),2&e&&(d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("idGetter",t.getLabelId),d.ɵɵadvance(2),d.ɵɵproperty("context",t))},directives:[tt,Yt,bi,ti,Mt],encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Fn,[{type:t.Component,args:[{selector:"hippodrome-editor",template:'\n      <ac-layer #editHippodromesLayer acFor="let hippodrome of editHippodromes$" [context]="this">\n          <ac-corridor-desc props="{\n            positions: hippodrome.getRealPositionsCallbackProperty(),\n            cornerType: Cesium.CornerType.ROUNDED,\n            material: hippodrome.hippodromeProps.material,\n            width : hippodrome.hippodromeProps.width,\n            outline: hippodrome.hippodromeProps.outline,\n            outlineColor: hippodrome.hippodromeProps.outlineColor,\n            outlineWidth: hippodrome.hippodromeProps.outlineWidth,\n            height: 0,\n            classificationType: hippodrome.hippodromeProps.classificationType,\n            zIndex: hippodrome.hippodromeProps.zIndex,\n            shadows: hippodrome.hippodromeProps.shadows,\n    }">\n          </ac-corridor-desc>\n\n          <ac-array-desc acFor="let label of hippodrome.labels" [idGetter]="getLabelId">\n              <ac-label-primitive-desc props="{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }">\n              </ac-label-primitive-desc>\n          </ac-array-desc>\n      </ac-layer>\n\n      <ac-layer #editPointsLayer acFor="let point of editPoints$" [context]="this">\n          <ac-point-desc props="{\n         position: point.getPositionCallbackProperty(),\n         pixelSize: getPointSize(point),\n         color: point.props.color,\n         outlineColor: point.props.outlineColor,\n         outlineWidth: point.props.outlineWidth,\n         show: getPointShow(point),\n         disableDepthTestDistance: point.props.disableDepthTestDistance,\n         heightReference: point.props.heightReference,\n    }">\n          </ac-point-desc>\n      </ac-layer>\n  ',providers:[D,Ln],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:jn},{type:D},{type:se},{type:C},{type:Ln}]}),{editPointsLayer:[{type:t.ViewChild,args:["editPointsLayer"]}],editHippodromesLayer:[{type:t.ViewChild,args:["editHippodromesLayer"]}]});var Nn=function(){function e(e,t){this.document=e,this.mapsManager=t,this.mainSubject=new r.Subject}return e.prototype.setCoordinateConverter=function(e){this.coordinateConverter=e},e.prototype.drag=function(e,t){var i=this;if(!this.coordinateConverter){var n=this.mapsManager.getMap();n&&(this.coordinateConverter=n.getCoordinateConverter())}this.cancel();var o=document.createElement("img");o.src=e,o.style.position="fixed",o.style.visibility="hidden",o.style.width="30px",o.style.height="30px",o.style["user-drag"]="none",o.style["user-select"]="none",o.style["-moz-user-select"]="none",o.style["-webkit-user-drag"]="none",o.style["-webkit-user-select"]="none",o.style["-ms-user-select"]="none",Object.assign(o.style,t),document.body.appendChild(o),this.createDragObservable(),this.dragObservable.subscribe((function(e){o.style.visibility="visible",o.style.left=e.screenPosition.x-o.clientWidth/2+"px",o.style.top=e.screenPosition.y-o.clientHeight/2+"px",i.mainSubject.next(e),e.drop&&o.remove()}),(function(e){o.remove()}),(function(){o.remove()}))},e.prototype.dragUpdates=function(){return this.mainSubject},e.prototype.cancel=function(){this.stopper&&(this.stopper.next(!0),this.stopper=void 0,this.dragObservable=void 0)},e.prototype.createDragObservable=function(){var e,t,i,n=this,s=new r.Subject,a=new r.Subject,c=r.fromEvent(document,"pointerup"),l=r.fromEvent(document,"pointermove").pipe(o.map((function(o){return e=e||o.x,t=t||o.y,i={drop:!1,initialScreenPosition:{x:e,y:t},screenPosition:{x:o.x,y:o.y},mapPosition:n.coordinateConverter?n.coordinateConverter.screenToCartesian3({x:o.x,y:o.y}):void 0}})),o.takeUntil(c),o.tap(void 0,void 0,(function(){if(i){var e=Object.assign({},i);e.drop=!0,a.next(e)}})));this.dragObservable=l.pipe(o.merge(a),o.takeUntil(s)),this.stopper=s},e}();Nn.ɵfac=function(e){return new(e||Nn)(d.ɵɵinject(i.DOCUMENT),d.ɵɵinject(le))},Nn.ɵprov=d.ɵɵdefineInjectable({token:Nn,factory:Nn.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Nn,[{type:t.Injectable}],(function(){return[{type:void 0,decorators:[{type:t.Inject,args:[i.DOCUMENT]}]},{type:le}]}),null);var Hn=function(){function e(e,t){this.iconDragService=t,e.nativeElement.style["user-drag"]="none",e.nativeElement.style["user-select"]="none",e.nativeElement.style["-moz-user-select"]="none",e.nativeElement.style["-webkit-user-drag"]="none",e.nativeElement.style["-webkit-user-select"]="none",e.nativeElement.style["-ms-user-select"]="none"}return e.prototype.ngOnInit=function(){"string"==typeof this.draggableToMap?this.src=this.draggableToMap:(this.src=this.draggableToMap.src,this.style=this.draggableToMap.style)},e.prototype.onMouseDown=function(){this.iconDragService.drag(this.src,this.style)},e}();function Bn(e,t){if(1&e&&d.ɵɵelement(0,"img",2),2&e){var i=d.ɵɵnextContext();d.ɵɵclassMapInterpolate1("icon ",i.iconClass,""),d.ɵɵproperty("src",i.iconUrl,d.ɵɵsanitizeUrl)}}Hn.ɵfac=function(e){return new(e||Hn)(d.ɵɵdirectiveInject(d.ElementRef),d.ɵɵdirectiveInject(Nn))},Hn.ɵdir=d.ɵɵdefineDirective({type:Hn,selectors:[["","draggableToMap",""]],hostBindings:function(e,t){1&e&&d.ɵɵlistener("mousedown",(function(){return t.onMouseDown()}))},inputs:{draggableToMap:"draggableToMap"}}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Hn,[{type:t.Directive,args:[{selector:"[draggableToMap]"}]}],(function(){return[{type:d.ElementRef},{type:Nn}]}),{draggableToMap:[{type:t.Input}],onMouseDown:[{type:t.HostListener,args:["mousedown"]}]});var Vn=function(){function e(){this.onClick=new t.EventEmitter}return e.prototype.ngOnInit=function(){},e}();Vn.ɵfac=function(e){return new(e||Vn)},Vn.ɵcmp=d.ɵɵdefineComponent({type:Vn,selectors:[["ac-toolbar-button"]],inputs:{iconUrl:"iconUrl",buttonClass:"buttonClass",iconClass:"iconClass"},outputs:{onClick:"onClick"},ngContentSelectors:["*"],decls:3,vars:4,consts:[[3,"click"],[3,"src","class",4,"ngIf"],[3,"src"]],template:function(e,t){1&e&&(d.ɵɵprojectionDef(),d.ɵɵelementStart(0,"div",0),d.ɵɵlistener("click",(function(){return t.onClick.emit()})),d.ɵɵtemplate(1,Bn,1,4,"img",1),d.ɵɵprojection(2),d.ɵɵelementEnd()),2&e&&(d.ɵɵclassMapInterpolate1("button-container ",t.buttonClass,""),d.ɵɵadvance(1),d.ɵɵproperty("ngIf",t.iconUrl))},directives:[u.NgIf],styles:[".button-container[_ngcontent-%COMP%] {\n            border-radius: 1px;\n            background-color: rgba(255, 255, 255, 0.8);\n            height: 30px;\n            width: 30px;\n            padding: 5px;\n            transition: all 0.2s;\n            cursor: pointer;\n            display: flex;\n            justify-content: center;\n            align-items: center;\n            flex-direction: column;\n        }\n\n        .button-container[_ngcontent-%COMP%]:hover {\n            background-color: rgba(255, 255, 255, 0.95);\n        }\n\n        .icon[_ngcontent-%COMP%] {\n            height: 30px;\n            width: 30px;\n        }"],changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Vn,[{type:t.Component,args:[{selector:"ac-toolbar-button",template:'\n        <div (click)="onClick.emit()" class="button-container {{buttonClass}}">\n            <img *ngIf="iconUrl" [src]="iconUrl" class="icon {{iconClass}}"/>\n            <ng-content></ng-content>\n        </div>\n    ',styles:["\n        .button-container {\n            border-radius: 1px;\n            background-color: rgba(255, 255, 255, 0.8);\n            height: 30px;\n            width: 30px;\n            padding: 5px;\n            transition: all 0.2s;\n            cursor: pointer;\n            display: flex;\n            justify-content: center;\n            align-items: center;\n            flex-direction: column;\n        }\n\n        .button-container:hover {\n            background-color: rgba(255, 255, 255, 0.95);\n        }\n\n        .icon {\n            height: 30px;\n            width: 30px;\n        }\n    "],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[]}),{iconUrl:[{type:t.Input}],buttonClass:[{type:t.Input}],iconClass:[{type:t.Input}],onClick:[{type:t.Output}]});var Gn=function(){};function Un(e,t){1&e&&(d.ɵɵelementStart(0,"div"),d.ɵɵelementStart(1,"ac-toolbar-button"),d.ɵɵelement(2,"ac-drag-icon"),d.ɵɵelementEnd(),d.ɵɵelementEnd())}Gn.ɵfac=function(e){return new(e||Gn)},Gn.ɵcmp=d.ɵɵdefineComponent({type:Gn,selectors:[["ac-drag-icon"]],decls:19,vars:0,consts:[["version","1.1","id","Capa_1","xmlns","http://www.w3.org/2000/svg","x","0px","y","0px","height","25","width","25","viewBox","0 0 476.737 476.737",0,"xml","space","preserve",2,"enable-background","new 0 0 476.737 476.737"],["d","M475.498,232.298l-3.401-5.149l-63.565-63.565c-6.198-6.198-16.304-6.198-22.47,0\n\t\t\tc-6.198,6.198-6.198,16.273,0,22.47l36.423,36.423H254.26V54.253l36.423,36.423c6.166,6.198,16.273,6.198,22.47,0\n\t\t\tc6.166-6.198,6.166-16.273,0-22.47L249.588,4.64l-0.159-0.095l-4.99-3.305L238.369,0h-0.064l-6.007,1.24l-4.99,3.305l-0.191,0.095\n\t\t\tl-63.565,63.565c-6.198,6.198-6.198,16.273,0,22.47s16.273,6.198,22.47,0l36.455-36.423v168.225H54.253l36.423-36.423\n\t\t\tc6.198-6.198,6.198-16.273,0-22.47s-16.273-6.198-22.47,0L4.64,227.149l-0.095,0.159l-3.305,4.99L0,238.369v0.064l1.24,6.007\n\t\t\tl3.305,4.958l0.095,0.191l63.565,63.565c6.198,6.198,16.273,6.198,22.47,0c6.198-6.166,6.198-16.273,0-22.47L54.253,254.26\n\t\t\th168.225v168.225l-36.423-36.423c-6.198-6.166-16.273-6.166-22.47,0c-6.198,6.198-6.198,16.304,0,22.47l63.565,63.565l5.149,3.432\n\t\t\tl6.007,1.208h0.064l6.07-1.24l5.149-3.401l63.565-63.565c6.166-6.198,6.166-16.304,0-22.47c-6.198-6.198-16.304-6.198-22.47,0\n\t\t\tl-36.423,36.423V254.26h168.225l-36.423,36.423c-6.166,6.166-6.166,16.273,0,22.47c6.198,6.166,16.304,6.166,22.47,0\n\t\t\tl63.565-63.565l3.432-5.149l1.208-6.007v-0.064L475.498,232.298z",2,"fill","#010002"]],template:function(e,t){1&e&&(d.ɵɵnamespaceSVG(),d.ɵɵelementStart(0,"svg",0),d.ɵɵelementStart(1,"g"),d.ɵɵelementStart(2,"g"),d.ɵɵelement(3,"path",1),d.ɵɵelementEnd(),d.ɵɵelementEnd(),d.ɵɵelement(4,"g"),d.ɵɵelement(5,"g"),d.ɵɵelement(6,"g"),d.ɵɵelement(7,"g"),d.ɵɵelement(8,"g"),d.ɵɵelement(9,"g"),d.ɵɵelement(10,"g"),d.ɵɵelement(11,"g"),d.ɵɵelement(12,"g"),d.ɵɵelement(13,"g"),d.ɵɵelement(14,"g"),d.ɵɵelement(15,"g"),d.ɵɵelement(16,"g"),d.ɵɵelement(17,"g"),d.ɵɵelement(18,"g"),d.ɵɵelementEnd())},encapsulation:2}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Gn,[{type:t.Component,args:[{selector:"ac-drag-icon",template:'\n        <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg"  x="0px" y="0px"  height="25"  width="25"\n\t viewBox="0 0 476.737 476.737" style="enable-background:new 0 0 476.737 476.737;" xml:space="preserve">\n<g>\n\t<g>\n\t\t<path style="fill:#010002;" d="M475.498,232.298l-3.401-5.149l-63.565-63.565c-6.198-6.198-16.304-6.198-22.47,0\n\t\t\tc-6.198,6.198-6.198,16.273,0,22.47l36.423,36.423H254.26V54.253l36.423,36.423c6.166,6.198,16.273,6.198,22.47,0\n\t\t\tc6.166-6.198,6.166-16.273,0-22.47L249.588,4.64l-0.159-0.095l-4.99-3.305L238.369,0h-0.064l-6.007,1.24l-4.99,3.305l-0.191,0.095\n\t\t\tl-63.565,63.565c-6.198,6.198-6.198,16.273,0,22.47s16.273,6.198,22.47,0l36.455-36.423v168.225H54.253l36.423-36.423\n\t\t\tc6.198-6.198,6.198-16.273,0-22.47s-16.273-6.198-22.47,0L4.64,227.149l-0.095,0.159l-3.305,4.99L0,238.369v0.064l1.24,6.007\n\t\t\tl3.305,4.958l0.095,0.191l63.565,63.565c6.198,6.198,16.273,6.198,22.47,0c6.198-6.166,6.198-16.273,0-22.47L54.253,254.26\n\t\t\th168.225v168.225l-36.423-36.423c-6.198-6.166-16.273-6.166-22.47,0c-6.198,6.198-6.198,16.304,0,22.47l63.565,63.565l5.149,3.432\n\t\t\tl6.007,1.208h0.064l6.07-1.24l5.149-3.401l63.565-63.565c6.166-6.198,6.166-16.304,0-22.47c-6.198-6.198-16.304-6.198-22.47,0\n\t\t\tl-36.423,36.423V254.26h168.225l-36.423,36.423c-6.166,6.166-6.166,16.273,0,22.47c6.198,6.166,16.304,6.166,22.47,0\n\t\t\tl63.565-63.565l3.432-5.149l1.208-6.007v-0.064L475.498,232.298z"/>\n\t</g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n<g>\n</g>\n</svg>\n    '}]}],(function(){return[]}),null);var zn=function(){function e(e,i){this.element=e,this.cesiumService=i,this.allowDrag=!0,this.onDrag=new t.EventEmitter,this.dragStyle={"height.px":20,"width.px":20}}return e.prototype.ngOnInit=function(){this.cesiumService.getMap().getMapContainer().appendChild(this.element.nativeElement),this.allowDrag&&this.listenForDragging()},e.prototype.ngOnChanges=function(e){e.allowDrag&&e.allowDrag.currentValue&&!e.allowDrag.previousValue&&this.listenForDragging(),e.allowDrag&&!e.allowDrag.currentValue&&e.allowDrag.previousValue&&this.dragSubscription.unsubscribe()},e.prototype.ngOnDestroy=function(){this.dragSubscription&&this.dragSubscription.unsubscribe()},e.prototype.listenForDragging=function(){var e=this;this.mouseDown$=this.mouseDown$||r.fromEvent(this.element.nativeElement,"mousedown"),this.mouseMove$=this.mouseMove$||r.fromEvent(document,"mousemove"),this.mouseUp$=this.mouseUp$||r.fromEvent(document,"mouseup"),this.drag$=this.drag$||this.mouseDown$.pipe(o.switchMap((function(){return e.mouseMove$.pipe(o.tap(e.onDrag.emit),o.takeUntil(e.mouseUp$))}))),this.dragSubscription=this.drag$.subscribe((function(t){e.element.nativeElement.style.left=t.x+"px",e.element.nativeElement.style.top=t.y+"px"}))},e}();zn.ɵfac=function(e){return new(e||zn)(d.ɵɵdirectiveInject(d.ElementRef),d.ɵɵdirectiveInject(b))},zn.ɵcmp=d.ɵɵdefineComponent({type:zn,selectors:[["ac-toolbar"]],inputs:{toolbarClass:"toolbarClass",allowDrag:"allowDrag"},outputs:{onDrag:"onDrag"},features:[d.ɵɵNgOnChangesFeature],ngContentSelectors:["*"],decls:3,vars:4,consts:[[4,"ngIf"]],template:function(e,t){1&e&&(d.ɵɵprojectionDef(),d.ɵɵelementStart(0,"div"),d.ɵɵtemplate(1,Un,3,0,"div",0),d.ɵɵprojection(2),d.ɵɵelementEnd()),2&e&&(d.ɵɵclassMap(t.toolbarClass),d.ɵɵadvance(1),d.ɵɵproperty("ngIf",t.allowDrag))},directives:[u.NgIf,Vn,Gn],styles:["[_nghost-%COMP%] {\n            position: absolute;\n            top: 20px;\n            left: 20px;\n            width: 20px;\n            height: 20px;\n            z-index: 999;\n            -webkit-user-drag: none;\n        }"],changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(zn,[{type:t.Component,args:[{selector:"ac-toolbar",template:'\n        <div class="{{toolbarClass}}">\n            <div *ngIf="allowDrag">\n                <ac-toolbar-button>\n                    <ac-drag-icon></ac-drag-icon>\n                </ac-toolbar-button>\n            </div>\n\n            <ng-content></ng-content>\n        </div>\n    ',styles:["\n        :host {\n            position: absolute;\n            top: 20px;\n            left: 20px;\n            width: 20px;\n            height: 20px;\n            z-index: 999;\n            -webkit-user-drag: none;\n        }\n    "],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:d.ElementRef},{type:b}]}),{toolbarClass:[{type:t.Input}],allowDrag:[{type:t.Input}],onDrag:[{type:t.Output}]});var Wn,Kn=function(){function t(e,t){this.polylineEditor=e,this.coordinateConverter=t,this.lineEditOptions={},this.labelsStyle={},this.distanceLabelsStyle={},this.bearingLabelsStyle={}}return t.prototype.create=function(t){var i=this,n=void 0===t?{lineEditOptions:{},labelsStyle:{},distanceLabelsStyle:{},bearingLabelsStyle:{}}:t,o=n.lineEditOptions,r=void 0===o?{}:o,s=n.labelsStyle,a=void 0===s?{}:s,c=n.distanceLabelsStyle,l=void 0===c?{}:c,p=n.bearingLabelsStyle,d=void 0===p?{}:p,u=n.bearingStringFn,h=n.distanceStringFn,f=n.labelsRenderFn,g=this.polylineEditor.create(Object.assign(Object.assign({allowDrag:!1,pointProps:{showVirtual:!1,pixelSize:8},polylineProps:{width:2}},this.lineEditOptions),r));return f?g.setLabelsRenderFn(f):this.labelsRenderFn?g.setLabelsRenderFn(this.labelsRenderFn):g.setLabelsRenderFn((function(t){var n=t.positions,o=0;return n&&0!==n.length?(t.editMode===e.EditModes.CREATE&&t.editAction!==e.EditActions.ADD_LAST_POINT?O(O([],T(n)),[t.updatedPosition]):n).reduce((function(e,t,n,r){if(0!==n){var s=r[n-1],c=i.coordinateConverter.bearingToCartesian(s,t),p=Cesium.Cartesian3.distance(s,t)/1e3;e.push(Object.assign(Object.assign(Object.assign(Object.assign({text:u&&u(c)||i.bearingStringFn&&i.bearingStringFn(c)||c.toFixed(2)+"°",scale:.2,font:"80px Helvetica",pixelOffset:new Cesium.Cartesian2(-20,-8),position:new Cesium.Cartesian3((t.x+s.x)/2,(t.y+s.y)/2,(t.z+s.z)/2),fillColor:Cesium.Color.WHITE,outlineColor:Cesium.Color.WHITE,showBackground:!0},i.labelsStyle),a),i.bearingLabelsStyle),d),Object.assign(Object.assign(Object.assign(Object.assign({text:h&&h(o+p)||i.distanceStringFn&&i.distanceStringFn(o+p)||(o+p).toFixed(2)+" Km",scale:.2,font:"80px Helvetica",pixelOffset:new Cesium.Cartesian2(-35,-8),position:t,fillColor:Cesium.Color.WHITE,outlineColor:Cesium.Color.WHITE,showBackground:!0},i.labelsStyle),a),i.distanceLabelsStyle),l)),o+=p}return e}),[Object.assign(Object.assign(Object.assign(Object.assign({text:h&&h(0)||i.distanceStringFn&&i.distanceStringFn(0)||"0 Km",scale:.2,font:"80px Helvetica",pixelOffset:new Cesium.Cartesian2(-20,-8),position:n[0],fillColor:Cesium.Color.WHITE,outlineColor:Cesium.Color.WHITE,showBackground:!0},i.labelsStyle),a),i.distanceLabelsStyle),l)]):[]})),g},t}();Kn.ɵfac=function(e){return new(e||Kn)(d.ɵɵdirectiveInject(Sn),d.ɵɵdirectiveInject(D))},Kn.ɵcmp=d.ɵɵdefineComponent({type:Kn,selectors:[["range-and-bearing"]],inputs:{lineEditOptions:"lineEditOptions",labelsStyle:"labelsStyle",distanceLabelsStyle:"distanceLabelsStyle",bearingLabelsStyle:"bearingLabelsStyle",bearingStringFn:"bearingStringFn",distanceStringFn:"distanceStringFn",labelsRenderFn:"labelsRenderFn"},features:[d.ɵɵProvidersFeature([Sn])],decls:1,vars:0,template:function(e,t){1&e&&d.ɵɵelement(0,"polylines-editor")},directives:[An],encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Kn,[{type:t.Component,args:[{selector:"range-and-bearing",template:"\n    <polylines-editor></polylines-editor>\n  ",changeDetection:t.ChangeDetectionStrategy.OnPush,providers:[Sn]}]}],(function(){return[{type:Sn},{type:D}]}),{lineEditOptions:[{type:t.Input}],labelsStyle:[{type:t.Input}],distanceLabelsStyle:[{type:t.Input}],bearingLabelsStyle:[{type:t.Input}],bearingStringFn:[{type:t.Input}],distanceStringFn:[{type:t.Input}],labelsRenderFn:[{type:t.Input}]}),e.MouseButtons=void 0,(Wn=e.MouseButtons||(e.MouseButtons={}))[Wn.LEFT=0]="LEFT",Wn[Wn.MIDDLE=1]="MIDDLE",Wn[Wn.RIGHT=2]="RIGHT";var $n=function(){function t(t,i,n){this.mapsManager=t,this.mapsZoomElements=new Map,this.defaultOptions={animationDurationInSeconds:.5,resetKeyCode:27,borderStyle:"2px solid rgba(0,0,0,0.5)",backgroundColor:"rgba(0,0,0,0.2)",autoDisableOnZoom:!0,threshold:9,keepRotation:!0,mouseButton:e.MouseButtons.LEFT}}return t.prototype.init=function(e,t){this.cameraService=t,this.cesiumService=e},t.prototype.activate=function(e,t){var i=this;if(void 0===e&&(e={}),!(this.cameraService&&this.cesiumService||t))throw new Error("The function must receive a mapId if the service wasn't initialized");var n,o,r=Object.assign({},this.defaultOptions,e),s=this.cameraService;if(this.cesiumService&&(n=this.cesiumService.getViewer().container,o=this.cesiumService.getMap()),t){if(!(o=this.mapsManager.getMap(t)))throw new Error("Map not found with id: "+t);s=o.getCameraService(),n=o.getCesiumViewer().container}if(!s||!n)throw new Error("The function must receive a mapId if the service wasn't initialized");this.disable(t);var a=document.createElement("div");n.style.position="relative",a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.top="0",a.style.left="0",n.appendChild(a);var c={container:a};this.mapsZoomElements.set(t||this.cesiumService.getMap().getId(),c);var l,p={endX:0,endY:0,startX:0,startY:0};a.onmousedown=function(t){if(t.button===r.mouseButton&&!l){e&&e.onStart&&e.onStart(o);var i=t.currentTarget.getBoundingClientRect(),n=t.clientX-i.left,s=t.clientY-i.top;p.startX=n,p.startY=s,(l=document.createElement("div")).className="zoom-to-rectangle-border",l.style.position="absolute",l.style.border=r.borderStyle,l.style.backgroundColor=r.backgroundColor,l.style.left=p.startX+"px",l.style.top=p.startY+"px",a.appendChild(l),c.borderElement=l}},a.onmouseup=function(e){if(l){var n=void 0;p&&Math.abs(p.endX-p.startX)*Math.abs(p.endY-p.startY)>r.threshold&&(n=i.zoomCameraToRectangle(s,p,r.animationDurationInSeconds,r)),l.remove(),l=void 0,c.borderElement=void 0,p={endX:0,endY:0,startX:0,startY:0},r.onComplete&&r.onComplete(o),r.autoDisableOnZoom&&n&&i.disable(t)}},a.onmousemove=function(e){if(l){var t=e.currentTarget.getBoundingClientRect(),i=e.clientX-t.left,n=e.clientY-t.top;p.endX=i,p.endY=n,l.style.width=Math.abs(p.endX-p.startX)+"px",l.style.height=Math.abs(p.endY-p.startY)+"px",l.style.left=Math.min(p.startX,p.endX)+"px",l.style.top=Math.min(p.startY,p.endY)+"px"}};var d=function(e){e.keyCode===r.resetKeyCode&&l&&(l.remove(),l=void 0,c.borderElement=void 0,p={endX:0,endY:0,startX:0,startY:0})};document.addEventListener("keydown",d),c.resetOnEscapePressFunc=d},t.prototype.disable=function(e){if(!this.cesiumService&&!e)throw new Error("If the service was not initialized with CesiumService, mapId must be provided");var t=this.mapsZoomElements.get(e||this.cesiumService.getMap().getId());t&&(t.container.remove(),t.borderElement&&t.borderElement.remove(),t.resetOnEscapePressFunc&&document.removeEventListener("keydown",t.resetOnEscapePressFunc)),this.mapsZoomElements.delete(e)},t.prototype.zoomCameraToRectangle=function(e,t,i,n){var o=e.getCamera(),r=o.pickEllipsoid({x:t.startX,y:t.startY}),s=o.pickEllipsoid({x:t.endX,y:t.endY});if(!r||!s)return!1;var a=Cesium.Cartographic.fromCartesian(r),c=Cesium.Cartographic.fromCartesian(s);return e.cameraFlyTo({destination:new Cesium.Rectangle(Math.min(a.longitude,c.longitude),Math.min(a.latitude,c.latitude),Math.max(a.longitude,c.longitude),Math.max(a.latitude,c.latitude)),orientation:n.keepRotation?{heading:o.heading}:void 0,duration:i}),!0},t}();$n.ɵfac=function(e){return new(e||$n)(d.ɵɵinject(le),d.ɵɵinject(C,8),d.ɵɵinject(b,8))},$n.ɵprov=d.ɵɵdefineInjectable({token:$n,factory:$n.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata($n,[{type:t.Injectable}],(function(){return[{type:le},{type:C,decorators:[{type:t.Optional}]},{type:b,decorators:[{type:t.Optional}]}]}),null);var Qn=function(){function e(){this.rectangles=new Map}return e.prototype.createEditableRectangle=function(e,t,i,n,o,r){var s=new yn(e,i,t,n,o,r);this.rectangles.set(e,s)},e.prototype.dispose=function(e){this.rectangles.get(e).dispose(),this.rectangles.delete(e)},e.prototype.get=function(e){return this.rectangles.get(e)},e.prototype.clear=function(){this.rectangles.forEach((function(e){return e.dispose()})),this.rectangles.clear()},e}();Qn.ɵfac=function(e){return new(e||Qn)},Qn.ɵprov=d.ɵɵdefineInjectable({token:Qn,factory:Qn.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Qn,[{type:t.Injectable}],null,null);var Yn={addPointEvent:e.CesiumEvent.LEFT_CLICK,dragPointEvent:e.CesiumEvent.LEFT_CLICK_DRAG,dragShapeEvent:e.CesiumEvent.LEFT_CLICK_DRAG,allowDrag:!0,pointProps:{color:Cesium.Color.WHITE,outlineColor:Cesium.Color.BLACK.withAlpha(.2),outlineWidth:1,pixelSize:13,virtualPointPixelSize:8,show:!0,showVirtual:!0,disableDepthTestDistance:Number.POSITIVE_INFINITY},rectangleProps:{height:0,extrudedHeight:0,material:Cesium.Color.CORNFLOWERBLUE.withAlpha(.4),fill:!0,classificationType:Cesium.ClassificationType.BOTH,outline:!0,outlineColor:Cesium.Color.WHITE,zIndex:0},clampHeightTo3D:!1,clampHeightTo3DOptions:{clampToTerrain:!1}},qn=function(){function t(){this.updateSubject=new r.Subject,this.updatePublisher=o.publish()(this.updateSubject),this.observablesMap=new Map}return t.prototype.init=function(e,t,i,n,o){this.mapEventsManager=e,this.coordinateConverter=t,this.cameraService=i,this.rectanglesManager=n,this.updatePublisher.connect(),this.cesiumScene=o.getScene()},t.prototype.onUpdate=function(){return this.updatePublisher},t.prototype.create=function(t,i){var n=this;void 0===t&&(t=Yn),void 0===i&&(i=100);var o=[],s=xi(),a=this.setOptions(t),c=new r.BehaviorSubject({id:s,editAction:null,editMode:e.EditModes.CREATE}),l=!1;this.updateSubject.next({id:s,positions:o,editMode:e.EditModes.CREATE,editAction:e.EditActions.INIT,rectangleOptions:a});var p=function(){var t={id:s,editMode:e.EditModes.CREATE,editAction:e.EditActions.CHANGE_TO_EDIT};return n.updateSubject.next(t),c.next(t),n.observablesMap.has(s)&&n.observablesMap.get(s).forEach((function(e){return e.dispose()})),n.observablesMap.delete(s),n.editRectangle(s,o,i,c,a,h),l=!0},d=this.mapEventsManager.register({event:e.CesiumEvent.MOUSE_MOVE,pick:e.PickOptions.NO_PICK,pickConfig:t.pickConfiguration,priority:i}),u=this.mapEventsManager.register({event:a.addPointEvent,pick:e.PickOptions.NO_PICK,pickConfig:t.pickConfiguration,priority:i});this.observablesMap.set(s,[d,u]);var h=this.createEditorObservable(c,s,p);return d.subscribe((function(t){var i=t.movement.endPosition,o=n.coordinateConverter.screenToCartesian3(i);o&&n.updateSubject.next({id:s,positions:n.getPositions(s),editMode:e.EditModes.CREATE,updatedPosition:o,editAction:e.EditActions.MOUSE_MOVE})})),u.subscribe((function(t){var i=t.movement.endPosition;if(!l){var o=n.coordinateConverter.screenToCartesian3(i);if(o){var r=n.getPositions(s),a=0===n.getPositions(s).length,d={id:s,positions:r,editMode:e.EditModes.CREATE,updatedPosition:o,editAction:e.EditActions.ADD_POINT};n.updateSubject.next(d),c.next(Object.assign(Object.assign({},d),{positions:n.getPositions(s),points:n.getPoints(s)})),a||(l=p())}}})),h},t.prototype.edit=function(t,i,n){if(void 0===i&&(i=Yn),void 0===n&&(n=100),2!==t.length)throw new Error("Rectangles editor error edit(): rectangle should have at least 2 positions");var o=xi(),s=this.setOptions(i),a=new r.BehaviorSubject({id:o,editAction:null,editMode:e.EditModes.EDIT}),c={id:o,positions:t,editMode:e.EditModes.EDIT,editAction:e.EditActions.INIT,rectangleOptions:s};return this.updateSubject.next(c),a.next(Object.assign(Object.assign({},c),{positions:this.getPositions(o),points:this.getPoints(o)})),this.editRectangle(o,t,n,a,s)},t.prototype.editRectangle=function(t,i,n,r,s,a){var c,l=this,p=this.mapEventsManager.register({event:s.dragPointEvent,entityType:Ai,pick:e.PickOptions.PICK_FIRST,pickConfig:s.pickConfiguration,priority:n,pickFilter:function(e){return t===e.editedEntityId}});s.allowDrag&&(c=this.mapEventsManager.register({event:s.dragShapeEvent,entityType:yn,pick:e.PickOptions.PICK_FIRST,pickConfig:s.pickConfiguration,priority:n,pickFilter:function(e){return t===e.id}})),p.pipe(o.tap((function(e){var i=e.movement.drop;return l.rectanglesManager.get(t).enableEdit&&l.cameraService.enableInputs(i)}))).subscribe((function(i){var n=i.movement,o=n.endPosition,s=n.drop,a=i.entities,c=l.coordinateConverter.screenToCartesian3(o);if(c){var p=a[0],d={id:t,positions:l.getPositions(t),editMode:e.EditModes.EDIT,updatedPosition:c,updatedPoint:p,editAction:s?e.EditActions.DRAG_POINT_FINISH:e.EditActions.DRAG_POINT};l.updateSubject.next(d),r.next(Object.assign(Object.assign({},d),{positions:l.getPositions(t),points:l.getPoints(t)}))}})),c&&c.pipe(o.tap((function(e){var i=e.movement.drop;return l.rectanglesManager.get(t).enableEdit&&l.cameraService.enableInputs(i)}))).subscribe((function(i){var n=i.movement,o=n.startPosition,s=n.endPosition,a=n.drop,c=(i.entities,l.coordinateConverter.screenToCartesian3(s)),p=l.coordinateConverter.screenToCartesian3(o);if(c){var d={id:t,positions:l.getPositions(t),editMode:e.EditModes.EDIT,updatedPosition:c,draggedPosition:p,editAction:a?e.EditActions.DRAG_SHAPE_FINISH:e.EditActions.DRAG_SHAPE};l.updateSubject.next(d),r.next(Object.assign(Object.assign({},d),{positions:l.getPositions(t),points:l.getPoints(t)}))}}));var d=[p];return c&&d.push(c),this.observablesMap.set(t,d),a||this.createEditorObservable(r,t)},t.prototype.setOptions=function(e){var t=JSON.parse(JSON.stringify(Yn)),i=Object.assign(t,e);if(i.pointProps=Object.assign({},Yn.pointProps,e.pointProps),i.rectangleProps=Object.assign({},Yn.rectangleProps,e.rectangleProps),e.clampHeightTo3D){if(!this.cesiumScene.pickPositionSupported||!this.cesiumScene.clampToHeightSupported)throw new Error("Cesium pickPosition and clampToHeight must be supported to use clampHeightTo3D");this.cesiumScene.pickTranslucentDepth&&console.warn("Cesium scene.pickTranslucentDepth must be false in order to make the editors work properly on 3D"),1!==i.pointProps.color.alpha&&1!==i.pointProps.outlineColor.alpha||console.warn("Point color and outline color must have alpha in order to make the editor work properly on 3D"),i.pointProps.heightReference=i.clampHeightTo3DOptions.clampToTerrain?Cesium.HeightReference.CLAMP_TO_GROUND:Cesium.HeightReference.RELATIVE_TO_GROUND,i.pointProps.disableDepthTestDistance=Number.POSITIVE_INFINITY}return i},t.prototype.createEditorObservable=function(t,i,n){var o=this;return t.dispose=function(){var t=o.observablesMap.get(i);t&&t.forEach((function(e){return e.dispose()})),o.observablesMap.delete(i),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.DISPOSE})},t.enable=function(){o.updateSubject.next({id:i,positions:o.getPositions(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.ENABLE})},t.disable=function(){o.updateSubject.next({id:i,positions:o.getPositions(i),editMode:e.EditModes.EDIT,editAction:e.EditActions.DISABLE})},t.setManually=function(t,n,r,s){var a=new Ai(i,t,r||Yn.pointProps),c=new Ai(i,n,s||Yn.pointProps);o.rectanglesManager.get(i).setPointsManually([a,c]),o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_MANUALLY})},t.setLabelsRenderFn=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK,labelsRenderFn:t})},t.updateLabels=function(t){o.updateSubject.next({id:i,editMode:e.EditModes.CREATE_OR_EDIT,editAction:e.EditActions.UPDATE_EDIT_LABELS,updateLabels:t})},t.finishCreation=function(){if(!n)throw new Error("Rectangles editor error edit(): cannot call finishCreation() on edit");return n()},t.getCurrentPoints=function(){return o.getPoints(i)},t.getEditValue=function(){return t.getValue()},t.getLabels=function(){return o.rectanglesManager.get(i).labels},t},t.prototype.getPositions=function(e){return this.rectanglesManager.get(e).getRealPositions()},t.prototype.getPoints=function(e){return this.rectanglesManager.get(e).getRealPoints()},t}();qn.ɵfac=function(e){return new(e||qn)},qn.ɵprov=d.ɵɵdefineInjectable({token:qn,factory:qn.ɵfac}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(qn,[{type:t.Injectable}],null,null);var Zn=["editRectanglesLayer"],Xn=["editPointsLayer"],Jn=function(){function t(e,t,i,n,o,s){this.rectanglesEditor=e,this.coordinateConverter=t,this.mapEventsManager=i,this.cameraService=n,this.rectanglesManager=o,this.cesiumService=s,this.Cesium=Cesium,this.editPoints$=new r.Subject,this.editRectangles$=new r.Subject,this.rectanglesEditor.init(this.mapEventsManager,this.coordinateConverter,this.cameraService,this.rectanglesManager,this.cesiumService),this.startListeningToEditorUpdates()}return t.prototype.startListeningToEditorUpdates=function(){var t=this;this.editorUpdatesSubscription=this.rectanglesEditor.onUpdate().subscribe((function(i){i.editMode===e.EditModes.CREATE||i.editMode===e.EditModes.CREATE_OR_EDIT?t.handleCreateUpdates(i):i.editMode===e.EditModes.EDIT&&t.handleEditUpdates(i)}))},t.prototype.getLabelId=function(e,t){return t.toString()},t.prototype.renderEditLabels=function(e,t,i){if(t.positions=e.getRealPositions(),t.points=e.getRealPoints(),i)return e.labels=i,void this.editRectanglesLayer.update(e,e.getId());this.editLabelsRenderFn&&(e.labels=this.editLabelsRenderFn(t,e.labels),this.editRectanglesLayer.update(e,e.getId()))},t.prototype.removeEditLabels=function(e){e.labels=[],this.editRectanglesLayer.update(e,e.getId())},t.prototype.handleCreateUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.rectanglesManager.createEditableRectangle(t.id,this.editRectanglesLayer,this.editPointsLayer,this.coordinateConverter,t.rectangleOptions);break;case e.EditActions.MOUSE_MOVE:var i=this.rectanglesManager.get(t.id);t.updatedPosition&&(i.moveTempMovingPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.ADD_POINT:i=this.rectanglesManager.get(t.id);t.updatedPosition&&(i.moveTempMovingPoint(t.updatedPosition),i.addPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.ADD_LAST_POINT:i=this.rectanglesManager.get(t.id);t.updatedPosition&&(i.addLastPoint(t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DISPOSE:(i=this.rectanglesManager.get(t.id))&&(i.dispose(),this.removeEditLabels(i)),this.editLabelsRenderFn=void 0;break;case e.EditActions.SET_EDIT_LABELS_RENDER_CALLBACK:i=this.rectanglesManager.get(t.id);this.editLabelsRenderFn=t.labelsRenderFn,this.renderEditLabels(i,t);break;case e.EditActions.UPDATE_EDIT_LABELS:i=this.rectanglesManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;case e.EditActions.SET_MANUALLY:i=this.rectanglesManager.get(t.id);this.renderEditLabels(i,t,t.updateLabels);break;default:return}},t.prototype.handleEditUpdates=function(t){switch(t.editAction){case e.EditActions.INIT:this.rectanglesManager.createEditableRectangle(t.id,this.editRectanglesLayer,this.editPointsLayer,this.coordinateConverter,t.rectangleOptions,t.positions);break;case e.EditActions.DRAG_POINT:(i=this.rectanglesManager.get(t.id))&&i.enableEdit&&(i.movePoint(t.updatedPosition,t.updatedPoint),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_POINT_FINISH:(i=this.rectanglesManager.get(t.id))&&i.enableEdit&&(i.endMovePoint(),this.renderEditLabels(i,t));break;case e.EditActions.DISABLE:(i=this.rectanglesManager.get(t.id))&&(i.enableEdit=!1,this.renderEditLabels(i,t));break;case e.EditActions.ENABLE:(i=this.rectanglesManager.get(t.id))&&(i.enableEdit=!0,this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE:(i=this.rectanglesManager.get(t.id))&&i.enableEdit&&(i.moveShape(t.draggedPosition,t.updatedPosition),this.renderEditLabels(i,t));break;case e.EditActions.DRAG_SHAPE_FINISH:var i;(i=this.rectanglesManager.get(t.id))&&i.enableEdit&&(i.endMoveShape(),this.renderEditLabels(i,t));break;default:return}},t.prototype.ngOnDestroy=function(){this.editorUpdatesSubscription.unsubscribe(),this.rectanglesManager.clear()},t.prototype.getPointSize=function(e){return e.isVirtualEditPoint()?e.props.virtualPointPixelSize:e.props.pixelSize},t.prototype.getPointShow=function(e){return e.show&&(e.isVirtualEditPoint()?e.props.showVirtual:e.props.show)},t}();Jn.ɵfac=function(e){return new(e||Jn)(d.ɵɵdirectiveInject(qn),d.ɵɵdirectiveInject(D),d.ɵɵdirectiveInject(se),d.ɵɵdirectiveInject(C),d.ɵɵdirectiveInject(Qn),d.ɵɵdirectiveInject(b))},Jn.ɵcmp=d.ɵɵdefineComponent({type:Jn,selectors:[["rectangles-editor"]],viewQuery:function(e,t){if(1&e&&(d.ɵɵviewQuery(Zn,5),d.ɵɵviewQuery(Xn,5)),2&e){var i=void 0;d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editRectanglesLayer=i.first),d.ɵɵqueryRefresh(i=d.ɵɵloadQuery())&&(t.editPointsLayer=i.first)}},features:[d.ɵɵProvidersFeature([D,Qn])],decls:8,vars:3,consts:[["acFor","let point of editPoints$",3,"context"],["editPointsLayer",""],["props","{\n        position: point.getPositionCallbackProperty(),\n        pixelSize: getPointSize(point),\n        color: point.props.color,\n        outlineColor: point.props.outlineColor,\n        outlineWidth: point.props.outlineWidth,\n        show: getPointShow(point),\n        disableDepthTestDistance: point.props.disableDepthTestDistance,\n        heightReference: point.props.heightReference,\n    }"],["acFor","let rectangle of editRectangles$",3,"context"],["editRectanglesLayer",""],["props","{\n          coordinates: rectangle.getRectangleCallbackProperty(),\n          material: rectangle.rectangleProps.material,\n          fill: rectangle.rectangleProps.fill,\n          classificationType: rectangle.rectangleProps.classificationType,\n          zIndex: rectangle.rectangleProps.zIndex,\n          outline: rectangle.rectangleProps.outline,\n          outlineColor: rectangle.rectangleProps.outlineColor,\n          height: rectangle.rectangleProps.height,\n          extrudedHeight: rectangle.rectangleProps.extrudedHeight\n        }"],["acFor","let label of rectangle.labels",3,"idGetter"],["props","{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"]],template:function(e,t){1&e&&(d.ɵɵelementStart(0,"ac-layer",0,1),d.ɵɵelement(2,"ac-point-desc",2),d.ɵɵelementEnd(),d.ɵɵelementStart(3,"ac-layer",3,4),d.ɵɵelement(5,"ac-rectangle-desc",5),d.ɵɵelementStart(6,"ac-array-desc",6),d.ɵɵelement(7,"ac-label-primitive-desc",7),d.ɵɵelementEnd(),d.ɵɵelementEnd()),2&e&&(d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("context",t),d.ɵɵadvance(3),d.ɵɵproperty("idGetter",t.getLabelId))},directives:[tt,Mt,Jt,bi,ti],encapsulation:2,changeDetection:0}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(Jn,[{type:t.Component,args:[{selector:"rectangles-editor",template:'\n    <ac-layer #editPointsLayer acFor="let point of editPoints$" [context]="this">\n      <ac-point-desc\n        props="{\n        position: point.getPositionCallbackProperty(),\n        pixelSize: getPointSize(point),\n        color: point.props.color,\n        outlineColor: point.props.outlineColor,\n        outlineWidth: point.props.outlineWidth,\n        show: getPointShow(point),\n        disableDepthTestDistance: point.props.disableDepthTestDistance,\n        heightReference: point.props.heightReference,\n    }"\n      >\n      </ac-point-desc>\n    </ac-layer>\n\n    <ac-layer #editRectanglesLayer acFor="let rectangle of editRectangles$" [context]="this">\n      <ac-rectangle-desc\n        props="{\n          coordinates: rectangle.getRectangleCallbackProperty(),\n          material: rectangle.rectangleProps.material,\n          fill: rectangle.rectangleProps.fill,\n          classificationType: rectangle.rectangleProps.classificationType,\n          zIndex: rectangle.rectangleProps.zIndex,\n          outline: rectangle.rectangleProps.outline,\n          outlineColor: rectangle.rectangleProps.outlineColor,\n          height: rectangle.rectangleProps.height,\n          extrudedHeight: rectangle.rectangleProps.extrudedHeight\n        }"\n      >\n      </ac-rectangle-desc>\n      <ac-array-desc acFor="let label of rectangle.labels" [idGetter]="getLabelId">\n        <ac-label-primitive-desc\n          props="{\n            position: label.position,\n            backgroundColor: label.backgroundColor,\n            backgroundPadding: label.backgroundPadding,\n            distanceDisplayCondition: label.distanceDisplayCondition,\n            eyeOffset: label.eyeOffset,\n            fillColor: label.fillColor,\n            font: label.font,\n            heightReference: label.heightReference,\n            horizontalOrigin: label.horizontalOrigin,\n            outlineColor: label.outlineColor,\n            outlineWidth: label.outlineWidth,\n            pixelOffset: label.pixelOffset,\n            pixelOffsetScaleByDistance: label.pixelOffsetScaleByDistance,\n            scale: label.scale,\n            scaleByDistance: label.scaleByDistance,\n            show: label.show,\n            showBackground: label.showBackground,\n            style: label.style,\n            text: label.text,\n            translucencyByDistance: label.translucencyByDistance,\n            verticalOrigin: label.verticalOrigin,\n            disableDepthTestDistance: label.disableDepthTestDistance,\n        }"\n        >\n        </ac-label-primitive-desc>\n      </ac-array-desc>\n    </ac-layer>\n  ',providers:[D,Qn],changeDetection:t.ChangeDetectionStrategy.OnPush}]}],(function(){return[{type:qn},{type:D},{type:se},{type:C},{type:Qn},{type:b}]}),{editRectanglesLayer:[{type:t.ViewChild,args:["editRectanglesLayer"]}],editPointsLayer:[{type:t.ViewChild,args:["editPointsLayer"]}]});var eo=function(){};eo.ɵfac=function(e){return new(e||eo)},eo.ɵmod=d.ɵɵdefineNgModule({type:eo}),eo.ɵinj=d.ɵɵdefineInjector({providers:[Nn,$n],imports:[[i.CommonModule,Di]]}),("undefined"==typeof ngDevMode||ngDevMode)&&d.ɵsetClassMetadata(eo,[{type:t.NgModule,args:[{imports:[i.CommonModule,Di],declarations:[Vi,Fn,qi,Jn,sn,hn,An,Hn,Gn,zn,Vn,Kn],exports:[Vi,Fn,qi,Jn,sn,hn,An,Hn,zn,Vn,Kn],providers:[Nn,$n]}]}],null,null),("undefined"==typeof ngJitMode||ngJitMode)&&d.ɵɵsetNgModuleScope(eo,{declarations:[Vi,Fn,qi,Jn,sn,hn,An,Hn,Gn,zn,Vn,Kn],imports:[i.CommonModule,Di],exports:[Vi,Fn,qi,Jn,sn,hn,An,Hn,zn,Vn,Kn]}),e.AcArcComponent=wt,e.AcArcDescComponent=yt,e.AcArrayDescComponent=bi,e.AcBillboardComponent=nt,e.AcBillboardDescComponent=ct,e.AcBillboardPrimitiveDescComponent=ei,e.AcBoxDescComponent=$t,e.AcCircleComponent=Ot,e.AcCircleDescComponent=gt,e.AcCorridorDescComponent=Yt,e.AcCylinderDescComponent=Qt,e.AcCzmlDescComponent=Mi,e.AcDefaultPlonterComponent=xt,e.AcDynamicCircleDescComponent=Ut,e.AcDynamicEllipseDescComponent=Ht,e.AcDynamicPolylineDescComponent=Bt,e.AcEllipseComponent=_t,e.AcEllipseDescComponent=lt,e.AcEllipsoidDescComponent=qt,e.AcEntity=bt,e.AcHtmlComponent=Tt,e.AcHtmlDescComponent=ui,e.AcLabelComponent=It,e.AcLabelDescComponent=ht,e.AcLabelPrimitiveDescComponent=ti,e.AcLayerComponent=tt,e.AcMapComponent=Ae,e.AcMapLayerProviderComponent=Pt,e.AcMapTerrainProviderComponent=Ct,e.AcModelDescComponent=Wt,e.AcNotification=Et,e.AcPointComponent=St,e.AcPointDescComponent=Mt,e.AcPointPrimitiveDescComponent=Ei,e.AcPolygonComponent=kt,e.AcPolygonDescComponent=At,e.AcPolylineComponent=Dt,e.AcPolylineDescComponent=pt,e.AcPolylinePrimitiveDescComponent=ii,e.AcPolylineVolumeDescComponent=Zt,e.AcPrimitivePolylineComponent=Pi,e.AcRectangleComponent=Ii,e.AcRectangleDescComponent=Jt,e.AcStaticCircleDescComponent=Gt,e.AcStaticEllipseDescComponent=Nt,e.AcStaticPolygonDescComponent=Vt,e.AcStaticPolylineDescComponent=zt,e.AcTileset3dComponent=Kt,e.AcToolbarButtonComponent=Vn,e.AcToolbarComponent=zn,e.AcWallDescComponent=Xt,e.AngularCesiumModule=Di,e.AngularCesiumWidgetsModule=eo,e.CameraService=C,e.CesiumService=b,e.CircleEditorObservable=Cn,e.CirclesEditorComponent=sn,e.CirclesEditorService=tn,e.ContextMenuService=M,e.CoordinateConverter=D,e.DEFAULT_CIRCLE_OPTIONS=en,e.DEFAULT_ELLIPSE_OPTIONS=ln,e.DEFAULT_HIPPODROME_OPTIONS=Rn,e.DEFAULT_POINT_OPTIONS=Fi,e.DEFAULT_POLYGON_OPTIONS=Wi,e.DEFAULT_POLYLINE_OPTIONS=_n,e.DEFAULT_RECTANGLE_OPTIONS=Yn,e.DisposableObservable=Si,e.DraggableToMapDirective=Hn,e.DraggableToMapService=Nn,e.EditArc=Zi,e.EditPoint=Ai,e.EditPolyline=Gi,e.EditableCircle=Xi,e.EditableEllipse=an,e.EditableHippodrome=Dn,e.EditablePoint=Ri,e.EditablePolygon=Ui,e.EditablePolyline=fn,e.EditableRectangle=yn,e.EditorObservable=vn,e.EllipseEditorObservable=Mn,e.EllipsesEditorComponent=hn,e.EllipsesEditorService=pn,e.GeoUtilsService=L,e.HippodromeEditorComponent=Fn,e.HippodromeEditorObservable=In,e.HippodromeEditorService=jn,e.KeyboardControlService=X,e.MapEventsManagerService=se,e.MapsManagerService=le,e.PREDEFINED_KEYBOARD_ACTIONS=Z,e.PixelOffsetPipe=dt,e.PlonterService=oe,e.PointEditorObservable=mn,e.PointsEditorComponent=Vi,e.PointsEditorService=Ni,e.PolygonEditorObservable=En,e.PolygonsEditorComponent=qi,e.PolygonsEditorService=Ki,e.PolylineEditorObservable=bn,e.PolylinesEditorComponent=An,e.PolylinesEditorService=Sn,e.RadiansToDegreesPipe=ut,e.RangeAndBearingComponent=Kn,e.RectangleEditorObservable=Pn,e.RectanglesEditorComponent=Jn,e.RectanglesEditorService=qn,e.ScreenshotService=ce,e.SelectionManagerService=wi,e.ViewerConfiguration=v,e.ZoomToRectangleService=$n,e.defaultLabelProps=Li,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=/sm/f9593af11ab8d672be17e6ced2c3f9412fd9835b9e3d6584c6b842863220cf12.map