@eliorar/angular-cesium
Version:
Angular library for working with Cesium.
1,391 lines (1,329 loc) • 196 kB
TypeScript
import * as i0 from '@angular/core';
import { NgZone, EventEmitter, OnChanges, OnInit, AfterViewInit, OnDestroy, ElementRef, SimpleChanges, AfterContentInit, PipeTransform, DoCheck, Renderer2, ChangeDetectorRef, ViewContainerRef, ComponentFactoryResolver, TemplateRef, ModuleWithProviders } from '@angular/core';
import * as i54 from '@auscope/angular2parse';
import { PipesConfig, Parse } from '@auscope/angular2parse';
import * as Cesium from 'cesium';
import { Cartesian3, Cartographic, CallbackProperty, Cartesian2, PolygonHierarchy, Rectangle } from 'cesium';
import { ConnectableObservable, Observable, Subject, BehaviorSubject } from 'rxjs';
import * as geodesy from 'geodesy';
import { hemisphere } from 'geodesy';
import * as i1 from '@angular/common';
/**
* The interface defines the options object that can be passed to AngularCesiumModule on initialization.
*/
interface ModuleConfiguration {
fixEntitiesShadows?: boolean;
customPipes: PipesConfig[];
}
declare class ViewerFactory {
/**
* Creates a viewer with default or custom options
* @param mapContainer - container to initialize the viewer on
* @param options - Options to create the viewer with - Optional
*
* @returns new viewer
*/
createViewer(mapContainer: HTMLElement, options?: any): any;
static ɵfac: i0.ɵɵFactoryDeclaration<ViewerFactory, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ViewerFactory>;
}
/**
* Service for setting cesium viewer map options.
* defaulty angular-cesium doesnt provide this service and viewer is created with default options.
* In order set specific options you must set this service as provider in your component and
* set the wanted options.
* ```typescript
* constructor(viewerConf :ViewerConfiguration ) {
* viewerConf.viewerOptions = { timeline: false };
* }
* ```
* notice this configuration will be for all <ac-maps> in your component.
*/
declare class ViewerConfiguration {
/**
* cesium viewer options According to [Viewer]{@link https://cesiumjs.org/Cesium/Build/Documentation/Viewer.html?classFilter=vie}
*/
private _viewerOptions;
private _viewerModifier;
private nextViewerOptionsIndex;
private nextViewerModifierIndex;
get viewerOptions(): object | object[];
Ï: any;
getNextViewerOptions(): object | object[];
/**
* Can be used to set initial map viewer options.
* If there is more than one map you can give the function an array of options.
* The map initialized first will be set with the first option object in the options array and so on.
*/
set viewerOptions(value: object | object[]);
get viewerModifier(): Function | Function[];
getNextViewerModifier(): Function | Function[];
/**
* Can be used to set map viewer options after the map has been initialized.
* If there is more than one map you can give the function an array of functions.
* The map initialized first will be set with the first option object in the options array and so on.
*/
set viewerModifier(value: Function | Function[]);
static ɵfac: i0.ɵɵFactoryDeclaration<ViewerConfiguration, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ViewerConfiguration>;
}
/**
* Service that initialize cesium viewer and expose cesium viewer and scene.
*/
declare class CesiumService {
private ngZone;
private viewerFactory;
private viewerConfiguration;
private cesiumViewer;
private mapContainer;
constructor(ngZone: NgZone, viewerFactory: ViewerFactory, viewerConfiguration: ViewerConfiguration);
init(mapContainer: HTMLElement): void;
/**
* For more information see https://cesiumjs.org/Cesium/Build/Documentation/Viewer.html?classFilter=viewe
* @returns cesiumViewer
*/
getViewer(): any;
/**
* For more information see https://cesiumjs.org/Cesium/Build/Documentation/Scene.html?classFilter=scene
* @returns cesium scene
*/
getScene(): any;
/**
* For more information see https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
* @returns cesium canvas
*/
getCanvas(): HTMLCanvasElement;
getMapContainer(): HTMLElement;
static ɵfac: i0.ɵɵFactoryDeclaration<CesiumService, [null, null, { optional: true; }]>;
static ɵprov: i0.ɵɵInjectableDeclaration<CesiumService>;
}
/**
* Cesium scene modes
*/
declare enum SceneMode {
SCENE3D = 0,
COLUMBUS_VIEW = 1,
SCENE2D = 2,
PERFORMANCE_SCENE2D = 3
}
/**
* The service exposes the scene's camera and screenSpaceCameraController
* SceneMode.PERFORMANCE_SCENE2D - is a 3D scene mode that acts like Cesium 2D mode,
* but is more efficient performance wise.
*/
declare class CameraService {
static PERFORMANCE_2D_ALTITUDE: number;
private viewer;
private scene;
private camera;
private screenSpaceCameraController;
private morphListenerCancelFn;
private lastRotate;
private lastTilt;
private lastLook;
private isSceneModePerformance2D;
constructor();
init(cesiumService: CesiumService): void;
_listenToSceneModeMorph(callback: Function): void;
_revertCameraProperties(): void;
/**
* Gets the scene's camera
*/
getCamera(): any;
/**
* Gets the scene's screenSpaceCameraController
*/
getScreenSpaceCameraController(): any;
/**
* Gets the minimum zoom value in meters
*/
getMinimumZoom(): number;
/**
* Sets the minimum zoom value in meters
* @param zoom amount
*/
setMinimumZoom(amount: number): void;
/**
* Gets the maximum zoom value in meters
*/
getMaximumZoom(): number;
/**
* Sets the maximum zoom value in meters
* @param zoom amount
*/
setMaximumZoom(amount: number): void;
/**
* Sets if the camera is able to tilt
*/
enableTilt(tilt: boolean): void;
/**
* Sets if the camera is able to rotate
*/
enableRotate(rotate: boolean): void;
/**
* Sets if the camera is able to free-look
*/
enableLook(lock: boolean): void;
/**
* Sets if the camera is able to translate
*/
enableTranslate(translate: boolean): void;
/**
* Sets if the camera is able to zoom
*/
enableZoom(zoom: boolean): void;
/**
* Sets if the camera receives inputs
*/
enableInputs(inputs: boolean): void;
/**
* Sets the map's SceneMode
* @param sceneMode - The SceneMode to morph the scene into.
* @param duration - The duration of scene morph animations, in seconds
*/
setSceneMode(sceneMode: SceneMode, duration?: number): void;
/**
* Flies the camera to a destination
* API: https://cesiumjs.org/Cesium/Build/Documentation/Camera.html?classFilter=cam#flyTo
*/
cameraFlyTo(options: any): any;
/**
* Flies the camera to a target
* API: https://cesiumjs.org/Cesium/Build/Documentation/Viewer.html?classFilter=viewer#flyTo
* @returns Promise<boolean>
*/
flyTo(target: any, options?: any): any;
/**
* Zooms amount along the camera's view vector.
* API: https://cesiumjs.org/Cesium/Build/Documentation/Camera.html#zoomIn
*/
zoomIn(amount: number): any;
/**
* Zooms amount along the opposite direction of the camera's view vector.
* API: https://cesiumjs.org/Cesium/Build/Documentation/Camera.html#zoomOut
*/
zoomOut(amount: number): any;
/**
* Zoom the camera to a target
* API: https://cesiumjs.org/Cesium/Build/Documentation/Viewer.html?classFilter=viewer#zoomTo
* @returns Promise<boolean>
*/
zoomTo(target: any, offset?: any): any;
/**
* Flies the camera to a destination
* API: https://cesiumjs.org/Cesium/Build/Documentation/Camera.html?classFilter=camera#setView
* @param options viewer options
*/
setView(options: any): void;
/**
* Set camera's rotation
*/
setRotation(degreesInRadians: number): void;
/**
* Locks or unlocks camera rotation
*/
lockRotation(lock: boolean): void;
/**
* Make the camera track a specific entity
* API: https://cesiumjs.org/Cesium/Build/Documentation/Viewer.html?classFilter=viewer#trackedEntity
* @param cesiumEntity - cesium entity( billboard, polygon...) to track
* @param options - track entity options
*/
trackEntity(cesiumEntity?: any, options?: {
flyTo: boolean;
flyToDuration?: number;
altitude?: number;
}): Promise<void>;
untrackEntity(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<CameraService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CameraService>;
}
/**
* Interface of context menu options that can be passed when opening a context menu.
*/
interface ContextMenuOptions<D = any> {
data?: D;
closeOnLeftCLick?: boolean;
closeOnLeftClickPriority?: number;
}
/**
* Event options for registration on map-event-manager.
*/
declare enum CesiumEvent {
MOUSE_MOVE = 15,
LEFT_CLICK = 2,
LEFT_DOUBLE_CLICK = 3,
LEFT_DOWN = 0,
LEFT_UP = 1,
MIDDLE_CLICK = 12,
MIDDLE_DOWN = 10,
MIDDLE_UP = 11,
PINCH_START = 17,
PINCH_END = 18,
PINCH_MOVE = 19,
RIGHT_CLICK = 7,
RIGHT_DOWN = 5,
RIGHT_UP = 6,
WHEEL = 16,
LONG_LEFT_PRESS = 110,
LONG_RIGHT_PRESS = 111,
LONG_MIDDLE_PRESS = 112,
LEFT_CLICK_DRAG = 113,
RIGHT_CLICK_DRAG = 114,
MIDDLE_CLICK_DRAG = 115
}
/**
* EventModifier options for registration on map-event-manager.
*/
declare enum CesiumEventModifier {
ALT = 2,
CTRL = 1,
SHIFT = 0
}
declare class CesiumEventBuilder {
private cesiumService;
constructor(cesiumService: CesiumService);
static longPressEvents: Set<CesiumEvent>;
private eventsHandler;
private cesiumEventsObservables;
static getEventFullName(event: CesiumEvent, modifier?: CesiumEventModifier): string;
init(): void;
get(event: CesiumEvent, modifier?: CesiumEventModifier): ConnectableObservable<any>;
private createCesiumEventObservable;
private createSpecialCesiumEventObservable;
static ɵfac: i0.ɵɵFactoryDeclaration<CesiumEventBuilder, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CesiumEventBuilder>;
}
/**
* NO_PICK, - will not pick entities
* PICK_FIRST - first entity will be picked . use Cesium.scene.pick()
* PICK_ONE - in case a few entities are picked plonter is resolved . use Cesium.scene.drillPick()
* PICK_ALL - all entities are picked. use Cesium.scene.drillPick()
*/
declare enum PickOptions {
NO_PICK = 0,
PICK_FIRST = 1,
PICK_ONE = 2,
PICK_ALL = 3
}
interface PickConfiguration {
pickHeight?: number;
pickWidth?: number;
drillPickLimit?: number;
}
/**
* Interface for Event Registration Input
* __usage:__
* ```
* MapEventsManagerService.register(eventRegistrationInput).subscribe()
* ```
*/
interface EventRegistrationInput {
event: CesiumEvent;
modifier?: CesiumEventModifier;
entityType?: any;
priority?: number;
pick?: PickOptions;
pickFilter?: (any: any) => boolean;
pickConfig?: PickConfiguration;
}
declare class DisposableObservable<T> extends Observable<T> {
dispose: Function;
}
/**
* Angular Cesium parent entity, all entities should inherit from it.
* ```typescript
* entity= new AcEntity({
* id: 0,
* name: 'click me',
* position: Cartesian3.fromRadians(0.5, 0.5),
* });
* ```
*/
declare class AcEntity {
/**
* Creates entity from a json
* @param json entity object
* @returns entity as AcEntity
*/
static create(json?: any): any;
/**
* Creates entity from a json
* @param json (Optional) entity object
*/
constructor(json?: any);
}
/**
* Service for solving plonter.
* Used by map-event-manager and plonter context component
*/
declare class PlonterService {
private _plonterShown;
private _entitesToPlonter;
private _plonterObserver;
private _eventResult;
private _plonterChangeNotifier;
constructor();
get plonterChangeNotifier(): EventEmitter<any>;
get plonterShown(): boolean;
get entitesToPlonter(): AcEntity[];
get plonterClickPosition(): Movement;
plonterIt(eventResult: EventResult): Subject<EventResult>;
resolvePlonter(entity: AcEntity): void;
static ɵfac: i0.ɵɵFactoryDeclaration<PlonterService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PlonterService>;
}
/**
* Returns screen position, drag boolean for drag events only
*/
interface Movement {
startPosition: {
x: number;
y: number;
};
endPosition: {
x: number;
y: number;
};
drop?: boolean;
}
interface EventResult {
movement: Movement;
cesiumEntities: any[];
entities: any[];
}
/**
* Manages all map events. Notice events will run outside of Angular zone.
* Provided by `<ac-map/>` component there for could be injected at any component under `<ac-map/>` hierarchy
* or from the `<ac-map/>` component reference `acMapComponent.getMapEventsManager()`
*
* __usage:__
* ```
* MapEventsManagerService.register({event, modifier, priority, entityType, pickOption}).subscribe()
* ```
* __param:__ {CesiumEvent} event
* __param:__ {CesiumEventModifier} modifier
* __param:__ priority - the bigger the number the bigger the priority. default : 0.
* __param:__ entityType - entity type class that you are interested like (Track). the class must extends AcEntity
* __param:__ pickOption - self explained
*/
declare class MapEventsManagerService {
private cesiumService;
private eventBuilder;
private plonterService;
private scene;
private eventRegistrations;
constructor(cesiumService: CesiumService, eventBuilder: CesiumEventBuilder, plonterService: PlonterService);
init(): void;
/**
* Register to map event
* @param input Event Registration Input
*
* @returns DisposableObservable<EventResult>
*/
register(input: EventRegistrationInput): DisposableObservable<EventResult>;
private disposeObservable;
private sortRegistrationsByPriority;
private createEventRegistration;
private createDragEvent;
private triggerPick;
private addEntities;
private plonter;
static ɵfac: i0.ɵɵFactoryDeclaration<MapEventsManagerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<MapEventsManagerService>;
}
/**
* The basic context menu class. All context menu components should extend this class.
*/
interface BasicContextMenu {
data: any;
}
/**
* The Service manages a singleton context menu over the map. It should be initialized with MapEventsManager.
* The Service allows opening and closing of the context menu and passing data to the context menu inner component.
*
* notice, `data` will be injected to your custom menu component into the `data` field in the component.
* __Usage :__
* ```
* ngOnInit() {
* this.clickEvent$ = this.eventsManager.register({ event: CesiumEvent.RIGHT_CLICK, pick: PickOptions.PICK_ONE });
* this.clickEvent$.subscribe(result => {
* if (result.entities) {
* const pickedMarker = result.entities[0];
* this.contextMenuService.open(MapContextmenuComponent, pickedMarker.position, {
* data: {
* myData: data,
* onDelete: () => this.delete(pickedMarker.id)
* }
* });
* }
* });
* }
*
*
* private delete(id) {
* this.mapMenu.close();
* this.detailedSiteService.removeMarker(id);
* }
* ```
*/
declare class ContextMenuService {
private _showContextMenu;
private _options;
private _position;
private _content;
private mapEventsManager;
private leftClickRegistration;
private leftClickSubscription;
private _contextMenuChangeNotifier;
private _onOpen;
private _onClose;
private _defaultContextMenuOptions;
get contextMenuChangeNotifier(): EventEmitter<any>;
get showContextMenu(): boolean;
get options(): ContextMenuOptions;
get position(): Cartesian3;
get content(): BasicContextMenu;
get onOpen(): EventEmitter<any>;
get onClose(): EventEmitter<any>;
init(mapEventsManager: MapEventsManagerService): void;
open<D>(contentComponent: any, position: Cartesian3, options?: ContextMenuOptions<D>): void;
close(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ContextMenuService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ContextMenuService>;
}
/**
* Given different types of coordinates, we provide you a service converting those types to the most common other types.
* We are using the geodesy implementation of UTM conversion. see: https://github.com/chrisveness/geodesy.
*
* @example
* import { Component, OnInit } from '@angular/core';
* import { CoordinateConverter } from 'angular2-cesium';
*
* @Component({
* selector:'my-component',
* template:'<div>{{showCartographic}}</div>',
* providers:[CoordinateConverter]
* })
* export class MyComponent implements OnInit {
* showCartographic;
*
* constructor(private coordinateConverter:CoordinateConverter){
* }
*
* ngOnInit(){
* this.showCartographic = this.coordinateConverter.degreesToCartographic(5, 5, 5);
* }
* }
*
*/
declare class CoordinateConverter {
private cesiumService?;
constructor(cesiumService?: CesiumService);
static cartesian3ToLatLon(cartesian3: Cartesian3, ellipsoid?: any): {
lon: number;
lat: number;
height: number;
};
screenToCartesian3(screenPos: {
x: number;
y: number;
}, addMapCanvasBoundsToPos?: boolean): any;
screenToCartographic(screenPos: {
x: number;
y: number;
}, ellipsoid?: any): Cartographic;
cartesian3ToCartographic(cartesian: Cartesian3, ellipsoid?: any): Cartographic;
degreesToCartographic(longitude: number, latitude: number, height?: number): Cartographic;
radiansToCartographic(longitude: number, latitude: number, height?: number): Cartographic;
degreesToUTM(longitude: number, latitude: number): geodesy.Utm;
UTMToDegrees(zone: number, hemisphereType: hemisphere, easting: number, northing: number): {
longitude: number;
latitude: number;
height: any;
};
private geodesyToCesiumObject;
/**
* middle point between two points
* @param first (latitude,longitude) in radians
* @param second (latitude,longitude) in radians
*/
midPointToCartesian3(first: {
latitude: number;
longitude: number;
}, second: {
latitude: number;
longitude: number;
}): Cartesian3;
middlePointByScreen(position0: Cartesian3, position1: Cartesian3): Cartesian3;
/**
* initial bearing between two points
*
* * @return bearing in degrees
* @param first - {latitude,longitude} in radians
* @param second - {latitude,longitude} in radians
*/
bearingTo(first: {
latitude: number;
longitude: number;
}, second: {
latitude: number;
longitude: number;
}): number;
/**
* initial bearing between two points
*
* @return bearing in degrees
*/
bearingToCartesian(firstCartesian3: Cartesian3, secondCartesian3: Cartesian3): number;
static ɵfac: i0.ɵɵFactoryDeclaration<CoordinateConverter, [{ optional: true; }]>;
static ɵprov: i0.ɵɵInjectableDeclaration<CoordinateConverter>;
}
/**
* Abstract drawer. All drawers extends this class.
*/
declare abstract class BasicDrawerService {
protected _propsAssigner: Function;
constructor();
abstract add(cesiumProps: any, ...args: any[]): any;
abstract update(primitive: any, cesiumProps: any, ...args: any[]): void;
abstract remove(primitive: any): void;
abstract removeAll(): void;
abstract setShow(showValue: boolean): void;
abstract init(options?: any): any;
setPropsAssigner(assigner: Function): void;
}
/**
* General primitives drawer responsible of drawing Cesium primitives.
* Drawers the handle Cesium primitives extend it.
*/
declare abstract class PrimitivesDrawerService extends BasicDrawerService {
private drawerType;
private cesiumService;
private _show;
private _primitiveCollectionWrap;
protected _cesiumCollection: any;
protected _propsAssigner: Function;
constructor(drawerType: any, cesiumService: CesiumService);
init(): void;
add(cesiumProps: any, ...args: any[]): any;
update(entity: any, cesiumProps: any, ...args: any[]): void;
remove(entity: any): void;
removeAll(): void;
setShow(showValue: boolean): void;
getShow(): boolean;
}
/**
+ This drawer is responsible for drawing an arc over the Cesium map.
+ This implementation uses simple PolylineGeometry and Primitive parameters.
+ This doesn't allow us to change the position, color, etc.. of the arc but setShow only.
*/
declare class ArcDrawerService extends PrimitivesDrawerService {
constructor(cesiumService: CesiumService);
_calculateArcPositions(cesiumProps: any): any[];
_calculateTriangle(cesiumProps: any): any[];
_calculateArc(cesiumProps: any): any[];
add(cesiumProps: any): any;
update(primitive: any, cesiumProps: any): any;
static ɵfac: i0.ɵɵFactoryDeclaration<ArcDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ArcDrawerService>;
}
declare class GraphicsType {
static ellipse: typeof Cesium.EllipseGraphics;
static ellipsoid: typeof Cesium.EllipsoidGraphics;
static polygon: typeof Cesium.PolygonGraphics;
static polyline: typeof Cesium.PolylineGraphics;
static polylineVolume: typeof Cesium.PolylineVolumeGraphics;
static box: typeof Cesium.BoxGraphics;
static corridor: typeof Cesium.CorridorGraphics;
static cylinder: typeof Cesium.CylinderGraphics;
static label: typeof Cesium.LabelGraphics;
static billboard: typeof Cesium.BillboardGraphics;
static model: typeof Cesium.ModelGraphics;
static path: typeof Cesium.PathGraphics;
static point: typeof Cesium.PointGraphics;
static rectangle: typeof Cesium.RectangleGraphics;
static wall: typeof Cesium.WallGraphics;
}
interface EntitiesDrawerOptions {
collectionSuspensionTime: number;
collectionsNumber: number;
collectionMaxSize: number;
}
/**
* General primitives drawer responsible of drawing Cesium primitives.
* Drawers the handle Cesium primitives extend it.
*/
declare class EntitiesDrawerService extends BasicDrawerService {
private cesiumService;
private graphicsType;
private defaultOptions;
private entityCollections;
private graphicsTypeName;
constructor(cesiumService: CesiumService, graphicsType: GraphicsType, defaultOptions?: EntitiesDrawerOptions);
private getFreeEntitiesCollection;
init(options?: EntitiesDrawerOptions): any[];
add(cesiumProps: any): any;
update(entity: any, cesiumProps: any): void;
remove(entity: any): void;
removeAll(): void;
setShow(showValue: boolean): void;
private suspendEntityCollection;
}
/**
* This drawer is responsible for drawing billboards.
*/
declare class BillboardDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<BillboardDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<BillboardDrawerService>;
}
/**
* This drawer is responsible for drawing czml dataSources.
*/
declare class CzmlDrawerService extends BasicDrawerService {
private cesiumService;
czmlStream: any;
constructor(cesiumService: CesiumService);
init(options?: EntitiesDrawerOptions): any[];
add(cesiumProps: any): any;
update(entity: any, cesiumProps: any): void;
remove(entity: any): void;
removeAll(): void;
setShow(showValue: boolean): void;
static ɵfac: i0.ɵɵFactoryDeclaration<CzmlDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CzmlDrawerService>;
}
/**
* This drawer is responsible for drawing ellipses.
*/
declare class EllipseDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<EllipseDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<EllipseDrawerService>;
}
/**
* This drawer is responsible for drawing labels.
*/
declare class LabelDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<LabelDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<LabelDrawerService>;
}
/**
* This drawer is responsible for drawing points.
*/
declare class PointDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<PointDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PointDrawerService>;
}
/**
* This drawer is responsible for drawing polygons.
*/
declare class PolygonDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<PolygonDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PolygonDrawerService>;
}
/**
* This drawer is responsible of drawing polylines.
*/
declare class PolylineDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<PolylineDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PolylineDrawerService>;
}
declare enum KeyboardAction {
CAMERA_FORWARD = 0,
CAMERA_BACKWARD = 1,
CAMERA_RIGHT = 2,
CAMERA_LEFT = 3,
CAMERA_UP = 4,
CAMERA_DOWN = 5,
CAMERA_LOOK_RIGHT = 6,
CAMERA_LOOK_LEFT = 7,
CAMERA_LOOK_UP = 8,
CAMERA_LOOK_DOWN = 9,
CAMERA_TWIST_RIGHT = 10,
CAMERA_TWIST_LEFT = 11,
CAMERA_ROTATE_RIGHT = 12,
CAMERA_ROTATE_LEFT = 13,
CAMERA_ROTATE_UP = 14,
CAMERA_ROTATE_DOWN = 15,
CAMERA_ZOOM_IN = 16,
CAMERA_ZOOM_OUT = 17
}
type KeyboardControlActionFn = (cesiumService: CesiumService, params: any, event: KeyboardEvent) => boolean | void;
type KeyboardControlValidationFn = (cesiumService: CesiumService, params: any, event: KeyboardEvent) => boolean;
type KeyboardControlDoneFn = (cesiumService: CesiumService, event: KeyboardEvent) => boolean;
interface KeyboardControlParams {
action: KeyboardAction | KeyboardControlActionFn;
validation?: KeyboardControlValidationFn;
params?: {
[paramName: string]: any;
};
done?: KeyboardControlDoneFn;
}
interface KeyboardControlDefinition {
[keyboardCharCode: string]: KeyboardControlParams;
}
/**
* Service that manages keyboard keys and execute actions per request.
* Inject the keyboard control service into any layer, under your `ac-map` component,
* And defined you keyboard handlers using `setKeyboardControls`.
*
* <caption>Simple Example</caption>
* ```typescript
* Component({
* selector: 'keyboard-control-layer',
* template: '',
* })
* export class KeyboardControlLayerComponent implements OnInit, OnDestroy {
* constructor(private keyboardControlService: KeyboardControlService) {}
*
* ngOnInit() {
* this.keyboardControlService.setKeyboardControls({
* W: { action: KeyboardAction.CAMERA_FORWARD },
* S: { action: KeyboardAction.CAMERA_BACKWARD },
* D: { action: KeyboardAction.CAMERA_RIGHT },
* A: { action: KeyboardAction.CAMERA_LEFT },
* });
* }
*
* ngOnDestroy() {
* this.keyboardControlService.removeKeyboardControls();
* }
* }
* ```
*
* <caption>Advanced Example</caption>
* ```typescript
* Component({
* selector: 'keyboard-control-layer',
* template: '',
* })
* export class KeyboardControlLayerComponent implements OnInit, OnDestroy {
* constructor(private keyboardControlService: KeyboardControlService) {}
*
* private myCustomValue = 10;
*
* ngOnInit() {
* this.keyboardControlService.setKeyboardControls({
* W: {
* action: KeyboardAction.CAMERA_FORWARD,
* validate: (camera, scene, params, key) => {
* // Replace `checkCamera` you with your validation logic
* if (checkCamera(camera) || params.customParams === true) {
* return true;
* }
*
* return false;
* },
* params: () => {
* return {
* myValue: this.myCustomValue,
* };
* },
* }
* });
* }
*
* ngOnDestroy() {
* this.keyboardControlService.removeKeyboardControls();
* }
* }
* ```
* <b>Predefined keyboard actions:</b>
* + `KeyboardAction.CAMERA_FORWARD` - Moves the camera forward, accepts a numeric parameter named `moveRate` that controls
* the factor of movement, according to the camera height.
* + `KeyboardAction.CAMERA_BACKWARD` - Moves the camera backward, accepts a numeric parameter named `moveRate` that controls
* the factor of movement, according to the camera height.
* + `KeyboardAction.CAMERA_UP` - Moves the camera up, accepts a numeric parameter named `moveRate` that controls
* the factor of movement, according to the camera height.
* + `KeyboardAction.CAMERA_DOWN` - Moves the camera down, accepts a numeric parameter named `moveRate` that controls
* the factor of movement, according to the camera height.
* + `KeyboardAction.CAMERA_RIGHT` - Moves the camera right, accepts a numeric parameter named `moveRate` that controls
* the factor of movement, according to the camera height.
* + `KeyboardAction.CAMERA_LEFT` - Moves the camera left, accepts a numeric parameter named `moveRate` that controls
* the factor of movement, according to the camera height.
* + `KeyboardAction.CAMERA_LOOK_RIGHT` - Changes the camera to look to the right, accepts a numeric parameter named `lookFactor` that
* controls the factor of looking, according to the camera current position.
* + `KeyboardAction.CAMERA_LOOK_LEFT` - Changes the camera to look to the left, accepts a numeric parameter named `lookFactor` that
* controls the factor of looking, according to the camera current position.
* + `KeyboardAction.CAMERA_LOOK_UP` - Changes the camera to look up, accepts a numeric parameter named `lookFactor` that controls
* the factor of looking, according to the camera current position.
* + `KeyboardAction.CAMERA_LOOK_DOWN` - Changes the camera to look down, accepts a numeric parameter named `lookFactor` that controls
* the factor of looking, according to the camera current position.
* + `KeyboardAction.CAMERA_TWIST_RIGHT` - Twists the camera to the right, accepts a numeric parameter named `amount` that controls
* the twist amount
* + `KeyboardAction.CAMERA_TWIST_LEFT` - Twists the camera to the left, accepts a numeric parameter named `amount` that controls
* the twist amount
* + `KeyboardAction.CAMERA_ROTATE_RIGHT` - Rotates the camera to the right, accepts a numeric parameter named `angle` that controls
* the rotation angle
* + `KeyboardAction.CAMERA_ROTATE_LEFT` - Rotates the camera to the left, accepts a numeric parameter named `angle` that controls
* the rotation angle
* + `KeyboardAction.CAMERA_ROTATE_UP` - Rotates the camera upwards, accepts a numeric parameter named `angle` that controls
* the rotation angle
* + `KeyboardAction.CAMERA_ROTATE_DOWN` - Rotates the camera downwards, accepts a numeric parameter named `angle` that controls
* the rotation angle
* + `KeyboardAction.CAMERA_ZOOM_IN` - Zoom in into the current camera center position, accepts a numeric parameter named
* `amount` that controls the amount of zoom in meters.
* + `KeyboardAction.CAMERA_ZOOM_OUT` - Zoom out from the current camera center position, accepts a numeric parameter named
* `amount` that controls the amount of zoom in meters.
*/
declare class KeyboardControlService {
private ngZone;
private cesiumService;
private document;
private _currentDefinitions;
private _activeDefinitions;
private _keyMappingFn;
/**
* Creats the keyboard control service.
*/
constructor(ngZone: NgZone, cesiumService: CesiumService, document: any);
/**
* Initializes the keyboard control service.
*/
init(): void;
/**
* Sets the current map keyboard control definitions.
* The definitions is a key mapping between a key string and a KeyboardControlDefinition:
* - `action` is a predefine action from `KeyboardAction` enum, or a custom method:
* `(camera, scene, params, key) => boolean | void` - returning false will cancel the current keydown.
* - `validation` is a method that validates if the event should occur or not (`camera, scene, params, key`)
* - `params` is an object (or function that returns object) that will be passed into the action executor.
* - `done` is a function that will be triggered when `keyup` is triggered.
* @param definitions Keyboard Control Definition
* @param keyMappingFn - Mapping function for custom keys
* @param outsideOfAngularZone - if key down events will run outside of angular zone.
*/
setKeyboardControls(definitions: KeyboardControlDefinition, keyMappingFn?: (keyEvent: KeyboardEvent) => string, outsideOfAngularZone?: boolean): void;
/**
* Removes the current set of keyboard control items, and unregister from map events.
*/
removeKeyboardControls(): void;
/**
* Returns the current action that handles `char` key string, or `null` if not exists
*/
private getAction;
/**
* The default `defaultKeyMappingFn` that maps `KeyboardEvent` into a key string.
*/
private defaultKeyMappingFn;
/**
* document's `keydown` event handler
*/
private handleKeydown;
/**
* document's `keyup` event handler
*/
private handleKeyup;
/**
* `tick` event handler that triggered by Cesium render loop
*/
private handleTick;
/**
*
* Params resolve function, returns object.
* In case of params function, executes it and returns it's return value.
*
*/
private getParams;
/**
*
* Executes a given `KeyboardControlParams` object.
*
*/
private executeAction;
/**
* Registers to keydown, keyup of `document`, and `tick` of Cesium.
*/
private registerEvents;
/**
* Unregisters to keydown, keyup of `document`, and `tick` of Cesium.
*/
private unregisterEvents;
static ɵfac: i0.ɵɵFactoryDeclaration<KeyboardControlService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<KeyboardControlService>;
}
declare class MapLayersService {
private cesiumService;
private layersDataSources;
constructor(cesiumService: CesiumService);
registerLayerDataSources(dataSources: any[], zIndex: number): void;
drawAllLayers(): void;
updateAndRefresh(dataSources: any[], newZIndex: number): void;
removeDataSources(dataSources: any[]): void;
static ɵfac: i0.ɵɵFactoryDeclaration<MapLayersService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<MapLayersService>;
}
/**
* The service manages `ac-map` instances. `ac-map` register itself to this service.
* This allows retrieval of maps provided services outside of `ac-map` scope.
*/
declare class MapsManagerService {
private defaultIdCounter;
private _Maps;
private firstMap;
private eventRemoveCallbacks;
constructor();
getMap(id?: string): AcMapComponent | undefined;
_registerMap(id: string, acMap: AcMapComponent): string;
_removeMapById(id: string): boolean;
private generateDefaultId;
/**
* Binds multiple 2D map's cameras together.
* @param mapsConfiguration - binding options.
* mapId - the id of the maps to bind.
* sensitivity - the amount the camera position should change in order to sync other maps.
* bindZoom - should bind zoom level
*/
sync2DMapsCameras(mapsConfiguration: {
id: string;
sensitivity?: number;
bindZoom?: boolean;
}[]): void;
/**
* Unsyncs maps cameras
*/
unsyncMapsCameras(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<MapsManagerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<MapsManagerService>;
}
/**
* Take screenshot of your cesium globe.
*
* usage:
* ```typescript
* // get base 64 data url
* const dataUrl = screenshotService.getMapScreenshotDataUrl();
*
* // or download as png
* screenshotService.downloadMapScreenshot('my-map.png');
*
* ```
*
*/
declare class ScreenshotService {
private cesiumService;
constructor(cesiumService: CesiumService);
getMapScreenshotDataUrlBase64(): string;
downloadMapScreenshot(filename?: string): void;
private downloadURI;
static ɵfac: i0.ɵɵFactoryDeclaration<ScreenshotService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ScreenshotService>;
}
/**
* This is a map implementation, creates the cesium map.
* Every layer should be tag inside ac-map tag
*
* Accessing cesium viewer:
* 1. acMapComponent.getCesiumViewer()
* 2. Use MapManagerService.getMap().getCesiumViewer() or if more then one map: MapManagerService.getMap(mapId).getCesiumViewer()
*
*
* @example
* <ac-map>
* <ac-map-layer-provider></ac-map-layer-provider>
* <dynamic-ellipse-layer #layer></dynamic-ellipse-layer>
* </ac-map>
*/
declare class AcMapComponent implements OnChanges, OnInit, AfterViewInit, OnDestroy {
private _cesiumService;
private _cameraService;
private _elemRef;
private document;
private mapsManagerService;
private billboardDrawerService;
private labelDrawerService;
private ellipseDrawerService;
private polylineDrawerService;
private polygonDrawerService;
private arcDrawerService;
private pointDrawerService;
private czmlDrawerService;
private mapEventsManager;
private keyboardControlService;
private mapLayersService;
private screenshotService;
contextMenuService: ContextMenuService;
private coordinateConverter;
/**
* Disable default plonter context menu
*/
disableDefaultPlonter: boolean;
/**
* Set the id name of the map
* default: 'default-map-id-[index]'
*/
mapId: string;
/**
* flyTo options according to https://cesiumjs.org/Cesium/Build/Documentation/Camera.html?classFilter=cam#flyTo
*/
flyTo: any;
/**
* Sets the map's SceneMode
*/
sceneMode: SceneMode;
/**
* Optional - the container element's id in which the map's canvas will be appended to.
* If not supplied - the container element will be the parent element of ac-map;
*/
containerId: string;
private mapContainer;
constructor(_cesiumService: CesiumService, _cameraService: CameraService, _elemRef: ElementRef, document: any, mapsManagerService: MapsManagerService, billboardDrawerService: BillboardDrawerService, labelDrawerService: LabelDrawerService, ellipseDrawerService: EllipseDrawerService, polylineDrawerService: PolylineDrawerService, polygonDrawerService: PolygonDrawerService, arcDrawerService: ArcDrawerService, pointDrawerService: PointDrawerService, czmlDrawerService: CzmlDrawerService, mapEventsManager: MapEventsManagerService, keyboardControlService: KeyboardControlService, mapLayersService: MapLayersService, screenshotService: ScreenshotService, contextMenuService: ContextMenuService, coordinateConverter: CoordinateConverter);
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
ngAfterViewInit(): void;
ngOnDestroy(): void;
/**
* @returns ac-map's cesium service
*/
getCesiumService(): CesiumService;
/**
* @returns map's cesium viewer
*/
getCesiumViewer(): any;
getCameraService(): CameraService;
getId(): string;
getMapContainer(): HTMLElement;
getMapEventsManager(): MapEventsManagerService;
getContextMenuService(): ContextMenuService;
getScreenshotService(): ScreenshotService;
getKeyboardControlService(): KeyboardControlService;
getCoordinateConverter(): CoordinateConverter;
static ɵfac: i0.ɵɵFactoryDeclaration<AcMapComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<AcMapComponent, "ac-map", never, { "disableDefaultPlonter": { "alias": "disableDefaultPlonter"; "required": false; }; "mapId": { "alias": "mapId"; "required": false; }; "flyTo": { "alias": "flyTo"; "required": false; }; "sceneMode": { "alias": "sceneMode"; "required": false; }; "containerId": { "alias": "containerId"; "required": false; }; }, {}, never, ["*"], false, never>;
}
interface IDescription {
draw(context: any, id: string, contextEntity: any): void;
remove(id: string): void;
removeAll(): void;
}
interface LayerOptions {
ellipse?: EntitiesDrawerOptions;
circle?: EntitiesDrawerOptions;
polygon?: EntitiesDrawerOptions;
model?: EntitiesDrawerOptions;
box?: EntitiesDrawerOptions;
corridor?: EntitiesDrawerOptions;
cylinder?: EntitiesDrawerOptions;
ellipsoid?: EntitiesDrawerOptions;
polylineVolume?: EntitiesDrawerOptions;
rectangle?: EntitiesDrawerOptions;
wall?: EntitiesDrawerOptions;
}
declare class LayerService {
private _context;
private _options;
private _show;
private _zIndex;
private _entityName;
private _cache;
private descriptions;
private layerUpdate;
get cache(): boolean;
set cache(value: boolean);
get zIndex(): number;
set zIndex(value: number);
get show(): boolean;
set show(value: boolean);
get options(): LayerOptions;
set options(value: LayerOptions);
get context(): any;
set context(context: any);
setEntityName(name: string): void;
getEntityName(): string;
registerDescription(descriptionComponent: IDescription): void;
unregisterDescription(descriptionComponent: IDescription): void;
getDescriptions(): IDescription[];
layerUpdates(): EventEmitter<any>;
static ɵfac: i0.ɵɵFactoryDeclaration<LayerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<LayerService>;
}
/**
* Action to do on entity
*/
declare enum ActionType {
ADD_UPDATE = 0,
DELETE = 1
}
/**
* Interface of Angular2Cesium notification.
* ac-layer receives an observer of AcNotifications
*/
interface AcNotification {
id: string;
entity?: AcEntity;
actionType: ActionType;
}
declare class AcNotification {
id: string;
entity?: AcEntity;
actionType: ActionType;
}
declare class ComputationCache {
private _cache;
get(expression: string, insertFn: (() => any)): any;
clear(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<ComputationCache, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ComputationCache>;
}
/**
* This drawer is responsible for creating the dynamic version of the ellipse component.
* We are using the primitive-primitives implementation of an ellipse. see: https://github.com/gotenxds/Primitive-primitives
* This allows us to change the position of the ellipses without creating a new primitive object
* as Cesium does not allow updating an ellipse.
*/
declare class DynamicEllipseDrawerService extends PrimitivesDrawerService {
constructor(cesiumService: CesiumService);
add(cesiumProps: any): any;
update(ellipse: any, cesiumProps: any): any;
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicEllipseDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<DynamicEllipseDrawerService>;
}
/**
* This drawer is responsible for creating the dynamic version of the polyline component.
*/
declare class DynamicPolylineDrawerService extends PrimitivesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicPolylineDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<DynamicPolylineDrawerService>;
}
/**
*
* This drawer is deprecated.
* General static primitives drawer responsible of drawing static Cesium primitives with material.
*/
declare abstract class StaticPrimitiveDrawer extends PrimitivesDrawerService {
private geometryType;
constructor(geometryType: any, cesiumService: CesiumService);
add(geometryProps: any, instanceProps: any, primitiveProps: any): any;
update(primitive: any, geometryProps: any, instanceProps: any, primitiveProps: any): any;
}
/**
* This drawer is responsible for creating the static version of the circle component.
*/
declare class StaticCircleDrawerService extends StaticPrimitiveDrawer {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<StaticCircleDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<StaticCircleDrawerService>;
}
/**
* This drawer is responsible for creating the static version of the polyline component.
* This also allows us to change the color of the polylines.
*/
declare class StaticPolylineDrawerService extends StaticPrimitiveDrawer {
constructor(cesiumService: CesiumService);
/**
* Update function can only change the primitive color.
*/
update(primitive: any, geometryProps: any, instanceProps: any, primitiveProps: any): any;
static ɵfac: i0.ɵɵFactoryDeclaration<StaticPolylineDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<StaticPolylineDrawerService>;
}
/**
+ This drawer is responsible for drawing a polygon over the Cesium map.
+ This implementation uses simple PolygonGeometry and Primitive parameters.
+ This doesn't allow us to change the position, color, etc.. of the polygons. For that you may use the dynamic polygon component.
*/
declare class StaticPolygonDrawerService extends StaticPrimitiveDrawer {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<StaticPolygonDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<StaticPolygonDrawerService>;
}
/**
+ * This drawer is responsible for drawing an ellipse over the Cesium map.
+ * This implementation uses simple EllipseGeometry and Primitive parameters.
+ * This doesn't allow us to change the position, color, etc.. of the ellipses. For that you may use the dynamic ellipse component.
+ */
declare class StaticEllipseDrawerService extends StaticPrimitiveDrawer {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<StaticEllipseDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<StaticEllipseDrawerService>;
}
/**
* This drawer is responsible for drawing models.
*/
declare class ModelDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<ModelDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<ModelDrawerService>;
}
/**
* This drawer is responsible for drawing box.
*/
declare class BoxDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<BoxDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<BoxDrawerService>;
}
/**
* This drawer is responsible for drawing corridors .
*/
declare class CorridorDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<CorridorDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CorridorDrawerService>;
}
/**
* This drawer is responsible for drawing cylinders.
*/
declare class CylinderDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<CylinderDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<CylinderDrawerService>;
}
/**
* This drawer is responsible for drawing ellipsoid.
*/
declare class EllipsoidDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<EllipsoidDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<EllipsoidDrawerService>;
}
/**
* This drawer is responsible for drawing polylines.
*/
declare class PolylineVolumeDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<PolylineVolumeDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PolylineVolumeDrawerService>;
}
/**
* This drawer is responsible for drawing polygons.
*/
declare class WallDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<WallDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<WallDrawerService>;
}
/**
* This drawer is responsible for drawing rectangles.
*/
declare class RectangleDrawerService extends EntitiesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.ɵɵFactoryDeclaration<RectangleDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<RectangleDrawerService>;
}
/**
* This drawer is responsible of drawing polylines as primitives.
* This drawer is more efficient than PolylineDrawerService when drawing dynamic polylines.
*/
declare class PolylinePrimitiveDrawerService extends PrimitivesDrawerService {
constructor(cesiumService: CesiumService);
add(cesiumProps: any): any;
update(cesiumObject: any, cesiumProps: any): void;
withColorMaterial(cesiumProps: any): any;
static ɵfac: i0.ɵɵFactoryDeclaration<PolylinePrimitiveDrawerService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<PolylinePrimitiveDrawerService>;
}
/**
* This drawer is responsible for drawing labels as primitives.
* This drawer is more efficient than LabelDrawerService when drawing dynamic labels.
*/
declare class LabelPrimitiveDrawerService extends PrimitivesDrawerService {
constructor(cesiumService: CesiumService);
static ɵfac: i0.