-
Notifications
You must be signed in to change notification settings - Fork 5
feat(gfi): migrate plugin #447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Changes from 89 commits
2f99431
74e98dd
0da4c0a
15972bf
d449c8d
1234994
8757e3b
425cfdb
bf71346
70ff48d
11fe191
978d718
6d60086
6182677
439ae45
aa854c8
a0daad3
63a5d72
55ff02a
c2edb52
79852f3
9f25413
d15b2c2
4dfe6af
875a35c
ec689f1
a6e5698
ef16d0b
3271a30
c7a096d
03243fe
92c938c
758e48e
b13d946
78cf7ea
5c52f98
2bc62e3
30369fe
71e0fe9
de7c0a2
049b529
c49b158
68760f7
37e1612
acc27d6
e50c423
e462655
2516299
6bebd40
92593c1
cf97607
f46aa79
b8fb5a2
985bc02
18d2a1a
4f9d2e1
e8f3597
c89b58b
fa787b1
07d6066
0bbd0fb
db2a657
9edf830
d1be583
f112666
7b08d89
b7280b0
3b0c6f5
c598a80
92f446f
62062f0
ea8c02d
f1ffdb6
f835925
bff6bdc
9d95f73
e82b7c6
7f05d42
635a1e7
2336f7e
a6607c6
3a9843a
1087c8d
8d17a09
1a360e9
1370962
37588de
271ad09
4a80f42
fb59311
ab14bb0
ed87486
c7c6b35
1f639d8
67eafe4
65ec115
1ab845c
7c49b21
db7493f
d3d97d6
13e685a
35610a2
cdeda5b
4f6c62e
bf3c65d
1547b7b
091af04
d1f3a92
0a16793
5c8f0c4
9cbbcf4
b0fc61e
940cf78
0623319
a20e34b
b760b14
7b84459
36db39c
4bc6e2b
a071a5d
a3b965e
0000a4f
b002d7b
6445501
374117e
48bdc5a
7f19cac
b099e3f
bf29efb
236c0fc
014198b
dc2dc75
d321f67
3b72e2d
87c843a
43f7344
7555797
178001a
debe186
97254a4
07b7bad
6c762b2
82d2196
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| <template> | ||
| <fieldset class="kern-fieldset"> | ||
| <legend class="kern-label"> | ||
| Wie soll die Auswahl für das GFI-Plugin ablaufen? | ||
| </legend> | ||
| <div class="kern-fieldset__body"> | ||
| <div | ||
| v-for="mode of selectionModes" | ||
| :key="mode.value" | ||
| class="kern-form-check" | ||
| > | ||
| <input | ||
| :id="`${id}-${mode.value}`" | ||
| v-model="selectionMode" | ||
| class="kern-form-check__radio" | ||
| :name="`${id}-layout`" | ||
| type="radio" | ||
| :value="mode.value" | ||
| /> | ||
| <label :for="`${id}-${mode.value}`" class="kern-label"> | ||
| {{ mode.label }} | ||
| </label> | ||
| </div> | ||
| </div> | ||
| </fieldset> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import type { MapConfiguration } from '@polar/polar' | ||
|
|
||
| import { isEqual } from 'es-toolkit' | ||
| import { computed, useId } from 'vue' | ||
|
|
||
| import { useIcebergStore } from '../stores/iceberg' | ||
|
|
||
| const id = useId() | ||
| const store = useIcebergStore() | ||
|
|
||
| const selectionModes = [ | ||
| { | ||
| value: 'direct', | ||
| label: 'Direkte Auswahl', | ||
| config: { | ||
| directSelect: true, | ||
| }, | ||
| }, | ||
| { | ||
| value: 'multi', | ||
| label: 'Mehrfachauswahl', | ||
| config: { | ||
| directSelect: true, | ||
| multiSelect: 'box', | ||
| }, | ||
| }, | ||
| { | ||
| value: 'pins', | ||
| label: 'Auswahl über das Pins-Plugin', | ||
| config: { | ||
| coordinateSources: [ | ||
| { | ||
| plugin: 'pins', | ||
| key: 'coordinate', | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| ] satisfies { | ||
| value: 'direct' | 'multi' | 'pins' | ||
| label: string | ||
| config: Partial<MapConfiguration['gfi']> | ||
| }[] | ||
|
|
||
| const selectionMode = computed({ | ||
| get: () => | ||
| selectionModes.find((mode) => | ||
| isEqual(mode.config, store.mapConfiguration.gfi) | ||
| )?.value || 'direct', | ||
| set: (value) => { | ||
| store.mapConfiguration.gfi = selectionModes.find( | ||
| (mode) => mode.value === value | ||
| )?.config as MapConfiguration['gfi'] | ||
| }, | ||
| }) | ||
| </script> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { getStore } from '@polar/polar' | ||
|
|
||
| function initializeDebugAssistant() { | ||
| const map = document.getElementById('snowbox') | ||
| const coreStore = getStore(map, 'core') | ||
| const activePluginIds = coreStore.activePluginIds | ||
|
|
||
| window.map = map | ||
| window.olMap = coreStore.map | ||
| window.coreStore = coreStore | ||
| window.activePluginIds = activePluginIds | ||
| for (const pluginId of activePluginIds) { | ||
| window[`${pluginId}Store`] = coreStore.getPluginStore(pluginId) | ||
| } | ||
| } | ||
|
|
||
| // We want to load as late as possible. | ||
| // Especially, the timeout stuff from snowbox code should be done when doing this. | ||
| setTimeout(() => { | ||
| initializeDebugAssistant() | ||
|
|
||
| // 7 seconds may be long sometimes, inform the developer about it. | ||
| // eslint-disable-next-line no-console | ||
| console.info('POLAR debug assistant was successfully initialized') | ||
| }, 7000) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ | |
| import pluginFilter from '@polar/polar/plugins/filter' | ||
| import pluginFullscreen from '@polar/polar/plugins/fullscreen' | ||
| import pluginGeoLocation from '@polar/polar/plugins/geoLocation' | ||
| import pluginGfi from '@polar/polar/plugins/gfi' | ||
| import pluginIconMenu from '@polar/polar/plugins/iconMenu' | ||
| import pluginLayerChooser from '@polar/polar/plugins/layerChooser' | ||
| import pluginLoadingIndicator from '@polar/polar/plugins/loadingIndicator' | ||
|
|
@@ -31,6 +32,7 @@ | |
| const ausgleichsflaechen = '1454' | ||
| const reports = '6059' | ||
| const denkmal = 'denkmaelerWMS' | ||
| const kielPolygon = 'kiel_polygon' | ||
| const hamburgBorder = '6074' | ||
|
|
||
| let colorScheme = 'light' | ||
|
|
@@ -92,7 +94,7 @@ | |
| colorScheme, | ||
| startCenter: [565874, 5934140], | ||
| layers: [ | ||
| // TODO: Add internalization to snowbox | ||
| { | ||
| id: basemapId, | ||
| visibility: true, | ||
|
|
@@ -148,6 +150,12 @@ | |
| }, | ||
| }, | ||
| }, | ||
| { | ||
| id: kielPolygon, | ||
| type: 'mask', | ||
| name: 'Kiel Polygone', | ||
| visibility: true, | ||
| }, | ||
| ], | ||
| layout: 'nineRegions', | ||
| checkServiceAvailability: true, | ||
|
|
@@ -212,6 +220,18 @@ | |
| label_off: 'Mach klein', | ||
| }, | ||
| }, | ||
| gfi: { | ||
| layer: { | ||
| [reports]: { | ||
| property: { | ||
| addr: 'Adresse', | ||
| statu: 'Status', | ||
| beschr: 'Beschr.', | ||
| kat_text: 'Kat.', | ||
| }, | ||
| }, | ||
| }, | ||
| }, | ||
| iconMenu: { | ||
| hints: { | ||
| attributions: 'LMAO', | ||
|
|
@@ -409,6 +429,68 @@ | |
| plugin: pluginLayerChooser({}), | ||
| }, | ||
| ], | ||
| [ | ||
| { | ||
| plugin: pluginGfi({ | ||
| layers: { | ||
| [reports]: { | ||
| window: true, | ||
| geometry: false, | ||
| properties: [ | ||
| 'addr', | ||
| 'statu', | ||
| 'beschr', | ||
| 'pic', | ||
| 'kat_text', | ||
| 'skat_text', | ||
| ], | ||
| exportProperty: 'pic', | ||
| showTooltip: (feature) => [ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous function also received the import { Feature, Map } from 'ol'
import { isVisible } from '@polar/lib-invisible-style'
export function showTooltip(feature: Feature, map: Map) {
const visibleFeatures = (feature.get('features') || []).filter(isVisible)
const isCluster = visibleFeatures.length > 1
if (isCluster) {
return [
['h2', 'meldemichel.gfi.tooltip.multiHeader'],
[
'span',
`meldemichel.gfi.tooltip.multiBody${
map.getView().getZoom() === map.getView().getMaxZoom()
? 'Unresolvable'
: ''
}`,
],
]
}
const tooltipFeature = visibleFeatures[0]
return [
['h2', `${tooltipFeature.get('str')} ${tooltipFeature.get('hsnr')}`],
['span', `meldemichel.skat.${tooltipFeature.get('skat')}`],
]
}
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you go: a3b965e |
||
| [ | ||
| 'span', | ||
| `Coordinates: ${feature.getGeometry().getCoordinates().join(', ')}`, | ||
| ], | ||
| ], | ||
| isSelectable: (feature) => isEvenId(feature.properties.mmlid), | ||
| }, | ||
| [kielPolygon]: { | ||
| window: true, | ||
| }, | ||
| }, | ||
| afterLoadFunction: (featuresByLayerId) => { | ||
| Object.values(featuresByLayerId).forEach((featureList) => { | ||
| featureList.forEach((feature) => { | ||
| if (feature.properties) { | ||
| feature.properties = { | ||
| addr: [ | ||
| feature.properties.str, | ||
| feature.properties.hsnr, | ||
| ].join(' '), | ||
| ...feature.properties, | ||
| } | ||
| } | ||
| }) | ||
| }) | ||
| return featuresByLayerId | ||
| }, | ||
| featureList: { | ||
| activeLayers: { | ||
| plugin: 'layerChooser', | ||
| key: 'activeMaskIds', | ||
| }, | ||
| mode: 'visible', | ||
| bindWithCoreHoverSelect: true, | ||
| pageLength: 5, | ||
| text: { | ||
| title: (feature) => | ||
| feature.get('str') + ' ' + feature.get('hsnr'), | ||
| subtitle: 'Michels Meldung', | ||
| subSubtitle: (feature) => feature.get('skat_text'), | ||
| }, | ||
| }, | ||
| }), | ||
| }, | ||
| ], | ||
| [ | ||
| { | ||
| plugin: pluginFilter({ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.