AW-6046 ng-openlayers

This commit is contained in:
2024-04-10 14:06:44 +02:00
parent 9c270bfe75
commit 4384b12944
100 changed files with 43 additions and 4228 deletions

View File

@@ -1,84 +0,0 @@
import { Component, Input, OnDestroy, OnInit, EventEmitter, Output } from '@angular/core';
import { MapComponent } from '../map.component';
import { Draw } from 'ol/interaction';
import { Collection, Feature } from 'ol';
import { Vector } from 'ol/source';
import { Style } from 'ol/style';
import { DrawEvent, GeometryFunction } from 'ol/interaction/Draw';
import { StyleFunction } from 'ol/style/Style';
import { Condition } from 'ol/events/condition';
import { Type } from 'ol/geom/Geometry';
import { ObjectEvent } from 'ol/Object';
import BaseEvent from 'ol/events/Event';
@Component({
selector: 'aol-interaction-draw',
template: '',
})
export class DrawInteractionComponent implements OnInit, OnDestroy {
@Input()
clickTolerance?: number;
@Input()
features?: Collection<Feature>;
@Input()
source?: Vector;
@Input()
snapTolerance?: number;
@Input()
type: Type;
@Input()
maxPoints?: number;
@Input()
minPoints?: number;
@Input()
finishCondition?: Condition;
@Input()
style?: Style | Style[] | StyleFunction;
@Input()
geometryFunction?: GeometryFunction;
@Input()
geometryName?: string;
@Input()
condition?: Condition;
@Input()
freehandCondition?: Condition;
@Input()
freehand?: boolean;
@Input()
wrapX?: boolean;
@Output()
olChange = new EventEmitter<DrawEvent>();
@Output()
olChangeActive = new EventEmitter<ObjectEvent>();
@Output()
olDrawAbort = new EventEmitter<DrawEvent>();
@Output()
drawEnd = new EventEmitter<DrawEvent>();
@Output()
drawStart = new EventEmitter<DrawEvent>();
@Output()
olError = new EventEmitter<BaseEvent>();
@Output()
propertyChange = new EventEmitter<ObjectEvent>();
instance: Draw;
constructor(private map: MapComponent) {}
ngOnInit() {
this.instance = new Draw(this);
this.instance.on('change', (event: DrawEvent) => this.olChange.emit(event));
this.instance.on('change:active', (event: ObjectEvent) => this.olChangeActive.emit(event));
this.instance.on('drawabort', (event: DrawEvent) => this.olDrawAbort.emit(event));
this.instance.on('drawend', (event: DrawEvent) => this.drawEnd.emit(event));
this.instance.on('drawstart', (event: DrawEvent) => this.drawStart.emit(event));
this.instance.on('error', (event: BaseEvent) => this.olError.emit(event));
this.instance.on('propertychange', (event: ObjectEvent) => this.propertyChange.emit(event));
this.map.instance.addInteraction(this.instance);
}
ngOnDestroy() {
this.map.instance.removeInteraction(this.instance);
}
}