Skip to content

Commit 62e0b49

Browse files
author
jerome.fayot
committed
fix: changed DefaultValues namespace to Frozen
1 parent 5fdf74b commit 62e0b49

File tree

280 files changed

+747
-840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+747
-840
lines changed

Documentation/Contributors/CodingGuide/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,15 +453,15 @@ Cartesian3.fromRadians = function (longitude, latitude, height) {
453453
this._mapProjection = options.mapProjection ?? new GeographicProjection();
454454
```
455455
456-
- If an `options` parameter is optional and never modified afterwards, use `DefaultValues.EMPTY_OBJECT` or `DefaultValues.EMPTY_ARRAY`, this could prevent from unnecessary memory allocations in code critical path, e.g.,
456+
- If an `options` parameter is optional and never modified afterwards, use `Frozen.EMPTY_OBJECT` or `Frozen.EMPTY_ARRAY`, this could prevent from unnecessary memory allocations in code critical path, e.g.,
457457
458458
```javascript
459459
function BaseLayerPickerViewModel(options) {
460-
options = options ?? DefaultValues.EMPTY_OBJECT;
460+
options = options ?? Frozen.EMPTY_OBJECT;
461461

462462
const globe = options.globe;
463463
const imageryProviderViewModels =
464-
options.imageryProviderViewModels ?? DefaultValues.EMPTY_ARRAY;
464+
options.imageryProviderViewModels ?? Frozen.EMPTY_ARRAY;
465465
// ...
466466
}
467467
```

Specs/Cesium3DTilesTester.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
Cartesian3,
33
Color,
4-
DefaultValues,
4+
Frozen,
55
defined,
66
JulianDate,
77
ImageBasedLighting,
@@ -164,7 +164,7 @@ Cesium3DTilesTester.tileDestroys = function (scene, url, options) {
164164

165165
Cesium3DTilesTester.generateBatchedTileBuffer = function (options) {
166166
// Procedurally generate the tile array buffer for testing purposes
167-
options = options ?? DefaultValues.EMPTY_OBJECT;
167+
options = options ?? Frozen.EMPTY_OBJECT;
168168
const magic = options.magic ?? [98, 51, 100, 109];
169169
const version = options.version ?? 1;
170170
const featuresLength = options.featuresLength ?? 1;
@@ -201,7 +201,7 @@ Cesium3DTilesTester.generateBatchedTileBuffer = function (options) {
201201

202202
Cesium3DTilesTester.generateInstancedTileBuffer = function (options) {
203203
// Procedurally generate the tile array buffer for testing purposes
204-
options = options ?? DefaultValues.EMPTY_OBJECT;
204+
options = options ?? Frozen.EMPTY_OBJECT;
205205
const magic = options.magic ?? [105, 51, 100, 109];
206206
const version = options.version ?? 1;
207207

@@ -288,7 +288,7 @@ Cesium3DTilesTester.generateInstancedTileBuffer = function (options) {
288288

289289
Cesium3DTilesTester.generatePointCloudTileBuffer = function (options) {
290290
// Procedurally generate the tile array buffer for testing purposes
291-
options = options ?? DefaultValues.EMPTY_OBJECT;
291+
options = options ?? Frozen.EMPTY_OBJECT;
292292
const magic = options.magic ?? [112, 110, 116, 115];
293293
const version = options.version ?? 1;
294294
let featureTableJson = options.featureTableJson;
@@ -342,10 +342,10 @@ Cesium3DTilesTester.generatePointCloudTileBuffer = function (options) {
342342

343343
Cesium3DTilesTester.generateCompositeTileBuffer = function (options) {
344344
// Procedurally generate the tile array buffer for testing purposes
345-
options = options ?? DefaultValues.EMPTY_OBJECT;
345+
options = options ?? Frozen.EMPTY_OBJECT;
346346
const magic = options.magic ?? [99, 109, 112, 116];
347347
const version = options.version ?? 1;
348-
const tiles = options.tiles ?? DefaultValues.EMPTY_ARRAY;
348+
const tiles = options.tiles ?? Frozen.EMPTY_ARRAY;
349349
const tilesLength = tiles.length;
350350

351351
let i;
@@ -379,7 +379,7 @@ Cesium3DTilesTester.generateCompositeTileBuffer = function (options) {
379379

380380
Cesium3DTilesTester.generateVectorTileBuffer = function (options) {
381381
// Procedurally generate the tile array buffer for testing purposes
382-
options = options ?? DefaultValues.EMPTY_OBJECT;
382+
options = options ?? Frozen.EMPTY_OBJECT;
383383
const magic = options.magic ?? [118, 99, 116, 114];
384384
const version = options.version ?? 1;
385385

@@ -432,7 +432,7 @@ Cesium3DTilesTester.generateVectorTileBuffer = function (options) {
432432

433433
Cesium3DTilesTester.generateGeometryTileBuffer = function (options) {
434434
// Procedurally generate the tile array buffer for testing purposes
435-
options = options ?? DefaultValues.EMPTY_OBJECT;
435+
options = options ?? Frozen.EMPTY_OBJECT;
436436
const magic = options.magic ?? [103, 101, 111, 109];
437437
const version = options.version ?? 1;
438438

Specs/DomEventSimulator.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { DefaultValues, FeatureDetection } from "@cesium/engine";
1+
import { Frozen, FeatureDetection } from "@cesium/engine";
22

33
function createMouseEvent(type, options) {
4-
options = options ?? DefaultValues.EMPTY_OBJECT;
4+
options = options ?? Frozen.EMPTY_OBJECT;
55
const canBubble = options.canBubble ?? true;
66
const cancelable = options.cancelable ?? true;
77
const view = options.view ?? window;
@@ -57,7 +57,7 @@ function createModifiersList(ctrlKey, altKey, shiftKey, metaKey) {
5757

5858
// MouseWheelEvent is legacy
5959
function createMouseWheelEvent(type, options) {
60-
options = options ?? DefaultValues.EMPTY_OBJECT;
60+
options = options ?? Frozen.EMPTY_OBJECT;
6161
const canBubble = options.canBubble ?? true;
6262
const cancelable = options.cancelable ?? true;
6363
const view = options.view ?? window;
@@ -95,7 +95,7 @@ function createMouseWheelEvent(type, options) {
9595
}
9696

9797
function createWheelEvent(type, options) {
98-
options = options ?? DefaultValues.EMPTY_OBJECT;
98+
options = options ?? Frozen.EMPTY_OBJECT;
9999
const canBubble = options.canBubble ?? true;
100100
const cancelable = options.cancelable ?? true;
101101
const view = options.view ?? window;
@@ -165,7 +165,7 @@ function createWheelEvent(type, options) {
165165
}
166166

167167
function createTouchEvent(type, options) {
168-
options = options ?? DefaultValues.EMPTY_OBJECT;
168+
options = options ?? Frozen.EMPTY_OBJECT;
169169
const canBubble = options.canBubble ?? true;
170170
const cancelable = options.cancelable ?? true;
171171
const view = options.view ?? window;
@@ -174,15 +174,15 @@ function createTouchEvent(type, options) {
174174
const event = document.createEvent("UIEvent");
175175
event.initUIEvent(type, canBubble, cancelable, view, detail);
176176

177-
event.touches = options.touches ?? DefaultValues.EMPTY_ARRAY;
178-
event.targetTouches = options.targetTouches ?? DefaultValues.EMPTY_ARRAY;
179-
event.changedTouches = options.changedTouches ?? DefaultValues.EMPTY_ARRAY;
177+
event.touches = options.touches ?? Frozen.EMPTY_ARRAY;
178+
event.targetTouches = options.targetTouches ?? Frozen.EMPTY_ARRAY;
179+
event.changedTouches = options.changedTouches ?? Frozen.EMPTY_ARRAY;
180180

181181
return event;
182182
}
183183

184184
function createPointerEvent(type, options) {
185-
options = options ?? DefaultValues.EMPTY_OBJECT;
185+
options = options ?? Frozen.EMPTY_OBJECT;
186186
let event;
187187

188188
if (FeatureDetection.isInternetExplorer()) {
@@ -277,7 +277,7 @@ function createPointerEvent(type, options) {
277277
}
278278

279279
function createDeviceOrientationEvent(type, options) {
280-
options = options ?? DefaultValues.EMPTY_OBJECT;
280+
options = options ?? Frozen.EMPTY_OBJECT;
281281
const canBubble = options.canBubble ?? true;
282282
const cancelable = options.cancelable ?? true;
283283
const alpha = options.alpha ?? 0.0;

Specs/MetadataTester.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
defined,
3-
DefaultValues,
3+
Frozen,
44
DeveloperError,
55
FeatureDetection,
66
PropertyTable,
@@ -143,7 +143,7 @@ function createProperties(options) {
143143
}
144144

145145
MetadataTester.createMetadataTable = function (options) {
146-
options = options ?? DefaultValues.EMPTY_OBJECT;
146+
options = options ?? Frozen.EMPTY_OBJECT;
147147
const disableBigIntSupport = options.disableBigIntSupport;
148148
const disableBigInt64ArraySupport = options.disableBigInt64ArraySupport;
149149
const disableBigUint64ArraySupport = options.disableBigUint64ArraySupport;
@@ -190,7 +190,7 @@ MetadataTester.createMetadataTable = function (options) {
190190
};
191191

192192
MetadataTester.createPropertyTable = function (options) {
193-
options = options ?? DefaultValues.EMPTY_OBJECT;
193+
options = options ?? Frozen.EMPTY_OBJECT;
194194
const disableBigIntSupport = options.disableBigIntSupport;
195195
const disableBigInt64ArraySupport = options.disableBigInt64ArraySupport;
196196
const disableBigUint64ArraySupport = options.disableBigUint64ArraySupport;
@@ -245,7 +245,7 @@ MetadataTester.createPropertyTable = function (options) {
245245

246246
// for EXT_structural_metadata
247247
MetadataTester.createPropertyTables = function (options) {
248-
options = options ?? DefaultValues.EMPTY_OBJECT;
248+
options = options ?? Frozen.EMPTY_OBJECT;
249249

250250
const propertyTables = [];
251251
const bufferViews = {};
@@ -277,7 +277,7 @@ MetadataTester.createPropertyTables = function (options) {
277277

278278
// For EXT_feature_metadata
279279
MetadataTester.createFeatureTables = function (options) {
280-
options = options ?? DefaultValues.EMPTY_OBJECT;
280+
options = options ?? Frozen.EMPTY_OBJECT;
281281

282282
const featureTables = {};
283283
const bufferViews = {};
@@ -309,7 +309,7 @@ MetadataTester.createFeatureTables = function (options) {
309309
};
310310

311311
MetadataTester.createGltf = function (options) {
312-
options = options ?? DefaultValues.EMPTY_OBJECT;
312+
options = options ?? Frozen.EMPTY_OBJECT;
313313

314314
const propertyTableResults = MetadataTester.createPropertyTables(options);
315315

Specs/createCamera.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
Cartesian3,
3-
DefaultValues,
3+
Frozen,
44
defined,
55
GeographicProjection,
66
Matrix4,
@@ -20,7 +20,7 @@ function MockScene(canvas) {
2020
}
2121

2222
function createCamera(options) {
23-
options = options ?? DefaultValues.EMPTY_OBJECT;
23+
options = options ?? Frozen.EMPTY_OBJECT;
2424

2525
const scene = new MockScene(options.canvas);
2626
const camera = new Camera(scene);

Specs/pollToPromise.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { DefaultValues, getTimestamp } from "@cesium/engine";
1+
import { Frozen, getTimestamp } from "@cesium/engine";
22

33
function pollToPromise(f, options) {
4-
options = options ?? DefaultValues.EMPTY_OBJECT;
4+
options = options ?? Frozen.EMPTY_OBJECT;
55

66
const pollInterval = options.pollInterval ?? 1;
77
const timeout = options.timeout ?? 5000;

Specs/pollWhilePromise.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { DefaultValues, getTimestamp } from "@cesium/engine";
1+
import { Frozen, getTimestamp } from "@cesium/engine";
22

33
function pollWhilePromise(promise, f, options) {
4-
options = options ?? DefaultValues.EMPTY_OBJECT;
4+
options = options ?? Frozen.EMPTY_OBJECT;
55

66
const pollInterval = options.pollInterval ?? 1;
77
const timeout = options.timeout ?? 5000;

packages/engine/Source/Core/ArcGISTiledElevationTerrainProvider.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Cartesian2 from "./Cartesian2.js";
22
import Check from "./Check.js";
33
import Credit from "./Credit.js";
4-
import DefaultValues from "./DefaultValues.js";
4+
import Frozen from "./Frozen.js";
55
import defined from "./defined.js";
66
import Ellipsoid from "./Ellipsoid.js";
77
import Event from "./Event.js";
@@ -234,7 +234,7 @@ async function requestMetadata(
234234
* @see TerrainProvider
235235
*/
236236
function ArcGISTiledElevationTerrainProvider(options) {
237-
options = options ?? DefaultValues.EMPTY_OBJECT;
237+
options = options ?? Frozen.EMPTY_OBJECT;
238238

239239
this._resource = undefined;
240240
this._credit = undefined;
@@ -357,7 +357,7 @@ ArcGISTiledElevationTerrainProvider.fromUrl = async function (url, options) {
357357
Check.defined("url", url);
358358
//>>includeEnd('debug');
359359

360-
options = options ?? DefaultValues.EMPTY_OBJECT;
360+
options = options ?? Frozen.EMPTY_OBJECT;
361361

362362
url = await Promise.resolve(url);
363363
let resource = Resource.createIfNeeded(url);

packages/engine/Source/Core/BingMapsGeocoderService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Check from "./Check.js";
22
import Credit from "./Credit.js";
3-
import DefaultValues from "./DefaultValues.js";
3+
import Frozen from "./Frozen.js";
44
import Rectangle from "./Rectangle.js";
55
import Resource from "./Resource.js";
66
import defined from "./defined.js";
@@ -20,7 +20,7 @@ const url = "https://dev.virtualearth.net/REST/v1/Locations";
2020
* @param {string} [options.culture] A Bing Maps {@link https://docs.microsoft.com/en-us/bingmaps/rest-services/common-parameters-and-types/supported-culture-codes|Culture Code} to return results in a specific culture and language.
2121
*/
2222
function BingMapsGeocoderService(options) {
23-
options = options ?? DefaultValues.EMPTY_OBJECT;
23+
options = options ?? Frozen.EMPTY_OBJECT;
2424
const key = options.key;
2525
//>>includeStart('debug', pragmas.debug);
2626
if (!defined(key)) {

packages/engine/Source/Core/BoxGeometry.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import BoundingSphere from "./BoundingSphere.js";
22
import Cartesian3 from "./Cartesian3.js";
33
import Check from "./Check.js";
44
import ComponentDatatype from "./ComponentDatatype.js";
5-
import DefaultValues from "./DefaultValues.js";
5+
import Frozen from "./Frozen.js";
66
import defined from "./defined.js";
77
import DeveloperError from "./DeveloperError.js";
88
import Geometry from "./Geometry.js";
@@ -40,7 +40,7 @@ const diffScratch = new Cartesian3();
4040
* const geometry = Cesium.BoxGeometry.createGeometry(box);
4141
*/
4242
function BoxGeometry(options) {
43-
options = options ?? DefaultValues.EMPTY_OBJECT;
43+
options = options ?? Frozen.EMPTY_OBJECT;
4444

4545
const min = options.minimum;
4646
const max = options.maximum;
@@ -88,7 +88,7 @@ function BoxGeometry(options) {
8888
* @see BoxGeometry.createGeometry
8989
*/
9090
BoxGeometry.fromDimensions = function (options) {
91-
options = options ?? DefaultValues.EMPTY_OBJECT;
91+
options = options ?? Frozen.EMPTY_OBJECT;
9292
const dimensions = options.dimensions;
9393

9494
//>>includeStart('debug', pragmas.debug);

packages/engine/Source/Core/BoxOutlineGeometry.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import BoundingSphere from "./BoundingSphere.js";
22
import Cartesian3 from "./Cartesian3.js";
33
import Check from "./Check.js";
44
import ComponentDatatype from "./ComponentDatatype.js";
5-
import DefaultValues from "./DefaultValues.js";
5+
import Frozen from "./Frozen.js";
66
import defined from "./defined.js";
77
import DeveloperError from "./DeveloperError.js";
88
import Geometry from "./Geometry.js";
@@ -35,7 +35,7 @@ const diffScratch = new Cartesian3();
3535
* const geometry = Cesium.BoxOutlineGeometry.createGeometry(box);
3636
*/
3737
function BoxOutlineGeometry(options) {
38-
options = options ?? DefaultValues.EMPTY_OBJECT;
38+
options = options ?? Frozen.EMPTY_OBJECT;
3939

4040
const min = options.minimum;
4141
const max = options.maximum;
@@ -78,7 +78,7 @@ function BoxOutlineGeometry(options) {
7878
* @see BoxOutlineGeometry.createGeometry
7979
*/
8080
BoxOutlineGeometry.fromDimensions = function (options) {
81-
options = options ?? DefaultValues.EMPTY_OBJECT;
81+
options = options ?? Frozen.EMPTY_OBJECT;
8282
const dimensions = options.dimensions;
8383

8484
//>>includeStart('debug', pragmas.debug);

packages/engine/Source/Core/CatmullRomSpline.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Cartesian3 from "./Cartesian3.js";
22
import Cartesian4 from "./Cartesian4.js";
33
import Check from "./Check.js";
4-
import DefaultValues from "./DefaultValues.js";
4+
import Frozen from "./Frozen.js";
55
import defined from "./defined.js";
66
import HermiteSpline from "./HermiteSpline.js";
77
import Matrix4 from "./Matrix4.js";
@@ -148,7 +148,7 @@ const lastTangentScratch = new Cartesian3();
148148
* @see MorphWeightSpline
149149
*/
150150
function CatmullRomSpline(options) {
151-
options = options ?? DefaultValues.EMPTY_OBJECT;
151+
options = options ?? Frozen.EMPTY_OBJECT;
152152

153153
const points = options.points;
154154
const times = options.times;

packages/engine/Source/Core/CesiumTerrainProvider.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import BoundingSphere from "./BoundingSphere.js";
33
import Cartesian3 from "./Cartesian3.js";
44
import Check from "./Check.js";
55
import Credit from "./Credit.js";
6-
import DefaultValues from "./DefaultValues.js";
6+
import Frozen from "./Frozen.js";
77
import defined from "./defined.js";
88
import Ellipsoid from "./Ellipsoid.js";
99
import Event from "./Event.js";
@@ -475,7 +475,7 @@ async function requestLayerJson(terrainProviderBuilder, provider) {
475475
* @see TerrainProvider
476476
*/
477477
function CesiumTerrainProvider(options) {
478-
options = options ?? DefaultValues.EMPTY_OBJECT;
478+
options = options ?? Frozen.EMPTY_OBJECT;
479479

480480
this._heightmapWidth = undefined;
481481
this._heightmapStructure = undefined;
@@ -1226,7 +1226,7 @@ CesiumTerrainProvider.fromUrl = async function (url, options) {
12261226
Check.defined("url", url);
12271227
//>>includeEnd('debug');
12281228

1229-
options = options ?? DefaultValues.EMPTY_OBJECT;
1229+
options = options ?? Frozen.EMPTY_OBJECT;
12301230

12311231
url = await Promise.resolve(url);
12321232
const resource = Resource.createIfNeeded(url);

0 commit comments

Comments
 (0)