@hzab/map-combine 0.2.6 → 0.2.7
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/cesium/CesiumMap.ts +24 -2
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/cesium/CesiumMap.ts
CHANGED
|
@@ -13,7 +13,13 @@ import { drawPolyline } from "./CesiumPolyline";
|
|
|
13
13
|
import { drawTile3D } from "./CesiumTile3D";
|
|
14
14
|
|
|
15
15
|
const $m = 20037508.34278924;
|
|
16
|
+
/**
|
|
17
|
+
* flyToViewer 最小判断半径(米)
|
|
18
|
+
*/
|
|
16
19
|
const MIN_RADIUS = 500;
|
|
20
|
+
/**
|
|
21
|
+
* flyToViewer 最大缩放层级
|
|
22
|
+
*/
|
|
17
23
|
const MAX_ZOOM = 18;
|
|
18
24
|
|
|
19
25
|
export class CesiumMap extends MapCombine {
|
|
@@ -255,8 +261,24 @@ export class CesiumMap extends MapCombine {
|
|
|
255
261
|
* @param points
|
|
256
262
|
* @param opt
|
|
257
263
|
* @param {Array<number> = [0,0,0,0]} opt.avoid 距离边框的内边距,顺序:上、下、左、右
|
|
264
|
+
* @param {Array<number> = [0,0,0,0]} opt.minRadius flyToViewer 最小范围(米)
|
|
265
|
+
* @param {Array<number> = [0,0,0,0]} opt.maxZoom flyToViewer 最大缩放层级
|
|
258
266
|
*/
|
|
259
|
-
flyToViewer(
|
|
267
|
+
flyToViewer(
|
|
268
|
+
points,
|
|
269
|
+
opt = {
|
|
270
|
+
avoid: [0, 0, 0, 0],
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* flyToViewer 最小判断半径(米)
|
|
274
|
+
*/
|
|
275
|
+
minRadius: MIN_RADIUS,
|
|
276
|
+
/**
|
|
277
|
+
* flyToViewer 最大缩放层级
|
|
278
|
+
*/
|
|
279
|
+
maxZoom: MAX_ZOOM,
|
|
280
|
+
},
|
|
281
|
+
) {
|
|
260
282
|
if (points?.length === 0) {
|
|
261
283
|
return this.flyTo(points[0], opt);
|
|
262
284
|
}
|
|
@@ -278,7 +300,7 @@ export class CesiumMap extends MapCombine {
|
|
|
278
300
|
|
|
279
301
|
let destination = rectangle;
|
|
280
302
|
// 点位距离小于指定范围使用固定高度
|
|
281
|
-
if (radius < MIN_RADIUS) {
|
|
303
|
+
if (radius < MIN_RADIUS || (opt?.minRadius && radius < opt.minRadius)) {
|
|
282
304
|
const center = Cesium.Rectangle.center(rectangle);
|
|
283
305
|
destination = Cesium.Cartesian3.fromRadians(
|
|
284
306
|
center.longitude,
|