From 0455a130868847a151c3da1c8e64ffc1428bb004 Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Fri, 2 Jun 2017 15:46:17 +0200 Subject: [PATCH 01/18] Extent setters in Cesium3DTileStyle --- Source/Scene/Cesium3DTileStyle.js | 37 ++++++- Specs/Scene/Cesium3DTileStyleSpec.js | 138 +++++++++++++++++++++++++++ 2 files changed, 172 insertions(+), 3 deletions(-) diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index a90f09be6e86..baeaceb50981 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -252,8 +252,19 @@ define([ return this._show; }, set : function(value) { + if (typeof value === 'boolean') { + this._show = new Expression(String(value)); + } else if (typeof value === 'string') { + this._show = new Expression(value); + } else if (defined(value.conditions)) { + this._show = new ConditionsExpression(value); + } else if (defined(value.expression) || defined(value.conditionsExpression)) { + this._show = value; + } else { + this._show = undefined; + return; + } this._showShaderFunctionReady = false; - this._show = value; } }, @@ -297,8 +308,17 @@ define([ return this._color; }, set : function(value) { + if (typeof value === 'string') { + this._color = new Expression(value); + } else if (defined(value.conditions)) { + this._color = new ConditionsExpression(value); + } else if (defined(value.expression) || defined(value.conditionsExpression)) { + this._color = value; + } else { + this._color = undefined; + return; + } this._colorShaderFunctionReady = false; - this._color = value; } }, @@ -342,8 +362,19 @@ define([ return this._pointSize; }, set : function(value) { + if (typeof value === 'number') { + this._pointSize = new Expression(String(value)); + } else if (typeof value === 'string') { + this._pointSize = new Expression(value); + } else if (defined(value.conditions)) { + this._pointSize = new ConditionsExpression(value); + } else if (defined(value.expression) || defined(value.conditionsExpression)) { + this._pointSize = value; + } else { + this._pointSize = undefined; + return; + } this._pointSizeShaderFunctionReady = false; - this._pointSize = value; } }, diff --git a/Specs/Scene/Cesium3DTileStyleSpec.js b/Specs/Scene/Cesium3DTileStyleSpec.js index e6ca079fe116..ddbf2b123606 100644 --- a/Specs/Scene/Cesium3DTileStyleSpec.js +++ b/Specs/Scene/Cesium3DTileStyleSpec.js @@ -155,6 +155,53 @@ defineSuite([ expect(style.show).toEqual(undefined); }); + it('sets show expressions in setter', function() { + var style = new Cesium3DTileStyle(); + + var condExp = new ConditionsExpression({ + conditions : [ + ['${height} > 2', 'false'], + ['true', 'true'] + ] + }); + + style.show = condExp; + expect(style.show).toEqual(condExp); + + var exp = new Expression('false'); + style.show = exp; + expect(style.show).toEqual(exp); + }); + + it('sets show values in setter', function() { + var style = new Cesium3DTileStyle(); + + style.show = '${height} * 10 >= 1000'; + expect(style.show).toEqual(new Expression('${height} * 10 >= 1000')); + + style.show = false; + expect(style.show).toEqual(new Expression('false')); + + var jsonExp = { + conditions : [ + ['${height} > 2', 'false'], + ['true', 'true'] + ] + }; + + style.show = jsonExp; + expect(style.show).toEqual(new ConditionsExpression(jsonExp)); + }); + + it('sets show to undefined if not a string, boolean or conditional in setter', function() { + var style = new Cesium3DTileStyle({ + show : true + }); + + style.show = 5; + expect(style.show).toEqual(undefined); + }); + it('sets color value to expression', function() { var style = new Cesium3DTileStyle({ color : 'color("red")' @@ -193,6 +240,50 @@ defineSuite([ expect(style.color).toEqual(undefined); }); + it('sets color expressions in setter', function() { + var style = new Cesium3DTileStyle(); + + var exp = new Expression('color("red")'); + style.color = exp; + expect(style.color).toEqual(exp); + + var condExp = new ConditionsExpression({ + conditions : [ + ['${height} > 2', 'color("cyan")'], + ['true', 'color("blue")'] + ] + }); + + style.color = condExp; + expect(style.color).toEqual(condExp); + }); + + it('sets color values in setter', function() { + var style = new Cesium3DTileStyle(); + + style.color = 'color("red")'; + expect(style.color).toEqual(new Expression('color("red")')); + + var jsonExp = { + conditions : [ + ['${height} > 2', 'color("cyan")'], + ['true', 'color("blue")'] + ] + }; + + style.color = jsonExp; + expect(style.color).toEqual(new ConditionsExpression(jsonExp)); + }); + + it('sets color to undefined if not a string or conditional in setter', function() { + var style = new Cesium3DTileStyle({ + color : 'color("red")' + }); + + style.color = 5; + expect(style.color).toEqual(undefined); + }); + it('sets pointSize value to expression', function() { var style = new Cesium3DTileStyle({ pointSize : '2' @@ -231,6 +322,53 @@ defineSuite([ expect(style.pointSize).toEqual(undefined); }); + it('sets pointSize expressions in setter', function() { + var style = new Cesium3DTileStyle(); + + var exp = new Expression('2'); + style.pointSize = exp; + expect(style.pointSize).toEqual(exp); + + var condExp = new ConditionsExpression({ + conditions : [ + ['${height} > 2', '1.0'], + ['true', '2.0'] + ] + }); + + style.pointSize = condExp; + expect(style.pointSize).toEqual(condExp); + }); + + it('sets pointSize values in setter', function() { + var style = new Cesium3DTileStyle(); + + style.pointSize = 2; + expect(style.pointSize).toEqual(new Expression('2')); + + style.pointSize = '${height} / 10'; + expect(style.pointSize).toEqual(new Expression('${height} / 10')); + + var jsonExp = { + conditions : [ + ['${height} > 2', '1.0'], + ['true', '2.0'] + ] + }; + + style.pointSize = jsonExp; + expect(style.pointSize).toEqual(new ConditionsExpression(jsonExp)); + }); + + it('sets pointSize to undefined if not a number, string or conditional in setter', function() { + var style = new Cesium3DTileStyle({ + pointSize : true + }); + + style.pointSize = false; + expect(style.pointSize).toEqual(undefined); + }); + it('throws on accessing style if not ready', function() { var style = new Cesium3DTileStyle({}); style._ready = false; From 8b551d2eabbeb895f6bc988657dce6aaafcfd82f Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Mon, 12 Jun 2017 09:29:14 +0200 Subject: [PATCH 02/18] Adjusted documentation --- Source/Scene/Cesium3DTileStyle.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index 59379ae8eb67..8f14527c03eb 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -211,7 +211,7 @@ define([ }, /** - * Gets or sets the {@link StyleExpression} object used to evaluate the style's show property. + * Gets or sets the {@link StyleExpression} object used to evaluate the style's show property. Alternative an object defining a show style can be used. *

* The expression must return or convert to a Boolean. *

@@ -267,7 +267,7 @@ define([ }, /** - * Gets or sets the {@link StyleExpression} object used to evaluate the style's color property. + * Gets or sets the {@link StyleExpression} object used to evaluate the style's color property. Alternative an object defining a color style can be used. *

* The expression must return a Color. *

@@ -321,7 +321,7 @@ define([ }, /** - * Gets or sets the {@link StyleExpression} object used to evaluate the style's pointSize property. + * Gets or sets the {@link StyleExpression} object used to evaluate the style's pointSize property. Alternative an object defining a pointSize style can be used. *

* The expression must return or convert to a Number. *

From 4d54231b5d16eb455cf800aa7c7ee672210e97e2 Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Tue, 11 Jul 2017 14:59:20 +0200 Subject: [PATCH 03/18] Adjust documentation --- Source/Scene/Cesium3DTileStyle.js | 82 ++++++++++++++++++++++++------- 1 file changed, 65 insertions(+), 17 deletions(-) diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index 52af95145538..ee7fb02aae85 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -209,7 +209,7 @@ define([ }, /** - * Gets or sets the {@link StyleExpression} object used to evaluate the style's show property. Alternative an object defining a show style can be used. + * Gets or sets the {@link StyleExpression} object used to evaluate the style's show property. Alternatively a boolean, string, or object defining a show style can be used. *

* The expression must return or convert to a Boolean. *

@@ -234,7 +234,29 @@ define([ * return true; * } * }; - */ + * + * @example + * var style = new Cesium.Cesium3DTileStyle(); + * // Override show expression with a boolean + * style.show = true; + * }; + * + * @example + * var style = new Cesium.Cesium3DTileStyle(); + * // Override show expression with a string + * style.show = '${Height} > 0'; + * }; + * + * @example + * var style = new Cesium.Cesium3DTileStyle(); + * // Override show expression with a condition + * style.show = { + * conditions: [ + * ['${height} > 2', 'false'], + * ['true', 'true'] + * ]; + * }; + */ show : { get : function() { //>>includeStart('debug', pragmas.debug); @@ -252,18 +274,15 @@ define([ this._show = new Expression(value); } else if (defined(value.conditions)) { this._show = new ConditionsExpression(value); - } else if (defined(value.expression) || defined(value.conditionsExpression)) { - this._show = value; } else { - this._show = undefined; - return; + this._show = value; } this._showShaderFunctionReady = false; } }, /** - * Gets or sets the {@link StyleExpression} object used to evaluate the style's color property. Alternative an object defining a color style can be used. + * Gets or sets the {@link StyleExpression} object used to evaluate the style's color property. Alternatively a string or object defining a color style can be used. *

* The expression must return a Color. *

@@ -288,6 +307,21 @@ define([ * return Cesium.Color.clone(Cesium.Color.WHITE, result); * } * }; + * + * @example + * var style = new Cesium.Cesium3DTileStyle(); + * // Override color expression with a string + * style.color = 'color("blue")'; + * + * @example + * var style = new Cesium.Cesium3DTileStyle(); + * // Override color expression with a condition + * style.color = { + * conditions : [ + * ['${height} > 2', 'color("cyan")'], + * ['true', 'color("blue")'] + * ] + * }; */ color : { get : function() { @@ -304,18 +338,15 @@ define([ this._color = new Expression(value); } else if (defined(value.conditions)) { this._color = new ConditionsExpression(value); - } else if (defined(value.expression) || defined(value.conditionsExpression)) { - this._color = value; } else { - this._color = undefined; - return; + this._color = value; } this._colorShaderFunctionReady = false; } }, /** - * Gets or sets the {@link StyleExpression} object used to evaluate the style's pointSize property. Alternative an object defining a pointSize style can be used. + * Gets or sets the {@link StyleExpression} object used to evaluate the style's pointSize property. Alternatively a number, string, or object defining a pointSize style can be used. *

* The expression must return or convert to a Number. *

@@ -340,7 +371,27 @@ define([ * return 1.0; * } * }; - */ + * + * @example + * var style = new Cesium.Cesium3DTileStyle(); + * // Override pointSize expression with a number + * style.pointSize = 1.0; + * + * @example + * var style = new Cesium.Cesium3DTileStyle(); + * // Override pointSize expression with a string + * style.pointSize = '${height} / 10'; + * + * @example + * var style = new Cesium.Cesium3DTileStyle(); + * // Override pointSize expression with a condition + * style.pointSize = { + * conditions : [ + * ['${height} > 2', '1.0'], + * ['true', '2.0'] + * ] + * }; + */ pointSize : { get : function() { //>>includeStart('debug', pragmas.debug); @@ -358,11 +409,8 @@ define([ this._pointSize = new Expression(value); } else if (defined(value.conditions)) { this._pointSize = new ConditionsExpression(value); - } else if (defined(value.expression) || defined(value.conditionsExpression)) { - this._pointSize = value; } else { - this._pointSize = undefined; - return; + this._pointSize = value; } this._pointSizeShaderFunctionReady = false; } From 15f1cbc13964110fdd328f633484ed4df28b1d3b Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Fri, 14 Jul 2017 14:07:51 +0200 Subject: [PATCH 04/18] Added support of interpreting existing defines in Cesium3DTileStyle setter --- Source/Scene/Cesium3DTileStyle.js | 65 ++++++---------------- Specs/Scene/Cesium3DTileStyleSpec.js | 83 ++++++++++------------------ 2 files changed, 48 insertions(+), 100 deletions(-) diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index ee7fb02aae85..f7612bba6598 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -95,49 +95,17 @@ define([ styleJson = defaultValue(styleJson, defaultValue.EMPTY_OBJECT); + that.color = defaultValue(styleJson.color, DEFAULT_JSON_COLOR_EXPRESSION); + that.show = defaultValue(styleJson.show, DEFAULT_JSON_BOOLEAN_EXPRESSION); + that.pointSize = defaultValue(styleJson.pointSize, DEFAULT_JSON_NUMBER_EXPRESSION); + that._colorShaderFunctionReady = !defined(styleJson.color); that._showShaderFunctionReady = !defined(styleJson.show); that._pointSizeShaderFunctionReady = !defined(styleJson.pointSize); - var colorExpression = defaultValue(styleJson.color, DEFAULT_JSON_COLOR_EXPRESSION); - var showExpression = defaultValue(styleJson.show, DEFAULT_JSON_BOOLEAN_EXPRESSION); - var pointSizeExpression = defaultValue(styleJson.pointSize, DEFAULT_JSON_NUMBER_EXPRESSION); - - var defines = styleJson.defines; - - var color; - if (typeof colorExpression === 'string') { - color = new Expression(colorExpression, defines); - } else if (defined(colorExpression.conditions)) { - color = new ConditionsExpression(colorExpression, defines); - } - - that._color = color; - - var show; - if (typeof showExpression === 'boolean') { - show = new Expression(String(showExpression), defines); - } else if (typeof showExpression === 'string') { - show = new Expression(showExpression, defines); - } else if (defined(showExpression.conditions)) { - show = new ConditionsExpression(showExpression, defines); - } - - that._show = show; - - var pointSize; - if (typeof pointSizeExpression === 'number') { - pointSize = new Expression(String(pointSizeExpression), defines); - } else if (typeof pointSizeExpression === 'string') { - pointSize = new Expression(pointSizeExpression, defines); - } else if (defined(pointSizeExpression.conditions)) { - pointSize = new ConditionsExpression(pointSizeExpression, defines); - } - - that._pointSize = pointSize; - var meta = {}; if (defined(styleJson.meta)) { + var defines = styleJson.defines; var metaJson = defaultValue(styleJson.meta, defaultValue.EMPTY_OBJECT); for (var property in metaJson) { if (metaJson.hasOwnProperty(property)) { @@ -240,13 +208,13 @@ define([ * // Override show expression with a boolean * style.show = true; * }; - * + * * @example * var style = new Cesium.Cesium3DTileStyle(); * // Override show expression with a string * style.show = '${Height} > 0'; * }; - * + * * @example * var style = new Cesium.Cesium3DTileStyle(); * // Override show expression with a condition @@ -256,7 +224,7 @@ define([ * ['true', 'true'] * ]; * }; - */ + */ show : { get : function() { //>>includeStart('debug', pragmas.debug); @@ -268,12 +236,13 @@ define([ return this._show; }, set : function(value) { + var defines = defaultValue(this._style, defaultValue.EMPTY_OBJECT).defines; if (typeof value === 'boolean') { this._show = new Expression(String(value)); } else if (typeof value === 'string') { - this._show = new Expression(value); + this._show = new Expression(value, defines); } else if (defined(value.conditions)) { - this._show = new ConditionsExpression(value); + this._show = new ConditionsExpression(value, defines); } else { this._show = value; } @@ -334,10 +303,11 @@ define([ return this._color; }, set : function(value) { + var defines = defaultValue(this._style, defaultValue.EMPTY_OBJECT).defines; if (typeof value === 'string') { - this._color = new Expression(value); + this._color = new Expression(value, defines); } else if (defined(value.conditions)) { - this._color = new ConditionsExpression(value); + this._color = new ConditionsExpression(value, defines); } else { this._color = value; } @@ -391,7 +361,7 @@ define([ * ['true', '2.0'] * ] * }; - */ + */ pointSize : { get : function() { //>>includeStart('debug', pragmas.debug); @@ -403,12 +373,13 @@ define([ return this._pointSize; }, set : function(value) { + var defines = defaultValue(this._style, defaultValue.EMPTY_OBJECT).defines; if (typeof value === 'number') { this._pointSize = new Expression(String(value)); } else if (typeof value === 'string') { - this._pointSize = new Expression(value); + this._pointSize = new Expression(value, defines); } else if (defined(value.conditions)) { - this._pointSize = new ConditionsExpression(value); + this._pointSize = new ConditionsExpression(value, defines); } else { this._pointSize = value; } diff --git a/Specs/Scene/Cesium3DTileStyleSpec.js b/Specs/Scene/Cesium3DTileStyleSpec.js index e0005b50d272..a36bbf997a41 100644 --- a/Specs/Scene/Cesium3DTileStyleSpec.js +++ b/Specs/Scene/Cesium3DTileStyleSpec.js @@ -147,13 +147,6 @@ defineSuite([ expect(style.show).toEqual(new ConditionsExpression(jsonExp)); }); - it('sets show to undefined if not a string, boolean, or conditional', function() { - var style = new Cesium3DTileStyle({ - show : 1 - }); - expect(style.show).toEqual(undefined); - }); - it('sets show expressions in setter', function() { var style = new Cesium3DTileStyle(); @@ -173,9 +166,14 @@ defineSuite([ }); it('sets show values in setter', function() { - var style = new Cesium3DTileStyle(); + var defines = { + 'defines': { + 'showFactor': 10 + } + }; + var style = new Cesium3DTileStyle(defines); - style.show = '${height} * 10 >= 1000'; + style.show = '${height} * ${showFactor} >= 1000'; expect(style.show).toEqual(new Expression('${height} * 10 >= 1000')); style.show = false; @@ -183,24 +181,15 @@ defineSuite([ var jsonExp = { conditions : [ - ['${height} > 2', 'false'], + ['${height} > ${showFactor}', 'false'], ['true', 'true'] ] }; style.show = jsonExp; - expect(style.show).toEqual(new ConditionsExpression(jsonExp)); + expect(style.show).toEqual(new ConditionsExpression(jsonExp, defines)); }); - it('sets show to undefined if not a string, boolean or conditional in setter', function() { - var style = new Cesium3DTileStyle({ - show : true - }); - - style.show = 5; - expect(style.show).toEqual(undefined); - }); - it('sets color value to expression', function() { var style = new Cesium3DTileStyle({ color : 'color("red")' @@ -232,13 +221,6 @@ defineSuite([ expect(style.color).toEqual(new ConditionsExpression(jsonExp)); }); - it('sets color to undefined if not a string or conditional', function() { - var style = new Cesium3DTileStyle({ - color : 1 - }); - expect(style.color).toEqual(undefined); - }); - it('sets color expressions in setter', function() { var style = new Cesium3DTileStyle(); @@ -258,15 +240,20 @@ defineSuite([ }); it('sets color values in setter', function() { - var style = new Cesium3DTileStyle(); + var defines = { + 'defines': { + 'targetColor': 'red' + } + }; + var style = new Cesium3DTileStyle(defines); - style.color = 'color("red")'; + style.color = 'color("${targetColor}")'; expect(style.color).toEqual(new Expression('color("red")')); var jsonExp = { conditions : [ ['${height} > 2', 'color("cyan")'], - ['true', 'color("blue")'] + ['true', 'color("${targetColor}")'] ] }; @@ -274,15 +261,6 @@ defineSuite([ expect(style.color).toEqual(new ConditionsExpression(jsonExp)); }); - it('sets color to undefined if not a string or conditional in setter', function() { - var style = new Cesium3DTileStyle({ - color : 'color("red")' - }); - - style.color = 5; - expect(style.color).toEqual(undefined); - }); - it('sets pointSize value to expression', function() { var style = new Cesium3DTileStyle({ pointSize : '2' @@ -324,6 +302,9 @@ defineSuite([ it('sets pointSize expressions in setter', function() { var style = new Cesium3DTileStyle(); + style.pointSize = 2; + expect(style.pointSize).toEqual(new Expression('2')); + var exp = new Expression('2'); style.pointSize = exp; expect(style.pointSize).toEqual(exp); @@ -340,32 +321,28 @@ defineSuite([ }); it('sets pointSize values in setter', function() { - var style = new Cesium3DTileStyle(); + var defines = { + 'defines': { + 'targetPointSize': '2.0' + } + }; + var style = new Cesium3DTileStyle(defines); style.pointSize = 2; expect(style.pointSize).toEqual(new Expression('2')); - style.pointSize = '${height} / 10'; - expect(style.pointSize).toEqual(new Expression('${height} / 10')); + style.pointSize = '${targetPointSize} + 1.0'; + expect(style.pointSize).toEqual(new Expression('2.0 + 1.0')); var jsonExp = { conditions : [ ['${height} > 2', '1.0'], - ['true', '2.0'] + ['true', '${targetPointSize}'] ] }; style.pointSize = jsonExp; - expect(style.pointSize).toEqual(new ConditionsExpression(jsonExp)); - }); - - it('sets pointSize to undefined if not a number, string or conditional in setter', function() { - var style = new Cesium3DTileStyle({ - pointSize : true - }); - - style.pointSize = false; - expect(style.pointSize).toEqual(undefined); + expect(style.pointSize).toEqual(new ConditionsExpression(jsonExp, defines)); }); it('throws on accessing style if not ready', function() { From b8a50255f097e6b24f0691efb7a958d229a8a9c3 Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Fri, 14 Jul 2017 15:40:49 +0200 Subject: [PATCH 05/18] Fix tests --- Specs/Scene/Cesium3DTileStyleSpec.js | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/Specs/Scene/Cesium3DTileStyleSpec.js b/Specs/Scene/Cesium3DTileStyleSpec.js index a36bbf997a41..f7c88c9aa7cd 100644 --- a/Specs/Scene/Cesium3DTileStyleSpec.js +++ b/Specs/Scene/Cesium3DTileStyleSpec.js @@ -167,14 +167,12 @@ defineSuite([ it('sets show values in setter', function() { var defines = { - 'defines': { - 'showFactor': 10 - } + 'showFactor': 10 }; - var style = new Cesium3DTileStyle(defines); + var style = new Cesium3DTileStyle({ 'defines': defines }); style.show = '${height} * ${showFactor} >= 1000'; - expect(style.show).toEqual(new Expression('${height} * 10 >= 1000')); + expect(style.show).toEqual(new Expression('${height} * ${showFactor} >= 1000', defines)); style.show = false; expect(style.show).toEqual(new Expression('false')); @@ -240,12 +238,10 @@ defineSuite([ }); it('sets color values in setter', function() { - var defines = { - 'defines': { - 'targetColor': 'red' - } + var defines = + 'targetColor': 'red' }; - var style = new Cesium3DTileStyle(defines); + var style = new Cesium3DTileStyle({ 'defines': defines }); style.color = 'color("${targetColor}")'; expect(style.color).toEqual(new Expression('color("red")')); @@ -322,11 +318,9 @@ defineSuite([ it('sets pointSize values in setter', function() { var defines = { - 'defines': { - 'targetPointSize': '2.0' - } + 'targetPointSize': '2.0' }; - var style = new Cesium3DTileStyle(defines); + var style = new Cesium3DTileStyle({ 'defines': defines }); style.pointSize = 2; expect(style.pointSize).toEqual(new Expression('2')); From 8d5734819acafad6de8c45b0e978e26dfc190a46 Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Fri, 14 Jul 2017 18:00:12 +0200 Subject: [PATCH 06/18] Changed behavior: Cesium3DTileStyle does not set default values anymore --- Source/Scene/Cesium3DTileBatchTable.js | 13 ++++++++----- Source/Scene/Cesium3DTileStyle.js | 22 +++++++++++---------- Specs/Scene/Cesium3DTileStyleSpec.js | 27 +++++++++++++++++--------- 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/Source/Scene/Cesium3DTileBatchTable.js b/Source/Scene/Cesium3DTileBatchTable.js index 79401ae40314..95f7c4a795e7 100644 --- a/Source/Scene/Cesium3DTileBatchTable.js +++ b/Source/Scene/Cesium3DTileBatchTable.js @@ -68,6 +68,9 @@ define([ StencilOperation) { 'use strict'; + var DEFAULT_COLOR_VALUE = Color.WHITE; + var DEFAULT_SHOW_VALUE = true; + /** * @private */ @@ -414,7 +417,7 @@ define([ Check.typeOf.object('color', color); //>>includeEnd('debug'); - if (Color.equals(color, Color.WHITE) && !defined(this._batchValues)) { + if (Color.equals(color, DEFAULT_COLOR_VALUE) && !defined(this._batchValues)) { // Avoid allocating since the default is white return; } @@ -475,7 +478,7 @@ define([ //>>includeEnd('debug'); if (!defined(this._batchValues)) { - return Color.clone(Color.WHITE, result); + return Color.clone(DEFAULT_COLOR_VALUE, result); } var batchValues = this._batchValues; @@ -495,7 +498,7 @@ define([ Cesium3DTileBatchTable.prototype.applyStyle = function(frameState, style) { if (!defined(style)) { - this.setAllColor(Color.WHITE); + this.setAllColor(DEFAULT_COLOR_VALUE); this.setAllShow(true); return; } @@ -504,8 +507,8 @@ define([ var length = this.featuresLength; for (var i = 0; i < length; ++i) { var feature = content.getFeature(i); - var color = style.color.evaluateColor(frameState, feature, scratchColor); - var show = style.show.evaluate(frameState, feature); + var color = defined(style.color) ? style.color.evaluateColor(frameState, feature, scratchColor) : DEFAULT_COLOR_VALUE; + var show = defined(style.show) ? style.show.evaluate(frameState, feature) : DEFAULT_SHOW_VALUE; this.setColor(i, color); this.setShow(i, show); } diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index f7612bba6598..c0a236205c8e 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -22,10 +22,6 @@ define([ Expression) { 'use strict'; - var DEFAULT_JSON_COLOR_EXPRESSION = 'color("#ffffff")'; - var DEFAULT_JSON_BOOLEAN_EXPRESSION = true; - var DEFAULT_JSON_NUMBER_EXPRESSION = 1.0; - /** * A style that is applied to a {@link Cesium3DTileset}. *

@@ -95,9 +91,9 @@ define([ styleJson = defaultValue(styleJson, defaultValue.EMPTY_OBJECT); - that.color = defaultValue(styleJson.color, DEFAULT_JSON_COLOR_EXPRESSION); - that.show = defaultValue(styleJson.show, DEFAULT_JSON_BOOLEAN_EXPRESSION); - that.pointSize = defaultValue(styleJson.pointSize, DEFAULT_JSON_NUMBER_EXPRESSION); + that.color = styleJson.color; + that.show = styleJson.show; + that.pointSize = styleJson.pointSize; that._colorShaderFunctionReady = !defined(styleJson.color); that._showShaderFunctionReady = !defined(styleJson.show); @@ -237,7 +233,9 @@ define([ }, set : function(value) { var defines = defaultValue(this._style, defaultValue.EMPTY_OBJECT).defines; - if (typeof value === 'boolean') { + if (!defined(value)) { + this._show = undefined; + } else if (typeof value === 'boolean') { this._show = new Expression(String(value)); } else if (typeof value === 'string') { this._show = new Expression(value, defines); @@ -304,7 +302,9 @@ define([ }, set : function(value) { var defines = defaultValue(this._style, defaultValue.EMPTY_OBJECT).defines; - if (typeof value === 'string') { + if (!defined(value)) { + this._color = undefined; + } else if (typeof value === 'string') { this._color = new Expression(value, defines); } else if (defined(value.conditions)) { this._color = new ConditionsExpression(value, defines); @@ -374,7 +374,9 @@ define([ }, set : function(value) { var defines = defaultValue(this._style, defaultValue.EMPTY_OBJECT).defines; - if (typeof value === 'number') { + if (!defined(value)) { + this._pointSize = undefined; + } else if (typeof value === 'number') { this._pointSize = new Expression(String(value)); } else if (typeof value === 'string') { this._pointSize = new Expression(value, defines); diff --git a/Specs/Scene/Cesium3DTileStyleSpec.js b/Specs/Scene/Cesium3DTileStyleSpec.js index f7c88c9aa7cd..d344898abcb9 100644 --- a/Specs/Scene/Cesium3DTileStyleSpec.js +++ b/Specs/Scene/Cesium3DTileStyleSpec.js @@ -82,28 +82,28 @@ defineSuite([ }); }); - it('sets show value to default expression', function() { + it('sets show value to undefined if value not present', function() { var style = new Cesium3DTileStyle({}); - expect(style.show).toEqual(new Expression('true')); + expect(style.show).toBeUndefined(); style = new Cesium3DTileStyle(); - expect(style.show).toEqual(new Expression('true')); + expect(style.show).toBeUndefined(); }); - it('sets color value to default expression', function() { + it('sets color value to undefined if value not present', function() { var style = new Cesium3DTileStyle({}); - expect(style.color).toEqual(new Expression('color("#ffffff")')); + expect(style.color).toBeUndefined(); style = new Cesium3DTileStyle(); - expect(style.color).toEqual(new Expression('color("#ffffff")')); + expect(style.color).toBeUndefined(); }); - it('sets pointSize value to default expression', function() { + it('sets pointSize value to undefined if value not present', function() { var style = new Cesium3DTileStyle({}); - expect(style.pointSize).toEqual(new Expression('1')); + expect(style.pointSize).toBeUndefined(); style = new Cesium3DTileStyle(); - expect(style.pointSize).toEqual(new Expression('1')); + expect(style.pointSize).toBeUndefined(); }); it('sets show value to expression', function() { @@ -186,6 +186,9 @@ defineSuite([ style.show = jsonExp; expect(style.show).toEqual(new ConditionsExpression(jsonExp, defines)); + + style.show = undefined; + expect(style.show).toBeUndefined(); }); it('sets color value to expression', function() { @@ -235,6 +238,9 @@ defineSuite([ style.color = condExp; expect(style.color).toEqual(condExp); + + style.color = undefined; + expect(style.color).toBeUndefined(); }); it('sets color values in setter', function() { @@ -314,6 +320,9 @@ defineSuite([ style.pointSize = condExp; expect(style.pointSize).toEqual(condExp); + + style.pointSize = undefined; + expect(style.pointSize).toBeUndefined(); }); it('sets pointSize values in setter', function() { From c2eea43ecde9808cc42431917dcae35214d51daa Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Fri, 14 Jul 2017 18:02:56 +0200 Subject: [PATCH 07/18] Fix whitespaces --- Source/Scene/Cesium3DTileStyle.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index c0a236205c8e..1ba4921e6df5 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -235,7 +235,7 @@ define([ var defines = defaultValue(this._style, defaultValue.EMPTY_OBJECT).defines; if (!defined(value)) { this._show = undefined; - } else if (typeof value === 'boolean') { + } else if (typeof value === 'boolean') { this._show = new Expression(String(value)); } else if (typeof value === 'string') { this._show = new Expression(value, defines); @@ -279,7 +279,7 @@ define([ * var style = new Cesium.Cesium3DTileStyle(); * // Override color expression with a string * style.color = 'color("blue")'; - * + * * @example * var style = new Cesium.Cesium3DTileStyle(); * // Override color expression with a condition @@ -302,9 +302,9 @@ define([ }, set : function(value) { var defines = defaultValue(this._style, defaultValue.EMPTY_OBJECT).defines; - if (!defined(value)) { + if (!defined(value)) { this._color = undefined; - } else if (typeof value === 'string') { + } else if (typeof value === 'string') { this._color = new Expression(value, defines); } else if (defined(value.conditions)) { this._color = new ConditionsExpression(value, defines); @@ -376,7 +376,7 @@ define([ var defines = defaultValue(this._style, defaultValue.EMPTY_OBJECT).defines; if (!defined(value)) { this._pointSize = undefined; - } else if (typeof value === 'number') { + } else if (typeof value === 'number') { this._pointSize = new Expression(String(value)); } else if (typeof value === 'string') { this._pointSize = new Expression(value, defines); From 9bc3764d046f8a2bbf84c5ffa9523f029f10bf72 Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Sat, 15 Jul 2017 02:22:13 +0200 Subject: [PATCH 08/18] Fix syntax error --- Specs/Scene/Cesium3DTileStyleSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Specs/Scene/Cesium3DTileStyleSpec.js b/Specs/Scene/Cesium3DTileStyleSpec.js index d344898abcb9..e2466fa91211 100644 --- a/Specs/Scene/Cesium3DTileStyleSpec.js +++ b/Specs/Scene/Cesium3DTileStyleSpec.js @@ -244,7 +244,7 @@ defineSuite([ }); it('sets color values in setter', function() { - var defines = + var defines = { 'targetColor': 'red' }; var style = new Cesium3DTileStyle({ 'defines': defines }); From a40077c7aa44f6d68906fa0ee93189eedcf5204e Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Mon, 17 Jul 2017 11:44:05 +0200 Subject: [PATCH 09/18] Fix remaining Cesium3DTileStyleSpec tests --- Specs/Scene/Cesium3DTileStyleSpec.js | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/Specs/Scene/Cesium3DTileStyleSpec.js b/Specs/Scene/Cesium3DTileStyleSpec.js index e2466fa91211..28ca9638c4fc 100644 --- a/Specs/Scene/Cesium3DTileStyleSpec.js +++ b/Specs/Scene/Cesium3DTileStyleSpec.js @@ -1,5 +1,5 @@ defineSuite([ - 'Scene/Cesium3DTileStyle', + 'Scene/Cesium3DTileStyle', 'Core/Color', 'Scene/ConditionsExpression', 'Scene/Expression' @@ -250,7 +250,7 @@ defineSuite([ var style = new Cesium3DTileStyle({ 'defines': defines }); style.color = 'color("${targetColor}")'; - expect(style.color).toEqual(new Expression('color("red")')); + expect(style.color).toEqual(new Expression('color("${targetColor}")', defines)); var jsonExp = { conditions : [ @@ -260,7 +260,7 @@ defineSuite([ }; style.color = jsonExp; - expect(style.color).toEqual(new ConditionsExpression(jsonExp)); + expect(style.color).toEqual(new ConditionsExpression(jsonExp, defines)); }); it('sets pointSize value to expression', function() { @@ -294,13 +294,6 @@ defineSuite([ expect(style.pointSize).toEqual(new ConditionsExpression(jsonExp)); }); - it('sets pointSize to undefined if not a number, string, or conditional', function() { - var style = new Cesium3DTileStyle({ - pointSize : true - }); - expect(style.pointSize).toEqual(undefined); - }); - it('sets pointSize expressions in setter', function() { var style = new Cesium3DTileStyle(); @@ -335,7 +328,7 @@ defineSuite([ expect(style.pointSize).toEqual(new Expression('2')); style.pointSize = '${targetPointSize} + 1.0'; - expect(style.pointSize).toEqual(new Expression('2.0 + 1.0')); + expect(style.pointSize).toEqual(new Expression('${targetPointSize} + 1.0', defines)); var jsonExp = { conditions : [ @@ -452,7 +445,6 @@ defineSuite([ expect(style.show.evaluate(frameState, feature1)).toEqual(true); expect(style.show.evaluate(frameState, feature2)).toEqual(false); - expect(style.color.evaluateColor(frameState, undefined)).toEqual(Color.WHITE); }); it('applies show style with regexp and variables', function() { @@ -462,7 +454,6 @@ defineSuite([ expect(style.show.evaluate(frameState, feature1)).toEqual(true); expect(style.show.evaluate(frameState, feature2)).toEqual(false); - expect(style.color.evaluateColor(frameState, undefined)).toEqual(Color.WHITE); }); it('applies show style with conditional', function() { @@ -486,7 +477,6 @@ defineSuite([ var style = new Cesium3DTileStyle({ "color" : "(${Temperature} > 90) ? color('red') : color('white')" }); - expect(style.show.evaluate(frameState, feature1)).toEqual(true); expect(style.color.evaluateColor(frameState, feature1)).toEqual(Color.WHITE); expect(style.color.evaluateColor(frameState, feature2)).toEqual(Color.RED); }); @@ -495,7 +485,6 @@ defineSuite([ var style = new Cesium3DTileStyle({ "color" : "rgba(${red}, ${green}, ${blue}, (${volume} > 100 ? 0.5 : 1.0))" }); - expect(style.show.evaluate(frameState, feature1)).toEqual(true); expect(style.color.evaluateColor(frameState, feature1)).toEqual(new Color(38/255, 255/255, 82/255, 0.5)); expect(style.color.evaluateColor(frameState, feature2)).toEqual(new Color(255/255, 30/255, 30/255, 1.0)); }); @@ -513,7 +502,6 @@ defineSuite([ ] } }); - expect(style.show.evaluate(frameState, feature1)).toEqual(true); expect(style.color.evaluateColor(frameState, feature1)).toEqual(Color.RED); expect(style.color.evaluateColor(frameState, feature2)).toEqual(Color.LIME); }); @@ -531,7 +519,6 @@ defineSuite([ ] } }); - expect(style.show.evaluate(frameState, feature1)).toEqual(true); expect(style.color.evaluateColor(frameState, feature1)).toEqual(Color.BLUE); expect(style.color.evaluateColor(frameState, feature2)).toEqual(Color.YELLOW); }); From c150bbf864f665337e9125255770faef61e81f18 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Mon, 17 Jul 2017 09:42:06 -0400 Subject: [PATCH 10/18] Fix eslint errors --- Specs/Scene/Cesium3DTileStyleSpec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Specs/Scene/Cesium3DTileStyleSpec.js b/Specs/Scene/Cesium3DTileStyleSpec.js index 28ca9638c4fc..c52940b75df4 100644 --- a/Specs/Scene/Cesium3DTileStyleSpec.js +++ b/Specs/Scene/Cesium3DTileStyleSpec.js @@ -190,7 +190,7 @@ defineSuite([ style.show = undefined; expect(style.show).toBeUndefined(); }); - + it('sets color value to expression', function() { var style = new Cesium3DTileStyle({ color : 'color("red")' @@ -262,7 +262,7 @@ defineSuite([ style.color = jsonExp; expect(style.color).toEqual(new ConditionsExpression(jsonExp, defines)); }); - + it('sets pointSize value to expression', function() { var style = new Cesium3DTileStyle({ pointSize : '2' From 585cb0fb8856d31699f4ed3ac44a61763265d9a2 Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Mon, 17 Jul 2017 15:50:31 +0200 Subject: [PATCH 11/18] Remove obsolete code --- Source/Scene/Cesium3DTileStyle.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index 1ba4921e6df5..80ac74cb2e41 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -95,10 +95,6 @@ define([ that.show = styleJson.show; that.pointSize = styleJson.pointSize; - that._colorShaderFunctionReady = !defined(styleJson.color); - that._showShaderFunctionReady = !defined(styleJson.show); - that._pointSizeShaderFunctionReady = !defined(styleJson.pointSize); - var meta = {}; if (defined(styleJson.meta)) { var defines = styleJson.defines; From bfb7c516a08bdba5bdb9bac3b06a496b11ba3fd4 Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Mon, 17 Jul 2017 16:12:10 +0200 Subject: [PATCH 12/18] Fix after last commit --- Source/Scene/Cesium3DTileStyle.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index 80ac74cb2e41..40e13e0d7739 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -437,7 +437,7 @@ define([ } this._colorShaderFunctionReady = true; - this._colorShaderFunction = this.color.getShaderFunction(functionName, attributePrefix, shaderState, 'vec4'); + this._colorShaderFunction = defined(this.color) ? this.color.getShaderFunction(functionName, attributePrefix, shaderState, 'vec4') : undefined; return this._colorShaderFunction; }; @@ -459,7 +459,7 @@ define([ } this._showShaderFunctionReady = true; - this._showShaderFunction = this.show.getShaderFunction(functionName, attributePrefix, shaderState, 'bool'); + this._showShaderFunction = defined(this.show) ? this.show.getShaderFunction(functionName, attributePrefix, shaderState, 'bool') : undefined; return this._showShaderFunction; }; @@ -481,7 +481,7 @@ define([ } this._pointSizeShaderFunctionReady = true; - this._pointSizeShaderFunction = this.pointSize.getShaderFunction(functionName, attributePrefix, shaderState, 'float'); + this._pointSizeShaderFunction = defined(this.pointSize) ? this.pointSize.getShaderFunction(functionName, attributePrefix, shaderState, 'float') ? undefined; return this._pointSizeShaderFunction; }; From e47c0c691346b09e8786990be9e0d0fb241122fe Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Mon, 17 Jul 2017 16:28:05 +0200 Subject: [PATCH 13/18] Fix syntax mistaken --- Source/Scene/Cesium3DTileStyle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index 40e13e0d7739..a60fc7ba8b4b 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -481,7 +481,7 @@ define([ } this._pointSizeShaderFunctionReady = true; - this._pointSizeShaderFunction = defined(this.pointSize) ? this.pointSize.getShaderFunction(functionName, attributePrefix, shaderState, 'float') ? undefined; + this._pointSizeShaderFunction = defined(this.pointSize) ? this.pointSize.getShaderFunction(functionName, attributePrefix, shaderState, 'float') : undefined; return this._pointSizeShaderFunction; }; From 3cdf90ca0f892ec092711dc64726f0c654b9fa2a Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Mon, 17 Jul 2017 16:41:22 +0200 Subject: [PATCH 14/18] Replace tab by whitespaces --- Specs/Scene/Cesium3DTileStyleSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Specs/Scene/Cesium3DTileStyleSpec.js b/Specs/Scene/Cesium3DTileStyleSpec.js index c52940b75df4..43fab6e103b1 100644 --- a/Specs/Scene/Cesium3DTileStyleSpec.js +++ b/Specs/Scene/Cesium3DTileStyleSpec.js @@ -1,5 +1,5 @@ defineSuite([ - 'Scene/Cesium3DTileStyle', + 'Scene/Cesium3DTileStyle', 'Core/Color', 'Scene/ConditionsExpression', 'Scene/Expression' From 10d5c7ab605c9b880e6b071c49149d62b037495c Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Mon, 17 Jul 2017 17:32:26 +0200 Subject: [PATCH 15/18] Fix Cesium3DTilesInspector --- .../Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js index 087e97918e5f..e9a5d9dfad75 100644 --- a/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js +++ b/Source/Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel.js @@ -974,7 +974,7 @@ define([ // Restore original color to feature that is no longer selected var frameState = this._scene.frameState; if (!this.colorize && defined(this._style)) { - currentFeature.color = this._style.color.evaluateColor(frameState, currentFeature, scratchColor); + currentFeature.color = defined(this._style.color) ? this._style.color.evaluateColor(frameState, currentFeature, scratchColor) : Color.WHITE; } else { currentFeature.color = oldColor; } From 7a44bfbdb71a99903fa80f7533064f612e78c609 Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Mon, 17 Jul 2017 23:21:53 +0200 Subject: [PATCH 16/18] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 1c038dc5ea5e..d856b94769e2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ Change Log * Added ability to show tile urls in the 3D Tiles Inspector. [#5592](https://github.com/AnalyticalGraphicsInc/cesium/pull/5592) * Added behavior to `Cesium3DTilesInspector` that selects the first tileset hovered over if no tilest is specified. [#5139](https://github.com/AnalyticalGraphicsInc/cesium/issues/5139) * Added ability to provide a `width` and `height` to `scene.pick`. [#5602](https://github.com/AnalyticalGraphicsInc/cesium/pull/5602) +* Added ability to set a style's `color`, `show`, or `pointSize` with a string or object literal. `show` may also take a boolean and `pointSize` may take a number. [#5412](https://github.com/AnalyticalGraphicsInc/cesium/pull/5412) * Fixed crash when using the `Cesium3DTilesInspectorViewModel` and removing a tileset [#5607](https://github.com/AnalyticalGraphicsInc/cesium/issues/5607) ### 1.35.2 - 2017-07-11 From 70f562f584446f0c8edefcefa4c58da905eb934d Mon Sep 17 00:00:00 2001 From: Heiko Thiel Date: Mon, 24 Jul 2017 15:08:43 +0200 Subject: [PATCH 17/18] Added deprecation note --- CHANGES.md | 1 + Source/Scene/Cesium3DTileStyle.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 47e96df82e74..a9691498e67b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ Change Log * The function `Quaternion.fromHeadingPitchRoll(heading, pitch, roll, result)` was removed. Use `Quaternion.fromHeadingPitchRoll(hpr, result)` instead where `hpr` is a `HeadingPitchRoll`. * The function `Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, result)` was removed. Use `Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result)` instead where `fixedFrameTransform` is a a 4x4 transformation matrix (see `Transforms.localFrameToFixedFrameGenerator`). * The function `Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, result)` was removed. Use `Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result)` instead where `fixedFrameTransform` is a a 4x4 transformation matrix (see `Transforms.localFrameToFixedFrameGenerator`). + * `color`, `show`, or `pointSize` of `Cesium3DTileStyle` are not initialized with a default value anymore. * Deprecated * `Scene/CullingVolume` is deprecated and will be removed in 1.38. Use `Core/CullingVolume`. * `Scene/OrthographicFrustum` is deprecated and will be removed in 1.38. Use `Core/OrthographicFrustum`. diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index a60fc7ba8b4b..f0498700d5ca 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -170,6 +170,7 @@ define([ /** * Gets or sets the {@link StyleExpression} object used to evaluate the style's show property. Alternatively a boolean, string, or object defining a show style can be used. + * In case passed value is a boolean, string, or condition object value will be converted into an {Expression} or {ConditionsExpression}. *

* The expression must return or convert to a Boolean. *

@@ -246,6 +247,7 @@ define([ /** * Gets or sets the {@link StyleExpression} object used to evaluate the style's color property. Alternatively a string or object defining a color style can be used. + * In case passed value is a string or condition object value will be converted into an {Expression} or {ConditionsExpression}. *

* The expression must return a Color. *

@@ -313,6 +315,7 @@ define([ /** * Gets or sets the {@link StyleExpression} object used to evaluate the style's pointSize property. Alternatively a number, string, or object defining a pointSize style can be used. + * In case passed value is a number, string, or condition object value will be converted into an {Expression} or {ConditionsExpression}. *

* The expression must return or convert to a Number. *

From fff7cddb322a1813f3e5962e7b83d92b8f159e43 Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Mon, 24 Jul 2017 22:50:00 -0400 Subject: [PATCH 18/18] Tweak doc wording --- CHANGES.md | 2 +- Source/Scene/Cesium3DTileStyle.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a9691498e67b..7f2e2a881cde 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,7 +7,7 @@ Change Log * The function `Quaternion.fromHeadingPitchRoll(heading, pitch, roll, result)` was removed. Use `Quaternion.fromHeadingPitchRoll(hpr, result)` instead where `hpr` is a `HeadingPitchRoll`. * The function `Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, result)` was removed. Use `Transforms.headingPitchRollToFixedFrame(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result)` instead where `fixedFrameTransform` is a a 4x4 transformation matrix (see `Transforms.localFrameToFixedFrameGenerator`). * The function `Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, result)` was removed. Use `Transforms.headingPitchRollQuaternion(origin, headingPitchRoll, ellipsoid, fixedFrameTransform, result)` instead where `fixedFrameTransform` is a a 4x4 transformation matrix (see `Transforms.localFrameToFixedFrameGenerator`). - * `color`, `show`, or `pointSize` of `Cesium3DTileStyle` are not initialized with a default value anymore. + * The `color`, `show`, and `pointSize` properties of `Cesium3DTileStyle` are no longer initialized with default values. * Deprecated * `Scene/CullingVolume` is deprecated and will be removed in 1.38. Use `Core/CullingVolume`. * `Scene/OrthographicFrustum` is deprecated and will be removed in 1.38. Use `Core/OrthographicFrustum`. diff --git a/Source/Scene/Cesium3DTileStyle.js b/Source/Scene/Cesium3DTileStyle.js index f0498700d5ca..a21770cf06ea 100644 --- a/Source/Scene/Cesium3DTileStyle.js +++ b/Source/Scene/Cesium3DTileStyle.js @@ -170,7 +170,7 @@ define([ /** * Gets or sets the {@link StyleExpression} object used to evaluate the style's show property. Alternatively a boolean, string, or object defining a show style can be used. - * In case passed value is a boolean, string, or condition object value will be converted into an {Expression} or {ConditionsExpression}. + * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter. *

* The expression must return or convert to a Boolean. *

@@ -247,7 +247,7 @@ define([ /** * Gets or sets the {@link StyleExpression} object used to evaluate the style's color property. Alternatively a string or object defining a color style can be used. - * In case passed value is a string or condition object value will be converted into an {Expression} or {ConditionsExpression}. + * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter. *

* The expression must return a Color. *

@@ -315,7 +315,7 @@ define([ /** * Gets or sets the {@link StyleExpression} object used to evaluate the style's pointSize property. Alternatively a number, string, or object defining a pointSize style can be used. - * In case passed value is a number, string, or condition object value will be converted into an {Expression} or {ConditionsExpression}. + * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter. *

* The expression must return or convert to a Number. *