cd-mapgis 1.0.58 → 1.0.59
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/MapView.js +11 -4
package/package.json
CHANGED
package/src/MapView.js
CHANGED
|
@@ -85,10 +85,17 @@ export default class MapView {
|
|
|
85
85
|
this.map.addLayer(this._view_templayer);// 添加到地图
|
|
86
86
|
// fit方法 - 自动适应范围
|
|
87
87
|
let extent = res.geometry.getExtent();
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
//非点
|
|
89
|
+
if (extent[0] != extent[2]) {
|
|
90
|
+
//缩放到指定的范围
|
|
91
|
+
let extent2 = this.expandExtent(extent);
|
|
92
|
+
this.map.getView().fit(extent2, {
|
|
93
|
+
size: this.map.getSize()
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
//平移到指定的点
|
|
97
|
+
this.map.getView().setCenter([extent[0], extent[1]]); // [经度, 纬度]
|
|
98
|
+
}
|
|
92
99
|
}
|
|
93
100
|
/**
|
|
94
101
|
* 清除显示在临时图层上的数据
|