Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty objects in options have been replaced #7793

Merged
merged 4 commits into from
Aug 19, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
* [Adrien David](https://github.com/adridavid)
* [Alexander Popiak](https://github.com/apopiak)
* [Merijn Wijngaard](https://github.com/mwijngaard)
* [Abu Darda](https://github.com/abuDarda97)
2 changes: 1 addition & 1 deletion Source/Core/EllipsoidTerrainProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ define([
* @see TerrainProvider
*/
function EllipsoidTerrainProvider(options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

this._tilingScheme = options.tilingScheme;
if (!defined(this._tilingScheme)) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/GeographicTilingScheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ define([
* the tile tree.
*/
function GeographicTilingScheme(options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
this._rectangle = defaultValue(options.rectangle, Rectangle.MAX_VALUE);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/GoogleEarthEnterpriseTerrainProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ define([
* @see {@link http://www.w3.org/TR/cors/|Cross-Origin Resource Sharing}
*/
function GoogleEarthEnterpriseTerrainProvider(options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

//>>includeStart('debug', pragmas.debug);
if (!(defined(options.url) || defined(options.metadata))) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/WebMercatorTilingScheme.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ define([
* direction, resulting in a square projection.
*/
function WebMercatorTilingScheme(options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

this._ellipsoid = defaultValue(options.ellipsoid, Ellipsoid.WGS84);
this._numberOfLevelZeroTilesX = defaultValue(options.numberOfLevelZeroTilesX, 1);
Expand Down
4 changes: 2 additions & 2 deletions Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,7 @@ define([
* );
*/
function KmlDataSource(options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
var camera = options.camera;
var canvas = options.canvas;

Expand Down Expand Up @@ -2700,7 +2700,7 @@ define([
}
//>>includeEnd('debug');

options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
DataSource.setLoading(this, true);

var oldName = this._name;
Expand Down
2 changes: 1 addition & 1 deletion Source/Renderer/Context.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ define([
this._canvas = canvas;

options = clone(options, true);
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is incorrect because the line below modifies options.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I should change it back to options = defaultValue(options, {}); ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe so, yes. Please also put a comment pointing out that options is being modified, which explains why we can't use EMPTY_OBJECT here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @shunter @emackey I have made the changes, is there anything else I need to change?

options.allowTextureFilterAnisotropic = defaultValue(options.allowTextureFilterAnisotropic, true);
var webglOptions = defaultValue(options.webgl, {});

Expand Down
28 changes: 14 additions & 14 deletions Source/Renderer/RenderState.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,20 @@ define([
* @private
*/
function RenderState(renderState) {
var rs = defaultValue(renderState, {});
var cull = defaultValue(rs.cull, {});
var polygonOffset = defaultValue(rs.polygonOffset, {});
var scissorTest = defaultValue(rs.scissorTest, {});
var scissorTestRectangle = defaultValue(scissorTest.rectangle, {});
var depthRange = defaultValue(rs.depthRange, {});
var depthTest = defaultValue(rs.depthTest, {});
var colorMask = defaultValue(rs.colorMask, {});
var blending = defaultValue(rs.blending, {});
var blendingColor = defaultValue(blending.color, {});
var stencilTest = defaultValue(rs.stencilTest, {});
var stencilTestFrontOperation = defaultValue(stencilTest.frontOperation, {});
var stencilTestBackOperation = defaultValue(stencilTest.backOperation, {});
var sampleCoverage = defaultValue(rs.sampleCoverage, {});
var rs = defaultValue(renderState, defaultValue.EMPTY_OBJECT);
var cull = defaultValue(rs.cull, defaultValue.EMPTY_OBJECT);
var polygonOffset = defaultValue(rs.polygonOffset, defaultValue.EMPTY_OBJECT);
var scissorTest = defaultValue(rs.scissorTest, defaultValue.EMPTY_OBJECT);
var scissorTestRectangle = defaultValue(scissorTest.rectangle, defaultValue.EMPTY_OBJECT);
var depthRange = defaultValue(rs.depthRange, defaultValue.EMPTY_OBJECT);
var depthTest = defaultValue(rs.depthTest, defaultValue.EMPTY_OBJECT);
var colorMask = defaultValue(rs.colorMask, defaultValue.EMPTY_OBJECT);
var blending = defaultValue(rs.blending, defaultValue.EMPTY_OBJECT);
var blendingColor = defaultValue(blending.color, defaultValue.EMPTY_OBJECT);
var stencilTest = defaultValue(rs.stencilTest, defaultValue.EMPTY_OBJECT);
var stencilTestFrontOperation = defaultValue(stencilTest.frontOperation, defaultValue.EMPTY_OBJECT);
var stencilTestBackOperation = defaultValue(stencilTest.backOperation, defaultValue.EMPTY_OBJECT);
var sampleCoverage = defaultValue(rs.sampleCoverage, defaultValue.EMPTY_OBJECT);
var viewport = rs.viewport;

this.frontFace = defaultValue(rs.frontFace, WindingOrder.COUNTER_CLOCKWISE);
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/ArcGisMapServerImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ define([
* @see {@link http://www.w3.org/TR/cors/|Cross-Origin Resource Sharing}
*/
function ArcGisMapServerImageryProvider(options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

//>>includeStart('debug', pragmas.debug);
if (!defined(options.url)) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/BingMapsImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ define([
* @see {@link http://www.w3.org/TR/cors/|Cross-Origin Resource Sharing}
*/
function BingMapsImageryProvider(options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

//>>includeStart('debug', pragmas.debug);
if (!defined(options.url)) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/ImageryLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ define([
function ImageryLayer(imageryProvider, options) {
this._imageryProvider = imageryProvider;

options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

/**
* The alpha blending value of this layer, with 0.0 representing fully transparent and
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/SingleTileImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ define([
* @see UrlTemplateImageryProvider
*/
function SingleTileImageryProvider(options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
//>>includeStart('debug', pragmas.debug);
if (!defined(options.url)) {
throw new DeveloperError('options.url is required.');
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/createOpenStreetMapImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ define([
* @see {@link http://www.w3.org/TR/cors/|Cross-Origin Resource Sharing}
*/
function createOpenStreetMapImageryProvider(options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

var url = defaultValue(options.url, 'https://a.tile.openstreetmap.org/');
url = appendForwardSlash(url);
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/createTileMapServiceImageryProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ define([
* });
*/
function createTileMapServiceImageryProvider(options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

//>>includeStart('debug', pragmas.debug);
if (!defined(options.url)) {
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/processModelMaterialsCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define([
* @private
*/
function processModelMaterialsCommon(gltf, options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

if (!defined(gltf)) {
return;
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/processPbrMaterials.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define([
* @private
*/
function processPbrMaterials(gltf, options) {
options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

// No need to create new techniques if they already exist,
// the shader should handle these values
Expand Down
2 changes: 1 addition & 1 deletion Source/Widgets/CesiumWidget/CesiumWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ define([

container = getElement(container);

options = defaultValue(options, {});
options = defaultValue(options, defaultValue.EMPTY_OBJECT);

//Configure the widget DOM elements
var element = document.createElement('div');
Expand Down