Skip to content

Commit

Permalink
Merge branch 'wegue-oss:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
wljrodrigues authored Apr 25, 2024
2 parents f3fa3f7 + 0c17a54 commit a66a50f
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 16 deletions.
1 change: 1 addition & 0 deletions app-starter/components/AppHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<template v-slot:activator="{on}">

<v-btn icon v-on="on"
class="wgu-menu-button"
color="onprimary"
:title="$t('wgu-toolbar-menu.title')">
<v-icon medium>menu</v-icon>
Expand Down
1 change: 1 addition & 0 deletions src/components/geolocator/Geolocator.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<span>
<v-btn @click="geolocateUserAndShowMarkerOnMap" icon
class="wgu-action-button"
color="onprimary"
:title="$t('wgu-geolocator.title')">
<v-icon v-if='this.isSearchingForGeolocation'>update</v-icon>
Expand Down
72 changes: 59 additions & 13 deletions src/components/infoclick/InfoClickWin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
<v-card-text v-if="!this.attributeData && !this.coordsData" class="no-data">
{{ $t('wgu-infoclick.mapClick') }}
</v-card-text>
<v-card-actions v-show="attributeData">
<v-spacer class="text-overline">{{ featureIdx + 1 }}/{{ numfeats }}: {{ layerName }}</v-spacer>
<v-btn v-show="numfeats > 1" x-small @click="prevFeat" ><v-icon>mdi-menu-left</v-icon></v-btn>
<v-btn v-show="numfeats > 1" x-small @click="nextFeat" ><v-icon>mdi-menu-right</v-icon></v-btn>
</v-card-actions>

<!-- feature property grid -->
<wgu-property-table :properties="attributeData" />
Expand Down Expand Up @@ -65,6 +70,7 @@ import ModuleCard from './../modulecore/ModuleCard';
import { WguEventBus } from '../../WguEventBus.js';
import PropertyTable from './PropertyTable';
import CoordsTable from './CoordsTable';
import MapInteractionUtil from '../../util/MapInteraction';
export default {
name: 'wgu-infoclick-win',
Expand All @@ -86,7 +92,11 @@ export default {
return {
moduleName: 'wgu-infoclick',
attributeData: null,
coordsData: null
coordsData: null,
featureIdx: 0,
features: null,
layerName: null,
numfeats: null
}
},
created () {
Expand Down Expand Up @@ -115,29 +125,65 @@ export default {
*/
onMapClick (evt) {
const me = this;
const featureLayer = me.map.forEachFeatureAtPixel(evt.pixel,
me.features = []
me.map.forEachFeatureAtPixel(evt.pixel,
(feature, layer) => {
return [feature, layer];
me.features.push([feature, layer])
});
// collect feature attributes --> PropertyTable
if (featureLayer) {
const feat = featureLayer[0];
const props = feat.getProperties();
// do not show geometry property
delete props.geometry;
me.attributeData = props;
if (this.features.length !== 0) {
this.featureIdx = 0
this.numfeats = me.features.length
this.viewProps(this.featureIdx)
} else {
me.attributeData = null;
this.attributeData = null;
}
// collect click coordinate + projection --> CoordsTable
me.coordsData = {
this.coordsData = {
coordinate: evt.coordinate,
projection: me.map.getView().getProjection().getCode()
projection: this.map.getView().getProjection().getCode()
};
},
prevFeat () {
this.featureIdx -= 1
if (this.featureIdx < 0) {
this.featureIdx = this.features.length - 1
}
this.viewProps(this.featureIdx)
},
nextFeat () {
this.featureIdx += 1
if (this.featureIdx > this.features.length - 1) {
this.featureIdx = 0
}
this.viewProps(this.featureIdx)
},
viewProps (idx) {
const infofeat = this.features[idx][0];
const props = infofeat.getProperties();
// do not show geometry property
delete props.geometry;
this.attributeData = props;
this.layerName = this.features[idx][1].get('name')
const lid = this.features[idx][1].get('lid')
const correspondingInteraction = MapInteractionUtil.getSelectInteraction(this.map, lid);
// we can only select layers that have a select interaction
if (!correspondingInteraction) {
return;
}
// add to map selection
correspondingInteraction.getFeatures().clear();
correspondingInteraction.getFeatures().push(infofeat);
},
/**
* (Un-)Register map interactions when the visibility of the module changes.
*
Expand Down
2 changes: 1 addition & 1 deletion src/components/localeswitcher/LocaleSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
color="onprimary"
background-color="transparent"
:title="$t('wgu-localeswitcher.title')"
class="ma-2"
class="ma-2 wgu-menu-button"
icon
v-on="on"
v-bind="attrs"
Expand Down
2 changes: 1 addition & 1 deletion src/components/maxextentbutton/ZoomToMaxExtentButton.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<v-btn icon color="onprimary" @click="onClick"
<v-btn icon color="onprimary" @click="onClick" class="wgu-action-button"
:title="$t('wgu-zoomtomaxextent.title')">
<v-icon medium>{{icon}}</v-icon>
</v-btn>
Expand Down
1 change: 1 addition & 0 deletions src/components/modulecore/ToggleButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
dense
color="onprimary"
background-color="transparent"
class="wgu-toggle-button"
:title="$t(moduleName + '.title')"
v-model="show">
<v-btn icon :value="true" color="onprimary" @click="toggleUi">
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/specs/components/infoclick/InfoClickWin.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('infoclick/InfoClickWin.vue', () => {
layers: [layer]
});
map.forEachFeatureAtPixel = () => {
return [feat, layer];
vm.features.push([feat, layer]);
};
vm.map = map;
vm.onMapClick(mockEvt);
Expand Down

0 comments on commit a66a50f

Please sign in to comment.