bruce-cesium 7.5.6 → 7.5.8

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.
@@ -6,8 +6,8 @@ import { GetClusterIconPriority } from "./point-clustering-core";
6
6
  * Util for generating labels within cesium space on entities.
7
7
  */
8
8
  export declare namespace EntityLabel {
9
- const ATTACH_KEY = "nextspace-navigator-entity-label";
10
- interface IOptions {
9
+ export const ATTACH_KEY = "nextspace-navigator-entity-label";
10
+ export interface IOptions {
11
11
  presentation?: "text" | "icon" | "icon-text-above" | "icon-text-side";
12
12
  text?: string;
13
13
  icon?: string;
@@ -51,12 +51,12 @@ export declare namespace EntityLabel {
51
51
  representative?: "status" | "nearest";
52
52
  };
53
53
  }
54
- function HasIcon(options: IOptions): boolean;
55
- function IsImageUrl(value: string): boolean;
56
- function GetDefaultImageUrl(entity: Entity.IEntity, api?: BruceApi.Api): string;
57
- function WithPhoto(options: IOptions, url: string): IOptions;
58
- function PhotoShape(width: number, height: number): "circle" | "rect";
59
- interface IHoverRingState {
54
+ export function HasIcon(options: IOptions): boolean;
55
+ export function IsImageUrl(value: string): boolean;
56
+ export function GetDefaultImageUrl(entity: Entity.IEntity, api?: BruceApi.Api): string;
57
+ export function WithPhoto(options: IOptions, url: string): IOptions;
58
+ export function PhotoShape(width: number, height: number): "circle" | "rect";
59
+ export interface IHoverRingState {
60
60
  animation?: {
61
61
  target: number;
62
62
  targetInner: number;
@@ -70,7 +70,14 @@ export declare namespace EntityLabel {
70
70
  arcTime?: number;
71
71
  };
72
72
  }
73
- interface IFrame {
73
+ export interface IModelBoxFrame {
74
+ points: TPoint[];
75
+ hull: TPoint[];
76
+ outline: TPoint[];
77
+ anchor: TPoint;
78
+ group: string;
79
+ }
80
+ export interface IFrame {
74
81
  canFlip?: boolean;
75
82
  textWrapped?: boolean;
76
83
  hasLeader?: boolean;
@@ -82,6 +89,8 @@ export declare namespace EntityLabel {
82
89
  leaderSide?: "left" | "right";
83
90
  distance?: number;
84
91
  iconRadius?: number;
92
+ modelBox?: IModelBoxFrame;
93
+ boxBlend?: number;
85
94
  id: string;
86
95
  text?: string;
87
96
  clusterBounds?: {
@@ -104,8 +113,8 @@ export declare namespace EntityLabel {
104
113
  priority?: number;
105
114
  options?: IOptions;
106
115
  }
107
- type TIconLook = Pick<IOptions, "icon" | "iconUrl" | "iconClass" | "iconColor" | "iconBackground" | "iconPhoto">;
108
- interface IPlacement {
116
+ export type TIconLook = Pick<IOptions, "icon" | "iconUrl" | "iconClass" | "iconColor" | "iconBackground" | "iconPhoto">;
117
+ export interface IPlacement {
109
118
  textSide?: "left" | "right";
110
119
  icons?: TIconLook[];
111
120
  frame: IFrame;
@@ -116,7 +125,7 @@ export declare namespace EntityLabel {
116
125
  members: string[];
117
126
  entityIds: string[];
118
127
  }
119
- class PlacementMemory {
128
+ export class PlacementMemory {
120
129
  private previous;
121
130
  private nextOrder;
122
131
  Resolve(frames: IFrame[]): Map<string, {
@@ -124,11 +133,111 @@ export declare namespace EntityLabel {
124
133
  side: "left" | "right";
125
134
  }>;
126
135
  }
127
- const IconPriority: typeof GetClusterIconPriority;
128
- function Layout(input: IFrame[], memory?: PlacementMemory): IPlacement[];
129
- function compatibleMembers<T>(seed: T, nearby: T[], group: (item: T) => string, look: (item: T) => string): T[];
130
- function SetContainer(viewer: Cesium.Viewer, container?: HTMLElement | null): void;
131
- class Label {
136
+ export const IconPriority: typeof GetClusterIconPriority;
137
+ export function Layout(input: IFrame[], memory?: PlacementMemory): IPlacement[];
138
+ export function compatibleMembers<T>(seed: T, nearby: T[], group: (item: T) => string, look: (item: T) => string): T[];
139
+ interface IParticipant {
140
+ project: () => IFrame;
141
+ apply: (placement?: IPlacement) => void;
142
+ }
143
+ export function SetContainer(viewer: Cesium.Viewer, container?: HTMLElement | null): void;
144
+ class Layer {
145
+ private viewer;
146
+ readonly element: HTMLDivElement;
147
+ coordinates: {
148
+ x: number;
149
+ y: number;
150
+ scaleX: number;
151
+ scaleY: number;
152
+ };
153
+ private participants;
154
+ private failed;
155
+ private placementMemory;
156
+ readonly modelBoxes: ModelBoxes;
157
+ private remove;
158
+ private forwardingWheel;
159
+ private pendingDrag;
160
+ private horizon;
161
+ private horizonScratch;
162
+ pointer: {
163
+ x: number;
164
+ y: number;
165
+ };
166
+ private pointerClient;
167
+ constructor(viewer: Cesium.Viewer);
168
+ private TrackPointer;
169
+ private PointerOut;
170
+ private ClearPointer;
171
+ private PreventNativeDrag;
172
+ private BeginDrag;
173
+ private FinishPendingDrag;
174
+ private EndPendingDrag;
175
+ private ContinueDrag;
176
+ private ForwardWheel;
177
+ Move(): void;
178
+ private MeasureCoordinates;
179
+ Add(participant: IParticipant): () => void;
180
+ IsBeyondHorizon(position: Cesium.Cartesian3): boolean;
181
+ private UpdateHorizon;
182
+ private Update;
183
+ private logFailure;
184
+ }
185
+ type TVec3 = [number, number, number];
186
+ export interface IModelShape {
187
+ centre: TVec3;
188
+ axes: [TVec3, TVec3, TVec3];
189
+ half: TVec3;
190
+ }
191
+ export function ReadOrientedBox(entity: Entity.IEntity): IModelShape;
192
+ export function GetModelBox(entity: Entity.IEntity, shape?: IModelShape): Cesium.Cartesian3[];
193
+ type TPoint = {
194
+ x: number;
195
+ y: number;
196
+ };
197
+ export interface IModelSolid {
198
+ centre: TVec3;
199
+ axes: [TVec3, TVec3, TVec3];
200
+ half: TVec3;
201
+ }
202
+ export function ModelSolid(corners: Cesium.Cartesian3[], origin: Cesium.Cartesian3): IModelSolid;
203
+ export function ModelSolidsTouch(a: IModelSolid, b: IModelSolid): boolean;
204
+ export function ModelBoxOutline(solids: IModelSolid[]): [TVec3, TVec3][];
205
+ export function HullsNear(a: TPoint[], b: TPoint[], margin: number): boolean;
206
+ interface IModelBoxRequest {
207
+ whole: boolean;
208
+ from: TPoint;
209
+ opacity: number;
210
+ zIndex: number;
211
+ color: string;
212
+ duration: number;
213
+ }
214
+ interface IModelBoxEntry {
215
+ selected: () => boolean;
216
+ hovered: () => boolean;
217
+ near: () => boolean;
218
+ }
219
+ export class ModelBoxes {
220
+ private entries;
221
+ private groups;
222
+ private hovered;
223
+ private outlines;
224
+ private hulls;
225
+ private frames;
226
+ private drawn;
227
+ private since;
228
+ private requests;
229
+ private looks;
230
+ private memberLooks;
231
+ Set(id: string, corners: Cesium.Cartesian3[], entityId: string, inputs: IModelBoxEntry): void;
232
+ Frame(id: string): IModelBoxFrame;
233
+ Hull(id: string): TPoint[];
234
+ Request(id: string, request: IModelBoxRequest): void;
235
+ private group;
236
+ Resolve(viewer: Cesium.Viewer, pointer?: TPoint): void;
237
+ Draw(viewer: Cesium.Viewer, element: HTMLElement, coordinates: Layer["coordinates"]): void;
238
+ private drawGroup;
239
+ }
240
+ export class Label {
132
241
  private id;
133
242
  private options;
134
243
  private groupId;
@@ -139,6 +248,8 @@ export declare namespace EntityLabel {
139
248
  private retainedHoverPosition;
140
249
  private ringAnimation;
141
250
  private cursorMotion;
251
+ private modelBox;
252
+ private boxMorph;
142
253
  private hoverRingState;
143
254
  SetHoverVisible(visible: boolean): void;
144
255
  private HoverOpacity;
@@ -197,6 +308,8 @@ export declare namespace EntityLabel {
197
308
  private buildIcon;
198
309
  private buildPhoto;
199
310
  private renderFor;
311
+ private loadModelBox;
312
+ private morphToBox;
200
313
  /**
201
314
  * Removes label from the viewer and unsubscribes from events.
202
315
  */
@@ -206,7 +319,7 @@ export declare namespace EntityLabel {
206
319
  * Creates an entity label for a given rego.
207
320
  * If one exists then the action is ignored.
208
321
  */
209
- function Attach(params: {
322
+ export function Attach(params: {
210
323
  rego: VisualsRegister.IVisualRego;
211
324
  viewer: Cesium.Viewer;
212
325
  pos3d?: Cesium.Cartesian3;
@@ -223,7 +336,7 @@ export declare namespace EntityLabel {
223
336
  * Removes an entity label from a given rego.
224
337
  * If one doesn't exist then the action is ignored.
225
338
  */
226
- function Detatch(params: {
339
+ export function Detatch(params: {
227
340
  rego?: VisualsRegister.IVisualRego;
228
341
  label?: Label;
229
342
  force?: boolean;
@@ -233,7 +346,8 @@ export declare namespace EntityLabel {
233
346
  * @param params
234
347
  * @returns
235
348
  */
236
- function GetLabel(params: {
349
+ export function GetLabel(params: {
237
350
  rego: VisualsRegister.IVisualRego;
238
351
  }): Label;
352
+ export {};
239
353
  }
@@ -579,6 +579,7 @@ export declare namespace VisualsRegister {
579
579
  } | null): void;
580
580
  ClearLabelHover: () => void;
581
581
  private CheckLabelHoverBounds;
582
+ IsLabelHovered(entityId: string, menuItemId?: string): boolean;
582
583
  GetLabelHoverPosition(entityId: string, menuItemId?: string): Readonly<{
583
584
  x: number;
584
585
  y: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bruce-cesium",
3
- "version": "7.5.6",
3
+ "version": "7.5.8",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/bruce-cesium.umd.js",
@@ -83,7 +83,7 @@
83
83
  "typescript": "^5.0.4"
84
84
  },
85
85
  "dependencies": {
86
- "bruce-models": "^7.1.114",
86
+ "bruce-models": "^7.1.120",
87
87
  "tslib": "^2.4.1"
88
88
  }
89
89
  }