Skip to content

Commit dfca21a

Browse files
committed
refine GeometrySearch draft
1 parent a5e87e4 commit dfca21a

File tree

10 files changed

+224
-136
lines changed

10 files changed

+224
-136
lines changed

packages/clients/textLocator/src/addPlugins.ts

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,27 @@ export const addPlugins = (core) => {
2424
setLayout(NineLayout)
2525

2626
core.addPlugins([
27-
Header({
27+
AddressSearch({
2828
displayComponent: true,
2929
layoutTag: NineLayoutTag.TOP_LEFT,
30+
minLength: 3,
31+
waitMs: 500,
32+
// @ts-expect-error | URL configured in a different way (simple API)
33+
searchMethods: [{ type: 'coastalGazetteer' }],
34+
addLoading: 'plugin/loadingIndicator/addLoadingKey',
35+
removeLoading: 'plugin/loadingIndicator/removeLoadingKey',
36+
customSearchMethods: {
37+
// @ts-expect-error | Local parameter requirements diverge from type
38+
coastalGazetteer: searchCoastalGazetteerByToponym,
39+
},
40+
customSelectResult: {
41+
// it's defined like that
42+
// eslint-disable-next-line @typescript-eslint/naming-convention
43+
'': selectResult,
44+
},
3045
}),
3146
Draw({
32-
displayComponent: false,
33-
selectableDrawModes: ['Point', 'LineString', 'Circle', 'Polygon'],
47+
selectableDrawModes: ['Point', 'Polygon'],
3448
style: {
3549
fill: {
3650
color: 'rgba(255, 255, 255, 0.5)',
@@ -45,10 +59,12 @@ export const addPlugins = (core) => {
4559
},
4660
},
4761
}),
62+
Header({
63+
displayComponent: true,
64+
layoutTag: NineLayoutTag.TOP_LEFT,
65+
}),
4866
IconMenu({
4967
displayComponent: true,
50-
// TODO fix, it's broken ...
51-
initiallyOpen: 'geometrySearch',
5268
menus: [
5369
{
5470
plugin: GeometrySearch({}),
@@ -67,25 +83,6 @@ export const addPlugins = (core) => {
6783
],
6884
layoutTag: NineLayoutTag.TOP_RIGHT,
6985
}),
70-
AddressSearch({
71-
displayComponent: true,
72-
layoutTag: NineLayoutTag.TOP_LEFT,
73-
minLength: 3,
74-
waitMs: 500,
75-
// @ts-expect-error | URL configured in a different way (simple API)
76-
searchMethods: [{ type: 'coastalGazetteer' }],
77-
addLoading: 'plugin/loadingIndicator/addLoadingKey',
78-
removeLoading: 'plugin/loadingIndicator/removeLoadingKey',
79-
customSearchMethods: {
80-
// @ts-expect-error | Local parameter requirements diverge from type
81-
coastalGazetteer: searchCoastalGazetteerByToponym,
82-
},
83-
customSelectResult: {
84-
// it's defined like that
85-
// eslint-disable-next-line @typescript-eslint/naming-convention
86-
'': selectResult,
87-
},
88-
}),
8986
Attributions({
9087
displayComponent: true,
9188
layoutTag: NineLayoutTag.BOTTOM_RIGHT,

packages/clients/textLocator/src/locales.ts

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
wmtsTopplusOpenWebGrey,
88
wmtsTopplusOpenLight,
99
wmtsTopplusOpenLightGrey,
10+
aerial,
1011
} from './services'
1112

1213
// Gefundene Orte
@@ -25,6 +26,7 @@ const locales: LanguageOption[] = [
2526
[wmtsTopplusOpenWebGrey]: 'TopPlusOpen (Web, Grau)',
2627
[wmtsTopplusOpenLight]: 'TopPlusOpen (Light)',
2728
[wmtsTopplusOpenLightGrey]: 'TopPlusOpen (Light, Grau)',
29+
[aerial]: 'Luftbilder Sen2Europe',
2830
},
2931
addressSearch: {
3032
unnamed: 'Unbenannt',
@@ -33,13 +35,20 @@ const locales: LanguageOption[] = [
3335
[openStreetMap]: `$t(textLocator.layers.${openStreetMap}): © <a href='https://www.openstreetmap.org/copyright' target='_blank'>OpenStreetMap</a> contributors`,
3436
[openSeaMap]: `$t(textLocator.layers.${openSeaMap}): © <a href='https://www.openseamap.org/ target='_blank''>OpenSeaMap</a>`,
3537
[mdiSeaNames]: `$t(textLocator.layers.${mdiSeaNames}): © <a href='https://projekt.mdi-de.org/kuesten-gazetteer/ target='_blank''>MDI DE</a>`,
36-
[wmtsTopplusOpenWeb]: `$t(textLocator.layers.${wmtsTopplusOpenWeb}): © Bundesamt für Kartographie und Geodäsie <YEAR>`,
37-
[wmtsTopplusOpenWebGrey]: `$t(textLocator.layers.${wmtsTopplusOpenWebGrey}): © Bundesamt für Kartographie und Geodäsie <YEAR>`,
38-
[wmtsTopplusOpenLight]: `$t(textLocator.layers.${wmtsTopplusOpenLight}): © Bundesamt für Kartographie und Geodäsie <YEAR>`,
39-
[wmtsTopplusOpenLightGrey]: `$t(textLocator.layers.${wmtsTopplusOpenLightGrey}): © Bundesamt für Kartographie und Geodäsie <YEAR>`,
38+
[wmtsTopplusOpenWeb]: `$t(textLocator.layers.${wmtsTopplusOpenWeb}): © Bundesamt für Kartographie und Geodäsie {{YEAR}}`,
39+
[wmtsTopplusOpenWebGrey]: `$t(textLocator.layers.${wmtsTopplusOpenWebGrey}): © Bundesamt für Kartographie und Geodäsie {{YEAR}}`,
40+
[wmtsTopplusOpenLight]: `$t(textLocator.layers.${wmtsTopplusOpenLight}): © Bundesamt für Kartographie und Geodäsie {{YEAR}}`,
41+
[wmtsTopplusOpenLightGrey]: `$t(textLocator.layers.${wmtsTopplusOpenLightGrey}): © Bundesamt für Kartographie und Geodäsie {{YEAR}}`,
42+
[aerial]:
43+
'© Europäische Union, enthält veränderte Copernicus Sentinel-Daten ({{YEAR}})',
4044
static:
4145
'<br><a href="https://github.com/Dataport/polar/blob/main/LEGALNOTICE.md">Impressum</a>',
4246
},
47+
info: {
48+
noLiteratureFound: 'Es wurden keine Texte zu diesen Orten gefunden.',
49+
noGeometriesFound:
50+
'Es wurden keine Orte zu dieser Geometrie gefunden.',
51+
},
4352
error: {
4453
searchCoastalGazetteer:
4554
'Die Suche ist mit einem unbekannten Fehler fehlgeschlagen. Bitte versuchen Sie es später erneut.',
@@ -64,6 +73,7 @@ const locales: LanguageOption[] = [
6473
[wmtsTopplusOpenWebGrey]: 'TopPlusOpen (Web, Grey)',
6574
[wmtsTopplusOpenLight]: 'TopPlusOpen (Light)',
6675
[wmtsTopplusOpenLightGrey]: 'TopPlusOpen (Light, Grey)',
76+
[aerial]: 'Luftbilder Sen2Europe',
6777
},
6878
addressSearch: {
6979
unnamed: 'Unnamed',
@@ -72,13 +82,19 @@ const locales: LanguageOption[] = [
7282
[openStreetMap]: `$t(textLocator.layers.${openStreetMap}): © <a href='https://www.openstreetmap.org/copyright' target='_blank'>OpenStreetMap</a> contributors`,
7383
[openSeaMap]: `$t(textLocator.layers.${openSeaMap}): © <a href='https://www.openseamap.org/ target='_blank''>OpenSeaMap</a>`,
7484
[mdiSeaNames]: `$t(textLocator.layers.${mdiSeaNames}): © <a href='https://projekt.mdi-de.org/kuesten-gazetteer/ target='_blank''>MDI DE</a>`,
75-
[wmtsTopplusOpenWeb]: `$t(textLocator.layers.${wmtsTopplusOpenWeb}): © Bundesamt für Kartographie und Geodäsie <YEAR>`,
76-
[wmtsTopplusOpenWebGrey]: `$t(textLocator.layers.${wmtsTopplusOpenWebGrey}): © Bundesamt für Kartographie und Geodäsie <YEAR>`,
77-
[wmtsTopplusOpenLight]: `$t(textLocator.layers.${wmtsTopplusOpenLight}): © Bundesamt für Kartographie und Geodäsie <YEAR>`,
78-
[wmtsTopplusOpenLightGrey]: `$t(textLocator.layers.${wmtsTopplusOpenLightGrey}): © Bundesamt für Kartographie und Geodäsie <YEAR>`,
85+
[wmtsTopplusOpenWeb]: `$t(textLocator.layers.${wmtsTopplusOpenWeb}): © Bundesamt für Kartographie und Geodäsie {{YEAR}}`,
86+
[wmtsTopplusOpenWebGrey]: `$t(textLocator.layers.${wmtsTopplusOpenWebGrey}): © Bundesamt für Kartographie und Geodäsie {{YEAR}}`,
87+
[wmtsTopplusOpenLight]: `$t(textLocator.layers.${wmtsTopplusOpenLight}): © Bundesamt für Kartographie und Geodäsie {{YEAR}}`,
88+
[wmtsTopplusOpenLightGrey]: `$t(textLocator.layers.${wmtsTopplusOpenLightGrey}): © Bundesamt für Kartographie und Geodäsie {{YEAR}}`,
89+
[aerial]:
90+
'© European Union, contains modified Copernicus Sentinel data ({{YEAR}})',
7991
static:
8092
'<br><a href="https://github.com/Dataport/polar/blob/main/LEGALNOTICE.md">Legal notice (Impressum)</a>',
8193
},
94+
info: {
95+
noLiteratureFound: 'No texts were found regarding these places.',
96+
noGeometriesFound: 'No places were found regarding this geometry.',
97+
},
8298
error: {
8399
searchCoastalGazetteer:
84100
'The search failed with an unknown error. Please try again later.',

packages/clients/textLocator/src/mapConfig.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
wmtsTopplusOpenWebGrey,
1111
wmtsTopplusOpenLight,
1212
wmtsTopplusOpenLightGrey,
13+
aerial,
1314
} from './services'
1415
import { theme } from './palettes'
1516

@@ -52,6 +53,11 @@ export const mapConfiguration: Partial<MapConfig> = {
5253
type: 'background',
5354
name: `textLocator.layers.${openStreetMap}`,
5455
},
56+
{
57+
id: aerial,
58+
type: 'background',
59+
name: `textLocator.layers.${aerial}`,
60+
},
5561
{
5662
id: openSeaMap,
5763
type: 'mask',

packages/clients/textLocator/src/plugins/GeometrySearch/components/GeometrySearch.vue

Lines changed: 51 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{{ $t('common:plugins.geometrySearch.draw.title') }}
55
</v-card-title>
66
<v-card-text class="text-locator-card-collapse">
7-
<v-radio-group v-model="_draw" dense hide-details>
7+
<v-radio-group v-model="_drawMode" dense hide-details>
88
<v-radio
99
:label="$t('common:plugins.draw.drawMode.point')"
1010
value="Point"
@@ -15,19 +15,22 @@
1515
></v-radio>
1616
</v-radio-group>
1717
</v-card-text>
18-
<v-card-text v-if="tipVisibility[_draw]" class="text-locator-card-collapse">
18+
<v-card-text
19+
v-if="tipVisibility[_drawMode]"
20+
class="text-locator-card-collapse"
21+
>
1922
<v-alert
20-
v-model="tipVisibility[_draw]"
23+
v-model="tipVisibility[_drawMode]"
2124
type="info"
2225
prominent
2326
dense
2427
colored-border
2528
border="left"
26-
:icon="_draw === 'Point' ? 'fa-location-dot' : 'fa-draw-polygon'"
29+
:icon="_drawMode === 'Point' ? 'fa-location-dot' : 'fa-draw-polygon'"
2730
dismissible
2831
elevation="4"
2932
>{{
30-
$t(`common:plugins.geometrySearch.draw.description.${_draw}`)
33+
$t(`common:plugins.geometrySearch.draw.description.${_drawMode}`)
3134
}}</v-alert
3235
>
3336
</v-card-text>
@@ -50,9 +53,21 @@
5053
dense
5154
hoverable
5255
activatable
56+
color="info"
5357
:items="treeViewItems"
58+
@update:active="changeActiveData"
5459
>
55-
<template #prepend="{ item }"> {{ item.count }} </template>
60+
<template #label="{ item }">
61+
<v-badge
62+
color="info"
63+
inline
64+
left
65+
:content="item.count"
66+
class="text-locator-result-badge"
67+
>
68+
{{ item.name }}
69+
</v-badge>
70+
</template>
5671
</v-treeview>
5772
<v-card-text v-else>
5873
{{ $t('common:plugins.geometrySearch.results.none') }}
@@ -62,9 +77,10 @@
6277
</template>
6378

6479
<script lang="ts">
80+
import { DrawMode } from '@polar/lib-custom-types'
6581
import Vue from 'vue'
6682
import { mapGetters, mapActions, mapMutations } from 'vuex'
67-
import { TextLocatorCategories, TextLocatorDrawModes } from '../types'
83+
import { TextLocatorCategories } from '../types'
6884
6985
export default Vue.extend({
7086
name: 'GeometrySearchPlugin',
@@ -75,11 +91,8 @@ export default Vue.extend({
7591
},
7692
}),
7793
computed: {
78-
...mapGetters('plugin/geometrySearch', [
79-
'draw',
80-
'byCategory',
81-
'treeViewItems',
82-
]),
94+
...mapGetters('plugin/geometrySearch', ['byCategory', 'treeViewItems']),
95+
...mapGetters('plugin/draw', ['drawMode']),
8396
_byCategory: {
8497
get() {
8598
return this.byCategory
@@ -88,17 +101,18 @@ export default Vue.extend({
88101
this.setByCategory(byCategory)
89102
},
90103
},
91-
_draw: {
104+
_drawMode: {
92105
get() {
93-
return this.draw
106+
return this.drawMode
94107
},
95-
set(drawMode: TextLocatorDrawModes) {
108+
set(drawMode: DrawMode) {
96109
this.setDrawMode(drawMode)
97110
},
98111
},
99112
},
100113
methods: {
101-
...mapActions('plugin/geometrySearch', ['setDrawMode']),
114+
...mapActions('plugin/draw', ['setDrawMode']),
115+
...mapActions('plugin/geometrySearch', ['changeActiveData']),
102116
...mapMutations('plugin/geometrySearch', ['setByCategory']),
103117
},
104118
})
@@ -119,6 +133,27 @@ export default Vue.extend({
119133
120134
.text-locator-btn-group-button {
121135
text-transform: unset;
136+
137+
// determined by trial & error ¯\ツ/¯
138+
&:hover:not(:last-child),
139+
&:focus:not(:last-child) {
140+
z-index: 1;
141+
margin-left: -2px;
142+
margin-right: -2px;
143+
}
144+
145+
&:hover:last-child,
146+
&:focus:last-child {
147+
margin-left: -3px;
148+
}
149+
}
150+
151+
.text-locator-result-badge {
152+
max-width: 500px;
153+
width: 500px;
154+
white-space: normal;
155+
justify-content: left;
156+
margin: 0.5em 0;
122157
}
123158
}
124159
</style>

packages/clients/textLocator/src/plugins/GeometrySearch/index.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ interface GeometrySearchConfiguration extends PluginOptions {
88
url: string
99
}
1010

11-
export default (options: GeometrySearchConfiguration) => (instance: Vue) =>
12-
instance.$store.dispatch('addComponent', {
13-
name: 'geometrySearch',
14-
plugin: GeometrySearch,
15-
language,
16-
storeModule: makeStoreModule(),
17-
options,
18-
})
11+
export default (options: Partial<GeometrySearchConfiguration>) =>
12+
(instance: Vue) =>
13+
instance.$store.dispatch('addComponent', {
14+
name: 'geometrySearch',
15+
plugin: GeometrySearch,
16+
language,
17+
storeModule: makeStoreModule(),
18+
options,
19+
})

0 commit comments

Comments
 (0)