bruce-cesium 7.2.2 → 7.2.3
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 +419 -372
- package/dist/bruce-cesium.es5.js.map +1 -1
- package/dist/bruce-cesium.umd.js +423 -377
- 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 +26 -36
- package/dist/lib/rendering/entity-render-engine-polygon.js.map +1 -1
- package/dist/lib/rendering/texture-frame-series-animator.js +271 -267
- package/dist/lib/rendering/texture-frame-series-animator.js.map +1 -1
- package/dist/lib/rendering/texture-value-labels.js +65 -23
- 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 +161 -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,179 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
86
68
|
};
|
|
87
69
|
}
|
|
88
70
|
const LAYOUT_TILES = "tiles";
|
|
71
|
+
const SUPPORTED_VERSION = 3;
|
|
89
72
|
/**
|
|
90
|
-
*
|
|
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.
|
|
185
|
+
* @param metadata the archive's Data.generation
|
|
186
|
+
*/
|
|
187
|
+
function SourceMap(metadata: IFrameArchiveMetadata | undefined): {
|
|
188
|
+
scale: number;
|
|
189
|
+
offset: number;
|
|
190
|
+
} | null;
|
|
191
|
+
/**
|
|
192
|
+
* A delivered value in the source's own terms, or unchanged when it cannot be turned back.
|
|
193
|
+
* @param map from SourceMap(), null when the archive does not say enough
|
|
194
|
+
*/
|
|
195
|
+
function ToSource(map: {
|
|
196
|
+
scale: number;
|
|
197
|
+
offset: number;
|
|
198
|
+
} | null, value: number): number;
|
|
199
|
+
/**
|
|
200
|
+
* Whether the archive's frames carry a 16 bit value packed across R and G.
|
|
91
201
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
202
|
+
* Every consumer that reads a texel has to ask: taking R alone from a packed frame yields a
|
|
203
|
+
* plausible surface quantised to 255 steps of the full range rather than an obvious failure.
|
|
94
204
|
* @param metadata the archive's Data.generation
|
|
95
205
|
*/
|
|
96
|
-
function
|
|
206
|
+
function IsPackedValue(metadata: IFrameArchiveMetadata | undefined): boolean;
|
|
97
207
|
/**
|
|
98
|
-
*
|
|
208
|
+
* The normalised 0 to 1 value at a texel, from whichever format the archive packed it in.
|
|
99
209
|
* @param metadata the archive's Data.generation
|
|
210
|
+
* @param pixels untinted RGBA value pixels
|
|
211
|
+
* @param at index of the texel's red channel
|
|
100
212
|
*/
|
|
101
|
-
function
|
|
102
|
-
const
|
|
103
|
-
const MEASURE_ANOMALY = "anomaly";
|
|
213
|
+
function NormalisedAt(metadata: IFrameArchiveMetadata | undefined, pixels: Uint8ClampedArray, at: number): number;
|
|
214
|
+
const DATUM_ELLIPSOIDAL = "WGS84";
|
|
104
215
|
/**
|
|
105
|
-
*
|
|
216
|
+
* Whether the values are heights against a vertical datum rather than a thickness.
|
|
106
217
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
218
|
+
* A thickness rises from wherever the polygon sits and a height already knows where it belongs, so
|
|
219
|
+
* this is what decides whether the polygon's own altitude may be added underneath it.
|
|
109
220
|
* @param metadata the archive's Data.generation
|
|
110
|
-
* @param value in the attribute's units
|
|
111
221
|
*/
|
|
112
|
-
function
|
|
222
|
+
function IsDatumHeight(metadata: IFrameArchiveMetadata | undefined): boolean;
|
|
113
223
|
/**
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* Worth asking before labelling anything: the two measures need different words for the same
|
|
117
|
-
* number, and calling an anomaly "water depth" is a worse error than the coarse ramp it replaced.
|
|
224
|
+
* The archive's tiles, which Adapt() guarantees are present.
|
|
118
225
|
* @param metadata the archive's Data.generation
|
|
119
226
|
*/
|
|
120
|
-
function
|
|
227
|
+
function TilesOf(metadata: IFrameArchiveMetadata | undefined): ITileEntry[];
|
|
121
228
|
/**
|
|
122
|
-
*
|
|
229
|
+
* Turns a value in the attribute's own units into the 0 to 1 position the ramp is indexed by.
|
|
123
230
|
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
231
|
+
* Stops are authored in real units, since "hide anything under 0.1 m" is the sentence a user
|
|
232
|
+
* actually has, and the archive's own published range is what makes that expressible.
|
|
126
233
|
* @param metadata the archive's Data.generation
|
|
234
|
+
* @param value in the attribute's units
|
|
127
235
|
*/
|
|
128
|
-
function
|
|
236
|
+
function NormalisePosition(metadata: IFrameArchiveMetadata | undefined, value: number): number;
|
|
129
237
|
/**
|
|
130
238
|
* Detects whether a ClientFile's `Data.generation` metadata describes a frame archive rather than a single static image,
|
|
131
239
|
* so a caller can decide whether to construct an Animator or fall back to the existing static-texture path.
|
|
132
|
-
* @param data ClientFile.Data
|
|
240
|
+
* @param data ClientFile.Data
|
|
133
241
|
*/
|
|
134
242
|
function IsFrameArchiveMetadata(data: any): data is {
|
|
135
|
-
generation:
|
|
243
|
+
generation: IValueMapMetadata;
|
|
136
244
|
};
|
|
137
245
|
/**
|
|
138
246
|
* Structural copies of the style shapes this consumes.
|
|
@@ -172,10 +280,6 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
172
280
|
driveMaterial?: boolean;
|
|
173
281
|
produceValueCanvas?: boolean;
|
|
174
282
|
drapeExtent?: IExtent;
|
|
175
|
-
baselineMask?: {
|
|
176
|
-
ByteOffset: number;
|
|
177
|
-
ByteLength: number;
|
|
178
|
-
};
|
|
179
283
|
maskBaseline?: boolean;
|
|
180
284
|
}
|
|
181
285
|
class Animator {
|
|
@@ -219,8 +323,7 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
219
323
|
private readonly produceValueCanvas;
|
|
220
324
|
private readonly metadata?;
|
|
221
325
|
private readonly drapeExtent?;
|
|
222
|
-
private readonly tiles
|
|
223
|
-
private scratch;
|
|
326
|
+
private readonly tiles;
|
|
224
327
|
private readonly valueCanvas;
|
|
225
328
|
private valueDims;
|
|
226
329
|
private presentVersion;
|
|
@@ -269,16 +372,12 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
269
372
|
private nearestUncachedFrame;
|
|
270
373
|
private pumpFetchQueue;
|
|
271
374
|
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<{
|
|
375
|
+
protected composeTiles(tiles: ITileEntry[], idx: number, buffer: ArrayBuffer, spanStart: number): Promise<{
|
|
276
376
|
pixels: Uint8ClampedArray;
|
|
277
377
|
width: number;
|
|
278
378
|
height: number;
|
|
279
379
|
valuePixels?: Uint8ClampedArray;
|
|
280
380
|
}>;
|
|
281
|
-
private composeTiles;
|
|
282
381
|
private compositeExtent;
|
|
283
382
|
private compositeSize;
|
|
284
383
|
protected tint(imageData: ImageData): {
|
|
@@ -288,7 +387,6 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
288
387
|
valuePixels?: Uint8ClampedArray;
|
|
289
388
|
};
|
|
290
389
|
private writeInto;
|
|
291
|
-
private sourceRect;
|
|
292
390
|
/**
|
|
293
391
|
* The archive's per-cell floor and ceiling rasters, once EnsureExtremes has resolved.
|
|
294
392
|
*/
|
|
@@ -304,9 +402,6 @@ export declare namespace TextureFrameSeriesAnimator {
|
|
|
304
402
|
private loadTiledExtremes;
|
|
305
403
|
private tileRect;
|
|
306
404
|
private decodeSlices;
|
|
307
|
-
private loadImageAt;
|
|
308
|
-
private remap;
|
|
309
|
-
private loadImageDataAt;
|
|
310
405
|
/**
|
|
311
406
|
* Fetches and decodes the archive's static baseline mask, at most once.
|
|
312
407
|
*/
|
|
@@ -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.3",
|
|
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
|
}
|