@aibee/crc-bmap 0.0.65 → 0.0.67
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 +271 -33
- 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 +10 -1
- package/lib/src/config.d.ts +3 -0
- package/lib/src/context.d.ts +2 -1
- 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 +20 -0
- package/lib/src/utils/camera-bound.d.ts +37 -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/src/bmap.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventDispatcher, Object3D, Vector3 } from "three";
|
|
2
2
|
import { Context } from "./context";
|
|
3
3
|
import { Config } from './config';
|
|
4
|
-
import { Graphic, HeatmapDataParam, PoiOptionsParam } from "./elements";
|
|
4
|
+
import { Graphic, HeatmapDataParam, ModelOptions, PoiOptionsParam } from "./elements";
|
|
5
5
|
import { GraphicInfo, GraphicOptions } from "./types";
|
|
6
6
|
export interface LoadQuery {
|
|
7
7
|
brand: string;
|
|
@@ -47,6 +47,7 @@ export declare class BMap extends EventDispatcher<BmapEventMap> {
|
|
|
47
47
|
private createFloor;
|
|
48
48
|
switchFloor({ brand, project, phase, building, floor, ts, resource_type_list }: LoadQuery): void;
|
|
49
49
|
onControlChange: () => void;
|
|
50
|
+
addModel(graphic: Graphic, options: ModelOptions): void;
|
|
50
51
|
addHeatmap(data: HeatmapDataParam): import("./elements").HeatmapElement | undefined;
|
|
51
52
|
getLegacyToGraphicMap(): Map<string, Graphic>;
|
|
52
53
|
/**
|
|
@@ -64,6 +65,14 @@ export declare class BMap extends EventDispatcher<BmapEventMap> {
|
|
|
64
65
|
translateElementToCenter(ele: {
|
|
65
66
|
getPosition: () => Vector3;
|
|
66
67
|
}, duration?: number): Promise<unknown>;
|
|
68
|
+
/**
|
|
69
|
+
* 移动相机位置让选中的元素居中显示
|
|
70
|
+
* @param ele { Graphic | Poi }
|
|
71
|
+
* @param duration
|
|
72
|
+
*/
|
|
73
|
+
translateElementToCenterX(ele: {
|
|
74
|
+
getPosition: () => Vector3;
|
|
75
|
+
}, duration?: number): Promise<unknown>;
|
|
67
76
|
/**
|
|
68
77
|
* 获取物体的屏幕坐标
|
|
69
78
|
*/
|
package/lib/src/config.d.ts
CHANGED
|
@@ -49,6 +49,9 @@ export interface Config {
|
|
|
49
49
|
graphic: {
|
|
50
50
|
fillOpacity: number;
|
|
51
51
|
};
|
|
52
|
+
cameraBound: {
|
|
53
|
+
padding: [number, number, number, number];
|
|
54
|
+
};
|
|
52
55
|
}
|
|
53
56
|
export declare const defaultConfig: Config;
|
|
54
57
|
export declare function getConfig(config: Partial<Config>): Config;
|
package/lib/src/context.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Config } from "./config";
|
|
|
7
7
|
import { Selection } from "./operations/selection/selection";
|
|
8
8
|
import { HoverHelper } from "./operations";
|
|
9
9
|
import { MaterialFactory } from "./factory";
|
|
10
|
+
import { CameraBound } from "./utils/camera-bound";
|
|
10
11
|
export interface ContextEventMap {
|
|
11
12
|
update: {};
|
|
12
13
|
"graphic-click": {
|
|
@@ -58,7 +59,7 @@ export declare class Context extends EventDispatcher<ContextEventMap> {
|
|
|
58
59
|
hoverHelper: HoverHelper;
|
|
59
60
|
private basicRatio?;
|
|
60
61
|
materialFactory: MaterialFactory;
|
|
61
|
-
|
|
62
|
+
cameraBound: CameraBound;
|
|
62
63
|
clientSize: {
|
|
63
64
|
width: number;
|
|
64
65
|
height: number;
|
|
@@ -6,6 +6,7 @@ import { Graphic, GraphicOptionsParam } from "./graphic";
|
|
|
6
6
|
import { Shadow } from "./shadow";
|
|
7
7
|
import { PoiOptionsParam } from "./poi";
|
|
8
8
|
import { HeatmapDataParam, HeatmapElement } from './heatmap';
|
|
9
|
+
import { Model, ModelOptions } from "./model";
|
|
9
10
|
export declare class Floor extends Object3D {
|
|
10
11
|
context: Context;
|
|
11
12
|
graphicLayer: GraphicLayer;
|
|
@@ -14,6 +15,7 @@ export declare class Floor extends Object3D {
|
|
|
14
15
|
shadow: Shadow;
|
|
15
16
|
heatmap?: HeatmapElement;
|
|
16
17
|
groundUpper: Object3D<import("three").Object3DEventMap>;
|
|
18
|
+
models: Object3D<import("three").Object3DEventMap>;
|
|
17
19
|
private groundMaxHeight;
|
|
18
20
|
constructor(context: Context);
|
|
19
21
|
createGround(options: GraphicOptionsParam): void;
|
|
@@ -21,6 +23,7 @@ export declare class Floor extends Object3D {
|
|
|
21
23
|
changeGroundMaxHeight(): void;
|
|
22
24
|
get hasElement(): boolean;
|
|
23
25
|
getCenter(): Vector3;
|
|
26
|
+
addModel(options: ModelOptions): Model;
|
|
24
27
|
addShadow(): void;
|
|
25
28
|
addGraphic(graphicOptions: GraphicOptionsParam): Graphic;
|
|
26
29
|
addPoi(poiOptions: PoiOptionsParam): import("./poi").Poi;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Object3D, Vector3 } from "three";
|
|
2
|
+
import { Context } from "../context";
|
|
3
|
+
import { Overlay } from "./overlay";
|
|
4
|
+
import { GLTF } from "three/examples/jsm/loaders/GLTFLoader";
|
|
5
|
+
export interface ModelOptions {
|
|
6
|
+
modelUrl: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
icon_size?: [number, number];
|
|
9
|
+
position?: Vector3;
|
|
10
|
+
}
|
|
11
|
+
export declare class Model extends Object3D {
|
|
12
|
+
context: Context;
|
|
13
|
+
private options;
|
|
14
|
+
overlay: Overlay | null;
|
|
15
|
+
model: GLTF | null;
|
|
16
|
+
constructor(context: Context, options: ModelOptions);
|
|
17
|
+
loadModel(): Promise<void>;
|
|
18
|
+
initOverlay(): void;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Context } from "../context";
|
|
2
|
+
export declare class CameraBound {
|
|
3
|
+
private context;
|
|
4
|
+
private prevCamera;
|
|
5
|
+
private enable;
|
|
6
|
+
constructor(context: Context);
|
|
7
|
+
setEnable(enable: boolean): void;
|
|
8
|
+
changePrevCamera(): void;
|
|
9
|
+
backToPrevCamera(): void;
|
|
10
|
+
registryEvent(): void;
|
|
11
|
+
unRegistryEvent(): void;
|
|
12
|
+
getCurFloorScreenPosition(): {
|
|
13
|
+
leftBottom: {
|
|
14
|
+
x: number;
|
|
15
|
+
y: number;
|
|
16
|
+
};
|
|
17
|
+
rightTop: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
} | null;
|
|
22
|
+
/**
|
|
23
|
+
* 检测地图是不是在显示范围
|
|
24
|
+
* @param leftBottom
|
|
25
|
+
* @param rightTop
|
|
26
|
+
* @returns { boolean }
|
|
27
|
+
*/
|
|
28
|
+
checkDistanceToScreenEdge(leftBottom: {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
}, rightTop: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}): boolean;
|
|
35
|
+
onCameraChange: () => void;
|
|
36
|
+
dispose(): void;
|
|
37
|
+
}
|
|
@@ -22,4 +22,9 @@ type Position = {
|
|
|
22
22
|
y: number;
|
|
23
23
|
};
|
|
24
24
|
export declare function isContain(point: Position, start: Position, end: Position): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* 获取最长边的方向
|
|
27
|
+
* @param cds
|
|
28
|
+
*/
|
|
29
|
+
export declare function getLongestSideDir(cds: Coordinate[]): Vector3;
|
|
25
30
|
export {};
|
package/lib/src/utils/index.d.ts
CHANGED