@aibee/crc-bmap 0.0.106 → 0.0.108

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.
@@ -99,7 +99,7 @@ export declare class Context extends EventDispatcher<ContextEventMap> {
99
99
  getPoisByDeviceXy(x: number, y: number): Poi[];
100
100
  onPointerover: (e: PointerEvent) => void;
101
101
  onPointermove: (e: PointerEvent) => void;
102
- onPointerleave: () => void;
102
+ onPointerleave: (e: PointerEvent) => void;
103
103
  onSelectionSelect: ({ graphics, isMultipleSelect }: {
104
104
  graphics: Graphic[];
105
105
  isMultipleSelect: boolean;
@@ -19,6 +19,7 @@ export declare class HoverHelper extends EventDispatcher<HoverHelperEventMap> {
19
19
  e: PointerEvent;
20
20
  }) => void;
21
21
  onPointerLevel: () => void;
22
+ onBodyPointerMove: (e: PointerEvent) => void;
22
23
  handleHoverGraphicsChange(graphics?: Set<Graphic>): void;
23
24
  registryEvent(): void;
24
25
  unRegistryEvent(): void;
@@ -1,9 +1,10 @@
1
1
  import { BMap } from "../../bmap";
2
2
  import { Plugin } from "../base";
3
- import { Path } from "./path";
3
+ import { Path, PathConfig } from "./path";
4
4
  import { WorkerEventType } from "./enum";
5
5
  import { UniqueKey } from "../../utils";
6
- import { Floor } from "src/elements";
6
+ import { Floor, Poi, PoiOptions } from "../../elements";
7
+ import { Group as TweenGroup } from "@tweenjs/tween.js";
7
8
  export type Point = [number, number];
8
9
  export type PathData = {
9
10
  floor: string;
@@ -14,6 +15,15 @@ interface EventMap {
14
15
  "fetch-road-status": {
15
16
  status: boolean;
16
17
  };
18
+ "path-animation": {};
19
+ "path-animation-end": {};
20
+ }
21
+ export interface NavigationConfig {
22
+ path?: Partial<PathConfig>;
23
+ speed: number;
24
+ cheapMaximumDistance: number;
25
+ startPoi: Partial<PoiOptions>;
26
+ needStartPoi: boolean;
17
27
  }
18
28
  export declare class Navigation extends Plugin<EventMap> {
19
29
  path: Path | null;
@@ -21,7 +31,17 @@ export declare class Navigation extends Plugin<EventMap> {
21
31
  fetchRoadStatus: boolean;
22
32
  uniqueKey: UniqueKey;
23
33
  paths: PathData;
24
- constructor(bmap: BMap, project: string);
34
+ options: NavigationConfig;
35
+ pathTween: TweenGroup;
36
+ startPoi: Poi | null;
37
+ animationPathOptions: {
38
+ cPathIndex: number;
39
+ };
40
+ cPath: Point[];
41
+ constructor(bmap: BMap, project: string, options?: Partial<NavigationConfig>);
42
+ registryEvent(): void;
43
+ unRegistryEvent(): void;
44
+ onUpdate: () => void;
25
45
  triggerWorker(type: WorkerEventType, data?: any): void;
26
46
  clearPath(): void;
27
47
  onSwitchFloor: ({ data: { curFloor } }: {
@@ -41,6 +61,16 @@ export declare class Navigation extends Plugin<EventMap> {
41
61
  }): Promise<PathData>;
42
62
  renderPath(points: Point[]): void;
43
63
  catmullRomCurve3(points: Point[]): [number, number][];
64
+ /**
65
+ * 按照指定速度移动到目标位置
66
+ * @param point 目标位置
67
+ * @param speed 移动速度
68
+ */
69
+ animationTo(point: {
70
+ floor: string;
71
+ pos: [number, number];
72
+ }, speed?: number): Promise<unknown>;
73
+ kmPerHourToMetersPerSecond(speedInKmPerHour: number): number;
44
74
  dispose(): void;
45
75
  }
46
76
  export {};
@@ -1,11 +1,12 @@
1
1
  import { Mesh, Object3D, Texture } from "three";
2
2
  import { Navigation } from "./navigation";
3
3
  import { MeshLine, MeshLineMaterial } from "../../external/meshLine";
4
- interface PathConfig {
4
+ export interface PathConfig {
5
5
  texture_url: string;
6
6
  lineWidth: number;
7
7
  color: number;
8
8
  }
9
+ export declare const defaultConfig: PathConfig;
9
10
  export declare class Path extends Object3D {
10
11
  navigation: Navigation;
11
12
  mesh: Mesh | null;
@@ -28,4 +29,3 @@ export declare class Path extends Object3D {
28
29
  create(points: [number, number][]): Promise<Mesh<any, any, import("three").Object3DEventMap>>;
29
30
  dispose(): void;
30
31
  }
31
- export {};
@@ -1,10 +1,36 @@
1
+ export declare function smoothPath(path: [number, number][], threshold?: number): [number, number][];
1
2
  /**
2
- * 路径简化
3
- * @param path 路径点集数组
4
- * @param ignoreFirst 是否在简化过程中忽略第一个点
5
- * @param smoothingOptimization 是否针对平滑对路径进行插值
6
- * @param simplifyDistanceThreshold 简化时路径最短保留的距离, 默认为5
7
- * @param maximumTurningDegree 简化时三点夹角认定为转弯的最大角度,默认为150
8
- * @param smoothingDistance 平滑时使用的转角最大距离
9
- */
3
+ * 路径简化
4
+ * @param path 路径点集数组
5
+ * @param ignoreFirst 是否在简化过程中忽略第一个点
6
+ * @param smoothingOptimization 是否针对平滑对路径进行插值
7
+ * @param simplifyDistanceThreshold 简化时路径最短保留的距离, 默认为5
8
+ * @param maximumTurningDegree 简化时三点夹角认定为转弯的最大角度,默认为150
9
+ * @param smoothingDistance 平滑时使用的转角最大距离
10
+ */
10
11
  export declare function simplifyPath(path: [number, number][], ignoreFirst?: boolean, smoothingOptimization?: boolean, simplifyDistanceThreshold?: number, maximumTurningDegree?: number, smoothingDistance?: number): [number, number][];
12
+ /**
13
+ * 对路径点做去重
14
+ * @param points 路径点
15
+ * @returns
16
+ */
17
+ export declare function removeWeightPath(points: [number, number][]): [number, number][];
18
+ /**
19
+ * 计算点在路线的最短距离和投影位置
20
+ * @param point 点
21
+ * @param start 路线起点
22
+ * @param end 路线终点
23
+ * @returns
24
+ */
25
+ export declare function distancePointToSegment(point: [number, number], start: [number, number], end: [number, number]): {
26
+ distance: number;
27
+ closestPoint: [number, number];
28
+ };
29
+ /**
30
+ * 计算路线的起点在路线上移动一定的距离后的点
31
+ * @param startPoint
32
+ * @param endPoint
33
+ * @param distance
34
+ * @returns
35
+ */
36
+ export declare function moveOnRoute(startPoint: [number, number], endPoint: [number, number], distance: number): [number, number];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.0.106",
3
+ "version": "0.0.108",
4
4
  "description": "",
5
5
  "main": "lib/bmap.min.js",
6
6
  "module": "lib/bmap.esm.js",