bruce-cesium 7.2.2 → 7.2.4
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 +437 -377
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +441 -382
- package/dist/bruce-cesium.umd.js.map +1 -1
- package/dist/lib/bruce-cesium.js +2 -1
- package/dist/lib/bruce-cesium.js.map +1 -1
- package/dist/lib/rendering/displaced-surface-primitive.js +51 -43
- package/dist/lib/rendering/displaced-surface-primitive.js.map +1 -1
- package/dist/lib/rendering/entity-render-engine-polygon.js +30 -39
- package/dist/lib/rendering/entity-render-engine-polygon.js.map +1 -1
- package/dist/lib/rendering/texture-frame-series-animator.js +279 -267
- package/dist/lib/rendering/texture-frame-series-animator.js.map +1 -1
- package/dist/lib/rendering/texture-value-labels.js +71 -25
- package/dist/lib/rendering/texture-value-labels.js.map +1 -1
- package/dist/types/bruce-cesium.d.ts +2 -1
- package/dist/types/rendering/displaced-surface-primitive.d.ts +2 -10
- package/dist/types/rendering/texture-frame-series-animator.d.ts +166 -66
- package/dist/types/rendering/texture-value-labels.d.ts +22 -0
- package/package.json +2 -2
|
@@ -23,34 +23,19 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
23
23
|
ResolutionX?: number;
|
|
24
24
|
ResolutionY?: number;
|
|
25
25
|
PixelPlacement?: string;
|
|
26
|
-
BaselineFaces?: number;
|
|
27
|
-
BaselineMask?: {
|
|
28
|
-
ByteOffset: number;
|
|
29
|
-
ByteLength: number;
|
|
30
|
-
};
|
|
31
|
-
BaselineValueMin?: number;
|
|
32
|
-
BaselineValueMax?: number;
|
|
33
|
-
Measure?: string;
|
|
34
|
-
AnomalyMax?: number;
|
|
35
|
-
Floor?: {
|
|
36
|
-
ByteOffset: number;
|
|
37
|
-
ByteLength: number;
|
|
38
|
-
};
|
|
39
|
-
Ceiling?: {
|
|
40
|
-
ByteOffset: number;
|
|
41
|
-
ByteLength: number;
|
|
42
|
-
};
|
|
43
26
|
ExtremesValueMin?: number;
|
|
44
27
|
ExtremesValueMax?: number;
|
|
45
|
-
Layout?: string;
|
|
46
|
-
TileTexels?: number;
|
|
47
28
|
Times?: string[];
|
|
48
29
|
Tiles?: ITileEntry[];
|
|
49
|
-
|
|
50
|
-
|
|
30
|
+
Format?: string;
|
|
31
|
+
Encoding?: string;
|
|
32
|
+
Units?: string;
|
|
33
|
+
SourceVerticalDatum?: string;
|
|
34
|
+
Transform?: string;
|
|
35
|
+
SourceUnits?: string;
|
|
36
|
+
SourceValueMin?: number;
|
|
37
|
+
SourceValueMax?: number;
|
|
51
38
|
}
|
|
52
|
-
const QUANTITY_THICKNESS = "thickness";
|
|
53
|
-
const QUANTITY_ELEVATION = "elevation";
|
|
54
39
|
/**
|
|
55
40
|
* One tile of an adaptive pyramid.
|
|
56
41
|
*
|
|
@@ -68,10 +53,7 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
68
53
|
TexelMetres: number;
|
|
69
54
|
ResolutionX: number;
|
|
70
55
|
ResolutionY: number;
|
|
71
|
-
Frames:
|
|
72
|
-
ByteOffset: number;
|
|
73
|
-
ByteLength: number;
|
|
74
|
-
}[];
|
|
56
|
+
Frames: IFrameEntry[];
|
|
75
57
|
Floor?: {
|
|
76
58
|
ByteOffset: number;
|
|
77
59
|
ByteLength: number;
|
|
@@ -86,53 +68,184 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
86
68
|
};
|
|
87
69
|
}
|
|
88
70
|
const LAYOUT_TILES = "tiles";
|
|
71
|
+
const SUPPORTED_VERSION = 3;
|
|
89
72
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
|
|
73
|
+
* A value map as the generator publishes it: what the numbers are, how they are packed, where
|
|
74
|
+
* they are, and which per-texel layers exist.
|
|
75
|
+
*/
|
|
76
|
+
interface IValueMapMetadata {
|
|
77
|
+
Version?: number;
|
|
78
|
+
Identity?: {
|
|
79
|
+
BruceSourceID?: number;
|
|
80
|
+
EntityTypeSourceID?: number;
|
|
81
|
+
EntityTypeID?: string;
|
|
82
|
+
Attribute?: string;
|
|
83
|
+
Label?: string;
|
|
84
|
+
Dataset?: string;
|
|
85
|
+
Generated?: string;
|
|
86
|
+
Revision?: number;
|
|
87
|
+
};
|
|
88
|
+
Series?: {
|
|
89
|
+
Start?: string;
|
|
90
|
+
End?: string;
|
|
91
|
+
Increment?: string;
|
|
92
|
+
Requested?: number;
|
|
93
|
+
Written?: number;
|
|
94
|
+
Complete?: boolean;
|
|
95
|
+
Times?: string[];
|
|
96
|
+
};
|
|
97
|
+
Value?: {
|
|
98
|
+
Units?: string;
|
|
99
|
+
Encoding?: string;
|
|
100
|
+
Format?: string;
|
|
101
|
+
Min?: number;
|
|
102
|
+
Max?: number;
|
|
103
|
+
};
|
|
104
|
+
ValueSource?: {
|
|
105
|
+
Units?: string;
|
|
106
|
+
Min?: number;
|
|
107
|
+
Max?: number;
|
|
108
|
+
VerticalDatum?: string;
|
|
109
|
+
Transform?: string;
|
|
110
|
+
};
|
|
111
|
+
Layers?: {
|
|
112
|
+
Name: string;
|
|
113
|
+
Format?: string;
|
|
114
|
+
PerTime?: boolean;
|
|
115
|
+
Min?: number;
|
|
116
|
+
Max?: number;
|
|
117
|
+
}[];
|
|
118
|
+
Geometry?: {
|
|
119
|
+
CRS?: string;
|
|
120
|
+
SourceCRS?: string;
|
|
121
|
+
West?: number;
|
|
122
|
+
East?: number;
|
|
123
|
+
South?: number;
|
|
124
|
+
North?: number;
|
|
125
|
+
PixelPlacement?: string;
|
|
126
|
+
ExtentCovers?: string;
|
|
127
|
+
Layout?: string;
|
|
128
|
+
TileTexels?: number;
|
|
129
|
+
ResolutionX?: number;
|
|
130
|
+
ResolutionY?: number;
|
|
131
|
+
};
|
|
132
|
+
Stats?: {
|
|
133
|
+
MovingRangeMax?: number;
|
|
134
|
+
BaselineCells?: number;
|
|
135
|
+
Baseline?: {
|
|
136
|
+
Min?: number;
|
|
137
|
+
Max?: number;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
Hints?: {
|
|
141
|
+
ColorBarMin?: number;
|
|
142
|
+
ColorBarMax?: number;
|
|
143
|
+
};
|
|
144
|
+
Tiles?: IValueMapTile[];
|
|
145
|
+
}
|
|
146
|
+
interface IValueMapTile {
|
|
147
|
+
Level: number;
|
|
148
|
+
X: number;
|
|
149
|
+
Y: number;
|
|
150
|
+
West: number;
|
|
151
|
+
East: number;
|
|
152
|
+
South: number;
|
|
153
|
+
North: number;
|
|
154
|
+
TexelMetres: number;
|
|
155
|
+
ResolutionX: number;
|
|
156
|
+
ResolutionY: number;
|
|
157
|
+
Layers?: {
|
|
158
|
+
[name: string]: {
|
|
159
|
+
Bytes: IByteRange;
|
|
160
|
+
} | {
|
|
161
|
+
Bytes: IByteRange;
|
|
162
|
+
}[];
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
interface IByteRange {
|
|
166
|
+
Offset: number;
|
|
167
|
+
Length: number;
|
|
168
|
+
}
|
|
169
|
+
const FORMAT_U8 = "u8";
|
|
170
|
+
const FORMAT_RG16 = "rg16";
|
|
171
|
+
const ENCODING_ABSOLUTE = "absolute";
|
|
172
|
+
const LAYER_VALUE = "Value";
|
|
173
|
+
const LAYER_VALUE_MIN = "ValueMin";
|
|
174
|
+
const LAYER_VALUE_MAX = "ValueMax";
|
|
175
|
+
const LAYER_BASELINE = "Baseline";
|
|
176
|
+
const LAYER_VALUE_SHIFT = "ValueShift";
|
|
177
|
+
/**
|
|
178
|
+
* Turns a published value map into the flat shape this renderer works in, or null when it cannot be drawn.
|
|
179
|
+
* @param published the archive's Data.generation
|
|
180
|
+
*/
|
|
181
|
+
function Adapt(published: IValueMapMetadata | undefined): IFrameArchiveMetadata | null;
|
|
182
|
+
/**
|
|
183
|
+
* How to turn a delivered value into the number the source published, or null when the archive
|
|
184
|
+
* does not say enough to do it.
|
|
94
185
|
* @param metadata the archive's Data.generation
|
|
95
186
|
*/
|
|
96
|
-
function
|
|
187
|
+
function SourceMap(metadata: IFrameArchiveMetadata | undefined): {
|
|
188
|
+
scale: number;
|
|
189
|
+
offset: number;
|
|
190
|
+
} | null;
|
|
97
191
|
/**
|
|
98
|
-
* Whether
|
|
192
|
+
* Whether anything was applied to the values on the way out of the source.
|
|
99
193
|
* @param metadata the archive's Data.generation
|
|
100
194
|
*/
|
|
101
|
-
function
|
|
102
|
-
const MEASURE_ABSOLUTE = "absolute";
|
|
103
|
-
const MEASURE_ANOMALY = "anomaly";
|
|
195
|
+
function IsTransformed(metadata: IFrameArchiveMetadata | undefined): boolean;
|
|
104
196
|
/**
|
|
105
|
-
*
|
|
197
|
+
* A delivered value in the source's own terms, or unchanged when it cannot be turned back.
|
|
198
|
+
* @param map from SourceMap(), null when the archive does not say enough
|
|
199
|
+
*/
|
|
200
|
+
function ToSource(map: {
|
|
201
|
+
scale: number;
|
|
202
|
+
offset: number;
|
|
203
|
+
} | null, value: number): number;
|
|
204
|
+
/**
|
|
205
|
+
* Whether the archive's frames carry a 16 bit value packed across R and G.
|
|
106
206
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
207
|
+
* Every consumer that reads a texel has to ask: taking R alone from a packed frame yields a
|
|
208
|
+
* plausible surface quantised to 255 steps of the full range rather than an obvious failure.
|
|
109
209
|
* @param metadata the archive's Data.generation
|
|
110
|
-
* @param value in the attribute's units
|
|
111
210
|
*/
|
|
112
|
-
function
|
|
211
|
+
function IsPackedValue(metadata: IFrameArchiveMetadata | undefined): boolean;
|
|
113
212
|
/**
|
|
114
|
-
*
|
|
213
|
+
* The normalised 0 to 1 value at a texel, from whichever format the archive packed it in.
|
|
214
|
+
* @param metadata the archive's Data.generation
|
|
215
|
+
* @param pixels untinted RGBA value pixels
|
|
216
|
+
* @param at index of the texel's red channel
|
|
217
|
+
*/
|
|
218
|
+
function NormalisedAt(metadata: IFrameArchiveMetadata | undefined, pixels: Uint8ClampedArray, at: number): number;
|
|
219
|
+
const DATUM_ELLIPSOIDAL = "WGS84";
|
|
220
|
+
/**
|
|
221
|
+
* Whether the values are heights against a vertical datum rather than a thickness.
|
|
115
222
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
223
|
+
* A thickness rises from wherever the polygon sits and a height already knows where it belongs, so
|
|
224
|
+
* this is what decides whether the polygon's own altitude may be added underneath it.
|
|
225
|
+
* @param metadata the archive's Data.generation
|
|
226
|
+
*/
|
|
227
|
+
function IsDatumHeight(metadata: IFrameArchiveMetadata | undefined): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* The archive's tiles, which Adapt() guarantees are present.
|
|
118
230
|
* @param metadata the archive's Data.generation
|
|
119
231
|
*/
|
|
120
|
-
function
|
|
232
|
+
function TilesOf(metadata: IFrameArchiveMetadata | undefined): ITileEntry[];
|
|
121
233
|
/**
|
|
122
|
-
*
|
|
234
|
+
* Turns a value in the attribute's own units into the 0 to 1 position the ramp is indexed by.
|
|
123
235
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
236
|
+
* Stops are authored in real units, since "hide anything under 0.1 m" is the sentence a user
|
|
237
|
+
* actually has, and the archive's own published range is what makes that expressible.
|
|
126
238
|
* @param metadata the archive's Data.generation
|
|
239
|
+
* @param value in the attribute's units
|
|
127
240
|
*/
|
|
128
|
-
function
|
|
241
|
+
function NormalisePosition(metadata: IFrameArchiveMetadata | undefined, value: number): number;
|
|
129
242
|
/**
|
|
130
243
|
* Detects whether a ClientFile's `Data.generation` metadata describes a frame archive rather than a single static image,
|
|
131
244
|
* so a caller can decide whether to construct an Animator or fall back to the existing static-texture path.
|
|
132
|
-
* @param data ClientFile.Data
|
|
245
|
+
* @param data ClientFile.Data
|
|
133
246
|
*/
|
|
134
247
|
function IsFrameArchiveMetadata(data: any): data is {
|
|
135
|
-
generation:
|
|
248
|
+
generation: IValueMapMetadata;
|
|
136
249
|
};
|
|
137
250
|
/**
|
|
138
251
|
* Structural copies of the style shapes this consumes.
|
|
@@ -172,10 +285,6 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
172
285
|
driveMaterial?: boolean;
|
|
173
286
|
produceValueCanvas?: boolean;
|
|
174
287
|
drapeExtent?: IExtent;
|
|
175
|
-
baselineMask?: {
|
|
176
|
-
ByteOffset: number;
|
|
177
|
-
ByteLength: number;
|
|
178
|
-
};
|
|
179
288
|
maskBaseline?: boolean;
|
|
180
289
|
}
|
|
181
290
|
class Animator {
|
|
@@ -219,8 +328,7 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
219
328
|
private readonly produceValueCanvas;
|
|
220
329
|
private readonly metadata?;
|
|
221
330
|
private readonly drapeExtent?;
|
|
222
|
-
private readonly tiles
|
|
223
|
-
private scratch;
|
|
331
|
+
private readonly tiles;
|
|
224
332
|
private readonly valueCanvas;
|
|
225
333
|
private valueDims;
|
|
226
334
|
private presentVersion;
|
|
@@ -269,16 +377,12 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
269
377
|
private nearestUncachedFrame;
|
|
270
378
|
private pumpFetchQueue;
|
|
271
379
|
private fetchAndTint;
|
|
272
|
-
|
|
273
|
-
* Decodes one frame's raw PNG bytes (as returned by a Range GET) and applies the grayscale color mask.
|
|
274
|
-
*/
|
|
275
|
-
protected decodeAndTint(buffer: ArrayBuffer): Promise<{
|
|
380
|
+
protected composeTiles(tiles: ITileEntry[], idx: number, buffer: ArrayBuffer, spanStart: number): Promise<{
|
|
276
381
|
pixels: Uint8ClampedArray;
|
|
277
382
|
width: number;
|
|
278
383
|
height: number;
|
|
279
384
|
valuePixels?: Uint8ClampedArray;
|
|
280
385
|
}>;
|
|
281
|
-
private composeTiles;
|
|
282
386
|
private compositeExtent;
|
|
283
387
|
private compositeSize;
|
|
284
388
|
protected tint(imageData: ImageData): {
|
|
@@ -288,7 +392,6 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
288
392
|
valuePixels?: Uint8ClampedArray;
|
|
289
393
|
};
|
|
290
394
|
private writeInto;
|
|
291
|
-
private sourceRect;
|
|
292
395
|
/**
|
|
293
396
|
* The archive's per-cell floor and ceiling rasters, once EnsureExtremes has resolved.
|
|
294
397
|
*/
|
|
@@ -304,9 +407,6 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
304
407
|
private loadTiledExtremes;
|
|
305
408
|
private tileRect;
|
|
306
409
|
private decodeSlices;
|
|
307
|
-
private loadImageAt;
|
|
308
|
-
private remap;
|
|
309
|
-
private loadImageDataAt;
|
|
310
410
|
/**
|
|
311
411
|
* Fetches and decodes the archive's static baseline mask, at most once.
|
|
312
412
|
*/
|
|
@@ -65,6 +65,27 @@ export declare namespace TextureValueLabels {
|
|
|
65
65
|
x: number;
|
|
66
66
|
y: number;
|
|
67
67
|
}[] | null;
|
|
68
|
+
/**
|
|
69
|
+
* One cell's numbers as a label should print them, or null where the texture has no data there.
|
|
70
|
+
* @param params at is the index of the cell's red channel. sourceMap is derived from the metadata
|
|
71
|
+
* when omitted, which a caller reading many cells should hoist rather than repeat.
|
|
72
|
+
*/
|
|
73
|
+
function ReadingAt(params: {
|
|
74
|
+
metadata?: TextureFrameSeriesAnimator.IFrameArchiveMetadata;
|
|
75
|
+
source: ImageData;
|
|
76
|
+
floor?: ImageData | null;
|
|
77
|
+
ceiling?: ImageData | null;
|
|
78
|
+
at: number;
|
|
79
|
+
sourceMap?: {
|
|
80
|
+
scale: number;
|
|
81
|
+
offset: number;
|
|
82
|
+
} | null;
|
|
83
|
+
}): IReading | null;
|
|
84
|
+
/**
|
|
85
|
+
* The unit a label's value line should name, or undefined when the archive states none.
|
|
86
|
+
* @param metadata the archive's Data.generation
|
|
87
|
+
*/
|
|
88
|
+
function LabelUnits(metadata?: TextureFrameSeriesAnimator.IFrameArchiveMetadata): string | undefined;
|
|
68
89
|
/**
|
|
69
90
|
* How many cells apart labels should sit, as a power of two.
|
|
70
91
|
* @param options cellPixels is one cell's size on screen, held is the stride already in use
|
|
@@ -84,6 +105,7 @@ export declare namespace TextureValueLabels {
|
|
|
84
105
|
private readonly settings;
|
|
85
106
|
private extent;
|
|
86
107
|
private metadata?;
|
|
108
|
+
private sourceMap;
|
|
87
109
|
private tiles?;
|
|
88
110
|
private clipRing?;
|
|
89
111
|
private source;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bruce-cesium",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.4",
|
|
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.
|
|
86
|
+
"bruce-models": "^7.1.80",
|
|
87
87
|
"tslib": "^2.4.1"
|
|
88
88
|
}
|
|
89
89
|
}
|