CylinderGraphics.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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 cylinder.
  19. *
  20. * @alias CylinderGraphics
  21. * @constructor
  22. */
  23. var CylinderGraphics = function() {
  24. this._length = undefined;
  25. this._lengthSubscription = undefined;
  26. this._topRadius = undefined;
  27. this._topRadiusSubscription = undefined;
  28. this._bottomRadius = undefined;
  29. this._bottomRadiusSubscription = undefined;
  30. this._numberOfVerticalLines = undefined;
  31. this._numberOfVerticalLinesSubscription = undefined;
  32. this._slices = undefined;
  33. this._slicesSubscription = undefined;
  34. this._show = undefined;
  35. this._showSubscription = undefined;
  36. this._material = undefined;
  37. this._materialSubscription = undefined;
  38. this._outline = undefined;
  39. this._outlineSubscription = undefined;
  40. this._outlineColor = undefined;
  41. this._outlineColorSubscription = undefined;
  42. this._outlineWidth = undefined;
  43. this._outlineWidthSubscription = undefined;
  44. this._definitionChanged = new Event();
  45. };
  46. defineProperties(CylinderGraphics.prototype, {
  47. /**
  48. * Gets the event that is raised whenever a new property is assigned.
  49. * @memberof CylinderGraphics.prototype
  50. *
  51. * @type {Event}
  52. * @readonly
  53. */
  54. definitionChanged : {
  55. get : function() {
  56. return this._definitionChanged;
  57. }
  58. },
  59. /**
  60. * Gets or sets the numeric {@link Property} specifying the cylinder's semi-major-axis.
  61. * @memberof CylinderGraphics.prototype
  62. * @type {Property}
  63. */
  64. length : createPropertyDescriptor('length'),
  65. /**
  66. * Gets or sets the numeric {@link Property} specifying the cylinder's semi-minor-axis.
  67. * @memberof CylinderGraphics.prototype
  68. * @type {Property}
  69. */
  70. topRadius : createPropertyDescriptor('topRadius'),
  71. /**
  72. * Gets or sets the numeric {@link Property} specifying the cylinder's bottomRadius.
  73. * @memberof CylinderGraphics.prototype
  74. * @type {Property}
  75. */
  76. bottomRadius : createPropertyDescriptor('bottomRadius'),
  77. /**
  78. * Gets or sets the Number {@link Property} specifying the number of vertical lines
  79. * to use when outlining the cylinder.
  80. * @memberof CylinderGraphics.prototype
  81. * @type {Property}
  82. */
  83. numberOfVerticalLines : createPropertyDescriptor('numberOfVerticalLines'),
  84. /**
  85. * Gets or sets the Number {@link Property} specifying the sampling distance, in radians,
  86. * between each latitude and longitude point.
  87. * @memberof CylinderGraphics.prototype
  88. * @type {Property}
  89. */
  90. slices : createPropertyDescriptor('slices'),
  91. /**
  92. * Gets or sets the boolean {@link Property} specifying the polygon's visibility.
  93. * @memberof CylinderGraphics.prototype
  94. * @type {Property}
  95. */
  96. show : createPropertyDescriptor('show'),
  97. /**
  98. * Gets or sets the {@link MaterialProperty} specifying the appearance of the polygon.
  99. * @memberof CylinderGraphics.prototype
  100. * @type {MaterialProperty}
  101. */
  102. material : createPropertyDescriptor('material'),
  103. /**
  104. * Gets or sets the Boolean {@link Property} specifying whether the cylinder should be filled.
  105. * @memberof CylinderGraphics.prototype
  106. * @type {Property}
  107. */
  108. fill : createPropertyDescriptor('fill'),
  109. /**
  110. * Gets or sets the Boolean {@link Property} specifying whether the cylinder should be outlined.
  111. * @memberof CylinderGraphics.prototype
  112. * @type {Property}
  113. */
  114. outline : createPropertyDescriptor('outline'),
  115. /**
  116. * Gets or sets the Color {@link Property} specifying the color of the outline.
  117. * @memberof CylinderGraphics.prototype
  118. * @type {Property}
  119. */
  120. outlineColor : createPropertyDescriptor('outlineColor'),
  121. /**
  122. * Gets or sets the Number {@link Property} specifying the width of the outline.
  123. * @memberof CylinderGraphics.prototype
  124. * @type {Property}
  125. */
  126. outlineWidth : createPropertyDescriptor('outlineWidth')
  127. });
  128. /**
  129. * Duplicates a CylinderGraphics instance.
  130. *
  131. * @param {CylinderGraphics} [result] The object onto which to store the result.
  132. * @returns {CylinderGraphics} The modified result parameter or a new instance if one was not provided.
  133. */
  134. CylinderGraphics.prototype.clone = function(result) {
  135. if (!defined(result)) {
  136. result = new CylinderGraphics();
  137. }
  138. result.bottomRadius = this.bottomRadius;
  139. result.length = this.length;
  140. result.topRadius = this.topRadius;
  141. result.show = this.show;
  142. result.material = this.material;
  143. result.numberOfVerticalLines = this.numberOfVerticalLines;
  144. result.slices = this.slices;
  145. result.fill = this.fill;
  146. result.outline = this.outline;
  147. result.outlineColor = this.outlineColor;
  148. result.outlineWidth = this.outlineWidth;
  149. return result;
  150. };
  151. /**
  152. * Assigns each unassigned property on this object to the value
  153. * of the same property on the provided source object.
  154. *
  155. * @param {CylinderGraphics} source The object to be merged into this object.
  156. */
  157. CylinderGraphics.prototype.merge = function(source) {
  158. //>>includeStart('debug', pragmas.debug);
  159. if (!defined(source)) {
  160. throw new DeveloperError('source is required.');
  161. }
  162. //>>includeEnd('debug');
  163. this.bottomRadius = defaultValue(this.bottomRadius, source.bottomRadius);
  164. this.length = defaultValue(this.length, source.length);
  165. this.topRadius = defaultValue(this.topRadius, source.topRadius);
  166. this.show = defaultValue(this.show, source.show);
  167. this.material = defaultValue(this.material, source.material);
  168. this.numberOfVerticalLines = defaultValue(this.numberOfVerticalLines, source.numberOfVerticalLines);
  169. this.slices = defaultValue(this.slices, source.slices);
  170. this.fill = defaultValue(this.fill, source.fill);
  171. this.outline = defaultValue(this.outline, source.outline);
  172. this.outlineColor = defaultValue(this.outlineColor, source.outlineColor);
  173. this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth);
  174. };
  175. return CylinderGraphics;
  176. });