cd-mapgis 1.0.37 → 1.0.38

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.37",
3
+ "version": "1.0.38",
4
4
  "main": "./src/index.js",
5
5
  "types": "./src/index.d.ts",
6
6
  "type": "module",
package/src/MapView.js CHANGED
@@ -196,4 +196,13 @@ export default class MapView {
196
196
  this.mapDrawUtil = null;
197
197
  }
198
198
  }
199
+ //将视图调整到一个指定的图层显示范围,并返回是否调整成功.只对矢量图层有效,瓦片图层无效
200
+ viewToLayer(layer) {
201
+ let source = layer.getSource();
202
+ if (source.getFeatures().length === 0) return false;
203
+ var extent = source.getExtent();
204
+ let view = this.map.getView();
205
+ view.fit(extent);
206
+ return true;
207
+ }
199
208
  }
package/src/index.d.ts CHANGED
@@ -7,6 +7,14 @@ declare module 'cd-mapgis' {
7
7
  expandExtent(): void;
8
8
  setCenter(center: [number, number], useAnimation?: boolean): void;
9
9
  setZoom(zoom: number): void;
10
+ addEvent(name: string, fun: any): any;
11
+ addEventOnce(name: string, fun: any): void;
12
+ removeEvent(key: any): void;
13
+ viewMousePoint(call: any): void;
14
+ startDraw(type: string, fun: any): void;
15
+ tool(type: string): void;
16
+ clearDraw(): void;
17
+ viewToLayer(layer: any): void;
10
18
  }
11
19
  export class OM {
12
20
  static map: any;