From 3292aeb743e93f2fdeb465cc019c7b05f9776d77 Mon Sep 17 00:00:00 2001 From: 李红刚 <p-honggang.li@pcitc.com> Date: 星期四, 18 三月 2021 10:34:00 +0800 Subject: [PATCH] 修改测量进行可编辑 --- src/components/plugin/MeaSure.js | 7 +++++++ src/components/plugin/leaflet-measure-path/leaflet-measure-path.js | 9 ++------- src/Sgis.js | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Sgis.js b/src/Sgis.js index ee53051..cbc3d10 100644 --- a/src/Sgis.js +++ b/src/Sgis.js @@ -10,7 +10,7 @@ // import FullScreen from '@components/plugin/FullScreen' import DownLoad from '@components/plugin/DownLoad' // 娴嬮噺 -import LeafletMeasurePath from '@components/plugin/leaflet-measure-path/leaflet-measure-path' +import '@components/plugin/leaflet-measure-path/leaflet-measure-path' import 'leaflet.markercluster' // import 'leaflet-canvas-markers' @@ -36,7 +36,7 @@ // FullScreen.init(L) // 涓嬭浇 DownLoad.init(L) - LeafletMeasurePath.init(L) + // LeafletMeasurePath.init(L) map = L.map(div, MapConfig.mapOptions) diff --git a/src/components/plugin/MeaSure.js b/src/components/plugin/MeaSure.js index 2c05000..b1e4508 100644 --- a/src/components/plugin/MeaSure.js +++ b/src/components/plugin/MeaSure.js @@ -53,6 +53,9 @@ }, dblclick: function (e) { // 鍙屽嚮缁撴潫 console.log('鍙屽嚮缁撴潫', e) + areaMeasure.polygon.enableEdit() + areaMeasure.polygon.dragging.disable() + areaMeasure.map.on('editable:vertex:drag editable:vertex:deleted', areaMeasure.polygon.updateMeasurements, areaMeasure.polygon) areaMeasure.polygon.addTo(areaMeasure.layers) areaMeasure.close(e.latlng) //areaMeasure.polygon.enableEdit(); @@ -120,12 +123,16 @@ color: 'red' }) distanceMeasure.polyline.addTo(distanceMeasure.layers) + // distanceMeasure.polyline.enableEdit() distanceMeasure.layers.addTo(distanceMeasure.map) distanceMeasure.points.pop() }, dblclick: function (e) { // 鍙屽嚮缁撴潫 console.log('鍙屽嚮缁撴潫', e) + distanceMeasure.polyline.enableEdit() + distanceMeasure.polyline.dragging.disable() distanceMeasure.polyline.addTo(distanceMeasure.layers) + distanceMeasure.map.on('editable:vertex:drag editable:vertex:deleted', distanceMeasure.polyline.updateMeasurements, distanceMeasure.polyline) distanceMeasure.close(e.latlng) distanceMeasure.map.off('click', distanceMeasure.click).off('mousemove', distanceMeasure.mousemove).off('dblclick', distanceMeasure.dblclick) }, diff --git a/src/components/plugin/leaflet-measure-path/leaflet-measure-path.js b/src/components/plugin/leaflet-measure-path/leaflet-measure-path.js index 28fdfd9..2f8a696 100644 --- a/src/components/plugin/leaflet-measure-path/leaflet-measure-path.js +++ b/src/components/plugin/leaflet-measure-path/leaflet-measure-path.js @@ -1,6 +1,5 @@ /* eslint-disable */ -const init = (L) => { - !(function() { + !(function() { 'use strict' L.Marker.Measurement = L[L.Layer ? 'Layer' : 'Class'].extend({ @@ -419,8 +418,4 @@ L.Circle.addInitHook(function() { addInitHook.call(this) }) - })() -} -export default { - init -} \ No newline at end of file + })() \ No newline at end of file -- Gitblit v1.8.0