@aibee/crc-bmap 0.0.64 → 0.0.66
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/example/src/main.ts +2 -2
- package/example/vite.config.ts +1 -1
- package/lib/bmap.cjs.min.js +1 -1
- package/lib/bmap.cjs.min.js.map +4 -4
- package/lib/bmap.esm.js +175 -36
- package/lib/bmap.esm.js.map +4 -4
- package/lib/bmap.esm.min.js +1 -1
- package/lib/bmap.esm.min.js.map +4 -4
- package/lib/bmap.min.js +1 -1
- package/lib/bmap.min.js.map +4 -4
- package/lib/src/bmap.d.ts +11 -0
- package/lib/src/context.d.ts +2 -2
- package/lib/src/elements/floor.d.ts +3 -0
- package/lib/src/elements/index.d.ts +1 -0
- package/lib/src/elements/model.d.ts +18 -0
- package/lib/src/utils/coordinate.d.ts +5 -0
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/model.d.ts +8 -0
- package/package.json +1 -1
package/lib/bmap.esm.js
CHANGED
|
@@ -44,7 +44,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
// src/bmap.ts
|
|
47
|
-
import { EventDispatcher as EventDispatcher7 } from "three";
|
|
47
|
+
import { EventDispatcher as EventDispatcher7, Vector3 as Vector312 } from "three";
|
|
48
48
|
|
|
49
49
|
// src/utils/timer.ts
|
|
50
50
|
var Timer = class {
|
|
@@ -277,6 +277,7 @@ function clearCanvas() {
|
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
// src/utils/coordinate.ts
|
|
280
|
+
import { Vector3 } from "three";
|
|
280
281
|
import { point, featureCollection, center } from "@turf/turf";
|
|
281
282
|
function vector3ToDevice(vector, camera, w, h) {
|
|
282
283
|
const _vector = vector.clone().project(camera);
|
|
@@ -294,6 +295,19 @@ function getCenter(coordinates) {
|
|
|
294
295
|
function isContain(point3, start, end) {
|
|
295
296
|
return point3.x >= start.x && point3.x <= end.x && point3.y >= start.y && point3.y <= end.y;
|
|
296
297
|
}
|
|
298
|
+
function getLongestSideDir(cds) {
|
|
299
|
+
let maxDistance = 0;
|
|
300
|
+
let dir = new Vector3();
|
|
301
|
+
for (let i = 1; i < cds.length; i++) {
|
|
302
|
+
const point_0 = new Vector3(cds[i - 1][0], cds[i - 1][1], 0);
|
|
303
|
+
const point_1 = new Vector3(cds[i][0], cds[i][1], 0);
|
|
304
|
+
const distance = point_1.distanceTo(point_0);
|
|
305
|
+
if (distance > maxDistance) {
|
|
306
|
+
dir = point_1.clone().sub(point_0).normalize();
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return dir;
|
|
310
|
+
}
|
|
297
311
|
|
|
298
312
|
// src/utils/proxy.ts
|
|
299
313
|
function proxyOptions(target, master) {
|
|
@@ -396,14 +410,42 @@ function addAlphaToHexColor(hexColor, alpha) {
|
|
|
396
410
|
return newHexColor;
|
|
397
411
|
}
|
|
398
412
|
|
|
413
|
+
// src/utils/model.ts
|
|
414
|
+
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
|
|
415
|
+
function createLoader() {
|
|
416
|
+
const loader2 = new GLTFLoader();
|
|
417
|
+
return loader2;
|
|
418
|
+
}
|
|
419
|
+
var loader = null;
|
|
420
|
+
var modelMap = /* @__PURE__ */ new Map();
|
|
421
|
+
function loadModel(url) {
|
|
422
|
+
if (modelMap.has(url)) {
|
|
423
|
+
return modelMap.get(url);
|
|
424
|
+
}
|
|
425
|
+
if (!loader) {
|
|
426
|
+
loader = createLoader();
|
|
427
|
+
}
|
|
428
|
+
const p = new Promise((resolve, reject) => {
|
|
429
|
+
loader.load(url, (gltf) => {
|
|
430
|
+
resolve(gltf);
|
|
431
|
+
}, void 0, reject);
|
|
432
|
+
});
|
|
433
|
+
modelMap.set(url, p);
|
|
434
|
+
return p;
|
|
435
|
+
}
|
|
436
|
+
function disposeLoader() {
|
|
437
|
+
loader = null;
|
|
438
|
+
modelMap.clear();
|
|
439
|
+
}
|
|
440
|
+
|
|
399
441
|
// src/context.ts
|
|
400
442
|
import {
|
|
401
443
|
EventDispatcher as EventDispatcher6,
|
|
402
444
|
Box2,
|
|
403
|
-
Vector3 as
|
|
445
|
+
Vector3 as Vector311,
|
|
404
446
|
Vector2 as Vector23,
|
|
405
447
|
Raycaster as Raycaster3,
|
|
406
|
-
Box3 as
|
|
448
|
+
Box3 as Box37,
|
|
407
449
|
Color as Color4,
|
|
408
450
|
AmbientLight as AmbientLight2
|
|
409
451
|
} from "three";
|
|
@@ -418,7 +460,7 @@ import {
|
|
|
418
460
|
ExtrudeGeometry,
|
|
419
461
|
Mesh,
|
|
420
462
|
Box3,
|
|
421
|
-
Vector3,
|
|
463
|
+
Vector3 as Vector32,
|
|
422
464
|
BufferGeometry,
|
|
423
465
|
LineSegments
|
|
424
466
|
} from "three";
|
|
@@ -529,7 +571,7 @@ var Graphic = class extends Object3D {
|
|
|
529
571
|
if (this.options.geometry.type === "point") {
|
|
530
572
|
return this.position.clone();
|
|
531
573
|
}
|
|
532
|
-
const center2 = new
|
|
574
|
+
const center2 = new Vector32();
|
|
533
575
|
const box = new Box3();
|
|
534
576
|
box.setFromObject(this);
|
|
535
577
|
box.getCenter(center2);
|
|
@@ -537,10 +579,10 @@ var Graphic = class extends Object3D {
|
|
|
537
579
|
}
|
|
538
580
|
getSize() {
|
|
539
581
|
if (this.options.geometry.type === "point") {
|
|
540
|
-
return new
|
|
582
|
+
return new Vector32(0, 0, 0);
|
|
541
583
|
}
|
|
542
584
|
const box = new Box3();
|
|
543
|
-
const size = new
|
|
585
|
+
const size = new Vector32();
|
|
544
586
|
box.setFromObject(this);
|
|
545
587
|
box.getSize(size);
|
|
546
588
|
return size;
|
|
@@ -606,8 +648,8 @@ var Graphic = class extends Object3D {
|
|
|
606
648
|
for (let i = 0; i < curCds.length; i++) {
|
|
607
649
|
const cur = curCds[i];
|
|
608
650
|
const next = i + 1 === curCds.length ? curCds[0] : curCds[i + 1];
|
|
609
|
-
points.push(new
|
|
610
|
-
points.push(new
|
|
651
|
+
points.push(new Vector32(cur[0], cur[1], height));
|
|
652
|
+
points.push(new Vector32(next[0], next[1], height));
|
|
611
653
|
}
|
|
612
654
|
}
|
|
613
655
|
return points;
|
|
@@ -724,10 +766,10 @@ var Shadow = class extends Object3D2 {
|
|
|
724
766
|
};
|
|
725
767
|
|
|
726
768
|
// src/elements/poi.ts
|
|
727
|
-
import { EventDispatcher as EventDispatcher2, Vector3 as
|
|
769
|
+
import { EventDispatcher as EventDispatcher2, Vector3 as Vector35 } from "three";
|
|
728
770
|
|
|
729
771
|
// src/elements/overlay.ts
|
|
730
|
-
import { Box3 as Box32, EventDispatcher, Vector3 as
|
|
772
|
+
import { Box3 as Box32, EventDispatcher, Vector3 as Vector34 } from "three";
|
|
731
773
|
var defaultOptions2 = {
|
|
732
774
|
autoUpdate: true
|
|
733
775
|
};
|
|
@@ -737,7 +779,7 @@ var Overlay = class extends EventDispatcher {
|
|
|
737
779
|
this.context = context;
|
|
738
780
|
__publicField(this, "div");
|
|
739
781
|
__publicField(this, "element");
|
|
740
|
-
__publicField(this, "position", new
|
|
782
|
+
__publicField(this, "position", new Vector34());
|
|
741
783
|
__publicField(this, "clientPos", { x: 0, y: 0 });
|
|
742
784
|
__publicField(this, "visible", true);
|
|
743
785
|
__publicField(this, "options");
|
|
@@ -788,7 +830,7 @@ var Overlay = class extends EventDispatcher {
|
|
|
788
830
|
return this.element.getPosition();
|
|
789
831
|
}
|
|
790
832
|
const box = new Box32().setFromObject(this.element);
|
|
791
|
-
const center2 = box.getCenter(new
|
|
833
|
+
const center2 = box.getCenter(new Vector34());
|
|
792
834
|
return center2;
|
|
793
835
|
} else {
|
|
794
836
|
return this.position;
|
|
@@ -837,7 +879,7 @@ var Poi = class extends EventDispatcher2 {
|
|
|
837
879
|
__publicField(this, "options");
|
|
838
880
|
__publicField(this, "visible", true);
|
|
839
881
|
__publicField(this, "size", { width: 0, height: 0 });
|
|
840
|
-
__publicField(this, "position", new
|
|
882
|
+
__publicField(this, "position", new Vector35());
|
|
841
883
|
__publicField(this, "_changePosition", () => {
|
|
842
884
|
});
|
|
843
885
|
this.options = proxyOptions(__spreadValues(__spreadValues({}, defaultOptions3), options), this);
|
|
@@ -1031,10 +1073,10 @@ var Poi = class extends EventDispatcher2 {
|
|
|
1031
1073
|
};
|
|
1032
1074
|
|
|
1033
1075
|
// src/elements/floor.ts
|
|
1034
|
-
import { Box3 as
|
|
1076
|
+
import { Box3 as Box35, Object3D as Object3D8, Vector3 as Vector38 } from "three";
|
|
1035
1077
|
|
|
1036
1078
|
// src/layer/graphic-layer.ts
|
|
1037
|
-
import { Box3 as Box33, Vector3 as
|
|
1079
|
+
import { Box3 as Box33, Vector3 as Vector36 } from "three";
|
|
1038
1080
|
|
|
1039
1081
|
// src/layer/layer.ts
|
|
1040
1082
|
import { Object3D as Object3D5 } from "three";
|
|
@@ -1057,7 +1099,7 @@ var GraphicLayer = class extends Layer {
|
|
|
1057
1099
|
}
|
|
1058
1100
|
getCenter() {
|
|
1059
1101
|
const box = new Box33().setFromObject(this);
|
|
1060
|
-
return box.getCenter(new
|
|
1102
|
+
return box.getCenter(new Vector36());
|
|
1061
1103
|
}
|
|
1062
1104
|
createGraphic(options) {
|
|
1063
1105
|
const graphic = new Graphic(this.context, options);
|
|
@@ -1337,8 +1379,54 @@ var HeatmapElement = class extends Object3D6 {
|
|
|
1337
1379
|
}
|
|
1338
1380
|
};
|
|
1339
1381
|
|
|
1382
|
+
// src/elements/model.ts
|
|
1383
|
+
import { Box3 as Box34, Object3D as Object3D7, Vector3 as Vector37 } from "three";
|
|
1384
|
+
var Model = class extends Object3D7 {
|
|
1385
|
+
constructor(context, options) {
|
|
1386
|
+
super();
|
|
1387
|
+
this.context = context;
|
|
1388
|
+
this.options = options;
|
|
1389
|
+
__publicField(this, "overlay", null);
|
|
1390
|
+
__publicField(this, "model", null);
|
|
1391
|
+
this.loadModel();
|
|
1392
|
+
}
|
|
1393
|
+
loadModel() {
|
|
1394
|
+
return __async(this, null, function* () {
|
|
1395
|
+
const object = yield loadModel(this.options.modelUrl);
|
|
1396
|
+
console.log(object);
|
|
1397
|
+
object.scene.rotation.set(Math.PI / 2, Math.PI / 2, 0);
|
|
1398
|
+
this.add(object.scene);
|
|
1399
|
+
this.model = object;
|
|
1400
|
+
this.initOverlay();
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
initOverlay() {
|
|
1404
|
+
if (!this.options.icon) {
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1407
|
+
if (this.model) {
|
|
1408
|
+
const box = new Box34().setFromObject(this.model.scene);
|
|
1409
|
+
const center2 = box.getCenter(new Vector37());
|
|
1410
|
+
const overlay = new Overlay(this.context, { autoUpdate: true });
|
|
1411
|
+
overlay.position = center2;
|
|
1412
|
+
const img = document.createElement("img");
|
|
1413
|
+
img.src = this.options.icon;
|
|
1414
|
+
overlay.div.appendChild(img);
|
|
1415
|
+
this.overlay = overlay;
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
dispose() {
|
|
1419
|
+
dispose(this);
|
|
1420
|
+
this.model = null;
|
|
1421
|
+
if (this.overlay) {
|
|
1422
|
+
this.overlay.dispose();
|
|
1423
|
+
this.overlay = null;
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
};
|
|
1427
|
+
|
|
1340
1428
|
// src/elements/floor.ts
|
|
1341
|
-
var Floor = class extends
|
|
1429
|
+
var Floor = class extends Object3D8 {
|
|
1342
1430
|
constructor(context) {
|
|
1343
1431
|
super();
|
|
1344
1432
|
this.context = context;
|
|
@@ -1347,13 +1435,15 @@ var Floor = class extends Object3D7 {
|
|
|
1347
1435
|
__publicField(this, "grounds", /* @__PURE__ */ new Set());
|
|
1348
1436
|
__publicField(this, "shadow", new Shadow());
|
|
1349
1437
|
__publicField(this, "heatmap");
|
|
1350
|
-
__publicField(this, "groundUpper", new
|
|
1438
|
+
__publicField(this, "groundUpper", new Object3D8());
|
|
1439
|
+
__publicField(this, "models", new Object3D8());
|
|
1351
1440
|
__publicField(this, "groundMaxHeight", 0);
|
|
1352
1441
|
this.graphicLayer = new GraphicLayer(this.context);
|
|
1353
1442
|
this.poiLayer = new PoiLayer(this.context);
|
|
1354
1443
|
this.groundUpper.add(this.graphicLayer);
|
|
1355
1444
|
this.groundUpper.add(this.poiLayer);
|
|
1356
1445
|
this.add(this.groundUpper);
|
|
1446
|
+
this.add(this.models);
|
|
1357
1447
|
}
|
|
1358
1448
|
createGround(options) {
|
|
1359
1449
|
const ground = new Graphic(this.context, options);
|
|
@@ -1373,17 +1463,23 @@ var Floor = class extends Object3D7 {
|
|
|
1373
1463
|
const grounds = Array.from(this.grounds);
|
|
1374
1464
|
this.groundMaxHeight = this.grounds.size > 0 ? Math.max(...grounds.map((ground) => ground.options.height + ground.options.airHeight + ground.options.deltaHeight)) : 0;
|
|
1375
1465
|
this.graphicLayer.position.z = this.groundMaxHeight;
|
|
1466
|
+
this.models.position.z = this.groundMaxHeight;
|
|
1376
1467
|
}
|
|
1377
1468
|
get hasElement() {
|
|
1378
1469
|
return !!(this.grounds.size || this.graphicLayer.children.length);
|
|
1379
1470
|
}
|
|
1380
1471
|
getCenter() {
|
|
1381
|
-
return new
|
|
1472
|
+
return new Box35().setFromObject(this.groundUpper).getCenter(new Vector38());
|
|
1473
|
+
}
|
|
1474
|
+
addModel(options) {
|
|
1475
|
+
const model = new Model(this.context, options);
|
|
1476
|
+
this.models.add(model);
|
|
1477
|
+
return model;
|
|
1382
1478
|
}
|
|
1383
1479
|
addShadow() {
|
|
1384
|
-
const box = new
|
|
1385
|
-
const center2 = box.getCenter(new
|
|
1386
|
-
const size = box.getSize(new
|
|
1480
|
+
const box = new Box35().setFromObject(this.groundUpper);
|
|
1481
|
+
const center2 = box.getCenter(new Vector38());
|
|
1482
|
+
const size = box.getSize(new Vector38());
|
|
1387
1483
|
this.shadow.setPosition(center2);
|
|
1388
1484
|
this.shadow.changeLightCamera(size);
|
|
1389
1485
|
this.add(this.shadow);
|
|
@@ -1400,7 +1496,7 @@ var Floor = class extends Object3D7 {
|
|
|
1400
1496
|
this.add(this.heatmap);
|
|
1401
1497
|
}
|
|
1402
1498
|
this.heatmap.loadData(data);
|
|
1403
|
-
const box = new
|
|
1499
|
+
const box = new Box35().setFromObject(this.graphicLayer);
|
|
1404
1500
|
this.heatmap.position.setZ(box.max.z);
|
|
1405
1501
|
return this.heatmap;
|
|
1406
1502
|
}
|
|
@@ -1425,12 +1521,14 @@ var Floor = class extends Object3D7 {
|
|
|
1425
1521
|
this.grounds.forEach((ground) => ground.dispose());
|
|
1426
1522
|
(_a = this.heatmap) == null ? void 0 : _a.dispose();
|
|
1427
1523
|
this.groundUpper.clear();
|
|
1524
|
+
this.models.children.forEach((model) => model.dispose());
|
|
1525
|
+
this.models.clear();
|
|
1428
1526
|
this.clear();
|
|
1429
1527
|
}
|
|
1430
1528
|
};
|
|
1431
1529
|
|
|
1432
1530
|
// src/elements/base-svg.ts
|
|
1433
|
-
import { EventDispatcher as EventDispatcher3, Vector3 as
|
|
1531
|
+
import { EventDispatcher as EventDispatcher3, Vector3 as Vector39 } from "three";
|
|
1434
1532
|
var BaseSvg = class extends EventDispatcher3 {
|
|
1435
1533
|
constructor(context) {
|
|
1436
1534
|
super();
|
|
@@ -1468,7 +1566,7 @@ var BaseSvg = class extends EventDispatcher3 {
|
|
|
1468
1566
|
const { clientWidth, clientHeight } = renderer.domElement;
|
|
1469
1567
|
const nx = x / clientWidth * 2 - 1;
|
|
1470
1568
|
const ny = 1 - y / clientHeight * 2;
|
|
1471
|
-
const v = new
|
|
1569
|
+
const v = new Vector39(nx, ny, 0);
|
|
1472
1570
|
return v.unproject(camera);
|
|
1473
1571
|
}
|
|
1474
1572
|
getSvgCoordinate(vector) {
|
|
@@ -1722,7 +1820,7 @@ var SvgPolygon = class extends BaseSvg {
|
|
|
1722
1820
|
};
|
|
1723
1821
|
|
|
1724
1822
|
// src/elements/select-box.ts
|
|
1725
|
-
import { Box3 as
|
|
1823
|
+
import { Box3 as Box36 } from "three";
|
|
1726
1824
|
var SelectBox = class extends BaseSvg {
|
|
1727
1825
|
constructor(context) {
|
|
1728
1826
|
super(context);
|
|
@@ -1741,7 +1839,7 @@ var SelectBox = class extends BaseSvg {
|
|
|
1741
1839
|
setRectPosition(this.centerRect[i], 0, 0, 0, 0);
|
|
1742
1840
|
}
|
|
1743
1841
|
} else {
|
|
1744
|
-
const box = new
|
|
1842
|
+
const box = new Box36().setFromObject(this.graphic);
|
|
1745
1843
|
const { camera, container: { clientWidth: w, clientHeight: h } } = this.context;
|
|
1746
1844
|
const { min, max } = box;
|
|
1747
1845
|
const leftBottom = vector3ToDevice(min, camera, w, h);
|
|
@@ -2293,7 +2391,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
2293
2391
|
/**
|
|
2294
2392
|
* 获取两个点之间的像素数
|
|
2295
2393
|
*/
|
|
2296
|
-
getRatio(point1 = new
|
|
2394
|
+
getRatio(point1 = new Vector311(0, 0, 0), point22 = new Vector311(100, 0, 0)) {
|
|
2297
2395
|
const { clientWidth, clientHeight } = this.container;
|
|
2298
2396
|
const device1 = vector3ToDevice(point1, this.camera, clientWidth, clientHeight);
|
|
2299
2397
|
const device2 = vector3ToDevice(point22, this.camera, clientWidth, clientHeight);
|
|
@@ -2433,7 +2531,7 @@ var Context = class extends EventDispatcher6 {
|
|
|
2433
2531
|
);
|
|
2434
2532
|
}
|
|
2435
2533
|
getCameraLookAt() {
|
|
2436
|
-
return new
|
|
2534
|
+
return new Vector311().subVectors(this.control.target, this.camera.position);
|
|
2437
2535
|
}
|
|
2438
2536
|
/**
|
|
2439
2537
|
* 按照一个中心点设置相机的放大缩小
|
|
@@ -2485,12 +2583,14 @@ var Context = class extends EventDispatcher6 {
|
|
|
2485
2583
|
* @param duration
|
|
2486
2584
|
* @returns
|
|
2487
2585
|
*/
|
|
2488
|
-
fitCameraToObject(object, padding = [20, 20, 20, 20], duration = 500) {
|
|
2586
|
+
fitCameraToObject(object, padding = [20, 20, 20, 20], duration = 500, force2DView = true) {
|
|
2489
2587
|
const [top, right, bottom, left] = padding;
|
|
2490
2588
|
const { clientSize: { width, height } } = this;
|
|
2491
2589
|
const polar = this.control.getPolarAngle();
|
|
2492
|
-
|
|
2493
|
-
|
|
2590
|
+
if (force2DView) {
|
|
2591
|
+
this.setPolarAngle(0, 0);
|
|
2592
|
+
}
|
|
2593
|
+
const boundingBox = new Box37().setFromObject(object);
|
|
2494
2594
|
this.setPolarAngle(polar, 0);
|
|
2495
2595
|
const { max, min } = boundingBox;
|
|
2496
2596
|
const max2d = vector3ToDevice(max, this.camera, width, height);
|
|
@@ -2503,12 +2603,12 @@ var Context = class extends EventDispatcher6 {
|
|
|
2503
2603
|
const xScale = (width - right - left) / size.x;
|
|
2504
2604
|
const yScale = (height - top - bottom) / size.y;
|
|
2505
2605
|
const scale = Math.min(xScale, yScale);
|
|
2506
|
-
const center2 = new
|
|
2606
|
+
const center2 = new Vector311((max.x + min.x) / 2, (max.y + min.y) / 2, max.z);
|
|
2507
2607
|
return this.setZoom(scale * this.camera.zoom, center2, duration);
|
|
2508
2608
|
}
|
|
2509
|
-
fitCameraToGround(padding = [20, 20, 20, 20], duration = 500) {
|
|
2609
|
+
fitCameraToGround(padding = [20, 20, 20, 20], duration = 500, force2DView = true) {
|
|
2510
2610
|
if (this.currentFloor && this.currentFloor.hasElement) {
|
|
2511
|
-
return this.fitCameraToObject(this.currentFloor.groundUpper, padding, duration);
|
|
2611
|
+
return this.fitCameraToObject(this.currentFloor.groundUpper, padding, duration, force2DView);
|
|
2512
2612
|
} else {
|
|
2513
2613
|
return Promise.resolve(false);
|
|
2514
2614
|
}
|
|
@@ -2850,6 +2950,9 @@ var BMap = class extends EventDispatcher7 {
|
|
|
2850
2950
|
this.context.control.minZoom = this.basicZoom;
|
|
2851
2951
|
this.context.control.maxZoom = this.basicZoom * 25;
|
|
2852
2952
|
this.context.control.addEventListener("change", this.onControlChange);
|
|
2953
|
+
if (this.type === "3d") {
|
|
2954
|
+
this.context.fitCameraToGround([80, 20, 80, 20], 0, false);
|
|
2955
|
+
}
|
|
2853
2956
|
this.onControlChange();
|
|
2854
2957
|
} else {
|
|
2855
2958
|
console.warn("[switchFloor error] [" + floor + "] \u697C\u5C42\u6CA1\u6709\u6570\u636E");
|
|
@@ -2858,6 +2961,25 @@ var BMap = class extends EventDispatcher7 {
|
|
|
2858
2961
|
console.warn("[switchFloor error] \u6CA1\u6709\u8FD9\u4E2A\u697C\u5C42\uFF0C\u8BF7\u5148\u8C03\u7528load\u65B9\u6CD5\u52A0\u8F7D\u697C\u5C42");
|
|
2859
2962
|
}
|
|
2860
2963
|
}
|
|
2964
|
+
// 扶梯
|
|
2965
|
+
addStaircaseModel(graphic, icon, modelUrl) {
|
|
2966
|
+
var _a;
|
|
2967
|
+
if (graphic.options.geometry.type === "polygon") {
|
|
2968
|
+
const dir = getLongestSideDir(graphic.options.geometry.cds[0]);
|
|
2969
|
+
const model = (_a = this.context.currentFloor) == null ? void 0 : _a.addModel({ icon, modelUrl });
|
|
2970
|
+
if (model) {
|
|
2971
|
+
model.position.copy(graphic.getPosition().setZ(0.1));
|
|
2972
|
+
const angleY = dir.angleTo(new Vector312(0, 1, 0));
|
|
2973
|
+
model.rotateZ(angleY);
|
|
2974
|
+
}
|
|
2975
|
+
}
|
|
2976
|
+
}
|
|
2977
|
+
// 电梯
|
|
2978
|
+
addLiftModel(graphic) {
|
|
2979
|
+
}
|
|
2980
|
+
// 楼梯
|
|
2981
|
+
addStairwayModel(graphic) {
|
|
2982
|
+
}
|
|
2861
2983
|
addHeatmap(data) {
|
|
2862
2984
|
var _a;
|
|
2863
2985
|
return (_a = this.context.currentFloor) == null ? void 0 : _a.addHeatmap(data);
|
|
@@ -2900,6 +3022,18 @@ var BMap = class extends EventDispatcher7 {
|
|
|
2900
3022
|
const position = ele.getPosition();
|
|
2901
3023
|
return this.context.setCameraPosition(position, duration);
|
|
2902
3024
|
}
|
|
3025
|
+
/**
|
|
3026
|
+
* 移动相机位置让选中的元素居中显示
|
|
3027
|
+
* @param ele { Graphic | Poi }
|
|
3028
|
+
* @param duration
|
|
3029
|
+
*/
|
|
3030
|
+
translateElementToCenterX(ele, duration = 500) {
|
|
3031
|
+
const { y, z } = this.context.camera.position;
|
|
3032
|
+
const position = ele.getPosition();
|
|
3033
|
+
position.setY(y);
|
|
3034
|
+
position.setZ(z);
|
|
3035
|
+
return this.context.setCameraPosition(position, duration);
|
|
3036
|
+
}
|
|
2903
3037
|
/**
|
|
2904
3038
|
* 获取物体的屏幕坐标
|
|
2905
3039
|
*/
|
|
@@ -3114,6 +3248,7 @@ var BMap = class extends EventDispatcher7 {
|
|
|
3114
3248
|
this.buildingGroundMap.clear();
|
|
3115
3249
|
clearTextTexture();
|
|
3116
3250
|
clearCanvas();
|
|
3251
|
+
disposeLoader();
|
|
3117
3252
|
this.unRegistryEvent();
|
|
3118
3253
|
}
|
|
3119
3254
|
};
|
|
@@ -3128,6 +3263,7 @@ export {
|
|
|
3128
3263
|
HoverHelper,
|
|
3129
3264
|
Layer,
|
|
3130
3265
|
MapTypePolar,
|
|
3266
|
+
Model,
|
|
3131
3267
|
Overlay,
|
|
3132
3268
|
Poi,
|
|
3133
3269
|
PoiLayer,
|
|
@@ -3148,8 +3284,10 @@ export {
|
|
|
3148
3284
|
createSvgElement,
|
|
3149
3285
|
defaultConfig,
|
|
3150
3286
|
dispose,
|
|
3287
|
+
disposeLoader,
|
|
3151
3288
|
getCenter,
|
|
3152
3289
|
getConfig,
|
|
3290
|
+
getLongestSideDir,
|
|
3153
3291
|
getTextureByText,
|
|
3154
3292
|
hasChinese,
|
|
3155
3293
|
initCamera,
|
|
@@ -3161,6 +3299,7 @@ export {
|
|
|
3161
3299
|
initScene,
|
|
3162
3300
|
initShape,
|
|
3163
3301
|
isContain,
|
|
3302
|
+
loadModel,
|
|
3164
3303
|
proxyOptions,
|
|
3165
3304
|
setCirclePosition,
|
|
3166
3305
|
setLineStartEnd,
|