bruce-cesium 7.3.9 → 7.4.1
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/dist/bruce-cesium.es5.js +2655 -603
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +2654 -600
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +8 -2
- package/dist/lib/bruce-cesium.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/entity-label-group.js +538 -0
- package/dist/lib/rendering/render-managers/common/entity-label-group.js.map +1 -0
- package/dist/lib/rendering/render-managers/common/entity-label.js +1213 -155
- package/dist/lib/rendering/render-managers/common/entity-label.js.map +1 -1
- package/dist/lib/rendering/render-managers/common/point-clustering-core.js +85 -0
- package/dist/lib/rendering/render-managers/common/point-clustering-core.js.map +1 -0
- package/dist/lib/rendering/render-managers/common/point-clustering.js +566 -419
- package/dist/lib/rendering/render-managers/common/point-clustering.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-ids-render-manager.js.map +1 -1
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js +2 -2
- package/dist/lib/rendering/render-managers/entities/entities-render-manager.js.map +1 -1
- package/dist/lib/rendering/visuals-register.js +273 -24
- package/dist/lib/rendering/visuals-register.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +4 -1
- package/dist/types/rendering/render-managers/common/entity-label-group.d.ts +109 -0
- package/dist/types/rendering/render-managers/common/entity-label.d.ts +138 -1
- package/dist/types/rendering/render-managers/common/point-clustering-core.d.ts +17 -0
- package/dist/types/rendering/render-managers/common/point-clustering.d.ts +37 -72
- package/dist/types/rendering/visuals-register.d.ts +43 -2
- package/package.json +1 -1
|
@@ -1,12 +1,134 @@
|
|
|
1
1
|
import * as Cesium from "cesium";
|
|
2
2
|
import { VisualsRegister } from "../../visuals-register";
|
|
3
|
-
import { BruceApi } from "bruce-models";
|
|
3
|
+
import { BruceApi, Calculator } from "bruce-models";
|
|
4
|
+
import { GetClusterIconPriority } from "./point-clustering-core";
|
|
4
5
|
/**
|
|
5
6
|
* Util for generating labels within cesium space on entities.
|
|
6
7
|
*/
|
|
7
8
|
export declare namespace EntityLabel {
|
|
8
9
|
const ATTACH_KEY = "nextspace-navigator-entity-label";
|
|
10
|
+
interface IOptions {
|
|
11
|
+
presentation?: "text" | "icon" | "icon-text-above" | "icon-text-side";
|
|
12
|
+
text?: string;
|
|
13
|
+
icon?: string;
|
|
14
|
+
iconUrl?: string;
|
|
15
|
+
iconClass?: string | Calculator.IField[];
|
|
16
|
+
iconColor?: string | Calculator.IField[];
|
|
17
|
+
iconBackground?: boolean;
|
|
18
|
+
iconSize?: number;
|
|
19
|
+
iconScale?: number;
|
|
20
|
+
iconPriority?: number;
|
|
21
|
+
iconStatus?: string;
|
|
22
|
+
leader?: boolean;
|
|
23
|
+
leaderLength?: number;
|
|
24
|
+
leaderColor?: string;
|
|
25
|
+
attributes?: string[];
|
|
26
|
+
near?: number;
|
|
27
|
+
far?: number;
|
|
28
|
+
overlapOpacity?: number;
|
|
29
|
+
selectOnClick?: boolean;
|
|
30
|
+
pointerAvoidance?: {
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
gap?: number;
|
|
33
|
+
delay?: number;
|
|
34
|
+
transitionDuration?: number;
|
|
35
|
+
};
|
|
36
|
+
anchorRing?: {
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
nearDistance?: number;
|
|
39
|
+
nearRadius?: number;
|
|
40
|
+
hoverDistance?: number;
|
|
41
|
+
hoverRadius?: number;
|
|
42
|
+
transitionDuration?: number;
|
|
43
|
+
};
|
|
44
|
+
cluster?: {
|
|
45
|
+
enabled?: boolean;
|
|
46
|
+
pixelRange?: number;
|
|
47
|
+
minSize?: number;
|
|
48
|
+
representative?: "status" | "nearest";
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
interface IHoverRingState {
|
|
52
|
+
animation?: {
|
|
53
|
+
target: number;
|
|
54
|
+
start: number;
|
|
55
|
+
outer: number;
|
|
56
|
+
inner: number;
|
|
57
|
+
fromOuter: number;
|
|
58
|
+
fromInner: number;
|
|
59
|
+
arcOffset?: number;
|
|
60
|
+
arcOpen?: number;
|
|
61
|
+
arcTime?: number;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
interface IFrame {
|
|
65
|
+
canFlip?: boolean;
|
|
66
|
+
textWrapped?: boolean;
|
|
67
|
+
hasLeader?: boolean;
|
|
68
|
+
transient?: boolean;
|
|
69
|
+
extendedGeometry?: boolean;
|
|
70
|
+
viewportWidth?: number;
|
|
71
|
+
leaderLength?: number;
|
|
72
|
+
distance?: number;
|
|
73
|
+
id: string;
|
|
74
|
+
text?: string;
|
|
75
|
+
clusterBounds?: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
width: number;
|
|
79
|
+
height: number;
|
|
80
|
+
};
|
|
81
|
+
entityKey?: string;
|
|
82
|
+
entityId?: string;
|
|
83
|
+
group?: string;
|
|
84
|
+
x: number;
|
|
85
|
+
y: number;
|
|
86
|
+
width: number;
|
|
87
|
+
height: number;
|
|
88
|
+
anchorX?: number;
|
|
89
|
+
anchorY?: number;
|
|
90
|
+
depth: number;
|
|
91
|
+
opacity: number;
|
|
92
|
+
priority?: number;
|
|
93
|
+
options?: IOptions;
|
|
94
|
+
}
|
|
95
|
+
interface IPlacement {
|
|
96
|
+
textSide?: "left" | "right";
|
|
97
|
+
summaryMore?: boolean;
|
|
98
|
+
frame: IFrame;
|
|
99
|
+
text?: string;
|
|
100
|
+
visible: boolean;
|
|
101
|
+
opacity: number;
|
|
102
|
+
zIndex: number;
|
|
103
|
+
members: string[];
|
|
104
|
+
entityIds: string[];
|
|
105
|
+
}
|
|
106
|
+
class PlacementMemory {
|
|
107
|
+
private previous;
|
|
108
|
+
private nextOrder;
|
|
109
|
+
Resolve(frames: IFrame[]): Map<string, {
|
|
110
|
+
frame: IFrame;
|
|
111
|
+
side: "left" | "right";
|
|
112
|
+
}>;
|
|
113
|
+
}
|
|
114
|
+
const IconPriority: typeof GetClusterIconPriority;
|
|
115
|
+
function Layout(input: IFrame[], memory?: PlacementMemory): IPlacement[];
|
|
116
|
+
function SetContainer(viewer: Cesium.Viewer, container?: HTMLElement | null): void;
|
|
9
117
|
class Label {
|
|
118
|
+
private id;
|
|
119
|
+
private options;
|
|
120
|
+
private groupId;
|
|
121
|
+
Persistent: boolean;
|
|
122
|
+
Transient: boolean;
|
|
123
|
+
get HasText(): boolean;
|
|
124
|
+
private hoverFade;
|
|
125
|
+
private retainedHoverPosition;
|
|
126
|
+
private ringAnimation;
|
|
127
|
+
private cursorMotion;
|
|
128
|
+
private hoverRingState;
|
|
129
|
+
SetHoverVisible(visible: boolean): void;
|
|
130
|
+
private HoverOpacity;
|
|
131
|
+
private visible;
|
|
10
132
|
private counter;
|
|
11
133
|
private viewer;
|
|
12
134
|
private api;
|
|
@@ -25,6 +147,7 @@ export declare namespace EntityLabel {
|
|
|
25
147
|
private loadTimeout;
|
|
26
148
|
private loadedName;
|
|
27
149
|
private line;
|
|
150
|
+
private anchor;
|
|
28
151
|
private additionalTexts;
|
|
29
152
|
constructor(params: {
|
|
30
153
|
rego: VisualsRegister.IVisualRego;
|
|
@@ -32,6 +155,12 @@ export declare namespace EntityLabel {
|
|
|
32
155
|
pos3d?: Cesium.Cartesian3;
|
|
33
156
|
visualRegister?: VisualsRegister.Register;
|
|
34
157
|
api?: BruceApi.Api;
|
|
158
|
+
options?: IOptions;
|
|
159
|
+
groupId?: string;
|
|
160
|
+
persistent?: boolean;
|
|
161
|
+
transient?: boolean;
|
|
162
|
+
hoverRingState?: IHoverRingState;
|
|
163
|
+
visible?: () => boolean;
|
|
35
164
|
});
|
|
36
165
|
/**
|
|
37
166
|
* Loads the Entity's name and updates the corresponding visual rego.
|
|
@@ -42,6 +171,7 @@ export declare namespace EntityLabel {
|
|
|
42
171
|
* Recalling will be ignored.
|
|
43
172
|
*/
|
|
44
173
|
Dispose(): void;
|
|
174
|
+
Configure(options?: IOptions, groupId?: string): void;
|
|
45
175
|
/**
|
|
46
176
|
* Creates cesium entity for the label if one does not exist.
|
|
47
177
|
* @param starterPos3d optional position to create label at. Ignored for billboard labels.
|
|
@@ -62,6 +192,12 @@ export declare namespace EntityLabel {
|
|
|
62
192
|
pos3d?: Cesium.Cartesian3;
|
|
63
193
|
visualRegister?: VisualsRegister.Register;
|
|
64
194
|
api?: BruceApi.Api;
|
|
195
|
+
options?: IOptions;
|
|
196
|
+
groupId?: string;
|
|
197
|
+
persistent?: boolean;
|
|
198
|
+
transient?: boolean;
|
|
199
|
+
hoverRingState?: IHoverRingState;
|
|
200
|
+
visible?: () => boolean;
|
|
65
201
|
}): Label;
|
|
66
202
|
/**
|
|
67
203
|
* Removes an entity label from a given rego.
|
|
@@ -70,6 +206,7 @@ export declare namespace EntityLabel {
|
|
|
70
206
|
function Detatch(params: {
|
|
71
207
|
rego?: VisualsRegister.IVisualRego;
|
|
72
208
|
label?: Label;
|
|
209
|
+
force?: boolean;
|
|
73
210
|
}): void;
|
|
74
211
|
/**
|
|
75
212
|
* Returns label instance from given rego if one exists.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface IClusterIconMetadata {
|
|
2
|
+
iconPriority?: number;
|
|
3
|
+
iconStatus?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
iconUrl?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function GetClusterIconPriority(options?: IClusterIconMetadata): number;
|
|
8
|
+
export declare function ClusterItems<T>(params: {
|
|
9
|
+
items: T[];
|
|
10
|
+
id: (item: T) => string;
|
|
11
|
+
neighbours: (item: T) => T[];
|
|
12
|
+
eligible?: (item: T) => boolean;
|
|
13
|
+
minSize?: number;
|
|
14
|
+
}): {
|
|
15
|
+
representative: T;
|
|
16
|
+
members: T[];
|
|
17
|
+
}[];
|
|
@@ -1,91 +1,56 @@
|
|
|
1
|
-
import { MenuItem } from "bruce-models";
|
|
1
|
+
import { Calculator, Entity, MenuItem } from "bruce-models";
|
|
2
2
|
import * as Cesium from "cesium";
|
|
3
3
|
import { VisualsRegister } from "../../visuals-register";
|
|
4
|
+
import { IClusterIconMetadata } from "./point-clustering-core";
|
|
5
|
+
export { ClusterItems } from "./point-clustering-core";
|
|
6
|
+
export type TEntityClusterKind = "point" | "polyline" | "polygon" | "model" | "other";
|
|
7
|
+
export interface IPointClusteringSettings extends MenuItem.Item.IClustering {
|
|
8
|
+
iconPriority?: number | Calculator.IField[];
|
|
9
|
+
iconStatus?: string | Calculator.IField[];
|
|
10
|
+
representative?: "status" | "nearest";
|
|
11
|
+
selectOnClick?: boolean;
|
|
12
|
+
minDistanceByType?: Partial<Record<TEntityClusterKind, number>>;
|
|
13
|
+
}
|
|
14
|
+
export interface IPointClusterItem extends IClusterIconMetadata {
|
|
15
|
+
entity?: Entity.IEntity;
|
|
16
|
+
}
|
|
17
|
+
interface IClusterView {
|
|
18
|
+
entity: Cesium.Entity;
|
|
19
|
+
entityIds: string[];
|
|
20
|
+
representativeId: string;
|
|
21
|
+
selected: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function PointClusterSize(count: number): number;
|
|
4
24
|
export declare class PointClustering {
|
|
25
|
+
private register;
|
|
26
|
+
private menuItemId;
|
|
27
|
+
private settings;
|
|
5
28
|
private minDistance;
|
|
6
29
|
private minTotalCount;
|
|
7
30
|
private quadTree;
|
|
8
|
-
private prevClusteredEntities;
|
|
9
31
|
private currClusteredEntities;
|
|
10
32
|
private viewer;
|
|
11
|
-
private register;
|
|
12
33
|
private updateQueue;
|
|
13
34
|
private clusterEntities;
|
|
14
|
-
private
|
|
15
|
-
private listenCameraRemoval;
|
|
16
|
-
private listenUpdateRemoval;
|
|
17
|
-
private menuItemId;
|
|
35
|
+
private clusterViews;
|
|
18
36
|
private registeredEntityIds;
|
|
19
|
-
private
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
constructor(register: VisualsRegister.Register, menuItemId: string, settings?:
|
|
37
|
+
private records;
|
|
38
|
+
private disposed;
|
|
39
|
+
private removals;
|
|
40
|
+
private picker;
|
|
41
|
+
private selectionQueued;
|
|
42
|
+
constructor(register: VisualsRegister.Register, menuItemId: string, settings?: IPointClusteringSettings);
|
|
25
43
|
Update(): void;
|
|
26
|
-
|
|
27
|
-
private runForceUpdateQueue;
|
|
28
|
-
/**
|
|
29
|
-
* Starts listening to camera changes.
|
|
30
|
-
* This will trigger the clustering update whenever camera is moved.
|
|
31
|
-
*/
|
|
32
|
-
private listenCamera;
|
|
33
|
-
/**
|
|
34
|
-
* Stops listening to camera changes.
|
|
35
|
-
*/
|
|
36
|
-
private unlistenCamera;
|
|
37
|
-
/**
|
|
38
|
-
* Starts listening to entity selection changes.
|
|
39
|
-
* Selected entities are not clustered.
|
|
40
|
-
*/
|
|
41
|
-
private listenSelection;
|
|
42
|
-
private unlistenSelection;
|
|
43
|
-
/**
|
|
44
|
-
* Removes all clusters and updates entities to no longer be suppressed.
|
|
45
|
-
* @returns
|
|
46
|
-
*/
|
|
44
|
+
GetClusters(): IClusterView[];
|
|
47
45
|
Dispose(): void;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*/
|
|
53
|
-
private calculateCentroid;
|
|
54
|
-
/**
|
|
55
|
-
* Gathers current clusters and renders them.
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
46
|
+
private refreshSelection;
|
|
47
|
+
private selectCluster;
|
|
48
|
+
private resolveGeometry;
|
|
49
|
+
private appearance;
|
|
58
50
|
private doUpdate;
|
|
59
51
|
private getClusterSpacing;
|
|
60
52
|
private getClusters;
|
|
61
|
-
/**
|
|
62
|
-
* Removes Cesium cluster entity.
|
|
63
|
-
* @param clusterId
|
|
64
|
-
*/
|
|
65
53
|
private removeClusterEntity;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Adds new entity to the clustering logic.
|
|
69
|
-
* @param id Bruce entity ID.
|
|
70
|
-
* @param cartesian3 entity's position.
|
|
71
|
-
*/
|
|
72
|
-
private addPoint;
|
|
73
|
-
/**
|
|
74
|
-
* Adds entity to clustering logic.
|
|
75
|
-
* Will return false if entity could not be clustered and therefor should not be hidden.
|
|
76
|
-
* @param id
|
|
77
|
-
* @param entity
|
|
78
|
-
* @param queueUpdate
|
|
79
|
-
* @returns
|
|
80
|
-
*/
|
|
81
|
-
AddEntity(id: string, entity: Cesium.Entity, queueUpdate?: boolean): boolean;
|
|
82
|
-
/**
|
|
83
|
-
* Removes entity from clustering logic.
|
|
84
|
-
* Warning: This will not reveal the entity, suppressShow will remain true.
|
|
85
|
-
* This is made with the assumption that the entity is being removed from viewer.
|
|
86
|
-
* @param id
|
|
87
|
-
* @param queueUpdate
|
|
88
|
-
* @returns
|
|
89
|
-
*/
|
|
54
|
+
AddEntity(id: string, visual: Cesium.Entity, queueUpdate?: boolean, metadata?: IPointClusterItem): boolean;
|
|
90
55
|
RemoveEntity(id: string, queueUpdate?: boolean): void;
|
|
91
56
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ApiGetters, BruceEvent, Cartes, Entity, EntityRelation, IDictionary, MenuItem, ProjectViewBookmark } from "bruce-models";
|
|
2
2
|
import * as Cesium from "cesium";
|
|
3
3
|
import { IShowGate } from "../internal/cesium-show-gate";
|
|
4
|
+
import { EntityLabel } from "../rendering/render-managers/common/entity-label";
|
|
5
|
+
import { EntityLabelGroup } from "./render-managers/common/entity-label-group";
|
|
4
6
|
/**
|
|
5
7
|
* Manages a registry of all Bruce visuals being rendered by menu items.
|
|
6
8
|
*/
|
|
@@ -112,12 +114,20 @@ export declare namespace VisualsRegister {
|
|
|
112
114
|
private updateQueueIds;
|
|
113
115
|
private updateQueueSettings;
|
|
114
116
|
private updateQueueInterval;
|
|
117
|
+
private menuItemSources;
|
|
118
|
+
private sourceOrderDirty;
|
|
119
|
+
private labelGroups;
|
|
120
|
+
private labelGroupsChanged;
|
|
121
|
+
get OnLabelGroupsChanged(): BruceEvent<void>;
|
|
122
|
+
private labelHover;
|
|
123
|
+
private hoverLabel;
|
|
124
|
+
private hoverRingState;
|
|
125
|
+
private hoverRingReset;
|
|
126
|
+
private retiringHoverLabels;
|
|
115
127
|
constructor(params: {
|
|
116
128
|
viewer: Cesium.Viewer;
|
|
117
129
|
apiGetters?: ApiGetters;
|
|
118
130
|
});
|
|
119
|
-
private menuItemSources;
|
|
120
|
-
private sourceOrderDirty;
|
|
121
131
|
/**
|
|
122
132
|
* Returns the collection a menu item's visuals belong in, creating its data source on first use.
|
|
123
133
|
* Returns null when there is nothing to key off, leaving the caller on the viewer's own collection.
|
|
@@ -552,5 +562,36 @@ export declare namespace VisualsRegister {
|
|
|
552
562
|
* @returns
|
|
553
563
|
*/
|
|
554
564
|
GetOpacityMap(): IDictionary<number>;
|
|
565
|
+
private ReleaseHoverLabel;
|
|
566
|
+
SetLabelHover(params?: {
|
|
567
|
+
entityId: string;
|
|
568
|
+
menuItemId?: string;
|
|
569
|
+
position?: {
|
|
570
|
+
x: number;
|
|
571
|
+
y: number;
|
|
572
|
+
};
|
|
573
|
+
createIfMissing?: boolean;
|
|
574
|
+
} | null): void;
|
|
575
|
+
ClearLabelHover: () => void;
|
|
576
|
+
private CheckLabelHoverBounds;
|
|
577
|
+
GetLabelHoverPosition(entityId: string, menuItemId?: string): Readonly<{
|
|
578
|
+
x: number;
|
|
579
|
+
y: number;
|
|
580
|
+
}> | undefined;
|
|
581
|
+
private SyncLabelHover;
|
|
582
|
+
SetLabelContainer(container?: HTMLElement | null): void;
|
|
583
|
+
ClearLabelContainer(): void;
|
|
584
|
+
SetLabelGroup(group: EntityLabelGroup.IGroup): Promise<EntityLabelGroup.IResult>;
|
|
585
|
+
RemoveLabelGroup(id: string): void;
|
|
586
|
+
RefreshLabelGroup(id: string): Promise<EntityLabelGroup.IResult>;
|
|
587
|
+
SetLabelGroupVisible(id: string, visible: boolean): boolean;
|
|
588
|
+
ClearLabelGroups(): void;
|
|
589
|
+
GetLabelGroups(): EntityLabelGroup.IState[];
|
|
590
|
+
GetLabelGroupFor(entityId: string, menuItemId?: string): {
|
|
591
|
+
groupId: string;
|
|
592
|
+
options: EntityLabel.IOptions;
|
|
593
|
+
item: EntityLabelGroup.IItem;
|
|
594
|
+
};
|
|
595
|
+
RefreshLabelGroupEntity(entityId: string): void;
|
|
555
596
|
}
|
|
556
597
|
}
|