File

projects/angular-cesium/src/lib/angular-cesium-widgets/services/entity-editors/polygons-editor/polygons-manager.service.ts

Index

Properties
Methods

Methods

clear
clear()
Returns : void
createEditablePolygon
createEditablePolygon(id: string, editPolygonsLayer: AcLayerComponent, editPointsLayer: AcLayerComponent, editPolylinesLayer: AcLayerComponent, coordinateConverter: CoordinateConverter, scene: any, polygonOptions?: PolygonEditOptions, positions?: Cartesian3[])
Parameters :
Name Type Optional
id string No
editPolygonsLayer AcLayerComponent No
editPointsLayer AcLayerComponent No
editPolylinesLayer AcLayerComponent No
coordinateConverter CoordinateConverter No
scene any No
polygonOptions PolygonEditOptions Yes
positions Cartesian3[] Yes
Returns : void
dispose
dispose(id: string)
Parameters :
Name Type Optional
id string No
Returns : void
get
get(id: string)
Parameters :
Name Type Optional
id string No
Returns : EditablePolygon

Properties

polygons
polygons: Map<string | EditablePolygon>
Type : Map<string | EditablePolygon>
Default value : new Map<string, EditablePolygon>()
import { Injectable } from '@angular/core';
import { EditablePolygon } from '../../../models/editable-polygon';
import { Cartesian3 } from '../../../../angular-cesium/models/cartesian3';
import { PolygonEditOptions } from '../../../models/polygon-edit-options';
import { AcLayerComponent } from '../../../../angular-cesium/components/ac-layer/ac-layer.component';
import { CoordinateConverter } from '../../../../angular-cesium/services/coordinate-converter/coordinate-converter.service';

@Injectable()
export class PolygonsManagerService {
  polygons: Map<string, EditablePolygon> = new Map<string, EditablePolygon>();

  createEditablePolygon(id: string, editPolygonsLayer: AcLayerComponent, editPointsLayer: AcLayerComponent,
                        editPolylinesLayer: AcLayerComponent, coordinateConverter: CoordinateConverter,
                        scene: any,
                        polygonOptions?: PolygonEditOptions, positions?: Cartesian3[]) {
    const editablePolygon = new EditablePolygon(
      id,
      editPolygonsLayer,
      editPointsLayer,
      editPolylinesLayer,
      coordinateConverter,
      scene,
      polygonOptions,
      positions);
    this.polygons.set(id, editablePolygon
    );
  }

  dispose(id: string) {
    this.polygons.get(id).dispose();
    this.polygons.delete(id);
  }

  get(id: string): EditablePolygon {
    return this.polygons.get(id);
  }

  clear() {
    this.polygons.forEach(polygon => polygon.dispose());
    this.polygons.clear();
  }
}

result-matching ""

    No results matching ""