Cesium3DTileStyle.js 62 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776
  1. import clone from "../Core/clone.js";
  2. import defaultValue from "../Core/defaultValue.js";
  3. import defined from "../Core/defined.js";
  4. import DeveloperError from "../Core/DeveloperError.js";
  5. import Resource from "../Core/Resource.js";
  6. import ConditionsExpression from "./ConditionsExpression.js";
  7. import Expression from "./Expression.js";
  8. /**
  9. * A style that is applied to a {@link Cesium3DTileset}.
  10. * <p>
  11. * Evaluates an expression defined using the
  12. * {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/Styling|3D Tiles Styling language}.
  13. * </p>
  14. *
  15. * @alias Cesium3DTileStyle
  16. * @constructor
  17. *
  18. * @param {Resource|String|Object} [style] The url of a style or an object defining a style.
  19. *
  20. * @example
  21. * tileset.style = new Cesium.Cesium3DTileStyle({
  22. * color : {
  23. * conditions : [
  24. * ['${Height} >= 100', 'color("purple", 0.5)'],
  25. * ['${Height} >= 50', 'color("red")'],
  26. * ['true', 'color("blue")']
  27. * ]
  28. * },
  29. * show : '${Height} > 0',
  30. * meta : {
  31. * description : '"Building id ${id} has height ${Height}."'
  32. * }
  33. * });
  34. *
  35. * @example
  36. * tileset.style = new Cesium.Cesium3DTileStyle({
  37. * color : 'vec4(${Temperature})',
  38. * pointSize : '${Temperature} * 2.0'
  39. * });
  40. *
  41. * @see {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/Styling|3D Tiles Styling language}
  42. */
  43. function Cesium3DTileStyle(style) {
  44. this._style = {};
  45. this._ready = false;
  46. this._show = undefined;
  47. this._color = undefined;
  48. this._pointSize = undefined;
  49. this._pointOutlineColor = undefined;
  50. this._pointOutlineWidth = undefined;
  51. this._labelColor = undefined;
  52. this._labelOutlineColor = undefined;
  53. this._labelOutlineWidth = undefined;
  54. this._font = undefined;
  55. this._labelStyle = undefined;
  56. this._labelText = undefined;
  57. this._backgroundColor = undefined;
  58. this._backgroundPadding = undefined;
  59. this._backgroundEnabled = undefined;
  60. this._scaleByDistance = undefined;
  61. this._translucencyByDistance = undefined;
  62. this._distanceDisplayCondition = undefined;
  63. this._heightOffset = undefined;
  64. this._anchorLineEnabled = undefined;
  65. this._anchorLineColor = undefined;
  66. this._image = undefined;
  67. this._disableDepthTestDistance = undefined;
  68. this._horizontalOrigin = undefined;
  69. this._verticalOrigin = undefined;
  70. this._labelHorizontalOrigin = undefined;
  71. this._labelVerticalOrigin = undefined;
  72. this._meta = undefined;
  73. this._colorShaderFunction = undefined;
  74. this._showShaderFunction = undefined;
  75. this._pointSizeShaderFunction = undefined;
  76. this._colorShaderFunctionReady = false;
  77. this._showShaderFunctionReady = false;
  78. this._pointSizeShaderFunctionReady = false;
  79. this._colorShaderTranslucent = false;
  80. let promise;
  81. if (typeof style === "string" || style instanceof Resource) {
  82. const resource = Resource.createIfNeeded(style);
  83. promise = resource.fetchJson(style);
  84. } else {
  85. promise = Promise.resolve(style);
  86. }
  87. const that = this;
  88. this._readyPromise = promise.then(function (styleJson) {
  89. setup(that, styleJson);
  90. return that;
  91. });
  92. }
  93. function setup(that, styleJson) {
  94. styleJson = defaultValue(clone(styleJson, true), that._style);
  95. that._style = styleJson;
  96. that.show = styleJson.show;
  97. that.color = styleJson.color;
  98. that.pointSize = styleJson.pointSize;
  99. that.pointOutlineColor = styleJson.pointOutlineColor;
  100. that.pointOutlineWidth = styleJson.pointOutlineWidth;
  101. that.labelColor = styleJson.labelColor;
  102. that.labelOutlineColor = styleJson.labelOutlineColor;
  103. that.labelOutlineWidth = styleJson.labelOutlineWidth;
  104. that.labelStyle = styleJson.labelStyle;
  105. that.font = styleJson.font;
  106. that.labelText = styleJson.labelText;
  107. that.backgroundColor = styleJson.backgroundColor;
  108. that.backgroundPadding = styleJson.backgroundPadding;
  109. that.backgroundEnabled = styleJson.backgroundEnabled;
  110. that.scaleByDistance = styleJson.scaleByDistance;
  111. that.translucencyByDistance = styleJson.translucencyByDistance;
  112. that.distanceDisplayCondition = styleJson.distanceDisplayCondition;
  113. that.heightOffset = styleJson.heightOffset;
  114. that.anchorLineEnabled = styleJson.anchorLineEnabled;
  115. that.anchorLineColor = styleJson.anchorLineColor;
  116. that.image = styleJson.image;
  117. that.disableDepthTestDistance = styleJson.disableDepthTestDistance;
  118. that.horizontalOrigin = styleJson.horizontalOrigin;
  119. that.verticalOrigin = styleJson.verticalOrigin;
  120. that.labelHorizontalOrigin = styleJson.labelHorizontalOrigin;
  121. that.labelVerticalOrigin = styleJson.labelVerticalOrigin;
  122. const meta = {};
  123. if (defined(styleJson.meta)) {
  124. const defines = styleJson.defines;
  125. const metaJson = defaultValue(styleJson.meta, defaultValue.EMPTY_OBJECT);
  126. for (const property in metaJson) {
  127. if (metaJson.hasOwnProperty(property)) {
  128. meta[property] = new Expression(metaJson[property], defines);
  129. }
  130. }
  131. }
  132. that._meta = meta;
  133. that._ready = true;
  134. }
  135. function getExpression(tileStyle, value) {
  136. const defines = defaultValue(tileStyle._style, defaultValue.EMPTY_OBJECT)
  137. .defines;
  138. if (!defined(value)) {
  139. return undefined;
  140. } else if (typeof value === "boolean" || typeof value === "number") {
  141. return new Expression(String(value));
  142. } else if (typeof value === "string") {
  143. return new Expression(value, defines);
  144. } else if (defined(value.conditions)) {
  145. return new ConditionsExpression(value, defines);
  146. }
  147. return value;
  148. }
  149. function getJsonFromExpression(expression) {
  150. if (!defined(expression)) {
  151. return undefined;
  152. } else if (defined(expression.expression)) {
  153. return expression.expression;
  154. } else if (defined(expression.conditionsExpression)) {
  155. return clone(expression.conditionsExpression, true);
  156. }
  157. return expression;
  158. }
  159. Object.defineProperties(Cesium3DTileStyle.prototype, {
  160. /**
  161. * Gets the object defining the style using the
  162. * {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification/Styling|3D Tiles Styling language}.
  163. *
  164. * @memberof Cesium3DTileStyle.prototype
  165. *
  166. * @type {Object}
  167. * @readonly
  168. *
  169. * @default {}
  170. *
  171. * @exception {DeveloperError} The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true.
  172. */
  173. style: {
  174. get: function () {
  175. //>>includeStart('debug', pragmas.debug);
  176. if (!this._ready) {
  177. throw new DeveloperError(
  178. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  179. );
  180. }
  181. //>>includeEnd('debug');
  182. return this._style;
  183. },
  184. },
  185. /**
  186. * When <code>true</code>, the style is ready and its expressions can be evaluated. When
  187. * a style is constructed with an object, as opposed to a url, this is <code>true</code> immediately.
  188. *
  189. * @memberof Cesium3DTileStyle.prototype
  190. *
  191. * @type {Boolean}
  192. * @readonly
  193. *
  194. * @default false
  195. */
  196. ready: {
  197. get: function () {
  198. return this._ready;
  199. },
  200. },
  201. /**
  202. * Gets the promise that will be resolved when the the style is ready and its expressions can be evaluated.
  203. *
  204. * @memberof Cesium3DTileStyle.prototype
  205. *
  206. * @type {Promise.<Cesium3DTileStyle>}
  207. * @readonly
  208. */
  209. readyPromise: {
  210. get: function () {
  211. return this._readyPromise;
  212. },
  213. },
  214. /**
  215. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>show</code> property. Alternatively a boolean, string, or object defining a show style can be used.
  216. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  217. * <p>
  218. * The expression must return or convert to a <code>Boolean</code>.
  219. * </p>
  220. * <p>
  221. * This expression is applicable to all tile formats.
  222. * </p>
  223. *
  224. * @memberof Cesium3DTileStyle.prototype
  225. *
  226. * @type {StyleExpression}
  227. *
  228. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  229. *
  230. * @example
  231. * const style = new Cesium3DTileStyle({
  232. * show : '(regExp("^Chest").test(${County})) && (${YearBuilt} >= 1970)'
  233. * });
  234. * style.show.evaluate(feature); // returns true or false depending on the feature's properties
  235. *
  236. * @example
  237. * const style = new Cesium.Cesium3DTileStyle();
  238. * // Override show expression with a custom function
  239. * style.show = {
  240. * evaluate : function(feature) {
  241. * return true;
  242. * }
  243. * };
  244. *
  245. * @example
  246. * const style = new Cesium.Cesium3DTileStyle();
  247. * // Override show expression with a boolean
  248. * style.show = true;
  249. * };
  250. *
  251. * @example
  252. * const style = new Cesium.Cesium3DTileStyle();
  253. * // Override show expression with a string
  254. * style.show = '${Height} > 0';
  255. * };
  256. *
  257. * @example
  258. * const style = new Cesium.Cesium3DTileStyle();
  259. * // Override show expression with a condition
  260. * style.show = {
  261. * conditions: [
  262. * ['${height} > 2', 'false'],
  263. * ['true', 'true']
  264. * ];
  265. * };
  266. */
  267. show: {
  268. get: function () {
  269. //>>includeStart('debug', pragmas.debug);
  270. if (!this._ready) {
  271. throw new DeveloperError(
  272. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  273. );
  274. }
  275. //>>includeEnd('debug');
  276. return this._show;
  277. },
  278. set: function (value) {
  279. this._show = getExpression(this, value);
  280. this._style.show = getJsonFromExpression(this._show);
  281. this._showShaderFunctionReady = false;
  282. },
  283. },
  284. /**
  285. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>color</code> property. Alternatively a string or object defining a color style can be used.
  286. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  287. * <p>
  288. * The expression must return a <code>Color</code>.
  289. * </p>
  290. * <p>
  291. * This expression is applicable to all tile formats.
  292. * </p>
  293. *
  294. * @memberof Cesium3DTileStyle.prototype
  295. *
  296. * @type {StyleExpression}
  297. *
  298. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  299. *
  300. * @example
  301. * const style = new Cesium3DTileStyle({
  302. * color : '(${Temperature} > 90) ? color("red") : color("white")'
  303. * });
  304. * style.color.evaluateColor(feature, result); // returns a Cesium.Color object
  305. *
  306. * @example
  307. * const style = new Cesium.Cesium3DTileStyle();
  308. * // Override color expression with a custom function
  309. * style.color = {
  310. * evaluateColor : function(feature, result) {
  311. * return Cesium.Color.clone(Cesium.Color.WHITE, result);
  312. * }
  313. * };
  314. *
  315. * @example
  316. * const style = new Cesium.Cesium3DTileStyle();
  317. * // Override color expression with a string
  318. * style.color = 'color("blue")';
  319. *
  320. * @example
  321. * const style = new Cesium.Cesium3DTileStyle();
  322. * // Override color expression with a condition
  323. * style.color = {
  324. * conditions : [
  325. * ['${height} > 2', 'color("cyan")'],
  326. * ['true', 'color("blue")']
  327. * ]
  328. * };
  329. */
  330. color: {
  331. get: function () {
  332. //>>includeStart('debug', pragmas.debug);
  333. if (!this._ready) {
  334. throw new DeveloperError(
  335. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  336. );
  337. }
  338. //>>includeEnd('debug');
  339. return this._color;
  340. },
  341. set: function (value) {
  342. this._color = getExpression(this, value);
  343. this._style.color = getJsonFromExpression(this._color);
  344. this._colorShaderFunctionReady = false;
  345. },
  346. },
  347. /**
  348. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>pointSize</code> property. Alternatively a string or object defining a point size style can be used.
  349. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  350. * <p>
  351. * The expression must return a <code>Number</code>.
  352. * </p>
  353. * <p>
  354. * This expression is only applicable to point features in a Vector tile or a Point Cloud tile.
  355. * </p>
  356. *
  357. * @memberof Cesium3DTileStyle.prototype
  358. *
  359. * @type {StyleExpression}
  360. *
  361. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  362. *
  363. * @example
  364. * const style = new Cesium3DTileStyle({
  365. * pointSize : '(${Temperature} > 90) ? 2.0 : 1.0'
  366. * });
  367. * style.pointSize.evaluate(feature); // returns a Number
  368. *
  369. * @example
  370. * const style = new Cesium.Cesium3DTileStyle();
  371. * // Override pointSize expression with a custom function
  372. * style.pointSize = {
  373. * evaluate : function(feature) {
  374. * return 1.0;
  375. * }
  376. * };
  377. *
  378. * @example
  379. * const style = new Cesium.Cesium3DTileStyle();
  380. * // Override pointSize expression with a number
  381. * style.pointSize = 1.0;
  382. *
  383. * @example
  384. * const style = new Cesium.Cesium3DTileStyle();
  385. * // Override pointSize expression with a string
  386. * style.pointSize = '${height} / 10';
  387. *
  388. * @example
  389. * const style = new Cesium.Cesium3DTileStyle();
  390. * // Override pointSize expression with a condition
  391. * style.pointSize = {
  392. * conditions : [
  393. * ['${height} > 2', '1.0'],
  394. * ['true', '2.0']
  395. * ]
  396. * };
  397. */
  398. pointSize: {
  399. get: function () {
  400. //>>includeStart('debug', pragmas.debug);
  401. if (!this._ready) {
  402. throw new DeveloperError(
  403. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  404. );
  405. }
  406. //>>includeEnd('debug');
  407. return this._pointSize;
  408. },
  409. set: function (value) {
  410. this._pointSize = getExpression(this, value);
  411. this._style.pointSize = getJsonFromExpression(this._pointSize);
  412. this._pointSizeShaderFunctionReady = false;
  413. },
  414. },
  415. /**
  416. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>pointOutlineColor</code> property. Alternatively a string or object defining a color style can be used.
  417. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  418. * <p>
  419. * The expression must return a <code>Color</code>.
  420. * </p>
  421. * <p>
  422. * This expression is only applicable to point features in a Vector tile.
  423. * </p>
  424. *
  425. * @memberof Cesium3DTileStyle.prototype
  426. *
  427. * @type {StyleExpression}
  428. *
  429. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  430. *
  431. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  432. *
  433. * @example
  434. * const style = new Cesium.Cesium3DTileStyle();
  435. * // Override pointOutlineColor expression with a string
  436. * style.pointOutlineColor = 'color("blue")';
  437. *
  438. * @example
  439. * const style = new Cesium.Cesium3DTileStyle();
  440. * // Override pointOutlineColor expression with a condition
  441. * style.pointOutlineColor = {
  442. * conditions : [
  443. * ['${height} > 2', 'color("cyan")'],
  444. * ['true', 'color("blue")']
  445. * ]
  446. * };
  447. */
  448. pointOutlineColor: {
  449. get: function () {
  450. //>>includeStart('debug', pragmas.debug);
  451. if (!this._ready) {
  452. throw new DeveloperError(
  453. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  454. );
  455. }
  456. //>>includeEnd('debug');
  457. return this._pointOutlineColor;
  458. },
  459. set: function (value) {
  460. this._pointOutlineColor = getExpression(this, value);
  461. this._style.pointOutlineColor = getJsonFromExpression(
  462. this._pointOutlineColor
  463. );
  464. },
  465. },
  466. /**
  467. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>pointOutlineWidth</code> property. Alternatively a string or object defining a number style can be used.
  468. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  469. * <p>
  470. * The expression must return a <code>Number</code>.
  471. * </p>
  472. * <p>
  473. * This expression is only applicable to point features in a Vector tile.
  474. * </p>
  475. *
  476. * @memberof Cesium3DTileStyle.prototype
  477. *
  478. * @type {StyleExpression}
  479. *
  480. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  481. *
  482. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  483. *
  484. * @example
  485. * const style = new Cesium.Cesium3DTileStyle();
  486. * // Override pointOutlineWidth expression with a string
  487. * style.pointOutlineWidth = '5';
  488. *
  489. * @example
  490. * const style = new Cesium.Cesium3DTileStyle();
  491. * // Override pointOutlineWidth expression with a condition
  492. * style.pointOutlineWidth = {
  493. * conditions : [
  494. * ['${height} > 2', '5'],
  495. * ['true', '0']
  496. * ]
  497. * };
  498. */
  499. pointOutlineWidth: {
  500. get: function () {
  501. //>>includeStart('debug', pragmas.debug);
  502. if (!this._ready) {
  503. throw new DeveloperError(
  504. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  505. );
  506. }
  507. //>>includeEnd('debug');
  508. return this._pointOutlineWidth;
  509. },
  510. set: function (value) {
  511. this._pointOutlineWidth = getExpression(this, value);
  512. this._style.pointOutlineWidth = getJsonFromExpression(
  513. this._pointOutlineWidth
  514. );
  515. },
  516. },
  517. /**
  518. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>labelColor</code> property. Alternatively a string or object defining a color style can be used.
  519. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  520. * <p>
  521. * The expression must return a <code>Color</code>.
  522. * </p>
  523. * <p>
  524. * This expression is only applicable to point features in a Vector tile.
  525. * </p>
  526. *
  527. * @memberof Cesium3DTileStyle.prototype
  528. *
  529. * @type {StyleExpression}
  530. *
  531. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  532. *
  533. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  534. *
  535. * @example
  536. * const style = new Cesium.Cesium3DTileStyle();
  537. * // Override labelColor expression with a string
  538. * style.labelColor = 'color("blue")';
  539. *
  540. * @example
  541. * const style = new Cesium.Cesium3DTileStyle();
  542. * // Override labelColor expression with a condition
  543. * style.labelColor = {
  544. * conditions : [
  545. * ['${height} > 2', 'color("cyan")'],
  546. * ['true', 'color("blue")']
  547. * ]
  548. * };
  549. */
  550. labelColor: {
  551. get: function () {
  552. //>>includeStart('debug', pragmas.debug);
  553. if (!this._ready) {
  554. throw new DeveloperError(
  555. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  556. );
  557. }
  558. //>>includeEnd('debug');
  559. return this._labelColor;
  560. },
  561. set: function (value) {
  562. this._labelColor = getExpression(this, value);
  563. this._style.labelColor = getJsonFromExpression(this._labelColor);
  564. },
  565. },
  566. /**
  567. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>labelOutlineColor</code> property. Alternatively a string or object defining a color style can be used.
  568. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  569. * <p>
  570. * The expression must return a <code>Color</code>.
  571. * </p>
  572. * <p>
  573. * This expression is only applicable to point features in a Vector tile.
  574. * </p>
  575. *
  576. * @memberof Cesium3DTileStyle.prototype
  577. *
  578. * @type {StyleExpression}
  579. *
  580. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  581. *
  582. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  583. *
  584. * @example
  585. * const style = new Cesium.Cesium3DTileStyle();
  586. * // Override labelOutlineColor expression with a string
  587. * style.labelOutlineColor = 'color("blue")';
  588. *
  589. * @example
  590. * const style = new Cesium.Cesium3DTileStyle();
  591. * // Override labelOutlineColor expression with a condition
  592. * style.labelOutlineColor = {
  593. * conditions : [
  594. * ['${height} > 2', 'color("cyan")'],
  595. * ['true', 'color("blue")']
  596. * ]
  597. * };
  598. */
  599. labelOutlineColor: {
  600. get: function () {
  601. //>>includeStart('debug', pragmas.debug);
  602. if (!this._ready) {
  603. throw new DeveloperError(
  604. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  605. );
  606. }
  607. //>>includeEnd('debug');
  608. return this._labelOutlineColor;
  609. },
  610. set: function (value) {
  611. this._labelOutlineColor = getExpression(this, value);
  612. this._style.labelOutlineColor = getJsonFromExpression(
  613. this._labelOutlineColor
  614. );
  615. },
  616. },
  617. /**
  618. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>labelOutlineWidth</code> property. Alternatively a string or object defining a number style can be used.
  619. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  620. * <p>
  621. * The expression must return a <code>Number</code>.
  622. * </p>
  623. * <p>
  624. * This expression is only applicable to point features in a Vector tile.
  625. * </p>
  626. *
  627. * @memberof Cesium3DTileStyle.prototype
  628. *
  629. * @type {StyleExpression}
  630. *
  631. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  632. *
  633. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  634. *
  635. * @example
  636. * const style = new Cesium.Cesium3DTileStyle();
  637. * // Override labelOutlineWidth expression with a string
  638. * style.labelOutlineWidth = '5';
  639. *
  640. * @example
  641. * const style = new Cesium.Cesium3DTileStyle();
  642. * // Override labelOutlineWidth expression with a condition
  643. * style.labelOutlineWidth = {
  644. * conditions : [
  645. * ['${height} > 2', '5'],
  646. * ['true', '0']
  647. * ]
  648. * };
  649. */
  650. labelOutlineWidth: {
  651. get: function () {
  652. //>>includeStart('debug', pragmas.debug);
  653. if (!this._ready) {
  654. throw new DeveloperError(
  655. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  656. );
  657. }
  658. //>>includeEnd('debug');
  659. return this._labelOutlineWidth;
  660. },
  661. set: function (value) {
  662. this._labelOutlineWidth = getExpression(this, value);
  663. this._style.labelOutlineWidth = getJsonFromExpression(
  664. this._labelOutlineWidth
  665. );
  666. },
  667. },
  668. /**
  669. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>font</code> property. Alternatively a string or object defining a string style can be used.
  670. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  671. * <p>
  672. * The expression must return a <code>String</code>.
  673. * </p>
  674. * <p>
  675. * This expression is only applicable to point features in a Vector tile.
  676. * </p>
  677. *
  678. * @memberof Cesium3DTileStyle.prototype
  679. *
  680. * @type {StyleExpression}
  681. *
  682. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  683. *
  684. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  685. *
  686. * @example
  687. * const style = new Cesium3DTileStyle({
  688. * font : '(${Temperature} > 90) ? "30px Helvetica" : "24px Helvetica"'
  689. * });
  690. * style.font.evaluate(feature); // returns a String
  691. *
  692. * @example
  693. * const style = new Cesium.Cesium3DTileStyle();
  694. * // Override font expression with a custom function
  695. * style.font = {
  696. * evaluate : function(feature) {
  697. * return '24px Helvetica';
  698. * }
  699. * };
  700. */
  701. font: {
  702. get: function () {
  703. //>>includeStart('debug', pragmas.debug);
  704. if (!this._ready) {
  705. throw new DeveloperError(
  706. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  707. );
  708. }
  709. //>>includeEnd('debug');
  710. return this._font;
  711. },
  712. set: function (value) {
  713. this._font = getExpression(this, value);
  714. this._style.font = getJsonFromExpression(this._font);
  715. },
  716. },
  717. /**
  718. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>label style</code> property. Alternatively a string or object defining a number style can be used.
  719. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  720. * <p>
  721. * The expression must return a <code>LabelStyle</code>.
  722. * </p>
  723. * <p>
  724. * This expression is only applicable to point features in a Vector tile.
  725. * </p>
  726. *
  727. * @memberof Cesium3DTileStyle.prototype
  728. *
  729. * @type {StyleExpression}
  730. *
  731. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  732. *
  733. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  734. *
  735. * @example
  736. * const style = new Cesium3DTileStyle({
  737. * labelStyle : '(${Temperature} > 90) ? ' + LabelStyle.FILL_AND_OUTLINE + ' : ' + LabelStyle.FILL
  738. * });
  739. * style.labelStyle.evaluate(feature); // returns a LabelStyle
  740. *
  741. * @example
  742. * const style = new Cesium.Cesium3DTileStyle();
  743. * // Override labelStyle expression with a custom function
  744. * style.labelStyle = {
  745. * evaluate : function(feature) {
  746. * return LabelStyle.FILL;
  747. * }
  748. * };
  749. */
  750. labelStyle: {
  751. get: function () {
  752. //>>includeStart('debug', pragmas.debug);
  753. if (!this._ready) {
  754. throw new DeveloperError(
  755. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  756. );
  757. }
  758. //>>includeEnd('debug');
  759. return this._labelStyle;
  760. },
  761. set: function (value) {
  762. this._labelStyle = getExpression(this, value);
  763. this._style.labelStyle = getJsonFromExpression(this._labelStyle);
  764. },
  765. },
  766. /**
  767. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>labelText</code> property. Alternatively a string or object defining a string style can be used.
  768. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  769. * <p>
  770. * The expression must return a <code>String</code>.
  771. * </p>
  772. * <p>
  773. * This expression is only applicable to point features in a Vector tile.
  774. * </p>
  775. *
  776. * @memberof Cesium3DTileStyle.prototype
  777. *
  778. * @type {StyleExpression}
  779. *
  780. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  781. *
  782. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  783. *
  784. * @example
  785. * const style = new Cesium3DTileStyle({
  786. * labelText : '(${Temperature} > 90) ? ">90" : "<=90"'
  787. * });
  788. * style.labelText.evaluate(feature); // returns a String
  789. *
  790. * @example
  791. * const style = new Cesium.Cesium3DTileStyle();
  792. * // Override labelText expression with a custom function
  793. * style.labelText = {
  794. * evaluate : function(feature) {
  795. * return 'Example label text';
  796. * }
  797. * };
  798. */
  799. labelText: {
  800. get: function () {
  801. //>>includeStart('debug', pragmas.debug);
  802. if (!this._ready) {
  803. throw new DeveloperError(
  804. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  805. );
  806. }
  807. //>>includeEnd('debug');
  808. return this._labelText;
  809. },
  810. set: function (value) {
  811. this._labelText = getExpression(this, value);
  812. this._style.labelText = getJsonFromExpression(this._labelText);
  813. },
  814. },
  815. /**
  816. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>backgroundColor</code> property. Alternatively a string or object defining a color style can be used.
  817. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  818. * <p>
  819. * The expression must return a <code>Color</code>.
  820. * </p>
  821. * <p>
  822. * This expression is only applicable to point features in a Vector tile.
  823. * </p>
  824. *
  825. * @memberof Cesium3DTileStyle.prototype
  826. *
  827. * @type {StyleExpression}
  828. *
  829. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  830. *
  831. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  832. *
  833. * @example
  834. * const style = new Cesium.Cesium3DTileStyle();
  835. * // Override backgroundColor expression with a string
  836. * style.backgroundColor = 'color("blue")';
  837. *
  838. * @example
  839. * const style = new Cesium.Cesium3DTileStyle();
  840. * // Override backgroundColor expression with a condition
  841. * style.backgroundColor = {
  842. * conditions : [
  843. * ['${height} > 2', 'color("cyan")'],
  844. * ['true', 'color("blue")']
  845. * ]
  846. * };
  847. */
  848. backgroundColor: {
  849. get: function () {
  850. //>>includeStart('debug', pragmas.debug);
  851. if (!this._ready) {
  852. throw new DeveloperError(
  853. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  854. );
  855. }
  856. //>>includeEnd('debug');
  857. return this._backgroundColor;
  858. },
  859. set: function (value) {
  860. this._backgroundColor = getExpression(this, value);
  861. this._style.backgroundColor = getJsonFromExpression(
  862. this._backgroundColor
  863. );
  864. },
  865. },
  866. /**
  867. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>backgroundPadding</code> property. Alternatively a string or object defining a vec2 style can be used.
  868. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  869. * <p>
  870. * The expression must return a <code>Cartesian2</code>.
  871. * </p>
  872. * <p>
  873. * This expression is only applicable to point features in a Vector tile.
  874. * </p>
  875. *
  876. * @memberof Cesium3DTileStyle.prototype
  877. *
  878. * @type {StyleExpression}
  879. *
  880. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  881. *
  882. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  883. *
  884. * @example
  885. * const style = new Cesium.Cesium3DTileStyle();
  886. * // Override backgroundPadding expression with a string
  887. * style.backgroundPadding = 'vec2(5.0, 7.0)';
  888. * style.backgroundPadding.evaluate(feature); // returns a Cartesian2
  889. */
  890. backgroundPadding: {
  891. get: function () {
  892. //>>includeStart('debug', pragmas.debug);
  893. if (!this._ready) {
  894. throw new DeveloperError(
  895. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  896. );
  897. }
  898. //>>includeEnd('debug');
  899. return this._backgroundPadding;
  900. },
  901. set: function (value) {
  902. this._backgroundPadding = getExpression(this, value);
  903. this._style.backgroundPadding = getJsonFromExpression(
  904. this._backgroundPadding
  905. );
  906. },
  907. },
  908. /**
  909. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>backgroundEnabled</code> property. Alternatively a string or object defining a boolean style can be used.
  910. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  911. * <p>
  912. * The expression must return a <code>Boolean</code>.
  913. * </p>
  914. * <p>
  915. * This expression is only applicable to point features in a Vector tile.
  916. * </p>
  917. *
  918. * @memberof Cesium3DTileStyle.prototype
  919. *
  920. * @type {StyleExpression}
  921. *
  922. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  923. *
  924. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  925. *
  926. * @example
  927. * const style = new Cesium.Cesium3DTileStyle();
  928. * // Override backgroundEnabled expression with a string
  929. * style.backgroundEnabled = 'true';
  930. *
  931. * @example
  932. * const style = new Cesium.Cesium3DTileStyle();
  933. * // Override backgroundEnabled expression with a condition
  934. * style.backgroundEnabled = {
  935. * conditions : [
  936. * ['${height} > 2', 'true'],
  937. * ['true', 'false']
  938. * ]
  939. * };
  940. */
  941. backgroundEnabled: {
  942. get: function () {
  943. //>>includeStart('debug', pragmas.debug);
  944. if (!this._ready) {
  945. throw new DeveloperError(
  946. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  947. );
  948. }
  949. //>>includeEnd('debug');
  950. return this._backgroundEnabled;
  951. },
  952. set: function (value) {
  953. this._backgroundEnabled = getExpression(this, value);
  954. this._style.backgroundEnabled = getJsonFromExpression(
  955. this._backgroundEnabled
  956. );
  957. },
  958. },
  959. /**
  960. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>scaleByDistance</code> property. Alternatively a string or object defining a vec4 style can be used.
  961. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  962. * <p>
  963. * The expression must return a <code>Cartesian4</code>.
  964. * </p>
  965. * <p>
  966. * This expression is only applicable to point features in a Vector tile.
  967. * </p>
  968. *
  969. * @memberof Cesium3DTileStyle.prototype
  970. *
  971. * @type {StyleExpression}
  972. *
  973. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  974. *
  975. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  976. *
  977. * @example
  978. * const style = new Cesium.Cesium3DTileStyle();
  979. * // Override scaleByDistance expression with a string
  980. * style.scaleByDistance = 'vec4(1.5e2, 2.0, 1.5e7, 0.5)';
  981. * style.scaleByDistance.evaluate(feature); // returns a Cartesian4
  982. */
  983. scaleByDistance: {
  984. get: function () {
  985. //>>includeStart('debug', pragmas.debug);
  986. if (!this._ready) {
  987. throw new DeveloperError(
  988. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  989. );
  990. }
  991. //>>includeEnd('debug');
  992. return this._scaleByDistance;
  993. },
  994. set: function (value) {
  995. this._scaleByDistance = getExpression(this, value);
  996. this._style.scaleByDistance = getJsonFromExpression(
  997. this._scaleByDistance
  998. );
  999. },
  1000. },
  1001. /**
  1002. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>translucencyByDistance</code> property. Alternatively a string or object defining a vec4 style can be used.
  1003. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1004. * <p>
  1005. * The expression must return a <code>Cartesian4</code>.
  1006. * </p>
  1007. * <p>
  1008. * This expression is only applicable to point features in a Vector tile.
  1009. * </p>
  1010. *
  1011. * @memberof Cesium3DTileStyle.prototype
  1012. *
  1013. * @type {StyleExpression}
  1014. *
  1015. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1016. *
  1017. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1018. *
  1019. * @example
  1020. * const style = new Cesium.Cesium3DTileStyle();
  1021. * // Override translucencyByDistance expression with a string
  1022. * style.translucencyByDistance = 'vec4(1.5e2, 1.0, 1.5e7, 0.2)';
  1023. * style.translucencyByDistance.evaluate(feature); // returns a Cartesian4
  1024. */
  1025. translucencyByDistance: {
  1026. get: function () {
  1027. //>>includeStart('debug', pragmas.debug);
  1028. if (!this._ready) {
  1029. throw new DeveloperError(
  1030. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1031. );
  1032. }
  1033. //>>includeEnd('debug');
  1034. return this._translucencyByDistance;
  1035. },
  1036. set: function (value) {
  1037. this._translucencyByDistance = getExpression(this, value);
  1038. this._style.translucencyByDistance = getJsonFromExpression(
  1039. this._translucencyByDistance
  1040. );
  1041. },
  1042. },
  1043. /**
  1044. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>distanceDisplayCondition</code> property. Alternatively a string or object defining a vec2 style can be used.
  1045. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1046. * <p>
  1047. * The expression must return a <code>Cartesian2</code>.
  1048. * </p>
  1049. * <p>
  1050. * This expression is only applicable to point features in a Vector tile.
  1051. * </p>
  1052. *
  1053. * @memberof Cesium3DTileStyle.prototype
  1054. *
  1055. * @type {StyleExpression}
  1056. *
  1057. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1058. *
  1059. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1060. *
  1061. * @example
  1062. * const style = new Cesium.Cesium3DTileStyle();
  1063. * // Override distanceDisplayCondition expression with a string
  1064. * style.distanceDisplayCondition = 'vec2(0.0, 5.5e6)';
  1065. * style.distanceDisplayCondition.evaluate(feature); // returns a Cartesian2
  1066. */
  1067. distanceDisplayCondition: {
  1068. get: function () {
  1069. //>>includeStart('debug', pragmas.debug);
  1070. if (!this._ready) {
  1071. throw new DeveloperError(
  1072. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1073. );
  1074. }
  1075. //>>includeEnd('debug');
  1076. return this._distanceDisplayCondition;
  1077. },
  1078. set: function (value) {
  1079. this._distanceDisplayCondition = getExpression(this, value);
  1080. this._style.distanceDisplayCondition = getJsonFromExpression(
  1081. this._distanceDisplayCondition
  1082. );
  1083. },
  1084. },
  1085. /**
  1086. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>heightOffset</code> property. Alternatively a string or object defining a number style can be used.
  1087. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1088. * <p>
  1089. * The expression must return a <code>Number</code>.
  1090. * </p>
  1091. * <p>
  1092. * This expression is only applicable to point features in a Vector tile.
  1093. * </p>
  1094. *
  1095. * @memberof Cesium3DTileStyle.prototype
  1096. *
  1097. * @type {StyleExpression}
  1098. *
  1099. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1100. *
  1101. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1102. *
  1103. * @example
  1104. * const style = new Cesium.Cesium3DTileStyle();
  1105. * // Override heightOffset expression with a string
  1106. * style.heightOffset = '2.0';
  1107. *
  1108. * @example
  1109. * const style = new Cesium.Cesium3DTileStyle();
  1110. * // Override heightOffset expression with a condition
  1111. * style.heightOffset = {
  1112. * conditions : [
  1113. * ['${height} > 2', '4.0'],
  1114. * ['true', '2.0']
  1115. * ]
  1116. * };
  1117. */
  1118. heightOffset: {
  1119. get: function () {
  1120. //>>includeStart('debug', pragmas.debug);
  1121. if (!this._ready) {
  1122. throw new DeveloperError(
  1123. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1124. );
  1125. }
  1126. //>>includeEnd('debug');
  1127. return this._heightOffset;
  1128. },
  1129. set: function (value) {
  1130. this._heightOffset = getExpression(this, value);
  1131. this._style.heightOffset = getJsonFromExpression(this._heightOffset);
  1132. },
  1133. },
  1134. /**
  1135. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>anchorLineEnabled</code> property. Alternatively a string or object defining a boolean style can be used.
  1136. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1137. * <p>
  1138. * The expression must return a <code>Boolean</code>.
  1139. * </p>
  1140. * <p>
  1141. * This expression is only applicable to point features in a Vector tile.
  1142. * </p>
  1143. *
  1144. * @memberof Cesium3DTileStyle.prototype
  1145. *
  1146. * @type {StyleExpression}
  1147. *
  1148. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1149. *
  1150. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1151. *
  1152. * @example
  1153. * const style = new Cesium.Cesium3DTileStyle();
  1154. * // Override anchorLineEnabled expression with a string
  1155. * style.anchorLineEnabled = 'true';
  1156. *
  1157. * @example
  1158. * const style = new Cesium.Cesium3DTileStyle();
  1159. * // Override anchorLineEnabled expression with a condition
  1160. * style.anchorLineEnabled = {
  1161. * conditions : [
  1162. * ['${height} > 2', 'true'],
  1163. * ['true', 'false']
  1164. * ]
  1165. * };
  1166. */
  1167. anchorLineEnabled: {
  1168. get: function () {
  1169. //>>includeStart('debug', pragmas.debug);
  1170. if (!this._ready) {
  1171. throw new DeveloperError(
  1172. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1173. );
  1174. }
  1175. //>>includeEnd('debug');
  1176. return this._anchorLineEnabled;
  1177. },
  1178. set: function (value) {
  1179. this._anchorLineEnabled = getExpression(this, value);
  1180. this._style.anchorLineEnabled = getJsonFromExpression(
  1181. this._anchorLineEnabled
  1182. );
  1183. },
  1184. },
  1185. /**
  1186. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>anchorLineColor</code> property. Alternatively a string or object defining a color style can be used.
  1187. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1188. * <p>
  1189. * The expression must return a <code>Color</code>.
  1190. * </p>
  1191. * <p>
  1192. * This expression is only applicable to point features in a Vector tile.
  1193. * </p>
  1194. *
  1195. * @memberof Cesium3DTileStyle.prototype
  1196. *
  1197. * @type {StyleExpression}
  1198. *
  1199. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1200. *
  1201. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1202. *
  1203. * @example
  1204. * const style = new Cesium.Cesium3DTileStyle();
  1205. * // Override anchorLineColor expression with a string
  1206. * style.anchorLineColor = 'color("blue")';
  1207. *
  1208. * @example
  1209. * const style = new Cesium.Cesium3DTileStyle();
  1210. * // Override anchorLineColor expression with a condition
  1211. * style.anchorLineColor = {
  1212. * conditions : [
  1213. * ['${height} > 2', 'color("cyan")'],
  1214. * ['true', 'color("blue")']
  1215. * ]
  1216. * };
  1217. */
  1218. anchorLineColor: {
  1219. get: function () {
  1220. //>>includeStart('debug', pragmas.debug);
  1221. if (!this._ready) {
  1222. throw new DeveloperError(
  1223. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1224. );
  1225. }
  1226. //>>includeEnd('debug');
  1227. return this._anchorLineColor;
  1228. },
  1229. set: function (value) {
  1230. this._anchorLineColor = getExpression(this, value);
  1231. this._style.anchorLineColor = getJsonFromExpression(
  1232. this._anchorLineColor
  1233. );
  1234. },
  1235. },
  1236. /**
  1237. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>image</code> property. Alternatively a string or object defining a string style can be used.
  1238. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1239. * <p>
  1240. * The expression must return a <code>String</code>.
  1241. * </p>
  1242. * <p>
  1243. * This expression is only applicable to point features in a Vector tile.
  1244. * </p>
  1245. *
  1246. * @memberof Cesium3DTileStyle.prototype
  1247. *
  1248. * @type {StyleExpression}
  1249. *
  1250. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1251. *
  1252. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1253. *
  1254. * @example
  1255. * const style = new Cesium3DTileStyle({
  1256. * image : '(${Temperature} > 90) ? "/url/to/image1" : "/url/to/image2"'
  1257. * });
  1258. * style.image.evaluate(feature); // returns a String
  1259. *
  1260. * @example
  1261. * const style = new Cesium.Cesium3DTileStyle();
  1262. * // Override image expression with a custom function
  1263. * style.image = {
  1264. * evaluate : function(feature) {
  1265. * return '/url/to/image';
  1266. * }
  1267. * };
  1268. */
  1269. image: {
  1270. get: function () {
  1271. //>>includeStart('debug', pragmas.debug);
  1272. if (!this._ready) {
  1273. throw new DeveloperError(
  1274. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1275. );
  1276. }
  1277. //>>includeEnd('debug');
  1278. return this._image;
  1279. },
  1280. set: function (value) {
  1281. this._image = getExpression(this, value);
  1282. this._style.image = getJsonFromExpression(this._image);
  1283. },
  1284. },
  1285. /**
  1286. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>disableDepthTestDistance</code> property. Alternatively a string or object defining a number style can be used.
  1287. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1288. * <p>
  1289. * The expression must return a <code>Number</code>.
  1290. * </p>
  1291. * <p>
  1292. * This expression is only applicable to point features in a Vector tile.
  1293. * </p>
  1294. *
  1295. * @memberof Cesium3DTileStyle.prototype
  1296. *
  1297. * @type {StyleExpression}
  1298. *
  1299. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1300. *
  1301. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1302. *
  1303. * @example
  1304. * const style = new Cesium.Cesium3DTileStyle();
  1305. * // Override disableDepthTestDistance expression with a string
  1306. * style.disableDepthTestDistance = '1000.0';
  1307. * style.disableDepthTestDistance.evaluate(feature); // returns a Number
  1308. */
  1309. disableDepthTestDistance: {
  1310. get: function () {
  1311. //>>includeStart('debug', pragmas.debug);
  1312. if (!this._ready) {
  1313. throw new DeveloperError(
  1314. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1315. );
  1316. }
  1317. //>>includeEnd('debug');
  1318. return this._disableDepthTestDistance;
  1319. },
  1320. set: function (value) {
  1321. this._disableDepthTestDistance = getExpression(this, value);
  1322. this._style.disableDepthTestDistance = getJsonFromExpression(
  1323. this._disableDepthTestDistance
  1324. );
  1325. },
  1326. },
  1327. /**
  1328. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>horizontalOrigin</code> property. Alternatively a string or object defining a number style can be used.
  1329. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1330. * <p>
  1331. * The expression must return a <code>HorizontalOrigin</code>.
  1332. * </p>
  1333. * <p>
  1334. * This expression is only applicable to point features in a Vector tile.
  1335. * </p>
  1336. *
  1337. * @memberof Cesium3DTileStyle.prototype
  1338. *
  1339. * @type {StyleExpression}
  1340. *
  1341. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1342. *
  1343. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1344. *
  1345. * @example
  1346. * const style = new Cesium3DTileStyle({
  1347. * horizontalOrigin : HorizontalOrigin.LEFT
  1348. * });
  1349. * style.horizontalOrigin.evaluate(feature); // returns a HorizontalOrigin
  1350. *
  1351. * @example
  1352. * const style = new Cesium.Cesium3DTileStyle();
  1353. * // Override horizontalOrigin expression with a custom function
  1354. * style.horizontalOrigin = {
  1355. * evaluate : function(feature) {
  1356. * return HorizontalOrigin.CENTER;
  1357. * }
  1358. * };
  1359. */
  1360. horizontalOrigin: {
  1361. get: function () {
  1362. //>>includeStart('debug', pragmas.debug);
  1363. if (!this._ready) {
  1364. throw new DeveloperError(
  1365. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1366. );
  1367. }
  1368. //>>includeEnd('debug');
  1369. return this._horizontalOrigin;
  1370. },
  1371. set: function (value) {
  1372. this._horizontalOrigin = getExpression(this, value);
  1373. this._style.horizontalOrigin = getJsonFromExpression(
  1374. this._horizontalOrigin
  1375. );
  1376. },
  1377. },
  1378. /**
  1379. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>verticalOrigin</code> property. Alternatively a string or object defining a number style can be used.
  1380. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1381. * <p>
  1382. * The expression must return a <code>VerticalOrigin</code>.
  1383. * </p>
  1384. * <p>
  1385. * This expression is only applicable to point features in a Vector tile.
  1386. * </p>
  1387. *
  1388. * @memberof Cesium3DTileStyle.prototype
  1389. *
  1390. * @type {StyleExpression}
  1391. *
  1392. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1393. *
  1394. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1395. *
  1396. * @example
  1397. * const style = new Cesium3DTileStyle({
  1398. * verticalOrigin : VerticalOrigin.TOP
  1399. * });
  1400. * style.verticalOrigin.evaluate(feature); // returns a VerticalOrigin
  1401. *
  1402. * @example
  1403. * const style = new Cesium.Cesium3DTileStyle();
  1404. * // Override verticalOrigin expression with a custom function
  1405. * style.verticalOrigin = {
  1406. * evaluate : function(feature) {
  1407. * return VerticalOrigin.CENTER;
  1408. * }
  1409. * };
  1410. */
  1411. verticalOrigin: {
  1412. get: function () {
  1413. //>>includeStart('debug', pragmas.debug);
  1414. if (!this._ready) {
  1415. throw new DeveloperError(
  1416. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1417. );
  1418. }
  1419. //>>includeEnd('debug');
  1420. return this._verticalOrigin;
  1421. },
  1422. set: function (value) {
  1423. this._verticalOrigin = getExpression(this, value);
  1424. this._style.verticalOrigin = getJsonFromExpression(this._verticalOrigin);
  1425. },
  1426. },
  1427. /**
  1428. Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>labelHorizontalOrigin</code> property. Alternatively a string or object defining a number style can be used.
  1429. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1430. * <p>
  1431. * The expression must return a <code>HorizontalOrigin</code>.
  1432. * </p>
  1433. * <p>
  1434. * This expression is only applicable to point features in a Vector tile.
  1435. * </p>
  1436. *
  1437. * @memberof Cesium3DTileStyle.prototype
  1438. *
  1439. * @type {StyleExpression}
  1440. *
  1441. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1442. *
  1443. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1444. *
  1445. * @example
  1446. * const style = new Cesium3DTileStyle({
  1447. * labelHorizontalOrigin : HorizontalOrigin.LEFT
  1448. * });
  1449. * style.labelHorizontalOrigin.evaluate(feature); // returns a HorizontalOrigin
  1450. *
  1451. * @example
  1452. * const style = new Cesium.Cesium3DTileStyle();
  1453. * // Override labelHorizontalOrigin expression with a custom function
  1454. * style.labelHorizontalOrigin = {
  1455. * evaluate : function(feature) {
  1456. * return HorizontalOrigin.CENTER;
  1457. * }
  1458. * };
  1459. */
  1460. labelHorizontalOrigin: {
  1461. get: function () {
  1462. //>>includeStart('debug', pragmas.debug);
  1463. if (!this._ready) {
  1464. throw new DeveloperError(
  1465. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1466. );
  1467. }
  1468. //>>includeEnd('debug');
  1469. return this._labelHorizontalOrigin;
  1470. },
  1471. set: function (value) {
  1472. this._labelHorizontalOrigin = getExpression(this, value);
  1473. this._style.labelHorizontalOrigin = getJsonFromExpression(
  1474. this._labelHorizontalOrigin
  1475. );
  1476. },
  1477. },
  1478. /**
  1479. * Gets or sets the {@link StyleExpression} object used to evaluate the style's <code>labelVerticalOrigin</code> property. Alternatively a string or object defining a number style can be used.
  1480. * The getter will return the internal {@link Expression} or {@link ConditionsExpression}, which may differ from the value provided to the setter.
  1481. * <p>
  1482. * The expression must return a <code>VerticalOrigin</code>.
  1483. * </p>
  1484. * <p>
  1485. * This expression is only applicable to point features in a Vector tile.
  1486. * </p>
  1487. *
  1488. * @memberof Cesium3DTileStyle.prototype
  1489. *
  1490. * @type {StyleExpression}
  1491. *
  1492. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1493. *
  1494. * @experimental This feature is using part of the 3D Tiles spec that is not final and is subject to change without Cesium's standard deprecation policy.
  1495. *
  1496. * @example
  1497. * const style = new Cesium3DTileStyle({
  1498. * labelVerticalOrigin : VerticalOrigin.TOP
  1499. * });
  1500. * style.labelVerticalOrigin.evaluate(feature); // returns a VerticalOrigin
  1501. *
  1502. * @example
  1503. * const style = new Cesium.Cesium3DTileStyle();
  1504. * // Override labelVerticalOrigin expression with a custom function
  1505. * style.labelVerticalOrigin = {
  1506. * evaluate : function(feature) {
  1507. * return VerticalOrigin.CENTER;
  1508. * }
  1509. * };
  1510. */
  1511. labelVerticalOrigin: {
  1512. get: function () {
  1513. //>>includeStart('debug', pragmas.debug);
  1514. if (!this._ready) {
  1515. throw new DeveloperError(
  1516. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1517. );
  1518. }
  1519. //>>includeEnd('debug');
  1520. return this._labelVerticalOrigin;
  1521. },
  1522. set: function (value) {
  1523. this._labelVerticalOrigin = getExpression(this, value);
  1524. this._style.labelVerticalOrigin = getJsonFromExpression(
  1525. this._labelVerticalOrigin
  1526. );
  1527. },
  1528. },
  1529. /**
  1530. * Gets or sets the object containing application-specific expression that can be explicitly
  1531. * evaluated, e.g., for display in a UI.
  1532. *
  1533. * @memberof Cesium3DTileStyle.prototype
  1534. *
  1535. * @type {StyleExpression}
  1536. *
  1537. * @exception {DeveloperError} The style is not loaded. Use {@link Cesium3DTileStyle#readyPromise} or wait for {@link Cesium3DTileStyle#ready} to be true.
  1538. *
  1539. * @example
  1540. * const style = new Cesium3DTileStyle({
  1541. * meta : {
  1542. * description : '"Building id ${id} has height ${Height}."'
  1543. * }
  1544. * });
  1545. * style.meta.description.evaluate(feature); // returns a String with the substituted variables
  1546. */
  1547. meta: {
  1548. get: function () {
  1549. //>>includeStart('debug', pragmas.debug);
  1550. if (!this._ready) {
  1551. throw new DeveloperError(
  1552. "The style is not loaded. Use Cesium3DTileStyle.readyPromise or wait for Cesium3DTileStyle.ready to be true."
  1553. );
  1554. }
  1555. //>>includeEnd('debug');
  1556. return this._meta;
  1557. },
  1558. set: function (value) {
  1559. this._meta = value;
  1560. },
  1561. },
  1562. });
  1563. /**
  1564. * Gets the color shader function for this style.
  1565. *
  1566. * @param {String} functionSignature Signature of the generated function.
  1567. * @param {Object} variableSubstitutionMap Maps variable names to shader variable names.
  1568. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent.
  1569. *
  1570. * @returns {String} The shader function.
  1571. *
  1572. * @private
  1573. */
  1574. Cesium3DTileStyle.prototype.getColorShaderFunction = function (
  1575. functionSignature,
  1576. variableSubstitutionMap,
  1577. shaderState
  1578. ) {
  1579. if (this._colorShaderFunctionReady) {
  1580. shaderState.translucent = this._colorShaderTranslucent;
  1581. // Return the cached result, may be undefined
  1582. return this._colorShaderFunction;
  1583. }
  1584. this._colorShaderFunctionReady = true;
  1585. if (defined(this.color) && defined(this.color.getShaderFunction)) {
  1586. this._colorShaderFunction = this.color.getShaderFunction(
  1587. functionSignature,
  1588. variableSubstitutionMap,
  1589. shaderState,
  1590. "vec4"
  1591. );
  1592. } else {
  1593. this._colorShaderFunction = undefined;
  1594. }
  1595. this._colorShaderTranslucent = shaderState.translucent;
  1596. return this._colorShaderFunction;
  1597. };
  1598. /**
  1599. * Gets the show shader function for this style.
  1600. *
  1601. * @param {String} functionSignature Signature of the generated function.
  1602. * @param {Object} variableSubstitutionMap Maps variable names to shader variable names.
  1603. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent.
  1604. *
  1605. * @returns {String} The shader function.
  1606. *
  1607. * @private
  1608. */
  1609. Cesium3DTileStyle.prototype.getShowShaderFunction = function (
  1610. functionSignature,
  1611. variableSubstitutionMap,
  1612. shaderState
  1613. ) {
  1614. if (this._showShaderFunctionReady) {
  1615. // Return the cached result, may be undefined
  1616. return this._showShaderFunction;
  1617. }
  1618. this._showShaderFunctionReady = true;
  1619. if (defined(this.show) && defined(this.show.getShaderFunction)) {
  1620. this._showShaderFunction = this.show.getShaderFunction(
  1621. functionSignature,
  1622. variableSubstitutionMap,
  1623. shaderState,
  1624. "bool"
  1625. );
  1626. } else {
  1627. this._showShaderFunction = undefined;
  1628. }
  1629. return this._showShaderFunction;
  1630. };
  1631. /**
  1632. * Gets the pointSize shader function for this style.
  1633. *
  1634. * @param {String} functionSignature Signature of the generated function.
  1635. * @param {Object} variableSubstitutionMap Maps variable names to shader variable names.
  1636. * @param {Object} shaderState Stores information about the generated shader function, including whether it is translucent.
  1637. *
  1638. * @returns {String} The shader function.
  1639. *
  1640. * @private
  1641. */
  1642. Cesium3DTileStyle.prototype.getPointSizeShaderFunction = function (
  1643. functionSignature,
  1644. variableSubstitutionMap,
  1645. shaderState
  1646. ) {
  1647. if (this._pointSizeShaderFunctionReady) {
  1648. // Return the cached result, may be undefined
  1649. return this._pointSizeShaderFunction;
  1650. }
  1651. this._pointSizeShaderFunctionReady = true;
  1652. if (defined(this.pointSize) && defined(this.pointSize.getShaderFunction)) {
  1653. this._pointSizeShaderFunction = this.pointSize.getShaderFunction(
  1654. functionSignature,
  1655. variableSubstitutionMap,
  1656. shaderState,
  1657. "float"
  1658. );
  1659. } else {
  1660. this._pointSizeShaderFunction = undefined;
  1661. }
  1662. return this._pointSizeShaderFunction;
  1663. };
  1664. /**
  1665. * Gets the variables used by the style.
  1666. *
  1667. * @returns {String[]} The variables used by the style.
  1668. *
  1669. * @private
  1670. */
  1671. Cesium3DTileStyle.prototype.getVariables = function () {
  1672. let variables = [];
  1673. if (defined(this.color) && defined(this.color.getVariables)) {
  1674. variables.push.apply(variables, this.color.getVariables());
  1675. }
  1676. if (defined(this.show) && defined(this.show.getVariables)) {
  1677. variables.push.apply(variables, this.show.getVariables());
  1678. }
  1679. if (defined(this.pointSize) && defined(this.pointSize.getVariables)) {
  1680. variables.push.apply(variables, this.pointSize.getVariables());
  1681. }
  1682. // Remove duplicates
  1683. variables = variables.filter(function (variable, index, variables) {
  1684. return variables.indexOf(variable) === index;
  1685. });
  1686. return variables;
  1687. };
  1688. export default Cesium3DTileStyle;