/
DynamicPyramid.js
149 lines (136 loc) · 5.46 KB
/
DynamicPyramid.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*global define*/
define([
'../Core/defaultValue',
'../Core/defined',
'../Core/defineProperties',
'../Core/DeveloperError',
'../Core/Event',
'./createDynamicPropertyDescriptor'
], function(
defaultValue,
defined,
defineProperties,
DeveloperError,
Event,
createDynamicPropertyDescriptor) {
"use strict";
/**
* An optionally time-dynamic pyramid.
*
* @alias DynamicPyramid
* @constructor
*/
var DynamicPyramid = function() {
this._show = undefined;
this._showSubscription = undefined;
this._directions = undefined;
this._directionsSubscription = undefined;
this._radius = undefined;
this._radiusSubscription = undefined;
this._showIntersection = undefined;
this._showIntersectionSubscription = undefined;
this._intersectionColor = undefined;
this._intersectionColorSubscription = undefined;
this._intersectionWidth = undefined;
this._intersectionWidthSubscription = undefined;
this._material = undefined;
this._materialSubscription = undefined;
this._definitionChanged = new Event();
};
defineProperties(DynamicPyramid.prototype, {
/**
* Gets the event that is raised whenever a new property is assigned.
* @memberof DynamicPyramid.prototype
* @type {Event}
*/
definitionChanged : {
get : function() {
return this._definitionChanged;
}
},
/**
* Gets or sets the boolean {@link Property} specifying the visibility of the pyramid.
* @memberof DynamicPyramid.prototype
* @type {Property}
*/
show : createDynamicPropertyDescriptor('show'),
/**
* A {@link Property} which returns an array of {@link Spherical} instances representing the pyramid's projection.
* @memberof DynamicPyramid.prototype
* @type {Property}
*/
directions : createDynamicPropertyDescriptor('directions'),
/**
* Gets or sets the numeric {@link Property} specifying the radius of the pyramid's projection.
* @memberof DynamicPyramid.prototype
* @type {Property}
*/
radius : createDynamicPropertyDescriptor('radius'),
/**
* Gets or sets the boolean {@link Property} specifying the visibility of the line formed by the intersection of the pyramid and other central bodies.
* @memberof DynamicPyramid.prototype
* @type {Property}
*/
showIntersection : createDynamicPropertyDescriptor('showIntersection'),
/**
* Gets or sets the {@link Color} {@link Property} specifying the color of the line formed by the intersection of the pyramid and other central bodies.
* @memberof DynamicPyramid.prototype
* @type {Property}
*/
intersectionColor : createDynamicPropertyDescriptor('intersectionColor'),
/**
* Gets or sets the numeric {@link Property} specifying the width of the line formed by the intersection of the pyramid and other central bodies.
* @memberof DynamicPyramid.prototype
* @type {Property}
*/
intersectionWidth : createDynamicPropertyDescriptor('intersectionWidth'),
/**
* Gets or sets the {@link MaterialProperty} specifying the the pyramid's appearance.
* @memberof DynamicPyramid.prototype
* @type {MaterialProperty}
*/
material : createDynamicPropertyDescriptor('material')
});
/**
* Duplicates a DynamicPyramid instance.
* @memberof DynamicPyramid
*
* @param {DynamicPyramid} [result] The object onto which to store the result.
* @returns {DynamicPyramid} The modified result parameter or a new instance if one was not provided.
*/
DynamicPyramid.prototype.clone = function(result) {
if (!defined(result)) {
result = new DynamicPyramid();
}
result.show = this.show;
result.directions = this.directions;
result.radius = this.radius;
result.showIntersection = this.showIntersection;
result.intersectionColor = this.intersectionColor;
result.intersectionWidth = this.intersectionWidth;
result.material = this.material;
return result;
};
/**
* Assigns each unassigned property on this object to the value
* of the same property on the provided source object.
* @memberof DynamicPyramid
*
* @param {DynamicPyramid} source The object to be merged into this object.
*/
DynamicPyramid.prototype.merge = function(source) {
//>>includeStart('debug', pragmas.debug);
if (!defined(source)) {
throw new DeveloperError('source is required.');
}
//>>includeEnd('debug');
this.show = defaultValue(this.show, source.show);
this.directions = defaultValue(this.directions, source.directions);
this.radius = defaultValue(this.radius, source.radius);
this.showIntersection = defaultValue(this.showIntersection, source.showIntersection);
this.intersectionColor = defaultValue(this.intersectionColor, source.intersectionColor);
this.intersectionWidth = defaultValue(this.intersectionWidth, source.intersectionWidth);
this.material = defaultValue(this.material, source.material);
};
return DynamicPyramid;
});