Inject clicked feature in component
Some checks failed
FarmMaps/FarmMapsLib/pipeline/head There was a failure building this commit

This commit is contained in:
Willem Dantuma 2021-12-02 11:13:03 +01:00
parent ff19d830a7
commit af3340ed70
4 changed files with 25 additions and 1 deletions

View File

@ -19,6 +19,7 @@ import * as mapEffects from './effects/map.effects';
import { IMapState} from './models/map.state';
import { ISelectedFeatures } from './models/selected.features';
import { IItemLayer,ItemLayer,ITemporalItemLayer,TemporalItemLayer } from './models/item.layer';
import { IClickedFeature } from './models/clicked.feature';
import { IPeriodState } from './models/period.state';
// components

View File

@ -74,7 +74,7 @@
</div>
</fm-side-panel>
<fm-side-panel [resizeable]="true" [visible]="!noContent">
<router-outlet></router-outlet>
<router-outlet (activate)="handleSidepaneloutletActivate($event)" (deactivate)="handleSidepaneloutletDeactivate($event)"></router-outlet>
</fm-side-panel>
</div>
</aol-map>

View File

@ -11,6 +11,7 @@ import { DeviceService } from '@farmmaps/common';
import * as mapReducers from '../../reducers/map.reducer';
import * as mapActions from '../../actions/map.actions';
import { IMapState} from '../../models/map.state';
import { IClickedFeature} from '../../models/clicked.feature';
import { IQuery } from '../../reducers/map.reducer'
import { ISelectedFeatures } from '../../models/selected.features';
import { IItemLayer } from '../../models/item.layer';
@ -175,6 +176,18 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
this.store.dispatch(new mapActions.DoQuery(queryState));
}
handleSidepaneloutletActivate(component:any) {
if(component && component.hasOwnProperty('clickedFeature')) {
(component as IClickedFeature).clickedFeature = this.clickedFeature;
}
}
handleSidepaneloutletDeactivate(component:any) {
if(component && component.hasOwnProperty('clickedFeature')) {
(component as IClickedFeature).clickedFeature = null;
}
}
ngOnInit() {
this.initialized = false;
console.debug("Init");

View File

@ -0,0 +1,10 @@
import {Feature} from 'ol';
import {Geometry} from 'ol/geom';
import { Observable } from 'rxjs';
/**
* @deprecated This interface will be removed soon
*/
export interface IClickedFeature {
clickedFeature: Observable<Feature<Geometry>>
}