@aibee/crc-bmap 0.14.20 → 0.14.23
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/index.cjs +20 -20
- package/lib/index.esm.min.js +20 -20
- package/lib/meta.json +274 -54
- package/lib/src/config.d.ts +5 -0
- package/lib/src/elements/base-svg.d.ts +1 -1
- package/lib/src/elements/poi2.d.ts +7 -0
- package/lib/src/elements/svg-line.d.ts +1 -0
- package/lib/src/elements/svg-polygon.d.ts +1 -0
- package/lib/src/factory/text-texture.d.ts +5 -0
- package/lib/src/factory/unique-key.d.ts +1 -0
- package/lib/src/plugins/car-inertial-position/car-inertial-position.d.ts +1 -0
- package/lib/src/plugins/graphic-draw/graphic-draw.d.ts +71 -0
- package/lib/src/plugins/graphic-draw/index.d.ts +4 -0
- package/lib/src/plugins/graphic-draw/svg-drawer.d.ts +38 -0
- package/lib/src/plugins/graphic-draw/transform-box.d.ts +77 -0
- package/lib/src/plugins/graphic-draw/types.d.ts +44 -0
- package/lib/src/plugins/index.d.ts +1 -0
- package/lib/src/plugins/nav-path/nav-path.d.ts +1 -0
- package/lib/src/plugins/recommend-parking-space/recommand-parking-space.d.ts +5 -2
- package/lib/src/plugins/recommend-parking-space/recommend-core.d.ts +30 -0
- package/lib/src/plugins/recommend-parking-space/recommend.worker.d.ts +1 -5
- package/lib/src/utils/obj-utils.d.ts +1 -1
- package/lib/src/utils/road2.d.ts +1 -0
- package/lib/worker/{path.worker-W3VDPRQY.js → path.worker-2A5W4SXQ.js} +1 -1
- package/lib/worker/{recommend.worker-DNMNFDYX.js → recommend.worker-5LGR2EOJ.js} +176 -176
- package/package.json +1 -1
|
@@ -2,7 +2,6 @@ import { Context } from "../context/context";
|
|
|
2
2
|
import { EventDispatcher, Vector3 } from "three";
|
|
3
3
|
export declare class BaseSvg<T extends {} = {}> extends EventDispatcher<T> {
|
|
4
4
|
context: Context;
|
|
5
|
-
protected points: Vector3[];
|
|
6
5
|
protected svg: SVGElement;
|
|
7
6
|
protected enable: boolean;
|
|
8
7
|
constructor(context: Context);
|
|
@@ -15,5 +14,6 @@ export declare class BaseSvg<T extends {} = {}> extends EventDispatcher<T> {
|
|
|
15
14
|
x: number;
|
|
16
15
|
y: number;
|
|
17
16
|
};
|
|
17
|
+
getWorldToDeviceDistance(worldDistance: number): number;
|
|
18
18
|
dispose(): void;
|
|
19
19
|
}
|
|
@@ -32,6 +32,11 @@ export interface PoiOptions2 {
|
|
|
32
32
|
icon_opacity: number;
|
|
33
33
|
icon_alpha_test: number;
|
|
34
34
|
text_alpha_test: number;
|
|
35
|
+
text_background?: {
|
|
36
|
+
enable: boolean;
|
|
37
|
+
color: string;
|
|
38
|
+
opacity: number;
|
|
39
|
+
};
|
|
35
40
|
}
|
|
36
41
|
type PoiEventMap2 = {
|
|
37
42
|
[K in keyof PoiOptions2 as `change-${K}`]: {
|
|
@@ -91,6 +96,7 @@ export declare class Poi2 extends Object3D<PoiEventMap2> {
|
|
|
91
96
|
unRegistryEvent(): void;
|
|
92
97
|
getPosition(): Vector3;
|
|
93
98
|
initIcon(): Promise<Sprite<Object3DEventMap> | undefined>;
|
|
99
|
+
get textTextureKey(): string;
|
|
94
100
|
_initTextTexture: () => Promise<void>;
|
|
95
101
|
initTextTexture: () => Promise<void>;
|
|
96
102
|
_initTextTextureRect: () => Promise<void>;
|
|
@@ -106,6 +112,7 @@ export declare class Poi2 extends Object3D<PoiEventMap2> {
|
|
|
106
112
|
renderBoxHelper(x?: number, y?: number): void;
|
|
107
113
|
setVisible(visible: boolean): void;
|
|
108
114
|
parentSetVisible(visible: boolean): void;
|
|
115
|
+
clearTextTextureCache(): void;
|
|
109
116
|
dispose(): void;
|
|
110
117
|
}
|
|
111
118
|
export {};
|
|
@@ -46,6 +46,11 @@ export declare class TextTextureFactory {
|
|
|
46
46
|
static splitText(text: string, ctx: CanvasRenderingContext2D, maxWidth: number): string[];
|
|
47
47
|
static getTextureByText(text: string, options?: Partial<typeof this.options> & {
|
|
48
48
|
maxWidth?: number;
|
|
49
|
+
background?: {
|
|
50
|
+
enable: boolean;
|
|
51
|
+
color: string;
|
|
52
|
+
opacity: number;
|
|
53
|
+
};
|
|
49
54
|
}): Promise<{
|
|
50
55
|
texture: DataTexture;
|
|
51
56
|
lines: number;
|
|
@@ -36,6 +36,7 @@ export declare class CarInertialPosition extends EventDispatcher<CarInertialPosi
|
|
|
36
36
|
angleExcessesCount: number;
|
|
37
37
|
pathAngle: number;
|
|
38
38
|
lastExternalPositionTime: number;
|
|
39
|
+
private _lastSpeedUpdateTime;
|
|
39
40
|
constructor();
|
|
40
41
|
setPathAngle(angle: number): void;
|
|
41
42
|
changeSpeed(): number | undefined;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Group } from "three";
|
|
2
|
+
import { BMap } from "../../bmap";
|
|
3
|
+
import { Plugin } from "../base";
|
|
4
|
+
import { Graphic } from "../../elements/graphic";
|
|
5
|
+
import { SvgDrawer } from "./svg-drawer";
|
|
6
|
+
import { TransformBox } from "./transform-box";
|
|
7
|
+
import { GraphicDrawOptions, DrawingState, GraphicDrawEventMap } from "./types";
|
|
8
|
+
import { Coordinate, GraphicOptions } from "../../types";
|
|
9
|
+
export declare class GraphicDraw extends Plugin<GraphicDrawEventMap> {
|
|
10
|
+
options: GraphicDrawOptions;
|
|
11
|
+
state: DrawingState;
|
|
12
|
+
svgDrawer: SvgDrawer;
|
|
13
|
+
transformBox: TransformBox;
|
|
14
|
+
graphicsGroup: Group;
|
|
15
|
+
graphics: Map<string, Graphic>;
|
|
16
|
+
selectedGraphic: Graphic | null;
|
|
17
|
+
private prevPanStatus?;
|
|
18
|
+
private prevRotateStatus?;
|
|
19
|
+
private prevMapType?;
|
|
20
|
+
private startPoint;
|
|
21
|
+
private circleCenter;
|
|
22
|
+
private circleRadius;
|
|
23
|
+
private originalStyle;
|
|
24
|
+
private initialRotateAngle;
|
|
25
|
+
private rotationCenter;
|
|
26
|
+
private raycaster;
|
|
27
|
+
private currentMousePoint;
|
|
28
|
+
constructor(bmap: BMap, options?: Partial<GraphicDrawOptions>);
|
|
29
|
+
getState(): DrawingState;
|
|
30
|
+
startDrawPolygon(): void;
|
|
31
|
+
startDrawRect(): void;
|
|
32
|
+
startDrawCircle(): void;
|
|
33
|
+
cancel(): void;
|
|
34
|
+
selectGraphic(id: string): void;
|
|
35
|
+
deselectGraphic(): void;
|
|
36
|
+
getSelectedGraphic(): Graphic | null;
|
|
37
|
+
setRotation(id: string, angle: number): void;
|
|
38
|
+
setWidth(id: string, width: number): void;
|
|
39
|
+
setHeight(id: string, height: number): void;
|
|
40
|
+
setCoordinates(id: string, coords: Coordinate[][]): void;
|
|
41
|
+
loadGraphics(options: GraphicOptions[]): void;
|
|
42
|
+
getGraphics(): Graphic[];
|
|
43
|
+
removeGraphic(id: string): void;
|
|
44
|
+
clearGraphics(): void;
|
|
45
|
+
private getScreenPoint;
|
|
46
|
+
private screenToWorld;
|
|
47
|
+
private screenCoordsToWorld;
|
|
48
|
+
private pixelsToWorldDistance;
|
|
49
|
+
private registryEvents;
|
|
50
|
+
private unRegistryEvents;
|
|
51
|
+
private registryTransformEvents;
|
|
52
|
+
private unRegistryTransformEvents;
|
|
53
|
+
private enter2DMode;
|
|
54
|
+
private exit2DMode;
|
|
55
|
+
private disableControls;
|
|
56
|
+
private enableControls;
|
|
57
|
+
private onContextMenu;
|
|
58
|
+
private onPointerDown;
|
|
59
|
+
private hitTestGraphic;
|
|
60
|
+
private onPointerMove;
|
|
61
|
+
private onPointerUp;
|
|
62
|
+
private onTransformStart;
|
|
63
|
+
private onTransform;
|
|
64
|
+
private onTransformEnd;
|
|
65
|
+
private finishPolygon;
|
|
66
|
+
private finishRect;
|
|
67
|
+
private finishCircle;
|
|
68
|
+
private buildGraphicOptions;
|
|
69
|
+
private createGraphic;
|
|
70
|
+
dispose(): void;
|
|
71
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { GraphicDraw } from './graphic-draw';
|
|
2
|
+
export { defaultGraphicDrawOptions } from './types';
|
|
3
|
+
export type { GraphicDrawOptions, GraphicDrawEventMap, ScreenPoint, DrawingState } from './types';
|
|
4
|
+
export type { TransformBoxEventMap, TransformAction, BoundingBoxInfo } from './transform-box';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Context } from "../../context/context";
|
|
2
|
+
import { BaseSvg } from "../../elements/base-svg";
|
|
3
|
+
import { ScreenPoint } from "./types";
|
|
4
|
+
export interface SvgDrawerOptions {
|
|
5
|
+
strokeColor: string;
|
|
6
|
+
strokeOpacity: number;
|
|
7
|
+
fillColor: string;
|
|
8
|
+
fillOpacity: number;
|
|
9
|
+
pointColor: string;
|
|
10
|
+
pointRadius: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class SvgDrawer extends BaseSvg {
|
|
13
|
+
previewElement: SVGElement | null;
|
|
14
|
+
previewFillElement: SVGElement | null;
|
|
15
|
+
controlPoints: SVGElement[];
|
|
16
|
+
lines: SVGElement[];
|
|
17
|
+
lastLine: SVGElement | null;
|
|
18
|
+
points: ScreenPoint[];
|
|
19
|
+
private polygonFillElement;
|
|
20
|
+
private currentMousePoint;
|
|
21
|
+
private options;
|
|
22
|
+
private adsorbRadius;
|
|
23
|
+
constructor(context: Context, options: SvgDrawerOptions & {
|
|
24
|
+
adsorbRadius?: number;
|
|
25
|
+
});
|
|
26
|
+
updateRectPreview(start: ScreenPoint, end: ScreenPoint, showFill?: boolean): void;
|
|
27
|
+
private updateRectPreviewFill;
|
|
28
|
+
updateCirclePreview(center: ScreenPoint, radius: number): void;
|
|
29
|
+
updateCirclePreviewFill(center: ScreenPoint, radius: number): void;
|
|
30
|
+
addPolygonPoint(point: ScreenPoint): void;
|
|
31
|
+
updatePolygonPreview(mousePoint: ScreenPoint): void;
|
|
32
|
+
checkAdsorb(mousePoint: ScreenPoint): boolean;
|
|
33
|
+
private updatePolygonFill;
|
|
34
|
+
clear(): void;
|
|
35
|
+
getLastPoint(): ScreenPoint | undefined;
|
|
36
|
+
getFirstPoint(): ScreenPoint | undefined;
|
|
37
|
+
dispose(): void;
|
|
38
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Context } from "../../context/context";
|
|
2
|
+
import { BaseSvg } from "../../elements/base-svg";
|
|
3
|
+
import { Box3 } from "three";
|
|
4
|
+
import { Graphic } from "../../elements/graphic";
|
|
5
|
+
export type TransformAction = 'move' | 'scale-left' | 'scale-right' | 'scale-top' | 'scale-bottom' | 'scale-left-top' | 'scale-right-top' | 'scale-left-bottom' | 'scale-right-bottom' | 'rotate';
|
|
6
|
+
export interface TransformBoxEventMap {
|
|
7
|
+
'transform-start': {
|
|
8
|
+
action: TransformAction;
|
|
9
|
+
point: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
'transform': {
|
|
15
|
+
action: TransformAction;
|
|
16
|
+
delta: {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
};
|
|
20
|
+
currentPoint: {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
'transform-end': {
|
|
26
|
+
action: TransformAction;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface BoundingBoxInfo {
|
|
30
|
+
min: {
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
};
|
|
34
|
+
max: {
|
|
35
|
+
x: number;
|
|
36
|
+
y: number;
|
|
37
|
+
};
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
centerX: number;
|
|
41
|
+
centerY: number;
|
|
42
|
+
}
|
|
43
|
+
export declare class TransformBox extends BaseSvg<TransformBoxEventMap> {
|
|
44
|
+
scalePoints: SVGElement[];
|
|
45
|
+
rotateHandle: SVGElement;
|
|
46
|
+
moveArea: SVGElement;
|
|
47
|
+
outline: SVGElement;
|
|
48
|
+
outlineLines: SVGElement[];
|
|
49
|
+
isTransforming: boolean;
|
|
50
|
+
private selectedGraphic;
|
|
51
|
+
private currentAction;
|
|
52
|
+
private startPoint;
|
|
53
|
+
private boundingBox;
|
|
54
|
+
private readonly SCALE_POINT_SIZE;
|
|
55
|
+
private readonly ROTATE_HANDLE_RADIUS;
|
|
56
|
+
private readonly ROTATE_HANDLE_OFFSET;
|
|
57
|
+
private readonly STROKE_COLOR;
|
|
58
|
+
private readonly FILL_COLOR;
|
|
59
|
+
constructor(context: Context);
|
|
60
|
+
private initElements;
|
|
61
|
+
private getCursorForPoint;
|
|
62
|
+
private registryEvent;
|
|
63
|
+
private unRegistryEvent;
|
|
64
|
+
private onUpdate;
|
|
65
|
+
getBoundingBoxInfo(): BoundingBoxInfo | null;
|
|
66
|
+
show(graphic: Graphic): void;
|
|
67
|
+
hide(): void;
|
|
68
|
+
updatePosition(): void;
|
|
69
|
+
private clearControlPoints;
|
|
70
|
+
getBoundingBox(): Box3 | null;
|
|
71
|
+
private getActionFromTarget;
|
|
72
|
+
private getContainerPoint;
|
|
73
|
+
private onPointerDown;
|
|
74
|
+
private onPointerMove;
|
|
75
|
+
private onPointerUp;
|
|
76
|
+
dispose(): void;
|
|
77
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface ScreenPoint {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
}
|
|
5
|
+
export interface GraphicDrawOptions {
|
|
6
|
+
strokeColor: string;
|
|
7
|
+
strokeOpacity: number;
|
|
8
|
+
strokeWidth: number;
|
|
9
|
+
fillColor: string;
|
|
10
|
+
fillOpacity: number;
|
|
11
|
+
pointColor: string;
|
|
12
|
+
pointOpacity: number;
|
|
13
|
+
pointRadius: number;
|
|
14
|
+
height: number;
|
|
15
|
+
circleSegments: number;
|
|
16
|
+
adsorbRadius: number;
|
|
17
|
+
autoSelect: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const defaultGraphicDrawOptions: GraphicDrawOptions;
|
|
20
|
+
export type DrawingState = 'idle' | 'polygon' | 'rect' | 'circle';
|
|
21
|
+
export interface GraphicDrawEventMap {
|
|
22
|
+
'finish': {
|
|
23
|
+
graphic: import("../../elements/graphic").Graphic;
|
|
24
|
+
drawType: 'polygon' | 'rect' | 'circle';
|
|
25
|
+
};
|
|
26
|
+
'cancel': {};
|
|
27
|
+
'start': {
|
|
28
|
+
drawType: 'polygon' | 'rect' | 'circle';
|
|
29
|
+
};
|
|
30
|
+
'select': {
|
|
31
|
+
graphic: import("../../elements/graphic").Graphic;
|
|
32
|
+
};
|
|
33
|
+
'deselect': {
|
|
34
|
+
graphic: import("../../elements/graphic").Graphic | null;
|
|
35
|
+
};
|
|
36
|
+
'graphic-click': {
|
|
37
|
+
graphic: import("../../elements/graphic").Graphic | null;
|
|
38
|
+
};
|
|
39
|
+
'change': {
|
|
40
|
+
action: 'add' | 'update' | 'remove' | 'move' | 'rotate' | 'resize';
|
|
41
|
+
graphic?: import("../../elements/graphic").Graphic;
|
|
42
|
+
id?: string;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { type CarLotStatus } from './recommend.worker';
|
|
2
2
|
import { End2, Facility, RoadData2, Start2 } from '../../utils';
|
|
3
3
|
import { ParkingType } from '../../types';
|
|
4
|
+
import { RecommendCore } from './recommend-core';
|
|
4
5
|
interface RecommendParkingSpaceOptions {
|
|
5
6
|
placeId: string | number;
|
|
6
7
|
catLotStatusApi: string;
|
|
8
|
+
useWorker: boolean;
|
|
7
9
|
filterCarLotStatus?: (carLotStatus: CarLotStatus[]) => CarLotStatus[];
|
|
8
10
|
}
|
|
9
11
|
export declare class RecommendParkingSpace {
|
|
10
|
-
worker: Worker;
|
|
12
|
+
worker: Worker | null;
|
|
13
|
+
recommendCore: RecommendCore | null;
|
|
11
14
|
options: RecommendParkingSpaceOptions;
|
|
12
15
|
constructor(options?: Partial<RecommendParkingSpaceOptions>);
|
|
13
|
-
setRoadData(roadData: RoadData2, facilities: Facility[]): Promise<any>;
|
|
16
|
+
setRoadData(roadData: RoadData2[], facilities: Facility[]): Promise<any>;
|
|
14
17
|
recommend(data: {
|
|
15
18
|
start: Start2;
|
|
16
19
|
end?: End2;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ParkingType } from "../../types";
|
|
2
|
+
import { Facility, RoadNetwork2, End2, Start2, RoadData2 } from "../../utils/road2";
|
|
3
|
+
export type CarLotStatus = {
|
|
4
|
+
floor: string;
|
|
5
|
+
lot_id: string;
|
|
6
|
+
status: number;
|
|
7
|
+
};
|
|
8
|
+
export interface RecommendParkingSpaceDest {
|
|
9
|
+
floor: string;
|
|
10
|
+
spaceNo: string;
|
|
11
|
+
distance: number;
|
|
12
|
+
}
|
|
13
|
+
export declare class RecommendCore {
|
|
14
|
+
private roadNetwork;
|
|
15
|
+
private roadReadyResolve;
|
|
16
|
+
private roadReadyPromise;
|
|
17
|
+
constructor();
|
|
18
|
+
setRoadData(roadData: RoadData2[], facilities: Facility[]): void;
|
|
19
|
+
setRoadNetwork(roadNetwork: RoadNetwork2): void;
|
|
20
|
+
recommend(start: Start2, carLotStatus: CarLotStatus[], end?: End2, travelDirection?: number, parkingType?: ParkingType): Promise<RecommendParkingSpaceDest | null>;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
private getFloorCarByDistance;
|
|
23
|
+
private recommendByStart;
|
|
24
|
+
private recommendByStartNearFloor;
|
|
25
|
+
private recommendByEnd;
|
|
26
|
+
private recommendFloorCarByEndDistance;
|
|
27
|
+
private recommendByStartNearFloorAndEnd;
|
|
28
|
+
private transformStart;
|
|
29
|
+
private transformEnd;
|
|
30
|
+
}
|