Tileset3DTileContent.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. import destroyObject from "../Core/destroyObject.js";
  2. import deprecationWarning from "../Core/deprecationWarning.js";
  3. /**
  4. * Represents content for a tile in a
  5. * {@link https://github.com/CesiumGS/3d-tiles/tree/main/specification|3D Tiles} tileset whose
  6. * content points to another 3D Tiles tileset.
  7. * <p>
  8. * Implements the {@link Cesium3DTileContent} interface.
  9. * </p>
  10. *
  11. * @alias Tileset3DTileContent
  12. * @constructor
  13. *
  14. * @private
  15. */
  16. function Tileset3DTileContent(tileset, tile, resource) {
  17. this._tileset = tileset;
  18. this._tile = tile;
  19. this._resource = resource;
  20. this.featurePropertiesDirty = false;
  21. this._metadata = undefined;
  22. this._group = undefined;
  23. this._ready = false;
  24. this._readyPromise = Promise.resolve(this);
  25. }
  26. Object.defineProperties(Tileset3DTileContent.prototype, {
  27. featuresLength: {
  28. get: function () {
  29. return 0;
  30. },
  31. },
  32. pointsLength: {
  33. get: function () {
  34. return 0;
  35. },
  36. },
  37. trianglesLength: {
  38. get: function () {
  39. return 0;
  40. },
  41. },
  42. geometryByteLength: {
  43. get: function () {
  44. return 0;
  45. },
  46. },
  47. texturesByteLength: {
  48. get: function () {
  49. return 0;
  50. },
  51. },
  52. batchTableByteLength: {
  53. get: function () {
  54. return 0;
  55. },
  56. },
  57. innerContents: {
  58. get: function () {
  59. return undefined;
  60. },
  61. },
  62. /**
  63. * Returns true when the tile's content is ready to render; otherwise false
  64. *
  65. * @memberof Tileset3DTileContent.prototype
  66. *
  67. * @type {boolean}
  68. * @readonly
  69. * @private
  70. */
  71. ready: {
  72. get: function () {
  73. return this._ready;
  74. },
  75. },
  76. /**
  77. * Gets the promise that will be resolved when the tile's content is ready to render.
  78. *
  79. * @memberof Tileset3DTileContent.prototype
  80. *
  81. * @type {Promise<Tileset3DTileContent>}
  82. * @readonly
  83. * @deprecated
  84. * @private
  85. */
  86. readyPromise: {
  87. get: function () {
  88. deprecationWarning(
  89. "Tileset3DTileContent.readyPromise",
  90. "Tileset3DTileContent.readyPromise was deprecated in CesiumJS 1.104. It will be removed in 1.107. Wait for Tileset3DTileContent.ready to return true instead."
  91. );
  92. return this._readyPromise;
  93. },
  94. },
  95. tileset: {
  96. get: function () {
  97. return this._tileset;
  98. },
  99. },
  100. tile: {
  101. get: function () {
  102. return this._tile;
  103. },
  104. },
  105. url: {
  106. get: function () {
  107. return this._resource.getUrlComponent(true);
  108. },
  109. },
  110. batchTable: {
  111. get: function () {
  112. return undefined;
  113. },
  114. },
  115. metadata: {
  116. get: function () {
  117. return this._metadata;
  118. },
  119. set: function (value) {
  120. this._metadata = value;
  121. },
  122. },
  123. group: {
  124. get: function () {
  125. return this._group;
  126. },
  127. set: function (value) {
  128. this._group = value;
  129. },
  130. },
  131. });
  132. /**
  133. * Creates an instance of Tileset3DTileContent from a parsed JSON object
  134. * @param {Cesium3DTileset} tileset
  135. * @param {Cesium3DTile} tile
  136. * @param {Resource} resource
  137. * @param {object} json
  138. * @returns {Tileset3DTileContent}
  139. */
  140. Tileset3DTileContent.fromJson = function (tileset, tile, resource, json) {
  141. const content = new Tileset3DTileContent(tileset, tile, resource);
  142. content._tileset.loadTileset(content._resource, json, content._tile);
  143. content._ready = true;
  144. return content;
  145. };
  146. /**
  147. * Part of the {@link Cesium3DTileContent} interface. <code>Tileset3DTileContent</code>
  148. * always returns <code>false</code> since a tile of this type does not have any features.
  149. */
  150. Tileset3DTileContent.prototype.hasProperty = function (batchId, name) {
  151. return false;
  152. };
  153. /**
  154. * Part of the {@link Cesium3DTileContent} interface. <code>Tileset3DTileContent</code>
  155. * always returns <code>undefined</code> since a tile of this type does not have any features.
  156. */
  157. Tileset3DTileContent.prototype.getFeature = function (batchId) {
  158. return undefined;
  159. };
  160. Tileset3DTileContent.prototype.applyDebugSettings = function (
  161. enabled,
  162. color
  163. ) {};
  164. Tileset3DTileContent.prototype.applyStyle = function (style) {};
  165. Tileset3DTileContent.prototype.update = function (tileset, frameState) {};
  166. Tileset3DTileContent.prototype.isDestroyed = function () {
  167. return false;
  168. };
  169. Tileset3DTileContent.prototype.destroy = function () {
  170. return destroyObject(this);
  171. };
  172. export default Tileset3DTileContent;