@aibee/crc-bmap 0.1.1 → 0.1.3
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/lib/bmap.cjs.min.js +7 -3722
- package/lib/bmap.cjs.min.js.map +4 -4
- package/lib/bmap.esm.js +643 -171
- package/lib/bmap.esm.js.map +4 -4
- package/lib/bmap.esm.min.js +7 -3722
- package/lib/bmap.esm.min.js.map +4 -4
- package/lib/bmap.min.js +7 -3722
- package/lib/bmap.min.js.map +4 -4
- package/lib/src/plugins/index.d.ts +1 -0
- package/lib/src/plugins/nav-path/nav-path.d.ts +2 -2
- package/lib/src/plugins/navigation/navigation.d.ts +40 -16
- package/lib/src/plugins/navigation/path.d.ts +1 -2
- package/lib/src/plugins/position/index.d.ts +2 -0
- package/lib/src/plugins/position/particle.d.ts +0 -0
- package/lib/src/plugins/position/pdr.d.ts +0 -0
- package/lib/src/plugins/position/position.d.ts +11 -0
- package/lib/src/plugins/position/sensor.d.ts +59 -0
- package/lib/src/plugins/select/box-selection.d.ts +39 -0
- package/lib/src/plugins/select/index.d.ts +1 -0
- package/lib/src/plugins/select/select.d.ts +47 -0
- package/lib/src/utils/create.d.ts +2 -1
- package/lib/src/utils/index.d.ts +1 -0
- package/lib/src/utils/os.d.ts +3 -0
- package/lib/src/utils/path.d.ts +2 -0
- package/lib/src/utils/tween.d.ts +16 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EventDispatcher } from "three";
|
|
2
|
-
import {
|
|
2
|
+
import { End2, PathData, PathDirection, RouteType2, Start2 } from "../../utils";
|
|
3
3
|
import { Facility, RoadData2 } from "../../utils/road2";
|
|
4
4
|
interface EventMap {
|
|
5
5
|
"init-road-status": {
|
|
@@ -16,7 +16,7 @@ export declare class NavPath extends EventDispatcher<EventMap> {
|
|
|
16
16
|
initRoadStatus: boolean;
|
|
17
17
|
constructor();
|
|
18
18
|
setRoadData(roadData: RoadData2[], facilities: Facility[]): Promise<void>;
|
|
19
|
-
getPath(start:
|
|
19
|
+
getPath(start: Start2, end: End2, type?: RouteType2): Promise<PathData>;
|
|
20
20
|
getDirectionPath(points: [number, number][]): Promise<DirectionPathData[]>;
|
|
21
21
|
dispose(): Promise<void>;
|
|
22
22
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { BMap } from "../../bmap";
|
|
2
2
|
import { Plugin } from "../base";
|
|
3
3
|
import { Path, PathConfig } from "./path";
|
|
4
|
-
import {
|
|
4
|
+
import { PathData2, TweenUtil } from "../../utils";
|
|
5
5
|
import { Floor, Poi2, PoiOptions2 } from "../../elements";
|
|
6
|
-
import {
|
|
6
|
+
import { PathDirection } from "../../utils/path";
|
|
7
|
+
import { Tween } from "@tweenjs/tween.js";
|
|
7
8
|
export type Point = [number, number];
|
|
9
|
+
export interface NavigationProcessInfo {
|
|
10
|
+
distance: number;
|
|
11
|
+
dir: PathDirection;
|
|
12
|
+
nextDirDistance: number;
|
|
13
|
+
}
|
|
8
14
|
interface EventMap {
|
|
9
15
|
"fetch-road-status": {
|
|
10
16
|
status: boolean;
|
|
@@ -13,49 +19,56 @@ interface EventMap {
|
|
|
13
19
|
pathIndex: number;
|
|
14
20
|
};
|
|
15
21
|
"path-animation-end": {};
|
|
16
|
-
"
|
|
17
|
-
|
|
22
|
+
"render-path": {
|
|
23
|
+
path: Path;
|
|
18
24
|
};
|
|
25
|
+
"navigation-info": NavigationProcessInfo;
|
|
19
26
|
}
|
|
20
27
|
export interface NavigationConfig {
|
|
21
28
|
path?: Partial<PathConfig>;
|
|
22
|
-
speed: number;
|
|
23
29
|
cheapMaximumDistance: number;
|
|
24
30
|
startPoi: Partial<PoiOptions2>;
|
|
25
31
|
needStartPoi: boolean;
|
|
26
|
-
loadRoad: boolean;
|
|
27
|
-
roadNetwork: "RoadNetwork" | "RoadNetwork2";
|
|
28
32
|
offsetY: number;
|
|
33
|
+
directionEmitThreshold: number;
|
|
34
|
+
disablePathAnimation: boolean;
|
|
29
35
|
}
|
|
30
36
|
export declare class Navigation extends Plugin<EventMap> {
|
|
31
37
|
path: Path | null;
|
|
32
|
-
worker: any;
|
|
33
38
|
fetchRoadStatus: boolean;
|
|
34
|
-
paths:
|
|
39
|
+
paths: PathData2;
|
|
40
|
+
curPathIndex: number;
|
|
41
|
+
curFloorPath: PathData2[0] | null;
|
|
42
|
+
translatePath: PathData2[0]["points"] | null;
|
|
43
|
+
currentPathPosition: [number, number] | null;
|
|
35
44
|
options: NavigationConfig;
|
|
36
|
-
pathTween:
|
|
45
|
+
pathTween: Tween<any> | null;
|
|
37
46
|
startPoi: Poi2 | null;
|
|
38
47
|
movedDistance: number;
|
|
39
48
|
pathStart: [number, number];
|
|
49
|
+
tweenUtil: TweenUtil;
|
|
40
50
|
animationPathOptions: {
|
|
41
51
|
cPathIndex: number;
|
|
42
52
|
};
|
|
43
53
|
cPath: Point[];
|
|
44
|
-
constructor(bmap: BMap, project
|
|
54
|
+
constructor(bmap: BMap, project?: string | Partial<NavigationConfig>, options?: Partial<NavigationConfig>);
|
|
55
|
+
get curFloorPathLength(): number;
|
|
56
|
+
get curFloorPathPoints(): [number, number][];
|
|
45
57
|
registryEvent(): void;
|
|
58
|
+
pauseAnimation(): void;
|
|
59
|
+
continueAnimation(): void;
|
|
46
60
|
unRegistryEvent(): void;
|
|
47
61
|
onUpdate: () => void;
|
|
48
|
-
setRoadData(roadData: RoadData[], facilities: Facility[]): Promise<void>;
|
|
49
62
|
clearPath(): void;
|
|
63
|
+
private setCurFloorPath;
|
|
64
|
+
setCurPathIndex(index: number): void;
|
|
50
65
|
onSwitchFloor: ({ data: { curFloor } }: {
|
|
51
66
|
data: {
|
|
52
67
|
curFloor: Floor;
|
|
53
68
|
};
|
|
54
69
|
}) => void;
|
|
55
|
-
|
|
56
|
-
addPath(paths: PathData): void;
|
|
70
|
+
addPath(paths: PathData2, routeIndex?: number): void;
|
|
57
71
|
translatePoints(points: Point[]): Point[];
|
|
58
|
-
getPath(start: Start, end: End, type?: RouteType): Promise<PathData>;
|
|
59
72
|
renderPath(points: Point[]): void;
|
|
60
73
|
catmullRomCurve3(points: Point[]): [number, number][];
|
|
61
74
|
/**
|
|
@@ -66,12 +79,23 @@ export declare class Navigation extends Plugin<EventMap> {
|
|
|
66
79
|
animationTo(point: {
|
|
67
80
|
floor: string;
|
|
68
81
|
pos: [number, number];
|
|
69
|
-
}, speed
|
|
82
|
+
}, speed: number): Promise<unknown>;
|
|
70
83
|
getPathDirection(): number | null;
|
|
71
84
|
changeCameraToPathUp(duration?: number): Promise<unknown>;
|
|
72
85
|
initNavigationCamera(): Promise<void>;
|
|
73
86
|
translateCameraToStartPoi(duration?: number): Promise<unknown>;
|
|
74
87
|
initCameraZoom(duration?: number): Promise<unknown>;
|
|
88
|
+
toPositionBySpeed(position: [number, number], speed: number): Promise<unknown>;
|
|
89
|
+
adsorb(position: [number, number]): {
|
|
90
|
+
distance: number;
|
|
91
|
+
closestPoint: [number, number];
|
|
92
|
+
} | null;
|
|
93
|
+
getRemainDistance(): number;
|
|
94
|
+
getNextDirDistance(): {
|
|
95
|
+
dir: PathDirection;
|
|
96
|
+
distance: number;
|
|
97
|
+
} | null;
|
|
98
|
+
private emitNavigationInfo;
|
|
75
99
|
dispose(): void;
|
|
76
100
|
}
|
|
77
101
|
export {};
|
|
@@ -15,7 +15,6 @@ export declare class Path extends Object3D {
|
|
|
15
15
|
texture: Texture | null;
|
|
16
16
|
config: PathConfig;
|
|
17
17
|
points: [number, number][];
|
|
18
|
-
pathDistance: number;
|
|
19
18
|
basicRepeat: number;
|
|
20
19
|
prevCameraZoom: number;
|
|
21
20
|
constructor(navigation: Navigation, config?: Partial<PathConfig>);
|
|
@@ -28,7 +27,7 @@ export declare class Path extends Object3D {
|
|
|
28
27
|
loadTexture(url: string): Promise<Texture>;
|
|
29
28
|
transformPoints(points: [number, number][]): number[];
|
|
30
29
|
updatePoints(points: [number, number][]): void;
|
|
31
|
-
movePath(
|
|
30
|
+
movePath(ratio: number): void;
|
|
32
31
|
create(points: [number, number][]): Promise<Mesh<any, any, import("three").Object3DEventMap>>;
|
|
33
32
|
dispose(): void;
|
|
34
33
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Sensor, SensorOptions } from "./sensor";
|
|
2
|
+
export interface PdrPositionOptions {
|
|
3
|
+
sensor?: Partial<SensorOptions>;
|
|
4
|
+
}
|
|
5
|
+
export declare class PdrPosition {
|
|
6
|
+
sensor: Sensor;
|
|
7
|
+
constructor(options?: PdrPositionOptions);
|
|
8
|
+
checkSensor(): Promise<{
|
|
9
|
+
deviceOrientation: boolean;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Timer } from "../../utils";
|
|
2
|
+
import { EventDispatcher } from "three";
|
|
3
|
+
interface SensorEventMap {
|
|
4
|
+
"start": {};
|
|
5
|
+
"stop": {};
|
|
6
|
+
"sensor-data": {
|
|
7
|
+
data: SensorData[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
interface DeviceMotionData {
|
|
11
|
+
type: "deviceMotion";
|
|
12
|
+
timestamp: number;
|
|
13
|
+
res: [number, number, number];
|
|
14
|
+
}
|
|
15
|
+
interface AccelerationData {
|
|
16
|
+
type: "accelerometer";
|
|
17
|
+
timestamp: number;
|
|
18
|
+
res: [number, number, number];
|
|
19
|
+
}
|
|
20
|
+
interface GpsData {
|
|
21
|
+
type: "gps";
|
|
22
|
+
timestamp: number;
|
|
23
|
+
res: [number, number, number];
|
|
24
|
+
}
|
|
25
|
+
interface CompassData {
|
|
26
|
+
type: "compass";
|
|
27
|
+
timestamp: number;
|
|
28
|
+
res: number;
|
|
29
|
+
}
|
|
30
|
+
type SensorData = DeviceMotionData | AccelerationData | GpsData | CompassData;
|
|
31
|
+
export interface SensorOptions {
|
|
32
|
+
time: number;
|
|
33
|
+
elements: ("compass" | "deviceMotion" | "acceleration" | "gps")[];
|
|
34
|
+
}
|
|
35
|
+
export declare class Sensor extends EventDispatcher<SensorEventMap> {
|
|
36
|
+
options: SensorOptions;
|
|
37
|
+
gpsTimer: null | number;
|
|
38
|
+
data: SensorData[];
|
|
39
|
+
timer: Timer;
|
|
40
|
+
dispatchTimer: number | null;
|
|
41
|
+
constructor(options?: Partial<SensorOptions>);
|
|
42
|
+
start(): void;
|
|
43
|
+
addDeviceMotion: import("lodash").DebouncedFunc<(data: DeviceMotionData) => void>;
|
|
44
|
+
addAcceleration: import("lodash").DebouncedFunc<(data: AccelerationData) => void>;
|
|
45
|
+
deviceOrientationAbsHandler: (e: DeviceOrientationEvent) => void;
|
|
46
|
+
/**
|
|
47
|
+
* 获取 compass 和 deviceMotion
|
|
48
|
+
*/
|
|
49
|
+
listenDeviceOrientation(): void;
|
|
50
|
+
handleAcceleration: (e: DeviceMotionEvent) => void;
|
|
51
|
+
listenAcceleration(): void;
|
|
52
|
+
listenGps(): void;
|
|
53
|
+
checkSensor(): Promise<{
|
|
54
|
+
deviceOrientation: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
checkDeviceOrientation(): Promise<boolean>;
|
|
57
|
+
stop(): void;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Context } from "../../context/context";
|
|
2
|
+
import { BaseSvg, Graphic } from "../../elements";
|
|
3
|
+
import { Frustum, Vector3 } from "three";
|
|
4
|
+
interface BoxSelectionEventMap {
|
|
5
|
+
"selected": {
|
|
6
|
+
list: Graphic[];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export declare class BoxSelection extends BaseSvg<BoxSelectionEventMap> {
|
|
10
|
+
startPoint?: Vector3;
|
|
11
|
+
endPoint?: Vector3;
|
|
12
|
+
rect: SVGElement;
|
|
13
|
+
frustum: Frustum;
|
|
14
|
+
constructor(context: Context);
|
|
15
|
+
setEnable(enable: boolean): void;
|
|
16
|
+
onPointerDown: (e: PointerEvent) => void;
|
|
17
|
+
onPointerMove: (e: PointerEvent) => void;
|
|
18
|
+
onPointerUp: (e: PointerEvent) => void;
|
|
19
|
+
onUpdate: () => void;
|
|
20
|
+
registryEvent(): void;
|
|
21
|
+
unRegistryEvent(): void;
|
|
22
|
+
doSelect(): void;
|
|
23
|
+
searchMapInFrustum(leftTop: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
}, rightBottom: {
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
}): Graphic[];
|
|
30
|
+
searchChildInFrustum(object: Graphic, leftTop: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
}, rightBottom: {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
}): boolean;
|
|
37
|
+
dispose(): void;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './select';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Graphic, Poi, Poi2 } from "../../elements";
|
|
2
|
+
import { BMap } from "../../bmap";
|
|
3
|
+
import { Plugin } from "../base";
|
|
4
|
+
import { BoxSelection } from "./box-selection";
|
|
5
|
+
export interface BMapSelectOptions {
|
|
6
|
+
boxSelection: boolean;
|
|
7
|
+
elements: ("graphic" | "poi")[];
|
|
8
|
+
}
|
|
9
|
+
interface SelectionEventMap {
|
|
10
|
+
"select": {
|
|
11
|
+
graphics: Graphic[];
|
|
12
|
+
pois: (Poi | Poi2)[];
|
|
13
|
+
isMultipleSelect: boolean;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export declare class BMapSelect extends Plugin<SelectionEventMap> {
|
|
17
|
+
options: BMapSelectOptions;
|
|
18
|
+
_list: Set<Graphic>;
|
|
19
|
+
_poiList: Set<Poi | Poi2>;
|
|
20
|
+
boxSelection: BoxSelection;
|
|
21
|
+
prevPanStatus?: boolean;
|
|
22
|
+
prevRotateStatus?: boolean;
|
|
23
|
+
downPoint: {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
} | null;
|
|
27
|
+
isMultipleSelect: boolean;
|
|
28
|
+
constructor(bmap: BMap, options?: Partial<BMapSelectOptions>);
|
|
29
|
+
get list(): Set<Graphic>;
|
|
30
|
+
enableBoxSelection(): void;
|
|
31
|
+
disableBoxSelection(): void;
|
|
32
|
+
onPointerDown: (e: PointerEvent) => void;
|
|
33
|
+
onPointerUp: (e: PointerEvent) => void;
|
|
34
|
+
onPointerOut: (e: PointerEvent) => void;
|
|
35
|
+
onKeyDown: (e: KeyboardEvent) => void;
|
|
36
|
+
onKeyUp: (e: KeyboardEvent) => void;
|
|
37
|
+
onBoxSelected: ({ list }: {
|
|
38
|
+
list: Graphic[];
|
|
39
|
+
}) => void;
|
|
40
|
+
selectEnd(): void;
|
|
41
|
+
registryEvent(): void;
|
|
42
|
+
unRegistryEvent(): void;
|
|
43
|
+
clear(): void;
|
|
44
|
+
remove(graphic: Graphic): void;
|
|
45
|
+
dispose(): void;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { BufferGeometry, Line, LineBasicMaterial, Vector3 } from "three";
|
|
1
|
+
import { BoxGeometry, BufferGeometry, Line, LineBasicMaterial, Mesh, Vector3 } from "three";
|
|
2
2
|
export declare function createThreeLine(points: Vector3[], color?: number): Line<BufferGeometry<import("three").NormalBufferAttributes>, LineBasicMaterial>;
|
|
3
|
+
export declare function createThreeBox(pos: Vector3, color?: number): Mesh<BoxGeometry, LineBasicMaterial, import("three").Object3DEventMap>;
|
package/lib/src/utils/index.d.ts
CHANGED
package/lib/src/utils/os.d.ts
CHANGED
package/lib/src/utils/path.d.ts
CHANGED
|
@@ -62,3 +62,5 @@ export declare function getDirectPath(points: [number, number][]): {
|
|
|
62
62
|
distance: number;
|
|
63
63
|
points: [number, number][];
|
|
64
64
|
}[];
|
|
65
|
+
export declare function getDistanceByPathPos(path: [number, number][], pos: [number, number]): number;
|
|
66
|
+
export declare function getPosByPathDistance(path: [number, number][], distance: number): [number, number] | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Tween, Group } from '@tweenjs/tween.js';
|
|
2
|
+
export declare class TweenUtil {
|
|
3
|
+
pauseTween: boolean;
|
|
4
|
+
tweenStore: Set<Tween<any>>;
|
|
5
|
+
group: Group;
|
|
6
|
+
constructor();
|
|
7
|
+
update(): void;
|
|
8
|
+
pause(): void;
|
|
9
|
+
continue(): void;
|
|
10
|
+
remove(tween: Tween<any>): void;
|
|
11
|
+
getAll(): Tween<{
|
|
12
|
+
[x: string]: any;
|
|
13
|
+
}>[];
|
|
14
|
+
clear(): void;
|
|
15
|
+
dispose(): void;
|
|
16
|
+
}
|