cd-mapgis 1.0.30 → 1.0.32

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.30",
3
+ "version": "1.0.32",
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,8 @@ 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
+ fun(geoJson, e.feature.getGeometry().getCoordinates());//绘制完成后,将绘制的坐标串传入回调函数
50
52
  } catch (ex) {
51
53
  console.error(ex);
52
54
  }
package/src/StyleUtil.js CHANGED
@@ -30,17 +30,17 @@ export default class StyleUtil {
30
30
  fill: new Fill({
31
31
  color: 'rgba(255, 255, 255, 0.2)'
32
32
  }),
33
- stroke: Stroke({
33
+ stroke: new Stroke({
34
34
  color: 'rgba(0, 0, 255, 1)',
35
35
  lineDash: [10, 10],
36
36
  width: 2
37
37
  }),
38
- image: Circle({
38
+ image: new Circle({
39
39
  radius: 5,
40
- stroke: Stroke({
40
+ stroke: new Stroke({
41
41
  color: 'rgba(0, 0, 0, 0.7)'
42
42
  }),
43
- fill: Fill({
43
+ fill: new Fill({
44
44
  color: 'rgba(255, 255, 255, 0.2)'
45
45
  })
46
46
  })