Empty3DTileContent.js 3.8 KB

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