EllipsoidGraphics.js 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*global define*/
  2. define([
  3. '../Core/defaultValue',
  4. '../Core/defined',
  5. '../Core/defineProperties',
  6. '../Core/DeveloperError',
  7. '../Core/Event',
  8. './createPropertyDescriptor'
  9. ], function(
  10. defaultValue,
  11. defined,
  12. defineProperties,
  13. DeveloperError,
  14. Event,
  15. createPropertyDescriptor) {
  16. "use strict";
  17. /**
  18. * An optionally time-dynamic ellipsoid.
  19. *
  20. * @alias EllipsoidGraphics
  21. * @constructor
  22. */
  23. var EllipsoidGraphics = function() {
  24. this._show = undefined;
  25. this._showSubscription = undefined;
  26. this._radii = undefined;
  27. this._radiiSubscription = undefined;
  28. this._material = undefined;
  29. this._materialSubscription = undefined;
  30. this._stackPartitions = undefined;
  31. this._stackPartitionsSubscription = undefined;
  32. this._slicePartitions = undefined;
  33. this._slicePartitionsSubscription = undefined;
  34. this._subdivisions = undefined;
  35. this._subdivisionsSubscription = undefined;
  36. this._outline = undefined;
  37. this._outlineSubscription = undefined;
  38. this._outlineColor = undefined;
  39. this._outlineColorSubscription = undefined;
  40. this._outlineWidth = undefined;
  41. this._outlineWidthSubscription = undefined;
  42. this._definitionChanged = new Event();
  43. };
  44. defineProperties(EllipsoidGraphics.prototype, {
  45. /**
  46. * Gets the event that is raised whenever a new property is assigned.
  47. * @memberof EllipsoidGraphics.prototype
  48. *
  49. * @type {Event}
  50. * @readonly
  51. */
  52. definitionChanged : {
  53. get : function() {
  54. return this._definitionChanged;
  55. }
  56. },
  57. /**
  58. * Gets or sets the boolean {@link Property} specifying the visibility of the ellipsoid.
  59. * @memberof EllipsoidGraphics.prototype
  60. * @type {Property}
  61. */
  62. show : createPropertyDescriptor('show'),
  63. /**
  64. * Gets or sets the {@link Cartesian3} {@link Property} specifying the radii of the ellipsoid.
  65. * @memberof EllipsoidGraphics.prototype
  66. * @type {Property}
  67. */
  68. radii : createPropertyDescriptor('radii'),
  69. /**
  70. * Gets or sets the {@link MaterialProperty} specifying the appearance of the ellipsoid.
  71. * @memberof EllipsoidGraphics.prototype
  72. * @type {MaterialProperty}
  73. */
  74. material : createPropertyDescriptor('material'),
  75. /**
  76. * Gets or sets the Boolean {@link Property} specifying whether the ellipsoid should be filled.
  77. * @memberof EllipsoidGraphics.prototype
  78. * @type {Property}
  79. */
  80. fill : createPropertyDescriptor('fill'),
  81. /**
  82. * Gets or sets the Boolean {@link Property} specifying whether the ellipsoid should be outlined.
  83. * @memberof EllipsoidGraphics.prototype
  84. * @type {Property}
  85. */
  86. outline : createPropertyDescriptor('outline'),
  87. /**
  88. * Gets or sets the Color {@link Property} specifying whether the color of the outline.
  89. * @memberof EllipsoidGraphics.prototype
  90. * @type {Property}
  91. */
  92. outlineColor : createPropertyDescriptor('outlineColor'),
  93. /**
  94. * Gets or sets the Number {@link Property} specifying the width of the outline.
  95. * @memberof EllipsoidGraphics.prototype
  96. * @type {Property}
  97. */
  98. outlineWidth : createPropertyDescriptor('outlineWidth'),
  99. /**
  100. * Gets or sets the Number {@link Property} specifying the number of times to partition the ellipsoid into stacks.
  101. * @memberof EllipsoidGraphics.prototype
  102. * @type {Property}
  103. */
  104. stackPartitions : createPropertyDescriptor('stackPartitions'),
  105. /**
  106. * Gets or sets the Number {@link Property} specifying the number of times to partition the ellipsoid into radial slices.
  107. * @memberof EllipsoidGraphics.prototype
  108. * @type {Property}
  109. */
  110. slicePartitions : createPropertyDescriptor('slicePartitions'),
  111. /**
  112. * Gets or sets the Number {@link Property} specifying the number of points per line, determining the granularity of the curvature .
  113. * @memberof EllipsoidGraphics.prototype
  114. * @type {Property}
  115. */
  116. subdivisions : createPropertyDescriptor('subdivisions')
  117. });
  118. /**
  119. * Duplicates a EllipsoidGraphics instance.
  120. *
  121. * @param {EllipsoidGraphics} [result] The object onto which to store the result.
  122. * @returns {EllipsoidGraphics} The modified result parameter or a new instance if one was not provided.
  123. */
  124. EllipsoidGraphics.prototype.clone = function(result) {
  125. if (!defined(result)) {
  126. result = new EllipsoidGraphics();
  127. }
  128. result.show = this.show;
  129. result.radii = this.radii;
  130. result.material = this.material;
  131. result.fill = this.fill;
  132. result.outline = this.outline;
  133. result.outlineColor = this.outlineColor;
  134. result.outlineWidth = this.outlineWidth;
  135. result.stackPartitions = this.stackPartitions;
  136. result.slicePartitions = this.slicePartitions;
  137. result.subdivisions = this.subdivisions;
  138. return result;
  139. };
  140. /**
  141. * Assigns each unassigned property on this object to the value
  142. * of the same property on the provided source object.
  143. *
  144. * @param {EllipsoidGraphics} source The object to be merged into this object.
  145. */
  146. EllipsoidGraphics.prototype.merge = function(source) {
  147. //>>includeStart('debug', pragmas.debug);
  148. if (!defined(source)) {
  149. throw new DeveloperError('source is required.');
  150. }
  151. //>>includeEnd('debug');
  152. this.show = defaultValue(this.show, source.show);
  153. this.radii = defaultValue(this.radii, source.radii);
  154. this.material = defaultValue(this.material, source.material);
  155. this.fill = defaultValue(this.fill, source.fill);
  156. this.outline = defaultValue(this.outline, source.outline);
  157. this.outlineColor = defaultValue(this.outlineColor, source.outlineColor);
  158. this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth);
  159. this.stackPartitions = defaultValue(this.stackPartitions, source.stackPartitions);
  160. this.slicePartitions = defaultValue(this.slicePartitions, source.slicePartitions);
  161. this.subdivisions = defaultValue(this.subdivisions, source.subdivisions);
  162. };
  163. return EllipsoidGraphics;
  164. });