|
@@ -11,9 +11,9 @@
|
|
|
<!-- <div class="model-btn" style="margin-left: 5px" @click="changeScaleControl">尺</div>-->
|
|
|
</div>
|
|
|
<!-- 测距工具 -->
|
|
|
- <div class="model-btn" @click="toggleRangingTool">
|
|
|
- {{ isRanging ? '关闭测距' : '开启测距' }}
|
|
|
- </div>
|
|
|
+<!-- <div class="model-btn" @click="toggleRangingTool">-->
|
|
|
+<!-- {{ isRanging ? '关闭测距' : '开启测距' }}-->
|
|
|
+<!-- </div>-->
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -75,10 +75,10 @@ const initMapEvent = () => {
|
|
|
layer_cva.metadata = { group: 'basemap' };
|
|
|
map.addLayer(layer_vtc);
|
|
|
map.addLayer(layer_cva);
|
|
|
- if (props.activeMap !== 'vectorgraph') {
|
|
|
- removeLayers();
|
|
|
- switchMap(props.activeMap);
|
|
|
- }
|
|
|
+ // if (props.activeMap !== 'vectorgraph') {
|
|
|
+ // removeLayers();
|
|
|
+ // switchMap(props.activeMap);
|
|
|
+ // }
|
|
|
});
|
|
|
};
|
|
|
// 切换地图
|
|
@@ -134,7 +134,6 @@ const setMapZoom = (value) => {
|
|
|
const switchThreeDimensional = () => {
|
|
|
mapState.isThreeDimensional = !mapState.isThreeDimensional;
|
|
|
const pitch = mapState.isThreeDimensional ? 45 : 0;
|
|
|
- debugger
|
|
|
map.setPitch(pitch);
|
|
|
};
|
|
|
|
|
@@ -156,9 +155,78 @@ const measureFunc = (e) => {
|
|
|
};
|
|
|
|
|
|
//画线
|
|
|
-function distanceMea() {
|
|
|
- draw.changeMode(draw.modes.DRAW_LINE_STRING);
|
|
|
-}
|
|
|
+// function distanceMea() {
|
|
|
+// draw.changeMode(draw.modes.DRAW_LINE_STRING);
|
|
|
+// }
|
|
|
+
|
|
|
+// 实例化点标记
|
|
|
+let markers = {};
|
|
|
+const addMarker = (item) => {
|
|
|
+ // 点标记显示内容,HTML要素字符串
|
|
|
+ var geopoint = {
|
|
|
+ type: 'geojson',
|
|
|
+ data: {
|
|
|
+ type: 'Feature',
|
|
|
+ geometry: {
|
|
|
+ type: 'Point',
|
|
|
+ coordinates: [item.center[0], item.center[1]]
|
|
|
+ },
|
|
|
+ properties: {
|
|
|
+ title: 'add point',
|
|
|
+ 'marker-symbol': 'monument'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ map.addLayer({
|
|
|
+ id: 'point',
|
|
|
+ type: 'circle',
|
|
|
+ geopoint,
|
|
|
+ paint: {
|
|
|
+ 'circle-radius': 5,
|
|
|
+ 'circle-color': 'red',
|
|
|
+ 'circle-opacity': 0.8
|
|
|
+ }
|
|
|
+ });
|
|
|
+ console.log(map.getLayer());
|
|
|
+ // var marker = new GeoGlobe.Layer.SymbolLayer({
|
|
|
+ // id: 'font',
|
|
|
+ // type: 'symbol',
|
|
|
+ // source: 'font',
|
|
|
+ // layout: {
|
|
|
+ // 'text-font': [
|
|
|
+ // 'Open Sans Regular',
|
|
|
+ // 'Arial Unicode MS Regular'
|
|
|
+ // ],
|
|
|
+ // 'text-size': 67,
|
|
|
+ // 'text-field': '你好!'
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // map.addLayer(marker);
|
|
|
+ // let marker = new AMap.Marker({
|
|
|
+ // size: new AMap.Size(25, 34),
|
|
|
+ // content: markerContent,
|
|
|
+ // position: [item.center[0], item.center[1]],
|
|
|
+ // offset: new AMap.Pixel(-13, -30)
|
|
|
+ // });
|
|
|
+ // marker.setMap(map);
|
|
|
+ // if (markers[item.id]) {
|
|
|
+ // markers[item.id].push(marker);
|
|
|
+ // } else {
|
|
|
+ // markers[item.id] = [marker];
|
|
|
+ // }
|
|
|
+};
|
|
|
+// 清除所有标加
|
|
|
+const clearMarker = (id) => {
|
|
|
+ if (!markers[id]) return;
|
|
|
+ markers[id].forEach((marker) => {
|
|
|
+ marker.remove();
|
|
|
+ });
|
|
|
+ delete markers[id];
|
|
|
+};
|
|
|
+const getMarkers = () => {
|
|
|
+ return markers;
|
|
|
+};
|
|
|
+defineExpose({ addMarker, getMarkers, clearMarker });
|
|
|
// 加载事件
|
|
|
onMounted(() => {
|
|
|
initMapEvent();
|