UNPKG

@geogirafe/lib-geoportal

Version:

GeoGirafe is a flexible application to build online geoportals.

60 lines (59 loc) 2.88 kB
import DrawingFeature, { DrawingShape } from './drawingFeature'; import MapComponent from '../map/component'; import State from '../../tools/state/state'; import { Collection, Feature } from 'ol'; import { Geometry, Polygon, SimpleGeometry } from 'ol/geom'; import { SketchCoordType } from 'ol/interaction/Draw'; import { Style } from 'ol/style'; import { Modify, Snap, Draw } from 'ol/interaction'; import VectorSource, { VectorSourceEvent } from 'ol/source/Vector'; import { Projection } from 'ol/proj'; import { Coordinate } from 'ol/coordinate'; import ConfigManager from '../../tools/configuration/configmanager'; import UserInteractionManager from '../../tools/state/userInteractionManager'; import { ContextMenu } from '../map/tools/contextmenu'; export default class OlDrawing { map: MapComponent; toolName: string; state: State; configManager: ConfigManager; userInteractionManager: UserInteractionManager; drawingSource: VectorSource; modifiableFeatures: Collection<Feature>; draw: Draw | null; modify: Modify | null; snap: Snap | null; editContextMenu: ContextMenu | null; currentShape: DrawingShape | null; featuresMap: Map<string, { feature: Feature<Geometry>; shape: DrawingShape; }>; fixedLength: number; constructor(map: MapComponent, toolName: string); createEditContextMenu(): void; setInteractionsActive(active: boolean): void; hasEditableVertexAtCoordinate(coordinate: Coordinate): boolean; getClosestVertexAndFeature(coordinate: Coordinate, filter?: (f: Feature) => boolean): [Coordinate, Feature<Geometry>] | undefined; removeLastInteractedVertex(): boolean | undefined; addFeatures(features: DrawingFeature[]): void; deleteFeatures(features: DrawingFeature[]): void; updateModifiableFeatures(features: DrawingFeature[]): void; onFeatureAdded(e: VectorSourceEvent): void; createOlFeature(feature: DrawingFeature): Feature<Geometry>; setFixedLength(length: number): void; createLineStringFixedLength(coordinates: SketchCoordType, geom: SimpleGeometry): SimpleGeometry; createSquareFixedLength(coordinates: SketchCoordType, geom: SimpleGeometry, proj: Projection): SimpleGeometry; createPolygonFixedLength(coordinates: SketchCoordType, geom: SimpleGeometry): SimpleGeometry; createDiskFixedLength(coordinates: SketchCoordType, geom: SimpleGeometry): SimpleGeometry; activateDrawTool(tool: DrawingShape): void; deactivateDrawTool(): void; addSnapInteraction(): void; centerViewOnFeature(feature: DrawingFeature): void; getStyle(feature: DrawingFeature | null, olFeature: Feature<Geometry>): Style[]; ensurePolygonIsProperlyClosed(polygon: Polygon): Coordinate[]; private removeEditContextMenu; registerInteractions(): void; unregisterInteractions(): void; private canExecute; }