-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(feature-info): display basic feature info in default template
- Loading branch information
Showing
14 changed files
with
927 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { useAppStore } from '@/stores/app.store' | ||
import useMap from '@/composables/map/map.composable' | ||
import { listen } from 'ol/events' | ||
import { FeatureInfoService } from './feature-info.service' | ||
import { useFeatureInfoStore } from '@/stores/feature-info.store' | ||
import { FeatureInfo } from './feature-info.model' | ||
import { MapBrowserEvent } from 'ol' | ||
|
||
export default function useFeatureInfo() { | ||
const map = useMap().getOlMap() | ||
const { toggleInfoOpen } = useAppStore() | ||
const { setContent } = useFeatureInfoStore() | ||
|
||
function init() { | ||
const featureInfoService = new FeatureInfoService(map) | ||
|
||
listen(map, 'pointerup', event => { | ||
;(async () => { | ||
const mapBrowserEvent = event as MapBrowserEvent<any> | ||
const content: FeatureInfo[] | undefined = | ||
await featureInfoService.singleclickEvent(mapBrowserEvent, false) | ||
if (content) { | ||
setContent(content) | ||
toggleInfoOpen(true) | ||
} | ||
})() | ||
}) | ||
} | ||
|
||
return { init } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { Geometry } from 'ol/geom' | ||
|
||
export interface Feature { | ||
type: string | ||
geometry: Geometry | ||
fid: string | ||
id: string | ||
attributes: Attributes | ||
alias: Record<string, unknown> | ||
} | ||
|
||
// interface Geometry { | ||
// type: string | ||
// coordinates: number[][][] | ||
// } | ||
|
||
export interface Attributes { | ||
name: string | ||
canton: string | ||
district: string | ||
showProfile: { active: boolean } | ||
profile: any | ||
label: string | ||
[key: string]: any | ||
value: string | ||
} | ||
|
||
export interface FeatureInfo { | ||
features: Feature[] | ||
remote_template: boolean | ||
template: string | ||
layer: string | ||
ordered: boolean | ||
has_profile: boolean | ||
total_features_count: number | ||
features_count: number | ||
layerLabel: string | ||
} |
Oops, something went wrong.