EllipseGraphics.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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 ellipse.
  19. *
  20. * @alias EllipseGraphics
  21. * @constructor
  22. */
  23. var EllipseGraphics = function() {
  24. this._semiMajorAxis = undefined;
  25. this._semiMajorAxisSubscription = undefined;
  26. this._semiMinorAxis = undefined;
  27. this._semiMinorAxisSubscription = undefined;
  28. this._rotation = undefined;
  29. this._rotationSubscription = undefined;
  30. this._show = undefined;
  31. this._showSubscription = undefined;
  32. this._material = undefined;
  33. this._materialSubscription = undefined;
  34. this._height = undefined;
  35. this._heightSubscription = undefined;
  36. this._extrudedHeight = undefined;
  37. this._extrudedHeightSubscription = undefined;
  38. this._granularity = undefined;
  39. this._granularitySubscription = undefined;
  40. this._stRotation = undefined;
  41. this._stRotationSubscription = undefined;
  42. this._outline = undefined;
  43. this._outlineSubscription = undefined;
  44. this._outlineColor = undefined;
  45. this._outlineColorSubscription = undefined;
  46. this._outlineWidth = undefined;
  47. this._outlineWidthSubscription = undefined;
  48. this._numberOfVerticalLines = undefined;
  49. this._numberOfVerticalLinesSubscription = undefined;
  50. this._definitionChanged = new Event();
  51. };
  52. defineProperties(EllipseGraphics.prototype, {
  53. /**
  54. * Gets the event that is raised whenever a new property is assigned.
  55. * @memberof EllipseGraphics.prototype
  56. *
  57. * @type {Event}
  58. * @readonly
  59. */
  60. definitionChanged : {
  61. get : function() {
  62. return this._definitionChanged;
  63. }
  64. },
  65. /**
  66. * Gets or sets the numeric {@link Property} specifying the ellipse's semi-major-axis.
  67. * @memberof EllipseGraphics.prototype
  68. * @type {Property}
  69. */
  70. semiMajorAxis : createPropertyDescriptor('semiMajorAxis'),
  71. /**
  72. * Gets or sets the numeric {@link Property} specifying the ellipse's semi-minor-axis.
  73. * @memberof EllipseGraphics.prototype
  74. * @type {Property}
  75. */
  76. semiMinorAxis : createPropertyDescriptor('semiMinorAxis'),
  77. /**
  78. * Gets or sets the numeric {@link Property} specifying the ellipse's rotation.
  79. * @memberof EllipseGraphics.prototype
  80. * @type {Property}
  81. */
  82. rotation : createPropertyDescriptor('rotation'),
  83. /**
  84. * Gets or sets the boolean {@link Property} specifying the polygon's visibility.
  85. * @memberof EllipseGraphics.prototype
  86. * @type {Property}
  87. */
  88. show : createPropertyDescriptor('show'),
  89. /**
  90. * Gets or sets the {@link MaterialProperty} specifying the appearance of the polygon.
  91. * @memberof EllipseGraphics.prototype
  92. * @type {MaterialProperty}
  93. */
  94. material : createPropertyDescriptor('material'),
  95. /**
  96. * Gets or sets the Number {@link Property} specifying the height of the polygon.
  97. * If undefined, the polygon will be on the surface.
  98. * @memberof EllipseGraphics.prototype
  99. * @type {Property}
  100. */
  101. height : createPropertyDescriptor('height'),
  102. /**
  103. * Gets or sets the Number {@link Property} specifying the extruded height of the polygon.
  104. * Setting this property creates a polygon shaped volume starting at height and ending
  105. * at the extruded height.
  106. * @memberof EllipseGraphics.prototype
  107. * @type {Property}
  108. */
  109. extrudedHeight : createPropertyDescriptor('extrudedHeight'),
  110. /**
  111. * Gets or sets the Number {@link Property} specifying the sampling distance, in radians,
  112. * between each latitude and longitude point.
  113. * @memberof EllipseGraphics.prototype
  114. * @type {Property}
  115. */
  116. granularity : createPropertyDescriptor('granularity'),
  117. /**
  118. * Gets or sets the Number {@link Property} specifying the rotation of the texture coordinates,
  119. * in radians. A positive rotation is counter-clockwise.
  120. * @memberof EllipseGraphics.prototype
  121. * @type {Property}
  122. */
  123. stRotation : createPropertyDescriptor('stRotation'),
  124. /**
  125. * Gets or sets the Boolean {@link Property} specifying whether the ellipse should be filled.
  126. * @memberof EllipseGraphics.prototype
  127. * @type {Property}
  128. */
  129. fill : createPropertyDescriptor('fill'),
  130. /**
  131. * Gets or sets the Boolean {@link Property} specifying whether the ellipse should be outlined.
  132. * @memberof EllipseGraphics.prototype
  133. * @type {Property}
  134. */
  135. outline : createPropertyDescriptor('outline'),
  136. /**
  137. * Gets or sets the Color {@link Property} specifying the color of the outline.
  138. * @memberof EllipseGraphics.prototype
  139. * @type {Property}
  140. */
  141. outlineColor : createPropertyDescriptor('outlineColor'),
  142. /**
  143. * Gets or sets the Number {@link Property} specifying the width of the outline.
  144. * @memberof EllipseGraphics.prototype
  145. * @type {Property}
  146. */
  147. outlineWidth : createPropertyDescriptor('outlineWidth'),
  148. /**
  149. * Gets or sets the Number {@link Property} specifying the number of vertical lines
  150. * to use when outlining the ellipse.
  151. * @memberof EllipseGraphics.prototype
  152. * @type {Property}
  153. */
  154. numberOfVerticalLines : createPropertyDescriptor('numberOfVerticalLines')
  155. });
  156. /**
  157. * Duplicates a EllipseGraphics instance.
  158. *
  159. * @param {EllipseGraphics} [result] The object onto which to store the result.
  160. * @returns {EllipseGraphics} The modified result parameter or a new instance if one was not provided.
  161. */
  162. EllipseGraphics.prototype.clone = function(result) {
  163. if (!defined(result)) {
  164. result = new EllipseGraphics();
  165. }
  166. result.rotation = this.rotation;
  167. result.semiMajorAxis = this.semiMajorAxis;
  168. result.semiMinorAxis = this.semiMinorAxis;
  169. result.show = this.show;
  170. result.material = this.material;
  171. result.height = this.height;
  172. result.extrudedHeight = this.extrudedHeight;
  173. result.granularity = this.granularity;
  174. result.stRotation = this.stRotation;
  175. result.fill = this.fill;
  176. result.outline = this.outline;
  177. result.outlineColor = this.outlineColor;
  178. result.outlineWidth = this.outlineWidth;
  179. result.numberOfVerticalLines = this.numberOfVerticalLines;
  180. return result;
  181. };
  182. /**
  183. * Assigns each unassigned property on this object to the value
  184. * of the same property on the provided source object.
  185. *
  186. * @param {EllipseGraphics} source The object to be merged into this object.
  187. */
  188. EllipseGraphics.prototype.merge = function(source) {
  189. //>>includeStart('debug', pragmas.debug);
  190. if (!defined(source)) {
  191. throw new DeveloperError('source is required.');
  192. }
  193. //>>includeEnd('debug');
  194. this.rotation = defaultValue(this.rotation, source.rotation);
  195. this.semiMajorAxis = defaultValue(this.semiMajorAxis, source.semiMajorAxis);
  196. this.semiMinorAxis = defaultValue(this.semiMinorAxis, source.semiMinorAxis);
  197. this.show = defaultValue(this.show, source.show);
  198. this.material = defaultValue(this.material, source.material);
  199. this.height = defaultValue(this.height, source.height);
  200. this.extrudedHeight = defaultValue(this.extrudedHeight, source.extrudedHeight);
  201. this.granularity = defaultValue(this.granularity, source.granularity);
  202. this.stRotation = defaultValue(this.stRotation, source.stRotation);
  203. this.fill = defaultValue(this.fill, source.fill);
  204. this.outline = defaultValue(this.outline, source.outline);
  205. this.outlineColor = defaultValue(this.outlineColor, source.outlineColor);
  206. this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth);
  207. this.numberOfVerticalLines = defaultValue(this.numberOfVerticalLines, source.numberOfVerticalLines);
  208. };
  209. return EllipseGraphics;
  210. });