Cesium3DTilePointFeature.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795
  1. import Cartographic from '../Core/Cartographic.js';
  2. import Color from '../Core/Color.js';
  3. import defaultValue from '../Core/defaultValue.js';
  4. import defined from '../Core/defined.js';
  5. import defineProperties from '../Core/defineProperties.js';
  6. import createBillboardPointCallback from './createBillboardPointCallback.js';
  7. /**
  8. * A point feature of a {@link Cesium3DTileset}.
  9. * <p>
  10. * Provides access to a feature's properties stored in the tile's batch table, as well
  11. * as the ability to show/hide a feature and change its point properties
  12. * </p>
  13. * <p>
  14. * Modifications to a <code>Cesium3DTilePointFeature</code> object have the lifetime of the tile's
  15. * content. If the tile's content is unloaded, e.g., due to it going out of view and needing
  16. * to free space in the cache for visible tiles, listen to the {@link Cesium3DTileset#tileUnload} event to save any
  17. * modifications. Also listen to the {@link Cesium3DTileset#tileVisible} event to reapply any modifications.
  18. * </p>
  19. * <p>
  20. * Do not construct this directly. Access it through {@link Cesium3DTileContent#getFeature}
  21. * or picking using {@link Scene#pick} and {@link Scene#pickPosition}.
  22. * </p>
  23. *
  24. * @alias Cesium3DTilePointFeature
  25. * @constructor
  26. *
  27. * @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.
  28. *
  29. * @example
  30. * // On mouse over, display all the properties for a feature in the console log.
  31. * handler.setInputAction(function(movement) {
  32. * var feature = scene.pick(movement.endPosition);
  33. * if (feature instanceof Cesium.Cesium3DTilePointFeature) {
  34. * var propertyNames = feature.getPropertyNames();
  35. * var length = propertyNames.length;
  36. * for (var i = 0; i < length; ++i) {
  37. * var propertyName = propertyNames[i];
  38. * console.log(propertyName + ': ' + feature.getProperty(propertyName));
  39. * }
  40. * }
  41. * }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42. */
  43. function Cesium3DTilePointFeature(content, batchId, billboard, label, polyline) {
  44. this._content = content;
  45. this._billboard = billboard;
  46. this._label = label;
  47. this._polyline = polyline;
  48. this._batchId = batchId;
  49. this._billboardImage = undefined;
  50. this._billboardColor = undefined;
  51. this._billboardOutlineColor = undefined;
  52. this._billboardOutlineWidth = undefined;
  53. this._billboardSize = undefined;
  54. this._pointSize = undefined;
  55. this._color = undefined;
  56. this._pointSize = undefined;
  57. this._pointOutlineColor = undefined;
  58. this._pointOutlineWidth = undefined;
  59. this._heightOffset = undefined;
  60. this._pickIds = new Array(3);
  61. setBillboardImage(this);
  62. }
  63. var scratchCartographic = new Cartographic();
  64. defineProperties(Cesium3DTilePointFeature.prototype, {
  65. /**
  66. * Gets or sets if the feature will be shown. This is set for all features
  67. * when a style's show is evaluated.
  68. *
  69. * @memberof Cesium3DTilePointFeature.prototype
  70. *
  71. * @type {Boolean}
  72. *
  73. * @default true
  74. */
  75. show : {
  76. get : function() {
  77. return this._label.show;
  78. },
  79. set : function(value) {
  80. this._label.show = value;
  81. this._billboard.show = value;
  82. this._polyline.show = value;
  83. }
  84. },
  85. /**
  86. * Gets or sets the color of the point of this feature.
  87. * <p>
  88. * Only applied when <code>image</code> is <code>undefined</code>.
  89. * </p>
  90. *
  91. * @memberof Cesium3DTilePointFeature.prototype
  92. *
  93. * @type {Color}
  94. */
  95. color : {
  96. get : function() {
  97. return this._color;
  98. },
  99. set : function(value) {
  100. this._color = Color.clone(value, this._color);
  101. setBillboardImage(this);
  102. }
  103. },
  104. /**
  105. * Gets or sets the point size of this feature.
  106. * <p>
  107. * Only applied when <code>image</code> is <code>undefined</code>.
  108. * </p>
  109. *
  110. * @memberof Cesium3DTilePointFeature.prototype
  111. *
  112. * @type {Number}
  113. */
  114. pointSize : {
  115. get : function() {
  116. return this._pointSize;
  117. },
  118. set : function(value) {
  119. this._pointSize = value;
  120. setBillboardImage(this);
  121. }
  122. },
  123. /**
  124. * Gets or sets the point outline color of this feature.
  125. * <p>
  126. * Only applied when <code>image</code> is <code>undefined</code>.
  127. * </p>
  128. *
  129. * @memberof Cesium3DTilePointFeature.prototype
  130. *
  131. * @type {Color}
  132. */
  133. pointOutlineColor : {
  134. get : function() {
  135. return this._pointOutlineColor;
  136. },
  137. set : function(value) {
  138. this._pointOutlineColor = Color.clone(value, this._pointOutlineColor);
  139. setBillboardImage(this);
  140. }
  141. },
  142. /**
  143. * Gets or sets the point outline width in pixels of this feature.
  144. * <p>
  145. * Only applied when <code>image</code> is <code>undefined</code>.
  146. * </p>
  147. *
  148. * @memberof Cesium3DTilePointFeature.prototype
  149. *
  150. * @type {Number}
  151. */
  152. pointOutlineWidth : {
  153. get : function() {
  154. return this._pointOutlineWidth;
  155. },
  156. set : function(value) {
  157. this._pointOutlineWidth = value;
  158. setBillboardImage(this);
  159. }
  160. },
  161. /**
  162. * Gets or sets the label color of this feature.
  163. * <p>
  164. * The color will be applied to the label if <code>labelText</code> is defined.
  165. * </p>
  166. *
  167. * @memberof Cesium3DTilePointFeature.prototype
  168. *
  169. * @type {Color}
  170. */
  171. labelColor : {
  172. get : function() {
  173. return this._label.fillColor;
  174. },
  175. set : function(value) {
  176. this._label.fillColor = value;
  177. this._polyline.show = this._label.show && value.alpha > 0.0;
  178. }
  179. },
  180. /**
  181. * Gets or sets the label outline color of this feature.
  182. * <p>
  183. * The outline color will be applied to the label if <code>labelText</code> is defined.
  184. * </p>
  185. *
  186. * @memberof Cesium3DTilePointFeature.prototype
  187. *
  188. * @type {Color}
  189. */
  190. labelOutlineColor : {
  191. get : function() {
  192. return this._label.outlineColor;
  193. },
  194. set : function(value) {
  195. this._label.outlineColor = value;
  196. }
  197. },
  198. /**
  199. * Gets or sets the outline width in pixels of this feature.
  200. * <p>
  201. * The outline width will be applied to the point if <code>labelText</code> is defined.
  202. * </p>
  203. *
  204. * @memberof Cesium3DTilePointFeature.prototype
  205. *
  206. * @type {Number}
  207. */
  208. labelOutlineWidth : {
  209. get : function() {
  210. return this._label.outlineWidth;
  211. },
  212. set : function(value) {
  213. this._label.outlineWidth = value;
  214. }
  215. },
  216. /**
  217. * Gets or sets the font of this feature.
  218. * <p>
  219. * Only applied when the <code>labelText</code> is defined.
  220. * </p>
  221. *
  222. * @memberof Cesium3DTilePointFeature.prototype
  223. *
  224. * @type {String}
  225. */
  226. font : {
  227. get : function() {
  228. return this._label.font;
  229. },
  230. set : function(value) {
  231. this._label.font = value;
  232. }
  233. },
  234. /**
  235. * Gets or sets the fill and outline style of this feature.
  236. * <p>
  237. * Only applied when <code>labelText</code> is defined.
  238. * </p>
  239. *
  240. * @memberof Cesium3DTilePointFeature.prototype
  241. *
  242. * @type {LabelStyle}
  243. */
  244. labelStyle : {
  245. get : function() {
  246. return this._label.style;
  247. },
  248. set : function(value) {
  249. this._label.style = value;
  250. }
  251. },
  252. /**
  253. * Gets or sets the text for this feature.
  254. *
  255. * @memberof Cesium3DTilePointFeature.prototype
  256. *
  257. * @type {String}
  258. */
  259. labelText : {
  260. get : function() {
  261. return this._label.text;
  262. },
  263. set : function(value) {
  264. if (!defined(value)) {
  265. value = '';
  266. }
  267. this._label.text = value;
  268. }
  269. },
  270. /**
  271. * Gets or sets the background color of the text for this feature.
  272. * <p>
  273. * Only applied when <code>labelText</code> is defined.
  274. * </p>
  275. *
  276. * @memberof Cesium3DTilePointFeature.prototype
  277. *
  278. * @type {Color}
  279. */
  280. backgroundColor : {
  281. get : function() {
  282. return this._label.backgroundColor;
  283. },
  284. set : function(value) {
  285. this._label.backgroundColor = value;
  286. }
  287. },
  288. /**
  289. * Gets or sets the background padding of the text for this feature.
  290. * <p>
  291. * Only applied when <code>labelText</code> is defined.
  292. * </p>
  293. *
  294. * @memberof Cesium3DTilePointFeature.prototype
  295. *
  296. * @type {Cartesian2}
  297. */
  298. backgroundPadding : {
  299. get : function() {
  300. return this._label.backgroundPadding;
  301. },
  302. set : function(value) {
  303. this._label.backgroundPadding = value;
  304. }
  305. },
  306. /**
  307. * Gets or sets whether to display the background of the text for this feature.
  308. * <p>
  309. * Only applied when <code>labelText</code> is defined.
  310. * </p>
  311. *
  312. * @memberof Cesium3DTilePointFeature.prototype
  313. *
  314. * @type {Boolean}
  315. */
  316. backgroundEnabled : {
  317. get : function() {
  318. return this._label.showBackground;
  319. },
  320. set : function(value) {
  321. this._label.showBackground = value;
  322. }
  323. },
  324. /**
  325. * Gets or sets the near and far scaling properties for this feature.
  326. *
  327. * @memberof Cesium3DTilePointFeature.prototype
  328. *
  329. * @type {NearFarScalar}
  330. */
  331. scaleByDistance : {
  332. get : function() {
  333. return this._label.scaleByDistance;
  334. },
  335. set : function(value) {
  336. this._label.scaleByDistance = value;
  337. this._billboard.scaleByDistance = value;
  338. }
  339. },
  340. /**
  341. * Gets or sets the near and far translucency properties for this feature.
  342. *
  343. * @memberof Cesium3DTilePointFeature.prototype
  344. *
  345. * @type {NearFarScalar}
  346. */
  347. translucencyByDistance : {
  348. get : function() {
  349. return this._label.translucencyByDistance;
  350. },
  351. set : function(value) {
  352. this._label.translucencyByDistance = value;
  353. this._billboard.translucencyByDistance = value;
  354. }
  355. },
  356. /**
  357. * Gets or sets the condition specifying at what distance from the camera that this feature will be displayed.
  358. *
  359. * @memberof Cesium3DTilePointFeature.prototype
  360. *
  361. * @type {DistanceDisplayCondition}
  362. */
  363. distanceDisplayCondition : {
  364. get : function() {
  365. return this._label.distanceDisplayCondition;
  366. },
  367. set : function(value) {
  368. this._label.distanceDisplayCondition = value;
  369. this._polyline.distanceDisplayCondition = value;
  370. this._billboard.distanceDisplayCondition = value;
  371. }
  372. },
  373. /**
  374. * Gets or sets the height offset in meters of this feature.
  375. *
  376. * @memberof Cesium3DTilePointFeature.prototype
  377. *
  378. * @type {Number}
  379. */
  380. heightOffset : {
  381. get : function() {
  382. return this._heightOffset;
  383. },
  384. set : function(value) {
  385. var offset = defaultValue(this._heightOffset, 0.0);
  386. var ellipsoid = this._content.tileset.ellipsoid;
  387. var cart = ellipsoid.cartesianToCartographic(this._billboard.position, scratchCartographic);
  388. cart.height = cart.height - offset + value;
  389. var newPosition = ellipsoid.cartographicToCartesian(cart);
  390. this._billboard.position = newPosition;
  391. this._label.position = this._billboard.position;
  392. this._polyline.positions = [this._polyline.positions[0], newPosition];
  393. this._heightOffset = value;
  394. }
  395. },
  396. /**
  397. * Gets or sets whether the anchor line is displayed.
  398. * <p>
  399. * Only applied when <code>heightOffset</code> is defined.
  400. * </p>
  401. *
  402. * @memberof Cesium3DTilePointFeature.prototype
  403. *
  404. * @type {Boolean}
  405. */
  406. anchorLineEnabled : {
  407. get : function() {
  408. return this._polyline.show;
  409. },
  410. set : function(value) {
  411. this._polyline.show = value;
  412. }
  413. },
  414. /**
  415. * Gets or sets the color for the anchor line.
  416. * <p>
  417. * Only applied when <code>heightOffset</code> is defined.
  418. * </p>
  419. *
  420. * @memberof Cesium3DTilePointFeature.prototype
  421. *
  422. * @type {Color}
  423. */
  424. anchorLineColor : {
  425. get : function() {
  426. return this._polyline.material.uniforms.color;
  427. },
  428. set : function(value) {
  429. this._polyline.material.uniforms.color = Color.clone(value, this._polyline.material.uniforms.color);
  430. }
  431. },
  432. /**
  433. * Gets or sets the image of this feature.
  434. *
  435. * @memberof Cesium3DTilePointFeature.prototype
  436. *
  437. * @type {String}
  438. */
  439. image : {
  440. get : function() {
  441. return this._billboardImage;
  442. },
  443. set : function(value) {
  444. var imageChanged = this._billboardImage !== value;
  445. this._billboardImage = value;
  446. if (imageChanged) {
  447. setBillboardImage(this);
  448. }
  449. }
  450. },
  451. /**
  452. * Gets or sets the distance where depth testing will be disabled.
  453. *
  454. * @memberof Cesium3DTilePointFeature.prototype
  455. *
  456. * @type {Number}
  457. */
  458. disableDepthTestDistance : {
  459. get : function() {
  460. return this._label.disableDepthTestDistance;
  461. },
  462. set : function(value) {
  463. this._label.disableDepthTestDistance = value;
  464. this._billboard.disableDepthTestDistance = value;
  465. }
  466. },
  467. /**
  468. * Gets or sets the horizontal origin of this point, which determines if the point is
  469. * to the left, center, or right of its anchor position.
  470. *
  471. * @memberof Cesium3DTilePointFeature.prototype
  472. *
  473. * @type {HorizontalOrigin}
  474. */
  475. horizontalOrigin : {
  476. get : function() {
  477. return this._billboard.horizontalOrigin;
  478. },
  479. set : function(value) {
  480. this._billboard.horizontalOrigin = value;
  481. }
  482. },
  483. /**
  484. * Gets or sets the vertical origin of this point, which determines if the point is
  485. * to the bottom, center, or top of its anchor position.
  486. *
  487. * @memberof Cesium3DTilePointFeature.prototype
  488. *
  489. * @type {VerticalOrigin}
  490. */
  491. verticalOrigin : {
  492. get : function() {
  493. return this._billboard.verticalOrigin;
  494. },
  495. set : function(value) {
  496. this._billboard.verticalOrigin = value;
  497. }
  498. },
  499. /**
  500. * Gets or sets the horizontal origin of this point's text, which determines if the point's text is
  501. * to the left, center, or right of its anchor position.
  502. *
  503. * @memberof Cesium3DTilePointFeature.prototype
  504. *
  505. * @type {HorizontalOrigin}
  506. */
  507. labelHorizontalOrigin : {
  508. get : function() {
  509. return this._label.horizontalOrigin;
  510. },
  511. set : function(value) {
  512. this._label.horizontalOrigin = value;
  513. }
  514. },
  515. /**
  516. * Get or sets the vertical origin of this point's text, which determines if the point's text is
  517. * to the bottom, center, top, or baseline of it's anchor point.
  518. *
  519. * @memberof Cesium3DTilePointFeature.prototype
  520. *
  521. * @type {VerticalOrigin}
  522. */
  523. labelVerticalOrigin : {
  524. get : function() {
  525. return this._label.verticalOrigin;
  526. },
  527. set : function(value) {
  528. this._label.verticalOrigin = value;
  529. }
  530. },
  531. /**
  532. * Gets the content of the tile containing the feature.
  533. *
  534. * @memberof Cesium3DTilePointFeature.prototype
  535. *
  536. * @type {Cesium3DTileContent}
  537. *
  538. * @readonly
  539. * @private
  540. */
  541. content : {
  542. get : function() {
  543. return this._content;
  544. }
  545. },
  546. /**
  547. * Gets the tileset containing the feature.
  548. *
  549. * @memberof Cesium3DTilePointFeature.prototype
  550. *
  551. * @type {Cesium3DTileset}
  552. *
  553. * @readonly
  554. */
  555. tileset : {
  556. get : function() {
  557. return this._content.tileset;
  558. }
  559. },
  560. /**
  561. * All objects returned by {@link Scene#pick} have a <code>primitive</code> property. This returns
  562. * the tileset containing the feature.
  563. *
  564. * @memberof Cesium3DTilePointFeature.prototype
  565. *
  566. * @type {Cesium3DTileset}
  567. *
  568. * @readonly
  569. */
  570. primitive : {
  571. get : function() {
  572. return this._content.tileset;
  573. }
  574. },
  575. /**
  576. * @private
  577. */
  578. pickIds : {
  579. get : function() {
  580. var ids = this._pickIds;
  581. ids[0] = this._billboard.pickId;
  582. ids[1] = this._label.pickId;
  583. ids[2] = this._polyline.pickId;
  584. return ids;
  585. }
  586. }
  587. });
  588. Cesium3DTilePointFeature.defaultColor = Color.WHITE;
  589. Cesium3DTilePointFeature.defaultPointOutlineColor = Color.BLACK;
  590. Cesium3DTilePointFeature.defaultPointOutlineWidth = 0.0;
  591. Cesium3DTilePointFeature.defaultPointSize = 8.0;
  592. function setBillboardImage(feature) {
  593. var b = feature._billboard;
  594. if (defined(feature._billboardImage) && feature._billboardImage !== b.image) {
  595. b.image = feature._billboardImage;
  596. return;
  597. }
  598. if (defined(feature._billboardImage)) {
  599. return;
  600. }
  601. var newColor = defaultValue(feature._color, Cesium3DTilePointFeature.defaultColor);
  602. var newOutlineColor = defaultValue(feature._pointOutlineColor, Cesium3DTilePointFeature.defaultPointOutlineColor);
  603. var newOutlineWidth = defaultValue(feature._pointOutlineWidth, Cesium3DTilePointFeature.defaultPointOutlineWidth);
  604. var newPointSize = defaultValue(feature._pointSize, Cesium3DTilePointFeature.defaultPointSize);
  605. var currentColor = feature._billboardColor;
  606. var currentOutlineColor = feature._billboardOutlineColor;
  607. var currentOutlineWidth = feature._billboardOutlineWidth;
  608. var currentPointSize = feature._billboardSize;
  609. if (Color.equals(newColor, currentColor) && Color.equals(newOutlineColor, currentOutlineColor) &&
  610. newOutlineWidth === currentOutlineWidth && newPointSize === currentPointSize) {
  611. return;
  612. }
  613. feature._billboardColor = Color.clone(newColor, feature._billboardColor);
  614. feature._billboardOutlineColor = Color.clone(newOutlineColor, feature._billboardOutlineColor);
  615. feature._billboardOutlineWidth = newOutlineWidth;
  616. feature._billboardSize = newPointSize;
  617. var centerAlpha = newColor.alpha;
  618. var cssColor = newColor.toCssColorString();
  619. var cssOutlineColor = newOutlineColor.toCssColorString();
  620. var textureId = JSON.stringify([cssColor, newPointSize, cssOutlineColor, newOutlineWidth]);
  621. b.setImage(textureId, createBillboardPointCallback(centerAlpha, cssColor, cssOutlineColor, newOutlineWidth, newPointSize));
  622. }
  623. /**
  624. * Returns whether the feature contains this property. This includes properties from this feature's
  625. * class and inherited classes when using a batch table hierarchy.
  626. *
  627. * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/extensions/3DTILES_batch_table_hierarchy}
  628. *
  629. * @param {String} name The case-sensitive name of the property.
  630. * @returns {Boolean} Whether the feature contains this property.
  631. */
  632. Cesium3DTilePointFeature.prototype.hasProperty = function(name) {
  633. return this._content.batchTable.hasProperty(this._batchId, name);
  634. };
  635. /**
  636. * Returns an array of property names for the feature. This includes properties from this feature's
  637. * class and inherited classes when using a batch table hierarchy.
  638. *
  639. * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/extensions/3DTILES_batch_table_hierarchy}
  640. *
  641. * @param {String[]} results An array into which to store the results.
  642. * @returns {String[]} The names of the feature's properties.
  643. */
  644. Cesium3DTilePointFeature.prototype.getPropertyNames = function(results) {
  645. return this._content.batchTable.getPropertyNames(this._batchId, results);
  646. };
  647. /**
  648. * Returns a copy of the value of the feature's property with the given name. This includes properties from this feature's
  649. * class and inherited classes when using a batch table hierarchy.
  650. *
  651. * @see {@link https://github.com/AnalyticalGraphicsInc/3d-tiles/tree/master/extensions/3DTILES_batch_table_hierarchy}
  652. *
  653. * @param {String} name The case-sensitive name of the property.
  654. * @returns {*} The value of the property or <code>undefined</code> if the property does not exist.
  655. *
  656. * @example
  657. * // Display all the properties for a feature in the console log.
  658. * var propertyNames = feature.getPropertyNames();
  659. * var length = propertyNames.length;
  660. * for (var i = 0; i < length; ++i) {
  661. * var propertyName = propertyNames[i];
  662. * console.log(propertyName + ': ' + feature.getProperty(propertyName));
  663. * }
  664. */
  665. Cesium3DTilePointFeature.prototype.getProperty = function(name) {
  666. return this._content.batchTable.getProperty(this._batchId, name);
  667. };
  668. /**
  669. * Sets the value of the feature's property with the given name.
  670. * <p>
  671. * If a property with the given name doesn't exist, it is created.
  672. * </p>
  673. *
  674. * @param {String} name The case-sensitive name of the property.
  675. * @param {*} value The value of the property that will be copied.
  676. *
  677. * @exception {DeveloperError} Inherited batch table hierarchy property is read only.
  678. *
  679. * @example
  680. * var height = feature.getProperty('Height'); // e.g., the height of a building
  681. *
  682. * @example
  683. * var name = 'clicked';
  684. * if (feature.getProperty(name)) {
  685. * console.log('already clicked');
  686. * } else {
  687. * feature.setProperty(name, true);
  688. * console.log('first click');
  689. * }
  690. */
  691. Cesium3DTilePointFeature.prototype.setProperty = function(name, value) {
  692. this._content.batchTable.setProperty(this._batchId, name, value);
  693. // PERFORMANCE_IDEA: Probably overkill, but maybe only mark the tile dirty if the
  694. // property is in one of the style's expressions or - if it can be done quickly -
  695. // if the new property value changed the result of an expression.
  696. this._content.featurePropertiesDirty = true;
  697. };
  698. /**
  699. * Returns whether the feature's class name equals <code>className</code>. Unlike {@link Cesium3DTileFeature#isClass}
  700. * this function only checks the feature's exact class and not inherited classes.
  701. * <p>
  702. * This function returns <code>false</code> if no batch table hierarchy is present.
  703. * </p>
  704. *
  705. * @param {String} className The name to check against.
  706. * @returns {Boolean} Whether the feature's class name equals <code>className</code>
  707. *
  708. * @private
  709. */
  710. Cesium3DTilePointFeature.prototype.isExactClass = function(className) {
  711. return this._content.batchTable.isExactClass(this._batchId, className);
  712. };
  713. /**
  714. * Returns whether the feature's class or any inherited classes are named <code>className</code>.
  715. * <p>
  716. * This function returns <code>false</code> if no batch table hierarchy is present.
  717. * </p>
  718. *
  719. * @param {String} className The name to check against.
  720. * @returns {Boolean} Whether the feature's class or inherited classes are named <code>className</code>
  721. *
  722. * @private
  723. */
  724. Cesium3DTilePointFeature.prototype.isClass = function(className) {
  725. return this._content.batchTable.isClass(this._batchId, className);
  726. };
  727. /**
  728. * Returns the feature's class name.
  729. * <p>
  730. * This function returns <code>undefined</code> if no batch table hierarchy is present.
  731. * </p>
  732. *
  733. * @returns {String} The feature's class name.
  734. *
  735. * @private
  736. */
  737. Cesium3DTilePointFeature.prototype.getExactClassName = function() {
  738. return this._content.batchTable.getExactClassName(this._batchId);
  739. };
  740. export default Cesium3DTilePointFeature;