flat: 街道添加地图

This commit is contained in:
Apcallover
2024-05-16 16:00:59 +08:00
parent 02359f2877
commit 7a35c32284
3 changed files with 79 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
<template>
<div class="app-content">
<el-input
v-if="type !== 'view'"
v-if="showInput"
:placeholder="placeholder"
clearable
v-model="addressLocation"
@@ -52,7 +52,7 @@ import {
GetFeaturesByGeometryParameters
} from '@supermap/iclient-ol';
console.log(process.env.VUE_APP_SUPPER_MAP)
const geoJSONParser = new GeoJSON();
export default {
name: "uMapView",
props: {
@@ -114,6 +114,14 @@ export default {
default: 'custom',
}
},
computed: {
showInput() {
if (this.type === 'view' || this.type === 'select') {
return false
}
return true
}
},
data() {
return {
// 实例化对象
@@ -281,6 +289,13 @@ export default {
careateFeature(result) {
if (this.vectorSourceIcon) {
this.vectorSourceIcon.clear()
const geojsonObject = {
type: 'FeatureCollection',
features: result,
};
this.vectorSourceIcon.addFeatures(geoJSONParser.readFeatures(geojsonObject))
this.vectorSourceIcon.changed()
return
}
const geojsonObject = {
type: 'FeatureCollection',
@@ -288,7 +303,7 @@ export default {
};
// 创建一个图层作为点位
this.vectorSourceIcon = new SourceVector({
features: new GeoJSON().readFeatures(geojsonObject)
features: geoJSONParser.readFeatures(geojsonObject)
});
this.vectorLayerIcon = new LayerVector({
source: this.vectorSourceIcon,