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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. // @ts-check
  2. /**
  3. * Represents the position relative to the terrain.
  4. *
  5. * @enum {number}
  6. */
  7. const HeightReference = {
  8. /**
  9. * The position is absolute.
  10. * @type {number}
  11. * @constant
  12. */
  13. NONE: 0,
  14. /**
  15. * The position is clamped to the terrain and 3D Tiles. When clamping to 3D Tilesets such as photorealistic 3D Tiles, ensure the tileset has {@link Cesium3DTileset#enableCollision} set to <code>true</code>. Otherwise, the entity may not be correctly clamped to the tileset surface.
  16. * @type {number}
  17. * @constant
  18. */
  19. CLAMP_TO_GROUND: 1,
  20. /**
  21. * The position height is the height above the terrain and 3D Tiles.
  22. * @type {number}
  23. * @constant
  24. */
  25. RELATIVE_TO_GROUND: 2,
  26. /**
  27. * The position is clamped to terain.
  28. * @type {number}
  29. * @constant
  30. */
  31. CLAMP_TO_TERRAIN: 3,
  32. /**
  33. * The position height is the height above terrain.
  34. * @type {number}
  35. * @constant
  36. */
  37. RELATIVE_TO_TERRAIN: 4,
  38. /**
  39. * The position is clamped to 3D Tiles.
  40. * @type {number}
  41. * @constant
  42. */
  43. CLAMP_TO_3D_TILE: 5,
  44. /**
  45. * The position height is the height above 3D Tiles.
  46. * @type {number}
  47. * @constant
  48. */
  49. RELATIVE_TO_3D_TILE: 6,
  50. };
  51. Object.freeze(HeightReference);
  52. export default HeightReference;
  53. /**
  54. * Returns true if the height should be clamped to the surface
  55. * @param {HeightReference} heightReference
  56. * @returns true if the height should be clamped to the surface
  57. * @private
  58. */
  59. export function isHeightReferenceClamp(heightReference) {
  60. return (
  61. heightReference === HeightReference.CLAMP_TO_GROUND ||
  62. heightReference === HeightReference.CLAMP_TO_3D_TILE ||
  63. heightReference === HeightReference.CLAMP_TO_TERRAIN
  64. );
  65. }
  66. /**
  67. * Returns true if the height should be offset relative to the surface
  68. * @param {HeightReference} heightReference
  69. * @returns true if the height should be offset relative to the surface
  70. * @private
  71. */
  72. export function isHeightReferenceRelative(heightReference) {
  73. return (
  74. heightReference === HeightReference.RELATIVE_TO_GROUND ||
  75. heightReference === HeightReference.RELATIVE_TO_3D_TILE ||
  76. heightReference === HeightReference.RELATIVE_TO_TERRAIN
  77. );
  78. }