Skip to content

Commit 7e459c8

Browse files
authored
Merge pull request #6890 from janeyx99/fix-6874
Removes frameState parameter from evaluate and evaluateColor
2 parents d22e21c + f9c2886 commit 7e459c8

29 files changed

+883
-903
lines changed

Apps/Sandcastle/gallery/3D Tiles Interactivity.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
}
146146

147147
// Evaluate feature description
148-
console.log('Description : ' + tileset.style.meta.description.evaluate(scene.frameState, feature));
148+
console.log('Description : ' + tileset.style.meta.description.evaluate(feature));
149149
}
150150

151151
function zoom(movement, feature) {

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Change Log
66
##### Breaking Changes :mega:
77
* Removed `ClippingPlaneCollection.clone` [#6872](https://github.com/AnalyticalGraphicsInc/cesium/pull/6872)
88
* Changed `Globe.pick` to return a position in ECEF coordinates regardless of the current scene mode. This will only effect you if you were working around a bug to make `Globe.pick` work in 2D and Columbus View. Use `Globe.pickWorldCoordinates` to get the position in world coordinates that correlate to the current scene mode. [#6859](https://github.com/AnalyticalGraphicsInc/cesium/pull/6859)
9+
* Removed the unused `frameState` parameter in `evaluate` and `evaluateColor` functions in `Expression`, `StyleExpression`, `ConditionsExpression` and all other places that call the functions. [#6890](https://github.com/AnalyticalGraphicsInc/cesium/pull/6890).
910

1011
##### Additions :tada:
1112
* Added `ClippingPlaneCollection.planeAdded` and `ClippingPlaneCollection.planeRemoved` events. `planeAdded` is raised when a new plane is added to the collection and `planeRemoved` is raised when a plane is removed. [#6875](https://github.com/AnalyticalGraphicsInc/cesium/pull/6875)

Source/Scene/Batched3DModel3DTileContent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,8 @@ define([
444444
}
445445
};
446446

447-
Batched3DModel3DTileContent.prototype.applyStyle = function(frameState, style) {
448-
this._batchTable.applyStyle(frameState, style);
447+
Batched3DModel3DTileContent.prototype.applyStyle = function(style) {
448+
this._batchTable.applyStyle(style);
449449
};
450450

451451
Batched3DModel3DTileContent.prototype.update = function(tileset, frameState) {

Source/Scene/Cesium3DTileBatchTable.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ define([
544544

545545
var scratchColor = new Color();
546546

547-
Cesium3DTileBatchTable.prototype.applyStyle = function(frameState, style) {
547+
Cesium3DTileBatchTable.prototype.applyStyle = function(style) {
548548
if (!defined(style)) {
549549
this.setAllColor(DEFAULT_COLOR_VALUE);
550550
this.setAllShow(true);
@@ -555,8 +555,8 @@ define([
555555
var length = this.featuresLength;
556556
for (var i = 0; i < length; ++i) {
557557
var feature = content.getFeature(i);
558-
var color = defined(style.color) ? style.color.evaluateColor(frameState, feature, scratchColor) : DEFAULT_COLOR_VALUE;
559-
var show = defined(style.show) ? style.show.evaluate(frameState, feature) : DEFAULT_SHOW_VALUE;
558+
var color = defined(style.color) ? style.color.evaluateColor(feature, scratchColor) : DEFAULT_COLOR_VALUE;
559+
var show = defined(style.show) ? style.show.evaluate(feature) : DEFAULT_SHOW_VALUE;
560560
this.setColor(i, color);
561561
this.setShow(i, show);
562562
}

Source/Scene/Cesium3DTileContent.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,11 @@ define([
271271
* not part of the public Cesium API.
272272
* </p>
273273
*
274-
* @param {FrameSate} frameState The frame state.
275274
* @param {Cesium3DTileStyle} style The style.
276275
*
277276
* @private
278277
*/
279-
Cesium3DTileContent.prototype.applyStyle = function(frameState, style) {
278+
Cesium3DTileContent.prototype.applyStyle = function(style) {
280279
DeveloperError.throwInstantiationError();
281280
};
282281

Source/Scene/Cesium3DTileStyle.js

+28-28
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,13 @@ define([
250250
* var style = new Cesium3DTileStyle({
251251
* show : '(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)'
252252
* });
253-
* style.show.evaluate(frameState, feature); // returns true or false depending on the feature's properties
253+
* style.show.evaluate(feature); // returns true or false depending on the feature's properties
254254
*
255255
* @example
256256
* var style = new Cesium.Cesium3DTileStyle();
257257
* // Override show expression with a custom function
258258
* style.show = {
259-
* evaluate : function(frameState, feature) {
259+
* evaluate : function(feature) {
260260
* return true;
261261
* }
262262
* };
@@ -319,13 +319,13 @@ define([
319319
* var style = new Cesium3DTileStyle({
320320
* color : '(${Temperature} > 90) ? color("red") : color("white")'
321321
* });
322-
* style.color.evaluateColor(frameState, feature, result); // returns a Cesium.Color object
322+
* style.color.evaluateColor(feature, result); // returns a Cesium.Color object
323323
*
324324
* @example
325325
* var style = new Cesium.Cesium3DTileStyle();
326326
* // Override color expression with a custom function
327327
* style.color = {
328-
* evaluateColor : function(frameState, feature, result) {
328+
* evaluateColor : function(feature, result) {
329329
* return Cesium.Color.clone(Cesium.Color.WHITE, result);
330330
* }
331331
* };
@@ -381,13 +381,13 @@ define([
381381
* var style = new Cesium3DTileStyle({
382382
* pointSize : '(${Temperature} > 90) ? 2.0 : 1.0'
383383
* });
384-
* style.pointSize.evaluate(frameState, feature); // returns a Number
384+
* style.pointSize.evaluate(feature); // returns a Number
385385
*
386386
* @example
387387
* var style = new Cesium.Cesium3DTileStyle();
388388
* // Override pointSize expression with a custom function
389389
* style.pointSize = {
390-
* evaluate : function(frameState, feature) {
390+
* evaluate : function(feature) {
391391
* return 1.0;
392392
* }
393393
* };
@@ -690,13 +690,13 @@ define([
690690
* var style = new Cesium3DTileStyle({
691691
* font : '(${Temperature} > 90) ? "30px Helvetica" : "24px Helvetica"'
692692
* });
693-
* style.font.evaluate(frameState, feature); // returns a String
693+
* style.font.evaluate(feature); // returns a String
694694
*
695695
* @example
696696
* var style = new Cesium.Cesium3DTileStyle();
697697
* // Override font expression with a custom function
698698
* style.font = {
699-
* evaluate : function(frameState, feature) {
699+
* evaluate : function(feature) {
700700
* return '24px Helvetica';
701701
* }
702702
* };
@@ -738,13 +738,13 @@ define([
738738
* var style = new Cesium3DTileStyle({
739739
* labelStyle : '(${Temperature} > 90) ? ' + LabelStyle.FILL_AND_OUTLINE + ' : ' + LabelStyle.FILL
740740
* });
741-
* style.labelStyle.evaluate(frameState, feature); // returns a LabelStyle
741+
* style.labelStyle.evaluate(feature); // returns a LabelStyle
742742
*
743743
* @example
744744
* var style = new Cesium.Cesium3DTileStyle();
745745
* // Override labelStyle expression with a custom function
746746
* style.labelStyle = {
747-
* evaluate : function(frameState, feature) {
747+
* evaluate : function(feature) {
748748
* return LabelStyle.FILL;
749749
* }
750750
* };
@@ -786,13 +786,13 @@ define([
786786
* var style = new Cesium3DTileStyle({
787787
* labelText : '(${Temperature} > 90) ? ">90" : "<=90"'
788788
* });
789-
* style.labelText.evaluate(frameState, feature); // returns a String
789+
* style.labelText.evaluate(feature); // returns a String
790790
*
791791
* @example
792792
* var style = new Cesium.Cesium3DTileStyle();
793793
* // Override labelText expression with a custom function
794794
* style.labelText = {
795-
* evaluate : function(frameState, feature) {
795+
* evaluate : function(feature) {
796796
* return 'Example label text';
797797
* }
798798
* };
@@ -882,7 +882,7 @@ define([
882882
* var style = new Cesium.Cesium3DTileStyle();
883883
* // Override backgroundPadding expression with a string
884884
* style.backgroundPadding = 'vec2(5.0, 7.0)';
885-
* style.backgroundPadding.evaluate(frameState, feature); // returns a Cartesian2
885+
* style.backgroundPadding.evaluate(feature); // returns a Cartesian2
886886
*/
887887
backgroundPadding : {
888888
get : function() {
@@ -969,7 +969,7 @@ define([
969969
* var style = new Cesium.Cesium3DTileStyle();
970970
* // Override scaleByDistance expression with a string
971971
* style.scaleByDistance = 'vec4(1.5e2, 2.0, 1.5e7, 0.5)';
972-
* style.scaleByDistance.evaluate(frameState, feature); // returns a Cartesian4
972+
* style.scaleByDistance.evaluate(feature); // returns a Cartesian4
973973
*/
974974
scaleByDistance : {
975975
get : function() {
@@ -1008,7 +1008,7 @@ define([
10081008
* var style = new Cesium.Cesium3DTileStyle();
10091009
* // Override translucencyByDistance expression with a string
10101010
* style.translucencyByDistance = 'vec4(1.5e2, 1.0, 1.5e7, 0.2)';
1011-
* style.translucencyByDistance.evaluate(frameState, feature); // returns a Cartesian4
1011+
* style.translucencyByDistance.evaluate(feature); // returns a Cartesian4
10121012
*/
10131013
translucencyByDistance : {
10141014
get : function() {
@@ -1047,7 +1047,7 @@ define([
10471047
* var style = new Cesium.Cesium3DTileStyle();
10481048
* // Override distanceDisplayCondition expression with a string
10491049
* style.distanceDisplayCondition = 'vec2(0.0, 5.5e6)';
1050-
* style.distanceDisplayCondition.evaluate(frameState, feature); // returns a Cartesian2
1050+
* style.distanceDisplayCondition.evaluate(feature); // returns a Cartesian2
10511051
*/
10521052
distanceDisplayCondition : {
10531053
get : function() {
@@ -1230,13 +1230,13 @@ define([
12301230
* var style = new Cesium3DTileStyle({
12311231
* image : '(${Temperature} > 90) ? "/url/to/image1" : "/url/to/image2"'
12321232
* });
1233-
* style.image.evaluate(frameState, feature); // returns a String
1233+
* style.image.evaluate(feature); // returns a String
12341234
*
12351235
* @example
12361236
* var style = new Cesium.Cesium3DTileStyle();
12371237
* // Override image expression with a custom function
12381238
* style.image = {
1239-
* evaluate : function(frameState, feature) {
1239+
* evaluate : function(feature) {
12401240
* return '/url/to/image';
12411241
* }
12421242
* };
@@ -1278,7 +1278,7 @@ define([
12781278
* var style = new Cesium.Cesium3DTileStyle();
12791279
* // Override disableDepthTestDistance expression with a string
12801280
* style.disableDepthTestDistance = '1000.0';
1281-
* style.disableDepthTestDistance.evaluate(frameState, feature); // returns a Number
1281+
* style.disableDepthTestDistance.evaluate(feature); // returns a Number
12821282
*/
12831283
disableDepthTestDistance : {
12841284
get : function() {
@@ -1317,13 +1317,13 @@ define([
13171317
* var style = new Cesium3DTileStyle({
13181318
* horizontalOrigin : HorizontalOrigin.LEFT
13191319
* });
1320-
* style.horizontalOrigin.evaluate(frameState, feature); // returns a HorizontalOrigin
1320+
* style.horizontalOrigin.evaluate(feature); // returns a HorizontalOrigin
13211321
*
13221322
* @example
13231323
* var style = new Cesium.Cesium3DTileStyle();
13241324
* // Override horizontalOrigin expression with a custom function
13251325
* style.horizontalOrigin = {
1326-
* evaluate : function(frameState, feature) {
1326+
* evaluate : function(feature) {
13271327
* return HorizontalOrigin.CENTER;
13281328
* }
13291329
* };
@@ -1365,13 +1365,13 @@ define([
13651365
* var style = new Cesium3DTileStyle({
13661366
* verticalOrigin : VerticalOrigin.TOP
13671367
* });
1368-
* style.verticalOrigin.evaluate(frameState, feature); // returns a VerticalOrigin
1368+
* style.verticalOrigin.evaluate(feature); // returns a VerticalOrigin
13691369
*
13701370
* @example
13711371
* var style = new Cesium.Cesium3DTileStyle();
13721372
* // Override verticalOrigin expression with a custom function
13731373
* style.verticalOrigin = {
1374-
* evaluate : function(frameState, feature) {
1374+
* evaluate : function(feature) {
13751375
* return VerticalOrigin.CENTER;
13761376
* }
13771377
* };
@@ -1413,13 +1413,13 @@ define([
14131413
* var style = new Cesium3DTileStyle({
14141414
* labelHorizontalOrigin : HorizontalOrigin.LEFT
14151415
* });
1416-
* style.labelHorizontalOrigin.evaluate(frameState, feature); // returns a HorizontalOrigin
1416+
* style.labelHorizontalOrigin.evaluate(feature); // returns a HorizontalOrigin
14171417
*
14181418
* @example
14191419
* var style = new Cesium.Cesium3DTileStyle();
14201420
* // Override labelHorizontalOrigin expression with a custom function
14211421
* style.labelHorizontalOrigin = {
1422-
* evaluate : function(frameState, feature) {
1422+
* evaluate : function(feature) {
14231423
* return HorizontalOrigin.CENTER;
14241424
* }
14251425
* };
@@ -1461,13 +1461,13 @@ define([
14611461
* var style = new Cesium3DTileStyle({
14621462
* labelVerticalOrigin : VerticalOrigin.TOP
14631463
* });
1464-
* style.labelVerticalOrigin.evaluate(frameState, feature); // returns a VerticalOrigin
1464+
* style.labelVerticalOrigin.evaluate(feature); // returns a VerticalOrigin
14651465
*
14661466
* @example
14671467
* var style = new Cesium.Cesium3DTileStyle();
14681468
* // Override labelVerticalOrigin expression with a custom function
14691469
* style.labelVerticalOrigin = {
1470-
* evaluate : function(frameState, feature) {
1470+
* evaluate : function(feature) {
14711471
* return VerticalOrigin.CENTER;
14721472
* }
14731473
* };
@@ -1503,7 +1503,7 @@ define([
15031503
* description : '"Building id ${id} has height ${Height}."'
15041504
* }
15051505
* });
1506-
* style.meta.description.evaluate(frameState, feature); // returns a String with the substituted variables
1506+
* style.meta.description.evaluate(feature); // returns a String with the substituted variables
15071507
*/
15081508
meta : {
15091509
get : function() {

Source/Scene/Cesium3DTileStyleEngine.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ define([
7171
// 2) this tile is now visible, but it wasn't visible when the style was first assigned
7272
var content = tile.content;
7373
tile.lastStyleTime = lastStyleTime;
74-
content.applyStyle(frameState, this._style);
74+
content.applyStyle(this._style);
7575
statistics.numberOfFeaturesStyled += content.featuresLength;
7676
++statistics.numberOfTilesStyled;
7777
}

Source/Scene/Composite3DTileContent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ define([
250250
}
251251
};
252252

253-
Composite3DTileContent.prototype.applyStyle = function(frameState, style) {
253+
Composite3DTileContent.prototype.applyStyle = function(style) {
254254
var contents = this._contents;
255255
var length = contents.length;
256256
for (var i = 0; i < length; ++i) {
257-
contents[i].applyStyle(frameState, style);
257+
contents[i].applyStyle(style);
258258
}
259259
};
260260

Source/Scene/ConditionsExpression.js

+7-9
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ define([
3434
* ['true', 'color("#FFFFFF")']
3535
* ]
3636
* });
37-
* expression.evaluateColor(frameState, feature, result); // returns a Cesium.Color object
37+
* expression.evaluateColor(feature, result); // returns a Cesium.Color object
3838
*/
3939
function ConditionsExpression(conditionsExpression, defines) {
4040
this._conditionsExpression = clone(conditionsExpression, true);
@@ -96,21 +96,20 @@ define([
9696
* a {@link Cartesian2}, {@link Cartesian3}, or {@link Cartesian4} object will be returned. If the <code>result</code> argument is
9797
* a {@link Color}, the {@link Cartesian4} value is converted to a {@link Color} and then returned.
9898
*
99-
* @param {FrameState} frameState The frame state.
10099
* @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
101100
* @param {Object} [result] The object onto which to store the result.
102101
* @returns {Boolean|Number|String|RegExp|Cartesian2|Cartesian3|Cartesian4|Color} The result of evaluating the expression.
103102
*/
104-
ConditionsExpression.prototype.evaluate = function(frameState, feature, result) {
103+
ConditionsExpression.prototype.evaluate = function(feature, result) {
105104
var conditions = this._runtimeConditions;
106105
if (!defined(conditions)) {
107106
return undefined;
108107
}
109108
var length = conditions.length;
110109
for (var i = 0; i < length; ++i) {
111110
var statement = conditions[i];
112-
if (statement.condition.evaluate(frameState, feature)) {
113-
return statement.expression.evaluate(frameState, feature, result);
111+
if (statement.condition.evaluate(feature)) {
112+
return statement.expression.evaluate(feature, result);
114113
}
115114
}
116115
};
@@ -120,21 +119,20 @@ define([
120119
* <p>
121120
* This is equivalent to {@link ConditionsExpression#evaluate} but always returns a {@link Color} object.
122121
* </p>
123-
* @param {FrameState} frameState The frame state.
124122
* @param {Cesium3DTileFeature} feature The feature whose properties may be used as variables in the expression.
125123
* @param {Color} [result] The object in which to store the result
126124
* @returns {Color} The modified result parameter or a new Color instance if one was not provided.
127125
*/
128-
ConditionsExpression.prototype.evaluateColor = function(frameState, feature, result) {
126+
ConditionsExpression.prototype.evaluateColor = function(feature, result) {
129127
var conditions = this._runtimeConditions;
130128
if (!defined(conditions)) {
131129
return undefined;
132130
}
133131
var length = conditions.length;
134132
for (var i = 0; i < length; ++i) {
135133
var statement = conditions[i];
136-
if (statement.condition.evaluate(frameState, feature)) {
137-
return statement.expression.evaluateColor(frameState, feature, result);
134+
if (statement.condition.evaluate(feature)) {
135+
return statement.expression.evaluateColor(feature, result);
138136
}
139137
}
140138
};

Source/Scene/Empty3DTileContent.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ define([
119119
Empty3DTileContent.prototype.applyDebugSettings = function(enabled, color) {
120120
};
121121

122-
Empty3DTileContent.prototype.applyStyle = function(frameState, style) {
122+
Empty3DTileContent.prototype.applyStyle = function(style) {
123123
};
124124

125125
Empty3DTileContent.prototype.update = function(tileset, frameState) {

0 commit comments

Comments
 (0)