bruce-cesium 7.5.8 → 7.6.0

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.
@@ -1,5 +1,6 @@
1
1
  import * as Cesium from "cesium";
2
2
  import { TextureFrameSeriesAnimator } from "./texture-frame-series-animator";
3
+ import { VisualsRegister } from "./visuals-register";
3
4
  /**
4
5
  * Prints a value texture's own numbers over the cells they belong to.
5
6
  */
@@ -35,6 +36,22 @@ export declare namespace TextureValueLabels {
35
36
  South: number;
36
37
  North: number;
37
38
  }
39
+ /**
40
+ * Value pixels, one texel per cell, value in R (and G when packed) and coverage in A.
41
+ */
42
+ interface IRaster {
43
+ data: Uint8ClampedArray;
44
+ width: number;
45
+ height: number;
46
+ }
47
+ /**
48
+ * Who the hover label is shown for, and the register that owns hover labels.
49
+ */
50
+ interface IHoverTarget {
51
+ register: VisualsRegister.Register;
52
+ entityId: string;
53
+ menuItemId?: string;
54
+ }
38
55
  interface IOptions {
39
56
  viewer: Cesium.Viewer;
40
57
  extent: IExtent;
@@ -45,6 +62,9 @@ export declare namespace TextureValueLabels {
45
62
  lon: number;
46
63
  lat: number;
47
64
  }[];
65
+ heightAt?: (lon: number, lat: number) => number | null;
66
+ heightKey?: () => unknown;
67
+ hover?: IHoverTarget;
48
68
  }
49
69
  /**
50
70
  * One cell's numbers, in the attribute's own units.
@@ -72,7 +92,7 @@ export declare namespace TextureValueLabels {
72
92
  */
73
93
  function ReadingAt(params: {
74
94
  metadata?: TextureFrameSeriesAnimator.IFrameArchiveMetadata;
75
- source: ImageData;
95
+ source: IRaster;
76
96
  floor?: ImageData | null;
77
97
  ceiling?: ImageData | null;
78
98
  at: number;
@@ -110,23 +130,44 @@ export declare namespace TextureValueLabels {
110
130
  private clipRing?;
111
131
  private source;
112
132
  private painted;
133
+ private paintedRamp;
113
134
  private floor;
114
135
  private ceiling;
136
+ private readonly heightAt?;
137
+ private readonly heightKey?;
138
+ private readonly hover?;
115
139
  private disposed;
116
- private drawn;
117
140
  private stride;
141
+ private readonly cellLabels;
142
+ private lingerTimer;
143
+ private drawnView;
144
+ private drawnInputs;
145
+ private readonly scratchWorld;
146
+ private readonly scratchWindow;
147
+ private readonly scratchClip;
148
+ private viewProjection;
149
+ private readonly viewProjectionScratch;
150
+ private hovering;
151
+ private hoverFrame;
152
+ private hoverAt;
153
+ private readonly onPointerMove;
154
+ private readonly onPointerLeave;
118
155
  constructor(options: IOptions);
119
156
  SetExtent(extent: IExtent): void;
120
157
  /**
121
- * The current frame's decoded values, as the animator's value canvas already provides them.
158
+ * The current frame's decoded values.
122
159
  * @param source value pixels, one texel per cell
123
160
  */
124
- SetSource(source: ImageData | null): void;
161
+ SetSource(source: IRaster | null): void;
125
162
  /**
126
163
  * The tinted pixels of the same frame, so the grid can skip cells the ramp painted nothing in.
127
- * @param painted RGBA of the presented frame, or null to fall back to coverage alone
164
+ * @param painted RGBA of the presented frame, or null to fall back to the ramp or coverage alone
128
165
  */
129
166
  SetPainted(painted: Uint8ClampedArray | null): void;
167
+ /**
168
+ * The surface's 256 step RGBA ramp, for telling whether a cell was painted without a tinted frame.
169
+ */
170
+ SetPaintedRamp(ramp: Uint8Array | null): void;
130
171
  /**
131
172
  * The archive's per-cell extremes, when it publishes them. Without these a label can still
132
173
  * print the current reading, just not the range behind it.
@@ -136,26 +177,33 @@ export declare namespace TextureValueLabels {
136
177
  Clear(): void;
137
178
  Dispose(): void;
138
179
  /**
139
- * Redraws every visible label. Cheap enough to call per rendered frame, because the cell
140
- * count it considers is bounded by the view rather than by the texture.
180
+ * Redraws the grid and syncs the value labels, when anything they are drawn from has changed.
141
181
  */
142
182
  Render(): void;
183
+ private labelCells;
184
+ private syncCellLabels;
185
+ private clearCellLabels;
186
+ private updateHover;
187
+ private releaseHover;
188
+ private readingUnder;
189
+ private cellUnder;
143
190
  private drawGrid;
144
191
  private applyRingClip;
145
- private tileCellOutline;
146
192
  private drawTileGrid;
147
193
  private groundAtScreenCentre;
148
194
  private coveredAt;
149
195
  private isCovered;
150
- private widestLabel;
151
- private cellOutline;
152
- private drawLabel;
196
+ private labelLines;
153
197
  private readNear;
154
198
  private paintedAt;
155
199
  private readAt;
200
+ private texelAt;
156
201
  private lonAt;
157
202
  private latAt;
158
203
  private visibleTexels;
204
+ private surfaceHeight;
205
+ private projectCell;
159
206
  private project;
207
+ private projectInto;
160
208
  }
161
209
  }
@@ -576,9 +576,15 @@ export declare namespace VisualsRegister {
576
576
  y: number;
577
577
  };
578
578
  createIfMissing?: boolean;
579
+ text?: string;
580
+ pos3d?: Cesium.Cartesian3;
579
581
  } | null): void;
580
582
  ClearLabelHover: () => void;
581
583
  private CheckLabelHoverBounds;
584
+ GetLabelHoverTarget(): Readonly<{
585
+ entityId: string;
586
+ menuItemId?: string;
587
+ }> | undefined;
582
588
  IsLabelHovered(entityId: string, menuItemId?: string): boolean;
583
589
  GetLabelHoverPosition(entityId: string, menuItemId?: string): Readonly<{
584
590
  x: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bruce-cesium",
3
- "version": "7.5.8",
3
+ "version": "7.6.0",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/bruce-cesium.umd.js",