cd-mapgis 1.1.0 → 1.1.2
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 +1 -1
- package/src/LineLayer.js +8 -1
- package/src/PointLayer.js +8 -1
package/package.json
CHANGED
package/src/LineLayer.js
CHANGED
|
@@ -13,7 +13,7 @@ export default class LineLayer {
|
|
|
13
13
|
constructor(p) {
|
|
14
14
|
this.vectorSource = new VectorSource();
|
|
15
15
|
this.vectorLayer = new VectorLayer({
|
|
16
|
-
source: vectorSource
|
|
16
|
+
source: this.vectorSource
|
|
17
17
|
});
|
|
18
18
|
this.mapView = p.mapView ? p.mapView : MapView.Instance;
|
|
19
19
|
this.map = this.mapView.map;
|
|
@@ -78,4 +78,11 @@ export default class LineLayer {
|
|
|
78
78
|
// 可根据需求决定是否停止
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* 缩放到本图层显示范围
|
|
83
|
+
*/
|
|
84
|
+
fitToLayer(){
|
|
85
|
+
const map = this.map;
|
|
86
|
+
map.getView().fit(this.vectorSource.getExtent(), map.getSize())
|
|
87
|
+
}
|
|
81
88
|
}
|
package/src/PointLayer.js
CHANGED
|
@@ -13,7 +13,7 @@ export default class PointLayer {
|
|
|
13
13
|
constructor(p) {
|
|
14
14
|
this.vectorSource = new VectorSource();
|
|
15
15
|
this.vectorLayer = new VectorLayer({
|
|
16
|
-
source: vectorSource
|
|
16
|
+
source: this.vectorSource
|
|
17
17
|
});
|
|
18
18
|
this.mapView = p.mapView ? p.mapView : MapView.Instance;
|
|
19
19
|
this.map = this.mapView.map;
|
|
@@ -82,4 +82,11 @@ export default class PointLayer {
|
|
|
82
82
|
// 可根据需求决定是否停止
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* 缩放到本图层显示范围
|
|
87
|
+
*/
|
|
88
|
+
fitToLayer(){
|
|
89
|
+
const map = this.map;
|
|
90
|
+
map.getView().fit(this.vectorSource.getExtent(), map.getSize())
|
|
91
|
+
}
|
|
85
92
|
}
|