Skip to content

Commit

Permalink
fix map search and geojson
Browse files Browse the repository at this point in the history
  • Loading branch information
solderq35 committed Dec 30, 2023
1 parent 7668336 commit c041108
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/components/map/map.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,20 @@
<l-tile-layer :url="url" :attribution="attribution"></l-tile-layer>
<l-geo-json
v-for="building of this.$store.getters['map/buildings']"
v-if="building.geoJSON"
:key="building.id * rKey"
:geojson="building.geoJSON"
:options="buildingOptions"
ref="geoLayer"
></l-geo-json>
</l-map>
</div>
<prompt v-if="askingForComparison" @cancel="stopCompare" @compare="showComparison" />
<prompt
:compareStories="compareStories"
v-if="askingForComparison"
@cancel="stopCompare"
@compare="showComparison"
/>
<prompt_error v-if="building_compare_error" @cancel="stopCompareError" @compare="showComparison" />
<transition name="side">
<compareSide v-if="showCompareSide" @hide="showCompareSide = false" :compareStories="compareStories" />
Expand Down Expand Up @@ -211,7 +217,7 @@ export default {
color: e.target.options.color
}
e.target.setStyle({ fillColor: '#000', color: '#000' })
e.target.bindTooltip(this.$store.getters['map/building'](e.target.feature.properties.id).name).openTooltip()
e.target.bindTooltip(e.target.feature.properties.name).openTooltip()
})
layer.on('mouseout', e => {
if (!e.target.setStyle) return
Expand Down Expand Up @@ -342,6 +348,13 @@ export default {
layer.unbindTooltip()
}
},
initBuildingRename () {
for (let layer of Object.values(this.map._layers)) {
if (layer.feature && layer.feature.geometry && layer.feature.geometry.type === 'Polygon') {
layer.feature.properties.name = this.$store.getters['map/building'](layer.feature.properties.id).name
}
}
},
removeAllMarkers: function () {
for (let marker of this.compareMarkers) {
this.map.removeLayer(marker)
Expand Down Expand Up @@ -492,6 +505,7 @@ export default {
this.message = inputWord
})
this.map.zoomControl.setPosition('topleft')
this.initBuildingRename()
},
mounted () {
this.$nextTick(() => {
Expand Down Expand Up @@ -633,8 +647,6 @@ export default {
var searchGroup = []
for (let layer of Object.values(this.map._layers)) {
if (layer.feature && layer.feature.geometry && layer.feature.geometry.type === 'Polygon') {
layer.feature.properties.name = this.$store.getters['map/building'](layer.feature.properties.id).name
if (layer.feature.properties.name !== undefined) {
if (layer.feature.properties.name.toLowerCase().includes(v.toLowerCase())) {
searchGroup.push(layer)
Expand Down

0 comments on commit c041108

Please sign in to comment.