@aibee/crc-bmap 0.0.105 → 0.0.107

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/src/bmap.d.ts CHANGED
@@ -3,6 +3,7 @@ import { Context } from "./context";
3
3
  import { Timer, HooksName } from "./utils";
4
4
  import { Config } from "./config";
5
5
  import { Floor, Graphic, HeatmapDataParam, ModelOptions, PoiOptionsParam } from "./elements";
6
+ import { SvgLine, SvgPolygon } from "./elements";
6
7
  import { GraphicInfo, GraphicOptions, LoadQuery } from "./types";
7
8
  import { Plugin } from "./plugins/base";
8
9
  interface BmapEventMap {
@@ -37,12 +38,12 @@ export declare class BMap extends EventDispatcher<BmapEventMap> {
37
38
  private container;
38
39
  config: Config;
39
40
  context: Context;
40
- private polarKeys;
41
- private azimuthalKeys;
42
- private svgLine?;
43
- private svgPolygon?;
41
+ polarKeys: string[];
42
+ azimuthalKeys: string[];
43
+ svgLine?: SvgLine;
44
+ svgPolygon?: SvgPolygon;
44
45
  basicZoom: number;
45
- private prevCameraZoom;
46
+ prevCameraZoom: number;
46
47
  type: MapType;
47
48
  floorDataMap: Map<string, GraphicInfo[]>;
48
49
  buildingGroundMap: Map<string, GraphicInfo | null>;
@@ -27,12 +27,12 @@ type GraphicEventMap = {
27
27
  } & Object3DEventMap;
28
28
  export declare class Graphic extends Object3D<GraphicEventMap> {
29
29
  private context;
30
- private geometry;
31
- private material;
30
+ geometry: ExtrudeGeometry;
31
+ material: MeshBasicMaterial | MeshBasicMaterial[] | ShaderMaterial[] | ShaderMaterial;
32
32
  mesh: Mesh;
33
- private line;
34
- private lineMaterial?;
35
- private lineGeometry?;
33
+ line: LineSegments;
34
+ lineMaterial?: LineBasicMaterial;
35
+ lineGeometry?: BufferGeometry;
36
36
  options: GraphicOptions;
37
37
  constructor(context: Context, options: GraphicOptionsParam);
38
38
  getCenter(): Vector3;
@@ -1,15 +1,15 @@
1
1
  import { Context } from "../context";
2
- import { Object3D, Matrix3 } from "three";
3
- import { HeatmapData, DataPoint } from '@mars3d/heatmap.js';
2
+ import { Object3D, Mesh, Matrix3 } from "three";
3
+ import { Heatmap, HeatmapData, DataPoint } from '@mars3d/heatmap.js';
4
4
  type V = 'value';
5
5
  type X = 'x';
6
6
  type Y = 'y';
7
7
  export type HeatmapDataParam = HeatmapData<DataPoint<V, X, Y>>;
8
8
  export declare class HeatmapElement extends Object3D {
9
- private context;
10
- private heatmap?;
11
- private div;
12
- private plane?;
9
+ context: Context;
10
+ heatmap?: Heatmap<V, X, Y>;
11
+ div: HTMLDivElement;
12
+ plane?: Mesh;
13
13
  constructor(context: Context);
14
14
  clearHeatmap(): void;
15
15
  loadData(data: HeatmapDataParam): void;
@@ -24,7 +24,7 @@ export declare class Overlay extends EventDispatcher<OverlayEventMap> {
24
24
  y: number;
25
25
  };
26
26
  visible: boolean;
27
- private options;
27
+ options: OverlayOptions;
28
28
  placement: Placement;
29
29
  observer: MutationObserver | null;
30
30
  constructor(context: Context, options?: Partial<OverlayOptions>);
@@ -1,5 +1,6 @@
1
1
  import { EventDispatcher, Object3DEventMap, Vector3 } from 'three';
2
2
  import { Context } from '../context';
3
+ import { Overlay } from './overlay';
3
4
  export interface PoiOptions {
4
5
  texts: {
5
6
  text: string;
@@ -38,9 +39,9 @@ export type PoiOptionsParam = Partial<PoiOptions>;
38
39
  export declare class Poi extends EventDispatcher<PoiEventMap> {
39
40
  private context;
40
41
  div: HTMLDivElement;
41
- private textDiv;
42
- private img?;
43
- private overlay;
42
+ textDiv: HTMLDivElement;
43
+ img?: HTMLImageElement;
44
+ overlay: Overlay;
44
45
  options: PoiOptions;
45
46
  visible: boolean;
46
47
  size: {
@@ -8,10 +8,10 @@ interface SvgLineEventMap {
8
8
  }
9
9
  export declare class SelectBox extends BaseSvg<SvgLineEventMap> {
10
10
  context: Context;
11
- private rect;
12
- private cornerRect;
13
- private centerRect;
14
- private graphic?;
11
+ rect: SVGElement;
12
+ cornerRect: SVGElement[];
13
+ centerRect: SVGElement[];
14
+ graphic?: Graphic;
15
15
  constructor(context: Context);
16
16
  setEnable(enable: boolean): void;
17
17
  registryEvent(): void;
@@ -1,7 +1,7 @@
1
1
  import { Object3D, PlaneGeometry, DirectionalLight, Mesh, ShadowMaterial, Vector3 } from 'three';
2
2
  export declare class Shadow extends Object3D {
3
- private directionalLight;
4
- private plane;
3
+ directionalLight: DirectionalLight;
4
+ plane: Mesh;
5
5
  basicOpacity: number;
6
6
  constructor();
7
7
  initLight(): DirectionalLight;
@@ -8,8 +8,8 @@ interface SvgLineEventMap {
8
8
  }
9
9
  export declare class SvgLine extends BaseSvg<SvgLineEventMap> {
10
10
  context: Context;
11
- private circles;
12
- private line;
11
+ circles: SVGElement[];
12
+ line: SVGElement;
13
13
  constructor(context: Context);
14
14
  setEnable(enable: boolean): void;
15
15
  registryEvent(): void;
@@ -7,14 +7,14 @@ interface SvgPolygonEventMap {
7
7
  };
8
8
  }
9
9
  export declare class SvgPolygon extends BaseSvg<SvgPolygonEventMap> {
10
- private circles;
11
- private lines;
12
- private isClose;
10
+ circles: SVGElement[];
11
+ lines: SVGElement[];
12
+ isClose: boolean;
13
13
  constructor(context: Context);
14
14
  setEnable(enable: boolean): void;
15
- private get lastLine();
16
- private addCircle;
17
- private addLine;
15
+ get lastLine(): SVGElement;
16
+ addCircle(circle: SVGElement): void;
17
+ addLine(line: SVGElement): void;
18
18
  registryEvent(): void;
19
19
  unRegistryEvent(): void;
20
20
  onUpdate: () => void;
@@ -1,14 +1,14 @@
1
1
  import { Context } from "../../context";
2
2
  import { BaseSvg, Graphic } from "../../elements";
3
- import { Frustum } from "three";
3
+ import { Frustum, Vector3 } from "three";
4
4
  interface BoxSelectionEventMap {
5
5
  "selected": {
6
6
  list: Graphic[];
7
7
  };
8
8
  }
9
9
  export declare class BoxSelection extends BaseSvg<BoxSelectionEventMap> {
10
- private startPoint?;
11
- private endPoint?;
10
+ startPoint?: Vector3;
11
+ endPoint?: Vector3;
12
12
  rect: SVGElement;
13
13
  frustum: Frustum;
14
14
  constructor(context: Context);
@@ -1,6 +1,7 @@
1
1
  import { EventDispatcher } from "three";
2
2
  import { Context } from "../../context";
3
3
  import { Graphic } from "../../elements";
4
+ import { BoxSelection } from "./box-selection";
4
5
  interface SelectionEventMap {
5
6
  "select": {
6
7
  graphics: Graphic[];
@@ -8,13 +9,16 @@ interface SelectionEventMap {
8
9
  };
9
10
  }
10
11
  export declare class Selection extends EventDispatcher<SelectionEventMap> {
11
- private context;
12
- private _list;
13
- private boxSelection;
14
- private prevPanStatus?;
15
- private prevRotateStatus?;
16
- private downPoint;
17
- private isMultipleSelect;
12
+ context: Context;
13
+ _list: Set<Graphic>;
14
+ boxSelection: BoxSelection;
15
+ prevPanStatus?: boolean;
16
+ prevRotateStatus?: boolean;
17
+ downPoint: {
18
+ x: number;
19
+ y: number;
20
+ } | null;
21
+ isMultipleSelect: boolean;
18
22
  constructor(context: Context);
19
23
  get list(): Set<Graphic>;
20
24
  enableBoxSelection(): 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,7 +1,7 @@
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;
@@ -28,4 +28,3 @@ export declare class Path extends Object3D {
28
28
  create(points: [number, number][]): Promise<Mesh<any, any, import("three").Object3DEventMap>>;
29
29
  dispose(): void;
30
30
  }
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,9 +1,9 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.0.105",
3
+ "version": "0.0.107",
4
4
  "description": "",
5
5
  "main": "lib/bmap.min.js",
6
- "module": "lib/bmap.esm.min.js",
6
+ "module": "lib/bmap.esm.js",
7
7
  "types": "lib/src/index.d.ts",
8
8
  "files": [
9
9
  "lib"