智慧水务管理系统 - 精河县供水工程综合管理平台

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. // @ts-check
  2. import DeveloperError from "../Core/DeveloperError.js";
  3. /** @import Context from "../Renderer/Context.js"; */
  4. /** @import DrawCommand from "../Renderer/DrawCommand.js"; */
  5. /** @import FrameState from "./FrameState.js"; */
  6. /** @import QuadtreeOccluders from "./QuadtreeOccluders.js"; */
  7. /** @import QuadtreePrimitive from "./QuadtreePrimitive.js"; */
  8. /** @import QuadtreeTile from "./QuadtreeTile.js"; */
  9. /** @import TilingScheme from "../Core/TilingScheme.js"; */
  10. /** @import Visibility from "../Core/Visibility.js"; */
  11. /**
  12. * Provides general quadtree tiles to be displayed on or near the surface of an ellipsoid. It is intended to be
  13. * used with the {@link QuadtreePrimitive}. This type describes an interface and is not intended to be
  14. * instantiated directly.
  15. *
  16. * @interface
  17. * @private
  18. */
  19. class QuadtreeTileProvider {
  20. /**
  21. * Gets or sets the {@link QuadtreePrimitive} for which this provider is
  22. * providing tiles.
  23. * @type {QuadtreePrimitive}
  24. */
  25. quadtree;
  26. /**
  27. * Gets the tiling scheme used by the provider.
  28. * @type {TilingScheme}
  29. */
  30. tilingScheme;
  31. /**
  32. * Gets an event that is raised when the geometry provider encounters an asynchronous error. By subscribing
  33. * to the event, you will be notified of the error and can potentially recover from it. Event listeners
  34. * are passed an instance of {@link TileProviderError}.
  35. * @type {Event}
  36. */
  37. errorEvent;
  38. constructor() {
  39. DeveloperError.throwInstantiationError();
  40. }
  41. /**
  42. * Computes the default geometric error for level zero of the quadtree.
  43. *
  44. * @param {TilingScheme} tilingScheme The tiling scheme for which to compute the geometric error.
  45. * @returns {number} The maximum geometric error at level zero, in meters.
  46. */
  47. static computeDefaultLevelZeroMaximumGeometricError(tilingScheme) {
  48. return (
  49. (tilingScheme.ellipsoid.maximumRadius * 2 * Math.PI * 0.25) /
  50. (65 * tilingScheme.getNumberOfXTilesAtLevel(0))
  51. );
  52. }
  53. /**
  54. * Called at the beginning of the update cycle, regardless of id a new frame is being rendered, before {@link QuadtreeTileProvider#beginUpdate}
  55. *
  56. * @param {Context} context The rendering context.
  57. * @param {FrameState} frameState The frame state.
  58. */
  59. update(context, frameState) {
  60. DeveloperError.throwInstantiationError();
  61. }
  62. /**
  63. * Called at the beginning of the update cycle for each render frame, before {@link QuadtreeTileProvider#showTileThisFrame}
  64. * or any other functions.
  65. *
  66. * @param {Context} context The rendering context.
  67. * @param {FrameState} frameState The frame state.
  68. * @param {DrawCommand[]} commandList An array of rendering commands. This method may push
  69. * commands into this array.
  70. */
  71. beginUpdate(context, frameState, commandList) {
  72. DeveloperError.throwInstantiationError();
  73. }
  74. /**
  75. * Called at the end of the update cycle for each render frame, after {@link QuadtreeTileProvider#showTileThisFrame}
  76. * and any other functions.
  77. *
  78. * @param {Context} context The rendering context.
  79. * @param {FrameState} frameState The frame state.
  80. * @param {DrawCommand[]} commandList An array of rendering commands. This method may push
  81. * commands into this array.
  82. */
  83. endUpdate(context, frameState, commandList) {
  84. DeveloperError.throwInstantiationError();
  85. }
  86. /**
  87. * Gets the maximum geometric error allowed in a tile at a given level, in meters.
  88. *
  89. * @see QuadtreeTileProvider#computeDefaultLevelZeroMaximumGeometricError
  90. *
  91. * @param {number} level The tile level for which to get the maximum geometric error.
  92. * @returns {number} The maximum geometric error in meters.
  93. */
  94. getLevelMaximumGeometricError(level) {
  95. DeveloperError.throwInstantiationError();
  96. }
  97. /**
  98. * Loads, or continues loading, a given tile. This function will continue to be called
  99. * until {@link QuadtreeTile#state} is no longer {@link QuadtreeTileLoadState#LOADING}.
  100. *
  101. * @param {Context} context The rendering context.
  102. * @param {FrameState} frameState The frame state.
  103. * @param {QuadtreeTile} tile The tile to load.
  104. */
  105. loadTile(context, frameState, tile) {
  106. DeveloperError.throwInstantiationError();
  107. }
  108. /**
  109. * Determines the visibility of a given tile. The tile may be fully visible, partially visible, or not
  110. * visible at all. Tiles that are renderable and are at least partially visible will be shown by a call
  111. * to {@link QuadtreeTileProvider#showTileThisFrame}.
  112. *
  113. * @param {QuadtreeTile} tile The tile instance.
  114. * @param {FrameState} frameState The state information about the current frame.
  115. * @param {QuadtreeOccluders} occluders The objects that may occlude this tile.
  116. *
  117. * @returns {Visibility} The visibility of the tile.
  118. */
  119. computeTileVisibility(tile, frameState, occluders) {
  120. DeveloperError.throwInstantiationError();
  121. }
  122. /**
  123. * Shows a specified tile in this frame. The provider can cause the tile to be shown by adding
  124. * render commands to the commandList, or use any other method as appropriate. The tile is not
  125. * expected to be visible next frame as well, unless this method is call next frame, too.
  126. *
  127. * @param {QuadtreeTile} tile The tile instance.
  128. * @param {Context} context The rendering context.
  129. * @param {FrameState} frameState The state information of the current rendering frame.
  130. * @param {DrawCommand[]} commandList The list of rendering commands. This method may add additional commands to this list.
  131. */
  132. showTileThisFrame(tile, context, frameState, commandList) {
  133. DeveloperError.throwInstantiationError();
  134. }
  135. /**
  136. * Gets the distance from the camera to the closest point on the tile. This is used for level-of-detail selection.
  137. *
  138. * @param {QuadtreeTile} tile The tile instance.
  139. * @param {FrameState} frameState The state information of the current rendering frame.
  140. *
  141. * @returns {number} The distance from the camera to the closest point on the tile, in meters.
  142. */
  143. computeDistanceToTile(tile, frameState) {
  144. DeveloperError.throwInstantiationError();
  145. }
  146. /**
  147. * Returns true if this object was destroyed; otherwise, false.
  148. * <br /><br />
  149. * If this object was destroyed, it should not be used; calling any function other than
  150. * <code>isDestroyed</code> will result in a {@link DeveloperError} exception.
  151. *
  152. * @returns {boolean} True if this object was destroyed; otherwise, false.
  153. *
  154. * @see QuadtreeTileProvider#destroy
  155. */
  156. isDestroyed() {
  157. DeveloperError.throwInstantiationError();
  158. }
  159. /**
  160. * Destroys the WebGL resources held by this object. Destroying an object allows for deterministic
  161. * release of WebGL resources, instead of relying on the garbage collector to destroy this object.
  162. * <br /><br />
  163. * Once an object is destroyed, it should not be used; calling any function other than
  164. * <code>isDestroyed</code> will result in a {@link DeveloperError} exception. Therefore,
  165. * assign the return value (<code>undefined</code>) to the object as done in the example.
  166. *
  167. * @exception {DeveloperError} This object was destroyed, i.e., destroy() was called.
  168. *
  169. * @example
  170. * provider = provider && provider();
  171. *
  172. * @see QuadtreeTileProvider#isDestroyed
  173. */
  174. destroy() {
  175. DeveloperError.throwInstantiationError();
  176. }
  177. }
  178. export default QuadtreeTileProvider;