@aibee/crc-bmap 0.0.93 → 0.0.95
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/a.json +5688 -0
- package/example/src/main.ts +392 -328
- package/example/vite.config.ts +1 -1
- package/lib/bmap.cjs.min.js +21 -3
- package/lib/bmap.cjs.min.js.map +4 -4
- package/lib/bmap.esm.js +1100 -903
- package/lib/bmap.esm.js.map +4 -4
- package/lib/bmap.esm.min.js +21 -3
- package/lib/bmap.esm.min.js.map +4 -4
- package/lib/bmap.min.js +21 -3
- package/lib/bmap.min.js.map +4 -4
- package/lib/src/api/floor.d.ts +15 -0
- package/lib/src/api/index.d.ts +1 -0
- package/lib/src/bmap.d.ts +18 -18
- package/lib/src/config.d.ts +1 -0
- package/lib/src/elements/floor.d.ts +1 -0
- package/lib/src/elements/poi.d.ts +1 -0
- package/lib/src/index.d.ts +2 -0
- package/lib/src/plugins/base.d.ts +6 -0
- package/lib/src/plugins/equipment/equipment.d.ts +21 -0
- package/lib/src/plugins/equipment/index.d.ts +1 -0
- package/lib/src/plugins/index.d.ts +3 -0
- package/lib/src/plugins/navigation/index.d.ts +1 -0
- package/lib/src/plugins/navigation/navigation.d.ts +9 -0
- package/lib/src/plugins/navigation/path.worker.d.ts +2 -0
- package/lib/src/plugins/split-load/index.d.ts +1 -0
- package/lib/src/plugins/split-load/split-load.d.ts +14 -0
- package/lib/src/types/index.d.ts +7 -0
- package/lib/src/utils/coordinate.d.ts +2 -2
- package/lib/src/utils/event-name.d.ts +4 -0
- package/lib/src/utils/events.d.ts +17 -0
- package/lib/src/utils/index.d.ts +3 -0
- package/lib/src/utils/obj-utils.d.ts +6 -0
- package/package.json +5 -4
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Config } from "../config";
|
|
2
|
+
import { GraphicInfo, LoadQuery } from "../types";
|
|
3
|
+
type BuildingGroundQuery = Omit<LoadQuery, "floor" | "ts" | "resource_type_list">;
|
|
4
|
+
/**
|
|
5
|
+
* 请求楼栋地面
|
|
6
|
+
*/
|
|
7
|
+
export declare function loadBuildingGround({ brand, project }: BuildingGroundQuery, config: Config): Promise<GraphicInfo | null>;
|
|
8
|
+
/**
|
|
9
|
+
* 加载图元
|
|
10
|
+
* @param param0
|
|
11
|
+
* @param config
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadGraphics({ brand, project, floor, ts, resource_type_list, }: LoadQuery, config: Config): Promise<GraphicInfo[]>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './floor';
|
package/lib/src/bmap.d.ts
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { EventDispatcher, Object3D, Vector3 } from "three";
|
|
2
2
|
import { Context } from "./context";
|
|
3
|
-
import { Timer } from "./utils";
|
|
3
|
+
import { Timer, Events, HooksName } from "./utils";
|
|
4
4
|
import { Config } from "./config";
|
|
5
|
-
import { Graphic, HeatmapDataParam, ModelOptions, PoiOptionsParam } from "./elements";
|
|
6
|
-
import { GraphicInfo, GraphicOptions } from "./types";
|
|
7
|
-
|
|
8
|
-
brand: string;
|
|
9
|
-
project: string;
|
|
10
|
-
phase: string;
|
|
11
|
-
building: string;
|
|
12
|
-
floor: string;
|
|
13
|
-
ts: string;
|
|
14
|
-
resource_type_list: string;
|
|
15
|
-
}
|
|
5
|
+
import { Floor, Graphic, HeatmapDataParam, ModelOptions, PoiOptionsParam } from "./elements";
|
|
6
|
+
import { GraphicInfo, GraphicOptions, LoadQuery } from "./types";
|
|
7
|
+
import { Plugin } from "./plugins/base";
|
|
16
8
|
interface BmapEventMap {
|
|
17
9
|
"zoom-change": {
|
|
18
10
|
basicZoom: number;
|
|
@@ -39,15 +31,23 @@ export declare class BMap extends EventDispatcher<BmapEventMap> {
|
|
|
39
31
|
buildingGroundMap: Map<string, GraphicInfo | null>;
|
|
40
32
|
currentBuildGround: GraphicInfo | null;
|
|
41
33
|
private observe;
|
|
34
|
+
event: Events;
|
|
42
35
|
timer: Timer;
|
|
36
|
+
plugins: Plugin[];
|
|
43
37
|
constructor(container: HTMLElement, config?: Partial<Config>);
|
|
44
|
-
|
|
45
|
-
getBuildingKey({ brand, project, phase, building, }: Omit<LoadQuery, "floor" | "ts" | "resource_type_list">): string;
|
|
38
|
+
loadGraphics({ brand, project, floor, ts, resource_type_list, }: LoadQuery): Promise<GraphicInfo[]>;
|
|
46
39
|
private loadBuildingGround;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
40
|
+
load({ brand, project, floor, ts, resource_type_list, }: LoadQuery): Promise<GraphicInfo[] | undefined>;
|
|
41
|
+
transformGraphicData(data: GraphicInfo[], center: [number, number]): void;
|
|
42
|
+
loadEquipment(): void;
|
|
43
|
+
use(plugin: Plugin): void;
|
|
44
|
+
createFloor(data: GraphicInfo[]): {
|
|
45
|
+
curFloor: Floor;
|
|
46
|
+
graphics: Graphic[];
|
|
47
|
+
};
|
|
48
|
+
triggerHooks(hooks: HooksName, ...args: any[]): void;
|
|
49
|
+
switchFloor({ brand, project, floor, ts, resource_type_list, }: LoadQuery): void;
|
|
50
|
+
initialFloorCamera(): void;
|
|
51
51
|
onControlChange: () => void;
|
|
52
52
|
addModel(graphic: Graphic, options: ModelOptions): void;
|
|
53
53
|
addHeatmap(data: HeatmapDataParam): import("./elements").HeatmapElement | undefined;
|
package/lib/src/config.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ export declare class Floor extends Object3D {
|
|
|
18
18
|
models: Object3D<import("three").Object3DEventMap>;
|
|
19
19
|
modelMap: Map<any, any>;
|
|
20
20
|
private groundMaxHeight;
|
|
21
|
+
name: string;
|
|
21
22
|
constructor(context: Context);
|
|
22
23
|
getPosition(): Vector3;
|
|
23
24
|
createGround(options: GraphicOptionsParam): void;
|
|
@@ -50,6 +50,7 @@ export declare class Poi extends EventDispatcher<PoiEventMap> {
|
|
|
50
50
|
position: Vector3;
|
|
51
51
|
userData: {};
|
|
52
52
|
showTextStatus: boolean;
|
|
53
|
+
disposed: boolean;
|
|
53
54
|
constructor(context: Context, options: PoiOptionsParam);
|
|
54
55
|
get withinDisplayRange(): boolean;
|
|
55
56
|
resetSize(): Promise<void>;
|
package/lib/src/index.d.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BMap } from "../../bmap";
|
|
2
|
+
import { Plugin } from "../base";
|
|
3
|
+
import { Graphic } from "../../elements";
|
|
4
|
+
interface EquipmentData {
|
|
5
|
+
equipment_id: string;
|
|
6
|
+
equipment_name: string;
|
|
7
|
+
equipment_icon: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class Equipment extends Plugin {
|
|
10
|
+
equipmentList: EquipmentData[];
|
|
11
|
+
equipmentMap: Map<string, EquipmentData>;
|
|
12
|
+
constructor(bmap: BMap);
|
|
13
|
+
fetchEquipment(): Promise<void>;
|
|
14
|
+
onSwitchFloor: (floor: {
|
|
15
|
+
graphics: Graphic[];
|
|
16
|
+
}) => void;
|
|
17
|
+
getGraphicEquipment(graphic: Graphic): any;
|
|
18
|
+
changeGraphicToEquipment(graphics: Graphic[]): void;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './equipment';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './navigation';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const workerCode = "\nself.onmessage = (e) => {\n console.log(e.data)\n loadRoad(\"\");\n getPath(\"\", \"\")\n}\n\nfunction loadRoad(project) { \n // \u8BF7\u6C42\u5168\u90E8\u697C\u5C42\u7684\u8DEF\u7F51\n console.log(project)\n self.postMessage(\"project\")\n}\n\nfunction getPath(start, end) { \n // \u89C4\u5212\u8DEF\u7EBF\n console.log(start, end)\n self.postMessage(\"getPath\")\n}\n";
|
|
2
|
+
export default workerCode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './split-load';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { GraphicInfo, LoadQuery } from "../../types";
|
|
2
|
+
import { Plugin } from "../base";
|
|
3
|
+
type LoadGraphicQuery = Omit<LoadQuery, "resource_type_list">;
|
|
4
|
+
export declare class SplitLoad extends Plugin {
|
|
5
|
+
cacheData: Map<string, GraphicInfo[]>;
|
|
6
|
+
load(query: LoadQuery): Promise<GraphicInfo[]>;
|
|
7
|
+
isSameFloor(query: LoadGraphicQuery): boolean;
|
|
8
|
+
switchFloorByData(data: GraphicInfo[], query: LoadGraphicQuery): void;
|
|
9
|
+
filterData(data: GraphicInfo[], query: LoadGraphicQuery): GraphicInfo[];
|
|
10
|
+
private switchFloorByStoreData;
|
|
11
|
+
private switchFloorByOtherData;
|
|
12
|
+
changeFloor(query: LoadGraphicQuery): Promise<unknown[]>;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
package/lib/src/types/index.d.ts
CHANGED
|
@@ -59,3 +59,10 @@ export interface ResGraphicInfo {
|
|
|
59
59
|
export interface GraphicInfo extends Omit<ResGraphicInfo, "info"> {
|
|
60
60
|
info: GraphicOptions;
|
|
61
61
|
}
|
|
62
|
+
export interface LoadQuery {
|
|
63
|
+
brand: string;
|
|
64
|
+
project: string;
|
|
65
|
+
floor: string;
|
|
66
|
+
ts: string;
|
|
67
|
+
resource_type_list: string;
|
|
68
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Coordinate } from '
|
|
1
|
+
import { Coordinate } from '../types';
|
|
2
2
|
import { Vector3, Camera } from 'three';
|
|
3
3
|
/**
|
|
4
4
|
* 3D坐标转屏幕坐标
|
|
@@ -16,7 +16,7 @@ export declare function vector3ToDevice(vector: Vector3, camera: Camera, w: numb
|
|
|
16
16
|
* 获取多变形的中心点
|
|
17
17
|
* @param coordinates
|
|
18
18
|
*/
|
|
19
|
-
export declare function getCenter(coordinates: Coordinate[]):
|
|
19
|
+
export declare function getCenter(coordinates: Coordinate[]): [number, number];
|
|
20
20
|
type Position = {
|
|
21
21
|
x: number;
|
|
22
22
|
y: number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type DefaultFn = (...args: any[]) => void;
|
|
2
|
+
interface EventI {
|
|
3
|
+
on(type: string, callback: DefaultFn): void;
|
|
4
|
+
once(type: string, callback: DefaultFn): void;
|
|
5
|
+
off(type: string, callback: DefaultFn): void;
|
|
6
|
+
offAll(): void;
|
|
7
|
+
emit(type: string, ...args: any[]): void;
|
|
8
|
+
}
|
|
9
|
+
export type { EventI };
|
|
10
|
+
export declare class Events implements EventI {
|
|
11
|
+
events: Map<string, Set<DefaultFn>>;
|
|
12
|
+
on(type: string, callback: DefaultFn): Set<DefaultFn> | Map<string, Set<DefaultFn>> | undefined;
|
|
13
|
+
once(type: string, callback: DefaultFn): Set<DefaultFn> | Map<string, Set<DefaultFn>> | undefined;
|
|
14
|
+
off(type: string, callback: DefaultFn): void;
|
|
15
|
+
offAll(): void;
|
|
16
|
+
emit(type: string, ...args: any[]): void;
|
|
17
|
+
}
|
package/lib/src/utils/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aibee/crc-bmap",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.95",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/bmap.min.js",
|
|
6
6
|
"module": "lib/bmap.esm.min.js",
|
|
@@ -9,14 +9,15 @@
|
|
|
9
9
|
"lib",
|
|
10
10
|
"example"
|
|
11
11
|
],
|
|
12
|
+
"type": "module",
|
|
12
13
|
"scripts": {
|
|
13
14
|
"build": "pnpm clean && pnpm build:min",
|
|
14
|
-
"build:min": "ts-node ./build/index.ts",
|
|
15
|
+
"build:min": "ts-node --esm ./build/index.ts",
|
|
15
16
|
"gen-type": "tsc",
|
|
16
17
|
"clean": "rm -rf lib",
|
|
17
18
|
"lint": "eslint src/**/*.ts",
|
|
18
19
|
"start": "cd example && vite",
|
|
19
|
-
"publish:all": "npm run build && npm version patch && npm run publish:npm
|
|
20
|
+
"publish:all": "npm run build && npm version patch && npm run publish:npm && npm run publish:aibee",
|
|
20
21
|
"publish:npm": "npm publish --access public --registry https://registry.npmjs.org",
|
|
21
22
|
"publish:aibee": "npm publish --registry https://npm.aibee.cn"
|
|
22
23
|
},
|
|
@@ -36,10 +37,10 @@
|
|
|
36
37
|
"vite": "^4.4.11"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@types/three": "^0.156.0",
|
|
40
40
|
"@mars3d/heatmap.js": "^2.0.7",
|
|
41
41
|
"@turf/turf": "^6.5.0",
|
|
42
42
|
"@tweenjs/tween.js": "^21.0.0",
|
|
43
|
+
"@types/three": "^0.156.0",
|
|
43
44
|
"hotkeys-js": "^3.12.0",
|
|
44
45
|
"lodash": "^4.17.21",
|
|
45
46
|
"three": "^0.157.0"
|