@aibee/crc-bmap 0.0.46 → 0.0.48

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
@@ -81,14 +81,14 @@ export declare class BMap extends EventDispatcher<BmapEventMap> {
81
81
  * @param duration
82
82
  * @returns
83
83
  */
84
- reduceMap(zoom?: number, duration?: number): Promise<unknown>;
84
+ reduceMap(zoom?: number, duration?: number): Promise<unknown> | undefined;
85
85
  /**
86
86
  * 放大地图
87
87
  * @param zoom
88
88
  * @param duration
89
89
  * @returns
90
90
  */
91
- enlargeMap(zoom?: number, duration?: number): Promise<unknown>;
91
+ enlargeMap(zoom?: number, duration?: number): Promise<unknown> | undefined;
92
92
  onKeydown: (e: KeyboardEvent) => void;
93
93
  onKeyUp: (e: KeyboardEvent) => void;
94
94
  registryEvent(): void;
@@ -10,6 +10,7 @@ export interface Config {
10
10
  useFloorCache: boolean;
11
11
  control: {
12
12
  maxPolar: number;
13
+ defaultPolar: number;
13
14
  };
14
15
  svg: {
15
16
  circle: {
@@ -27,6 +28,22 @@ export interface Config {
27
28
  hover: {
28
29
  time: number;
29
30
  };
31
+ ground: {
32
+ color: string;
33
+ opacity: number;
34
+ height: number;
35
+ stroke: boolean;
36
+ strokeColor: string;
37
+ strokeOpacity: number;
38
+ };
39
+ markGraphic: {
40
+ color: string;
41
+ opacity: number;
42
+ height: number;
43
+ stroke: boolean;
44
+ strokeColor: string;
45
+ strokeOpacity: number;
46
+ };
30
47
  }
31
48
  export declare const defaultConfig: Config;
32
49
  export declare function getConfig(config: Partial<Config>): Config;
@@ -6,6 +6,7 @@ import { Group as TweenGroup } from "@tweenjs/tween.js";
6
6
  import { Config } from "./config";
7
7
  import { Selection } from "./operations/selection/selection";
8
8
  import { HoverHelper } from "./operations";
9
+ import { MaterialFactory } from "./factory";
9
10
  export interface ContextEventMap {
10
11
  update: {};
11
12
  "graphic-click": {
@@ -51,6 +52,7 @@ export declare class Context extends EventDispatcher<ContextEventMap> {
51
52
  selection: Selection;
52
53
  hoverHelper: HoverHelper;
53
54
  private basicRatio?;
55
+ materialFactory: MaterialFactory;
54
56
  clientSize: {
55
57
  width: number;
56
58
  height: number;
@@ -103,7 +105,7 @@ export declare class Context extends EventDispatcher<ContextEventMap> {
103
105
  * 设置横向旋转角度
104
106
  * @param azimuthal 弧度
105
107
  */
106
- setAzimuthalAngle(azimuthal: number, duration?: number): Promise<unknown>;
108
+ setAzimuthalAngle(azimuthal: number, duration?: number): Promise<unknown> | undefined;
107
109
  getCameraLookAt(): Vector3;
108
110
  /**
109
111
  * 按照一个中心点设置相机的放大缩小
@@ -111,7 +113,7 @@ export declare class Context extends EventDispatcher<ContextEventMap> {
111
113
  * @param center
112
114
  * @returns
113
115
  */
114
- setZoom(zoom: number, center: Vector3, duration?: number): Promise<unknown>;
116
+ setZoom(zoom: number, center: Vector3, duration?: number): Promise<unknown> | undefined;
115
117
  /**
116
118
  * 放大相机到物体占全屏
117
119
  * @param object
@@ -119,8 +121,8 @@ export declare class Context extends EventDispatcher<ContextEventMap> {
119
121
  * @param duration
120
122
  * @returns
121
123
  */
122
- fitCameraToObject(object: Object3D, padding?: [number, number, number, number], duration?: number): Promise<unknown>;
123
- fitCameraToGround(padding?: [number, number, number, number], duration?: number): Promise<unknown>;
124
+ fitCameraToObject(object: Object3D, padding?: [number, number, number, number], duration?: number): Promise<unknown> | undefined;
125
+ fitCameraToGround(padding?: [number, number, number, number], duration?: number): Promise<unknown> | undefined;
124
126
  /**
125
127
  * 修改相机位置
126
128
  * @param position 修改后的相机的位置
@@ -1,8 +1,6 @@
1
- import { Object3D, ExtrudeGeometry, MeshStandardMaterial, Mesh, Raycaster, Object3DEventMap, Vector3 } from 'three';
1
+ import { Object3D, ExtrudeGeometry, MeshStandardMaterial, Mesh, Raycaster, Object3DEventMap, Vector3, BufferGeometry, LineBasicMaterial, LineSegments } from 'three';
2
2
  import { GraphicOptions } from 'src/types';
3
3
  import { Context } from '../context';
4
- import { LineMaterial } from 'three/examples/jsm/lines/LineMaterial.js';
5
- import { LineSegments2 } from 'three/examples/jsm/lines/LineSegments2.js';
6
4
  declare const DoorType: {
7
5
  single: string;
8
6
  double: string;
@@ -33,6 +31,8 @@ export declare class Graphic extends Object3D<GraphicEventMap> {
33
31
  private material;
34
32
  mesh: Mesh;
35
33
  private line;
34
+ private lineMaterial?;
35
+ private lineGeometry?;
36
36
  options: GraphicOptions;
37
37
  constructor(context: Context, options: GraphicOptionsParam);
38
38
  getCenter(): Vector3;
@@ -41,9 +41,11 @@ export declare class Graphic extends Object3D<GraphicEventMap> {
41
41
  init(): void;
42
42
  initGeometry(): ExtrudeGeometry;
43
43
  initMaterial(): MeshStandardMaterial;
44
- initLineMaterial(): LineMaterial;
45
- initMesh(): Mesh<ExtrudeGeometry, MeshStandardMaterial, Object3DEventMap>;
46
- createBorder(): LineSegments2;
44
+ initLineMaterial(): LineBasicMaterial;
45
+ initMesh(): void;
46
+ getBorderPoints(): Vector3[];
47
+ initLineGeometry(): void;
48
+ createBorder(): LineSegments<BufferGeometry<import("three").NormalBufferAttributes>, LineBasicMaterial>;
47
49
  raycast(raycaster: Raycaster): false | {
48
50
  position: Vector3;
49
51
  distance: number;
@@ -1,7 +1,12 @@
1
1
  import { Object3D, Object3DEventMap } from 'three';
2
2
  import { Context } from '../context';
3
3
  export interface PoiOptions {
4
- text: string;
4
+ texts: {
5
+ text: string;
6
+ styles?: {
7
+ [key: string]: string;
8
+ };
9
+ }[];
5
10
  icon?: string;
6
11
  icon_size?: [number, number];
7
12
  level: number;
@@ -0,0 +1 @@
1
+ export * from './material';
@@ -0,0 +1,21 @@
1
+ import { Context } from "../context";
2
+ import { LineBasicMaterial, MeshStandardMaterial } from "three";
3
+ interface LineMaterialOptions {
4
+ color: string;
5
+ opacity: number;
6
+ }
7
+ interface MeshStandardMaterialOptions {
8
+ color: string;
9
+ opacity: number;
10
+ }
11
+ export declare class MaterialFactory {
12
+ private context;
13
+ private lineMaterialMap;
14
+ private meshStandardMaterialMap;
15
+ constructor(context: Context);
16
+ generateLineMaterialKey({ color, opacity }: LineMaterialOptions): string;
17
+ createLineMaterial({ color, opacity }: LineMaterialOptions): LineBasicMaterial;
18
+ createMeshStandardMaterial({ color, opacity }: MeshStandardMaterialOptions): MeshStandardMaterial;
19
+ dispose(): void;
20
+ }
21
+ export {};
@@ -29,6 +29,8 @@ export interface GraphicOptions {
29
29
  layerType: string;
30
30
  zIndex: number;
31
31
  transformToBuildingGround?: boolean;
32
+ stroke?: boolean;
33
+ userData: Record<string, any>;
32
34
  }
33
35
  /**
34
36
  * 接口返回的图元信息
@@ -1 +1,8 @@
1
1
  export declare function strToNumber(str: string): number;
2
+ /**
3
+ * 给颜色加上透明度
4
+ * @param hexColor
5
+ * @param alpha
6
+ * @returns
7
+ */
8
+ export declare function addAlphaToHexColor(hexColor: string, alpha: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibee/crc-bmap",
3
- "version": "0.0.46",
3
+ "version": "0.0.48",
4
4
  "description": "",
5
5
  "main": "lib/bmap.min.js",
6
6
  "module": "lib/bmap.esm.min.js",