From cc4726e85c825501e5e37f557020088750935ccd Mon Sep 17 00:00:00 2001 From: Willem Dantuma Date: Thu, 2 Dec 2021 11:13:03 +0100 Subject: [PATCH] Inject clicked feature in component --- projects/common-map/src/fm-map/common-map.module.ts | 1 + .../src/fm-map/components/map/map.component.html | 2 +- .../src/fm-map/components/map/map.component.ts | 13 +++++++++++++ .../common-map/src/fm-map/models/clicked.feature.ts | 10 ++++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 projects/common-map/src/fm-map/models/clicked.feature.ts diff --git a/projects/common-map/src/fm-map/common-map.module.ts b/projects/common-map/src/fm-map/common-map.module.ts index 9860d47..e8c6e85 100644 --- a/projects/common-map/src/fm-map/common-map.module.ts +++ b/projects/common-map/src/fm-map/common-map.module.ts @@ -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 diff --git a/projects/common-map/src/fm-map/components/map/map.component.html b/projects/common-map/src/fm-map/components/map/map.component.html index 7c3ac19..79c1542 100644 --- a/projects/common-map/src/fm-map/components/map/map.component.html +++ b/projects/common-map/src/fm-map/components/map/map.component.html @@ -74,7 +74,7 @@ - + diff --git a/projects/common-map/src/fm-map/components/map/map.component.ts b/projects/common-map/src/fm-map/components/map/map.component.ts index f3723bc..a8f32d6 100644 --- a/projects/common-map/src/fm-map/components/map/map.component.ts +++ b/projects/common-map/src/fm-map/components/map/map.component.ts @@ -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'; @@ -176,6 +177,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"); diff --git a/projects/common-map/src/fm-map/models/clicked.feature.ts b/projects/common-map/src/fm-map/models/clicked.feature.ts new file mode 100644 index 0000000..728fa70 --- /dev/null +++ b/projects/common-map/src/fm-map/models/clicked.feature.ts @@ -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> +} \ No newline at end of file