cd-mapgis 1.0.31 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cd-mapgis",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "main": "./src/index.js",
5
5
  "types": "./src/index.d.ts",
6
6
  "type": "module",
@@ -5,6 +5,7 @@ import StyleUtil from './StyleUtil.js';
5
5
  import { getLength, getArea } from 'ol/sphere.js';
6
6
  import { unByKey } from 'ol/Observable.js';
7
7
  import Overlay from 'ol/Overlay.js';
8
+ import GeoJSON from 'ol/format/GeoJSON.js';
8
9
 
9
10
  /**
10
11
  * 地图绘图工具
@@ -46,7 +47,11 @@ export default class MapDrawUtil {
46
47
  this.drawObj.on('drawend', (e) => {
47
48
  _this._drawTempLayer(e.feature);
48
49
  try {
49
- fun(e.feature.getGeometry().getCoordinates());//绘制完成后,将绘制的坐标串传入回调函数
50
+ let geoJson = new GeoJSON().writeFeature(e.feature);
51
+ let geometry = JSON.stringify(JSON.parse(geoJson).geometry);
52
+ let obj = { geometry: geometry, geoJson: geoJson };
53
+ obj.points = e.feature.getGeometry().getCoordinates();
54
+ fun(obj);//绘制完成后,将绘制的坐标串传入回调函数
50
55
  } catch (ex) {
51
56
  console.error(ex);
52
57
  }