WallGraphics.js 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 two dimensional wall.
  19. *
  20. * @alias WallGraphics
  21. * @constructor
  22. */
  23. var WallGraphics = function() {
  24. this._show = undefined;
  25. this._showSubscription = undefined;
  26. this._material = undefined;
  27. this._materialSubscription = undefined;
  28. this._positions = undefined;
  29. this._positionsSubscription = undefined;
  30. this._minimumHeights = undefined;
  31. this._minimumHeightsSubscription = undefined;
  32. this._maximumHeights = undefined;
  33. this._maximumHeightsSubscription = undefined;
  34. this._granularity = undefined;
  35. this._granularitySubscription = 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(WallGraphics.prototype, {
  45. /**
  46. * Gets the event that is raised whenever a new property is assigned.
  47. * @memberof WallGraphics.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 wall's visibility.
  59. * @memberof WallGraphics.prototype
  60. * @type {Property}
  61. */
  62. show : createPropertyDescriptor('show'),
  63. /**
  64. * Gets or sets the {@link MaterialProperty} specifying the appearance of the wall.
  65. * @memberof WallGraphics.prototype
  66. * @type {MaterialProperty}
  67. */
  68. material : createPropertyDescriptor('material'),
  69. /**
  70. * Gets or sets the vertex positions.
  71. * @memberof WallGraphics.prototype
  72. * @type {Property}
  73. */
  74. positions : createPropertyDescriptor('positions'),
  75. /**
  76. * Gets or sets the Array {@link Property} specifying the bottom heights of the wall.
  77. * This array must be the same length as positions, containing a height for
  78. * each position. If undefined, the bottom of the wall will be on the surface of the
  79. * ellipsoid.
  80. * @memberof WallGraphics.prototype
  81. * @type {Property}
  82. */
  83. minimumHeights : createPropertyDescriptor('minimumHeights'),
  84. /**
  85. * Gets or sets the Array {@link Property} specifying the top heights along the wall.
  86. * This array must be the same length as positions, containing a height for
  87. * each position. If undefined, the heights from positions are used.
  88. * @memberof WallGraphics.prototype
  89. * @type {Property}
  90. */
  91. maximumHeights : createPropertyDescriptor('maximumHeights'),
  92. /**
  93. * Gets or sets the Number {@link Property} specifying the sampling distance, in radians,
  94. * between each latitude and longitude point.
  95. * @memberof WallGraphics.prototype
  96. * @type {Property}
  97. */
  98. granularity : createPropertyDescriptor('granularity'),
  99. /**
  100. * Gets or sets the Boolean {@link Property} specifying whether the wall should be filled.
  101. * @memberof WallGraphics.prototype
  102. * @type {Property}
  103. */
  104. fill : createPropertyDescriptor('fill'),
  105. /**
  106. * Gets or sets the Boolean {@link Property} specifying whether the wall should be outlined.
  107. * @memberof WallGraphics.prototype
  108. * @type {Property}
  109. */
  110. outline : createPropertyDescriptor('outline'),
  111. /**
  112. * Gets or sets the Color {@link Property} specifying whether the color of the outline.
  113. * @memberof WallGraphics.prototype
  114. * @type {Property}
  115. */
  116. outlineColor : createPropertyDescriptor('outlineColor'),
  117. /**
  118. * Gets or sets the Number {@link Property} specifying the width of the outline.
  119. * @memberof WallGraphics.prototype
  120. * @type {Property}
  121. */
  122. outlineWidth : createPropertyDescriptor('outlineWidth')
  123. });
  124. /**
  125. * Duplicates a WallGraphics instance.
  126. *
  127. * @param {WallGraphics} [result] The object onto which to store the result.
  128. * @returns {WallGraphics} The modified result parameter or a new instance if one was not provided.
  129. */
  130. WallGraphics.prototype.clone = function(result) {
  131. if (!defined(result)) {
  132. result = new WallGraphics();
  133. }
  134. result.show = this.show;
  135. result.material = this.material;
  136. result.positions = this.positions;
  137. result.minimumHeights = this.minimumHeights;
  138. result.maximumHeights = this.maximumHeights;
  139. result.granularity = this.granularity;
  140. result.fill = this.fill;
  141. result.outline = this.outline;
  142. result.outlineColor = this.outlineColor;
  143. result.outlineWidth = this.outlineWidth;
  144. return result;
  145. };
  146. /**
  147. * Assigns each unassigned property on this object to the value
  148. * of the same property on the provided source object.
  149. *
  150. * @param {WallGraphics} source The object to be merged into this object.
  151. */
  152. WallGraphics.prototype.merge = function(source) {
  153. //>>includeStart('debug', pragmas.debug);
  154. if (!defined(source)) {
  155. throw new DeveloperError('source is required.');
  156. }
  157. //>>includeEnd('debug');
  158. this.show = defaultValue(this.show, source.show);
  159. this.material = defaultValue(this.material, source.material);
  160. this.positions = defaultValue(this.positions, source.positions);
  161. this.minimumHeights = defaultValue(this.minimumHeights, source.minimumHeights);
  162. this.maximumHeights = defaultValue(this.maximumHeights, source.maximumHeights);
  163. this.granularity = defaultValue(this.granularity, source.granularity);
  164. this.fill = defaultValue(this.fill, source.fill);
  165. this.outline = defaultValue(this.outline, source.outline);
  166. this.outlineColor = defaultValue(this.outlineColor, source.outlineColor);
  167. this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth);
  168. };
  169. return WallGraphics;
  170. });