Aw5739 Add ngx openlayers
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
2023-12-29 11:01:36 +01:00
parent 5cbb6f32f9
commit 8e8f18ad7c
92 changed files with 6555 additions and 2465 deletions

View File

@@ -0,0 +1,35 @@
import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
import { Feature } from 'ol';
import { SourceVectorComponent } from './sources/vector.component';
@Component({
selector: 'aol-feature',
template: ` <ng-content></ng-content> `,
})
export class FeatureComponent implements OnInit, OnDestroy, OnChanges {
@Input()
id: string | number | undefined;
componentType = 'feature';
instance: Feature;
constructor(private host: SourceVectorComponent) {}
ngOnInit() {
this.instance = new Feature();
if (this.id !== undefined) {
this.instance.setId(this.id);
}
this.host.instance.addFeature(this.instance);
}
ngOnDestroy() {
this.host.instance.removeFeature(this.instance);
}
ngOnChanges(changes: SimpleChanges) {
if (this.instance) {
this.instance.setId(this.id);
}
}
}