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

KeyframeNode.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. const LoadState = Object.freeze({
  2. UNLOADED: 0, // Has no data and is in dormant state
  3. RECEIVING: 1, // Is waiting on data from the provider
  4. PROCESSING: 2, // Data received. Contents are being processed for rendering. Depending on the content, it might make its own requests for external data.
  5. LOADED: 3, // Processed data from provider
  6. FAILED: 4, // Failed to receive data from the provider
  7. UNAVAILABLE: 5, // No data available for this tile
  8. });
  9. /**
  10. * @alias KeyframeNode
  11. * @constructor
  12. *
  13. * @param {SpatialNode} spatialNode
  14. * @param {number} keyframe
  15. *
  16. * @private
  17. */
  18. function KeyframeNode(spatialNode, keyframe) {
  19. this.spatialNode = spatialNode;
  20. this.keyframe = keyframe;
  21. this.state = LoadState.UNLOADED;
  22. this.content = undefined;
  23. this.megatextureIndex = -1;
  24. this.priority = -Number.MAX_VALUE;
  25. this.highPriorityFrameNumber = -1;
  26. }
  27. /**
  28. * Frees the resources used by this object.
  29. * @private
  30. */
  31. KeyframeNode.prototype.unload = function () {
  32. this.content = this.content && this.content.destroy();
  33. this.spatialNode = undefined;
  34. this.state = LoadState.UNLOADED;
  35. this.megatextureIndex = -1;
  36. this.priority = -Number.MAX_VALUE;
  37. this.highPriorityFrameNumber = -1;
  38. };
  39. /**
  40. * @param {KeyframeNode} a
  41. * @param {KeyframeNode} b
  42. */
  43. KeyframeNode.priorityComparator = function (a, b) {
  44. return a.priority - b.priority;
  45. };
  46. /**
  47. * @param {KeyframeNode} a
  48. * @param {KeyframeNode} b
  49. */
  50. KeyframeNode.searchComparator = function (a, b) {
  51. return a.keyframe - b.keyframe;
  52. };
  53. KeyframeNode.LoadState = LoadState;
  54. export default KeyframeNode;