/
DynamicEllipsoid.js
99 lines (91 loc) · 3.11 KB
/
DynamicEllipsoid.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
/*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 ellipsoid.
*
* @alias DynamicEllipsoid
* @constructor
*/
var DynamicEllipsoid = function() {
this._show = undefined;
this._radii = undefined;
this._material = undefined;
this._propertyChanged = new Event();
};
defineProperties(DynamicEllipsoid.prototype, {
/**
* Gets the event that is raised whenever a new property is assigned.
* @memberof DynamicEllipsoid.prototype
* @type {Event}
*/
propertyChanged : {
get : function() {
return this._propertyChanged;
}
},
/**
* Gets or sets the boolean {@link Property} specifying the visibility of the ellipsoid.
* @memberof DynamicEllipsoid.prototype
* @type {Property}
*/
show : createDynamicPropertyDescriptor('show', '_show'),
/**
* Gets or sets the {@link Cartesian3} {@link Property} specifying the radii of the ellipsoid.
* @memberof DynamicEllipsoid.prototype
* @type {Property}
*/
radii : createDynamicPropertyDescriptor('radii', '_radii'),
/**
* Gets or sets the {@link MaterialProperty} specifying the appearance of the ellipsoid.
* @memberof DynamicEllipsoid.prototype
* @type {MaterialProperty}
*/
material : createDynamicPropertyDescriptor('material', '_material')
});
/**
* Duplicates a DynamicEllipsoid instance.
* @memberof DynamicEllipsoid
*
* @param {DynamicEllipsoid} [result] The object onto which to store the result.
* @returns {DynamicEllipsoid} The modified result parameter or a new instance if one was not provided.
*/
DynamicEllipsoid.prototype.clone = function(result) {
if (!defined(result)) {
result = new DynamicEllipsoid();
}
result.show = this.show;
result.radii = this.radii;
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 DynamicEllipsoid
*
* @param {DynamicEllipsoid} source The object to be merged into this object.
* @exception {DeveloperError} source is required.
*/
DynamicEllipsoid.prototype.merge = function(source) {
if (!defined(source)) {
throw new DeveloperError('source is required.');
}
this.show = defaultValue(this.show, source.show);
this.radii = defaultValue(this.radii, source.radii);
this.material = defaultValue(this.material, source.material);
};
return DynamicEllipsoid;
});