From 000e6ba3d3e8f4333c9704fc101ccbe6756ac391 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Fri, 21 Jun 2013 12:14:16 -0400
Subject: [PATCH 01/65] DynamicPositionProperty and
DynamicVertexPositionsProperty cleanup
1. Remove `getValueCartographic`
2. Rename `getValueCartesian` to getValue.
3. Remove `getValueRangeCartesian` since it is unused.
4. Also start to clean up DyanmicDirectionsProperty.
---
.../DynamicBillboardVisualizer.js | 2 +-
.../DynamicConeVisualizerUsingCustomSensor.js | 2 +-
.../DynamicScene/DynamicDirectionsProperty.js | 6 +-
.../DynamicEllipsoidVisualizer.js | 2 +-
Source/DynamicScene/DynamicLabelVisualizer.js | 2 +-
Source/DynamicScene/DynamicObjectView.js | 19 +-
Source/DynamicScene/DynamicPointVisualizer.js | 2 +-
.../DynamicScene/DynamicPolygonVisualizer.js | 4 +-
.../DynamicScene/DynamicPolylineVisualizer.js | 4 +-
.../DynamicScene/DynamicPositionProperty.js | 155 +--------------
.../DynamicScene/DynamicPyramidVisualizer.js | 2 +-
.../DynamicScene/DynamicVectorVisualizer.js | 2 +-
.../DynamicVertexPositionsProperty.js | 43 +----
Source/DynamicScene/GeoJsonDataSource.js | 2 +-
Source/DynamicScene/ReferenceProperty.js | 17 +-
.../DynamicBillboardVisualizerSpec.js | 4 +-
...amicConeVisualizerUsingCustomSensorSpec.js | 2 +-
.../DynamicDirectionsPropertySpec.js | 18 +-
.../DynamicEllipsoidVisualizerSpec.js | 2 +-
.../DynamicLabelVisualizerSpec.js | 4 +-
Specs/DynamicScene/DynamicObjectSpec.js | 4 +-
.../DynamicScene/DynamicPathVisualizerSpec.js | 4 +-
.../DynamicPointVisualizerSpec.js | 4 +-
.../DynamicPolylineVisualizerSpec.js | 4 +-
.../DynamicPositionPropertySpec.js | 181 +++++++-----------
.../DynamicPyramidVisualizerSpec.js | 2 +-
.../DynamicVertexPositionsPropertySpec.js | 137 +++----------
Specs/DynamicScene/GeoJsonDataSourceSpec.js | 24 +--
Specs/DynamicScene/ReferencePropertySpec.js | 28 +--
Specs/MockProperty.js | 11 +-
30 files changed, 172 insertions(+), 521 deletions(-)
diff --git a/Source/DynamicScene/DynamicBillboardVisualizer.js b/Source/DynamicScene/DynamicBillboardVisualizer.js
index eeaaefee8dd4..bb480c5157ed 100644
--- a/Source/DynamicScene/DynamicBillboardVisualizer.js
+++ b/Source/DynamicScene/DynamicBillboardVisualizer.js
@@ -270,7 +270,7 @@ define([
return;
}
- position = positionProperty.getValueCartesian(time, position);
+ position = positionProperty.getValue(time, position);
if (typeof position !== 'undefined') {
billboard.setPosition(position);
}
diff --git a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
index cec7b8fa2f3e..f12e25b61400 100644
--- a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
+++ b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
@@ -344,7 +344,7 @@ define([
}
}
- position = defaultValue(positionProperty.getValueCartesian(time, position), cone._visualizerPosition);
+ position = defaultValue(positionProperty.getValue(time, position), cone._visualizerPosition);
orientation = defaultValue(orientationProperty.getValue(time, orientation), cone._visualizerOrientation);
if (typeof position !== 'undefined' &&
diff --git a/Source/DynamicScene/DynamicDirectionsProperty.js b/Source/DynamicScene/DynamicDirectionsProperty.js
index c0820a9992ba..38344e9bd246 100644
--- a/Source/DynamicScene/DynamicDirectionsProperty.js
+++ b/Source/DynamicScene/DynamicDirectionsProperty.js
@@ -47,7 +47,7 @@ define([
return sphericals;
};
- ValueHolder.prototype.getValueCartesian = function() {
+ ValueHolder.prototype.getValue = function() {
var cartesians = this.cartesian;
if (typeof cartesians === 'undefined') {
cartesians = [];
@@ -124,12 +124,12 @@ define([
* @param {JulianDate} time The time for which to retrieve the value.
* @returns An array of unit cartesian coordinates for the provided time.
*/
- DynamicDirectionsProperty.prototype.getValueCartesian = function(time) {
+ DynamicDirectionsProperty.prototype.getValue = function(time) {
var interval = this._propertyIntervals.findIntervalContainingDate(time);
if (typeof interval === 'undefined') {
return undefined;
}
- return interval.data.getValueCartesian();
+ return interval.data.getValue();
};
function addCzmlInterval(dynamicDirectionsProperty, czmlInterval, constrainedInterval, dynamicObjectCollection) {
diff --git a/Source/DynamicScene/DynamicEllipsoidVisualizer.js b/Source/DynamicScene/DynamicEllipsoidVisualizer.js
index b1ba109ff9ad..0cece99b51f9 100644
--- a/Source/DynamicScene/DynamicEllipsoidVisualizer.js
+++ b/Source/DynamicScene/DynamicEllipsoidVisualizer.js
@@ -238,7 +238,7 @@ define([
ellipsoid.radii = radiiProperty.getValue(time, ellipsoid.radii);
- position = defaultValue(positionProperty.getValueCartesian(time, position), ellipsoid._visualizerPosition);
+ position = defaultValue(positionProperty.getValue(time, position), ellipsoid._visualizerPosition);
orientation = defaultValue(orientationProperty.getValue(time, orientation), ellipsoid._visualizerOrientation);
if (typeof position !== 'undefined' &&
diff --git a/Source/DynamicScene/DynamicLabelVisualizer.js b/Source/DynamicScene/DynamicLabelVisualizer.js
index 9ba92e94e4de..f0ef58237094 100644
--- a/Source/DynamicScene/DynamicLabelVisualizer.js
+++ b/Source/DynamicScene/DynamicLabelVisualizer.js
@@ -245,7 +245,7 @@ define([
label.setText(text);
}
- position = positionProperty.getValueCartesian(time, position);
+ position = positionProperty.getValue(time, position);
if (typeof position !== 'undefined') {
label.setPosition(position);
}
diff --git a/Source/DynamicScene/DynamicObjectView.js b/Source/DynamicScene/DynamicObjectView.js
index 600d2a3daf67..9b3596e7c0ed 100644
--- a/Source/DynamicScene/DynamicObjectView.js
+++ b/Source/DynamicScene/DynamicObjectView.js
@@ -31,7 +31,7 @@ define([
SceneMode) {
"use strict";
- function update2D(that, camera, objectChanged, offset, positionProperty, time, projection) {
+ function update2D(that, camera, objectChanged, offset, positionProperty, time, ellipsoid, projection) {
var viewDistance;
var scene = that.scene;
var modeChanged = scene.mode !== that._mode;
@@ -46,8 +46,9 @@ define([
viewDistance = camera.position.z;
}
- var cartographic = positionProperty.getValueCartographic(time, that._lastCartographic);
- if (typeof cartographic !== 'undefined') {
+ var cartesian = positionProperty.getValue(time, that._lastCartesian);
+ if (typeof cartesian !== 'undefined') {
+ var cartographic = ellipsoid.cartesianToCartographic(cartesian, that._lastCartographic);
//We are assigning the position of the camera, not of the object, so modify the height appropriately.
cartographic.height = viewDistance;
if (objectChanged || modeChanged) {
@@ -88,14 +89,14 @@ define([
function update3D(that, camera, objectChanged, offset, positionProperty, time, ellipsoid) {
update3DController(that, camera, objectChanged, offset);
- var cartesian = positionProperty.getValueCartesian(time, that._lastCartesian);
+ var cartesian = positionProperty.getValue(time, that._lastCartesian);
if (typeof cartesian !== 'undefined') {
var successful = false;
// The time delta was determined based on how fast satellites move compared to vehicles near the surface.
// Slower moving vehicles will most likely default to east-north-up, while faster ones will be LVLH.
var deltaTime = time.addSeconds(0.01);
- var deltaCartesian = positionProperty.getValueCartesian(deltaTime, update3DCartesian3Scratch1);
+ var deltaCartesian = positionProperty.getValue(deltaTime, update3DCartesian3Scratch1);
if (typeof deltaCartesian !== 'undefined' && !Cartesian3.equalsEpsilon(cartesian, deltaCartesian, CesiumMath.EPSILON6)) {
var toInertial = Transforms.computeFixedToIcrfMatrix(time, update3DMatrix3Scratch1);
var toInertialDelta = Transforms.computeFixedToIcrfMatrix(deltaTime, update3DMatrix3Scratch2);
@@ -172,8 +173,10 @@ define([
update3DController(that, camera, objectChanged, offset);
//The swizzling here is intentional because ColumbusView uses a different coordinate system.
- var cartographic = positionProperty.getValueCartographic(time, that._lastCartographic);
- if (typeof cartographic !== 'undefined') {
+ var cartesian = positionProperty.getValue(time, that._lastCartesian);
+ if (typeof cartesian !== 'undefined') {
+ var cartographic = ellipsoid.cartesianToCartographic(cartesian, that._lastCartographic);
+
var projectedPosition = projection.project(cartographic);
updateColumbusCartesian4.x = projectedPosition.z;
updateColumbusCartesian4.y = projectedPosition.x;
@@ -363,7 +366,7 @@ define([
var mode = scene.mode;
if (mode === SceneMode.SCENE2D) {
- update2D(this, scene.getCamera(), objectChanged, offset, positionProperty, time, scene.scene2D.projection);
+ update2D(this, scene.getCamera(), objectChanged, offset, positionProperty, time, ellipsoid, scene.scene2D.projection);
} else if (mode === SceneMode.SCENE3D) {
update3D(this, scene.getCamera(), objectChanged, offset, positionProperty, time, ellipsoid);
} else if (mode === SceneMode.COLUMBUS_VIEW) {
diff --git a/Source/DynamicScene/DynamicPointVisualizer.js b/Source/DynamicScene/DynamicPointVisualizer.js
index e73a87c41ebf..f44af96d2f09 100644
--- a/Source/DynamicScene/DynamicPointVisualizer.js
+++ b/Source/DynamicScene/DynamicPointVisualizer.js
@@ -225,7 +225,7 @@ define([
billboard.setShow(true);
- position = positionProperty.getValueCartesian(time, position);
+ position = positionProperty.getValue(time, position);
if (typeof position !== 'undefined') {
billboard.setPosition(position);
}
diff --git a/Source/DynamicScene/DynamicPolygonVisualizer.js b/Source/DynamicScene/DynamicPolygonVisualizer.js
index dc9515ac69ef..82168f3a893a 100644
--- a/Source/DynamicScene/DynamicPolygonVisualizer.js
+++ b/Source/DynamicScene/DynamicPolygonVisualizer.js
@@ -221,9 +221,9 @@ define(['../Core/Cartesian3',
var vertexPositions;
if (hasVertexPostions) {
- vertexPositions = vertexPositionsProperty.getValueCartesian(time);
+ vertexPositions = vertexPositionsProperty.getValue(time);
} else {
- vertexPositions = ellipseProperty.getValue(time, positionProperty.getValueCartesian(time, cachedPosition));
+ vertexPositions = ellipseProperty.getValue(time, positionProperty.getValue(time, cachedPosition));
}
if (polygon._visualizerPositions !== vertexPositions && //
diff --git a/Source/DynamicScene/DynamicPolylineVisualizer.js b/Source/DynamicScene/DynamicPolylineVisualizer.js
index 7ed7a4a00ba9..a6619e43cb58 100644
--- a/Source/DynamicScene/DynamicPolylineVisualizer.js
+++ b/Source/DynamicScene/DynamicPolylineVisualizer.js
@@ -231,9 +231,9 @@ define([
var vertexPositions;
if (typeof ellipseProperty !== 'undefined') {
- vertexPositions = ellipseProperty.getValue(time, positionProperty.getValueCartesian(time, cachedPosition));
+ vertexPositions = ellipseProperty.getValue(time, positionProperty.getValue(time, cachedPosition));
} else {
- vertexPositions = vertexPositionsProperty.getValueCartesian(time);
+ vertexPositions = vertexPositionsProperty.getValue(time);
}
if (typeof vertexPositions !== 'undefined' && polyline._visualizerPositions !== vertexPositions) {
diff --git a/Source/DynamicScene/DynamicPositionProperty.js b/Source/DynamicScene/DynamicPositionProperty.js
index ee003c4ee6f0..8606a107d413 100644
--- a/Source/DynamicScene/DynamicPositionProperty.js
+++ b/Source/DynamicScene/DynamicPositionProperty.js
@@ -26,7 +26,6 @@ define([
"use strict";
var scratchMatrix3 = new Matrix3();
- var wgs84 = Ellipsoid.WGS84;
function convertToFixed(time, value) {
var icrfToFixed = Transforms.computeIcrfToFixedMatrix(time, scratchMatrix3);
@@ -79,42 +78,6 @@ define([
}
};
- /**
- * Retrieves the value of the object at the supplied time as a Cartographic.
- * @memberof DynamicPositionProperty
- *
- * @param {JulianDate} time The time for which to retrieve the value.
- * @param {Cartographic} [result] The object to store the result onto, if undefined a new instance will be created.
- * @returns The modified result property, or a new instance if result was undefined.
- */
- DynamicPositionProperty.prototype.getValueCartographic = function(time, result) {
- if (typeof time === 'undefined') {
- throw new DeveloperError('time is required.');
- }
-
- var interval = this._cachedInterval;
- if (!JulianDate.equals(this._cachedTime, time)) {
- this._cachedTime = JulianDate.clone(time, this._cachedTime);
- if (typeof interval === 'undefined' || !interval.contains(time)) {
- interval = this._propertyIntervals.findIntervalContainingDate(time);
- this._cachedInterval = interval;
- }
- }
-
- if (typeof interval === 'undefined') {
- return undefined;
- }
- var property = interval.data;
- result = interval.cachedValue = property.getValue(time, interval.cachedValue);
- if (typeof result !== 'undefined') {
- if (interval.data.referenceFrame === ReferenceFrame.INERTIAL) {
- result = convertToFixed(time, result);
- }
- result = wgs84.cartesianToCartographic(result);
- }
- return result;
- };
-
/**
* Retrieves the value of the object at the supplied time as a Cartesian3.
* @memberof DynamicPositionProperty
@@ -123,7 +86,7 @@ define([
* @param {Cartesian3} [result] The object to store the result onto, if undefined a new instance will be created.
* @returns The modified result property, or a new instance if result was undefined.
*/
- DynamicPositionProperty.prototype.getValueCartesian = function(time, result) {
+ DynamicPositionProperty.prototype.getValue = function(time, result) {
if (typeof time === 'undefined') {
throw new DeveloperError('time is required.');
}
@@ -148,122 +111,6 @@ define([
return result;
};
- /**
- * Retrieves all values in the provided time range. Rather than sampling, this
- * method returns the actual data points used in the source data, with the exception
- * of start, stop and currentTime parameters, which will be sampled.
- *
- * @param {JulianDate} start The first time to retrieve values for.
- * @param {JulianDate} stop The last time to retrieve values for .
- * @param {JulianDate} [currentTime] If provided, causes the algorithm to always sample the provided time, assuming it is between start and stop.
- * @param {Array} [result] The array into which to store the result.
- * @returns The modified result array or a new instance if one was not provided.
- */
- DynamicPositionProperty.prototype.getValueRangeCartesian = function(start, stop, currentTime, result) {
- if (typeof start === 'undefined') {
- throw new DeveloperError('start is required');
- }
-
- if (typeof stop === 'undefined') {
- throw new DeveloperError('stop is required');
- }
-
- if (typeof result === 'undefined') {
- result = [];
- }
-
- var propertyIntervals = this._propertyIntervals;
-
- var startIndex = typeof start !== 'undefined' ? propertyIntervals.indexOf(start) : 0;
- var stopIndex = typeof stop !== 'undefined' ? propertyIntervals.indexOf(stop) : propertyIntervals.length - 1;
- if (startIndex < 0) {
- startIndex = ~startIndex;
- }
-
- if (startIndex === propertyIntervals.getLength()) {
- result.length = 0;
- return result;
- }
-
- if (stopIndex < 0) {
- stopIndex = ~stopIndex;
- if (stopIndex !== propertyIntervals.getLength()) {
- result.length = 0;
- return result;
- }
- stopIndex -= 1;
- }
-
- var r = 0;
- //Always step exactly on start (but only use it if it exists.)
- var tmp;
- tmp = this.getValueCartesian(start, result[r]);
- if (typeof tmp !== 'undefined') {
- result[r++] = tmp;
- }
-
- var steppedOnNow = typeof currentTime === 'undefined' || currentTime.lessThan(start) || currentTime.greaterThan(stop);
- for ( var i = startIndex; i < stopIndex + 1; i++) {
- var current;
- var interval = propertyIntervals.get(i);
- var nextInterval = propertyIntervals.get(i + 1);
- var loopStop = stop;
- if (typeof nextInterval !== 'undefined' && stop.greaterThan(nextInterval.start)) {
- loopStop = nextInterval.start;
- }
- var property = interval.data;
- var currentInterval = property._intervals.get(0);
- var times = currentInterval.data.times;
- if (typeof times !== 'undefined') {
- //Iterate over all interval times and add the ones that fall in our
- //time range. Note that times can contain data outside of
- //the intervals range. This is by design for use with interpolation.
- var t;
- for (t = 0; t < times.length; t++) {
- current = times[t];
- if (!steppedOnNow && current.greaterThanOrEquals(currentTime)) {
- tmp = property.getValue(currentTime, result[r]);
- if (typeof tmp !== 'undefined') {
- result[r++] = tmp;
- }
- steppedOnNow = true;
- }
- if (current.greaterThan(start) && current.lessThan(loopStop)) {
- tmp = property.getValue(current, result[r]);
- if (typeof tmp !== 'undefined') {
- result[r++] = tmp;
- }
- }
- }
- } else {
- //If times is undefined, it's because the interval contains a single position
- //at which it stays for the duration of the interval.
- current = interval.start;
-
- //We don't need to actually step on now in this case, since the next value
- //will be the same; but we do still need to check for it.
- steppedOnNow = steppedOnNow || current.greaterThanOrEquals(currentTime);
-
- //Finally, get the value at this non-sampled interval.
- if (current.lessThan(loopStop)) {
- tmp = property.getValue(current, result[r]);
- if (typeof tmp !== 'undefined') {
- result[r++] = tmp;
- }
- }
- }
- }
-
- //Always step exactly on stop (but only use it if it exists.)
- tmp = this.getValueCartesian(stop, result[r]);
- if (typeof tmp !== 'undefined') {
- result[r++] = tmp;
- }
-
- result.length = r;
- return result;
- };
-
DynamicPositionProperty.prototype._addCzmlInterval = function(czmlInterval, constrainedInterval) {
this._cachedTime = undefined;
this._cachedInterval = undefined;
diff --git a/Source/DynamicScene/DynamicPyramidVisualizer.js b/Source/DynamicScene/DynamicPyramidVisualizer.js
index c43feff4221d..92e2a8d608ba 100644
--- a/Source/DynamicScene/DynamicPyramidVisualizer.js
+++ b/Source/DynamicScene/DynamicPyramidVisualizer.js
@@ -249,7 +249,7 @@ define([
pyramid._visualizerDirections = directions;
}
- position = defaultValue(positionProperty.getValueCartesian(time, position), pyramid._visualizerPosition);
+ position = defaultValue(positionProperty.getValue(time, position), pyramid._visualizerPosition);
orientation = defaultValue(orientationProperty.getValue(time, orientation), pyramid._visualizerOrientation);
if (typeof position !== 'undefined' &&
diff --git a/Source/DynamicScene/DynamicVectorVisualizer.js b/Source/DynamicScene/DynamicVectorVisualizer.js
index 3b79c40b5e28..55f47004e730 100644
--- a/Source/DynamicScene/DynamicVectorVisualizer.js
+++ b/Source/DynamicScene/DynamicVectorVisualizer.js
@@ -226,7 +226,7 @@ define([
polyline.setShow(true);
var positions = polyline._visualizerPositions;
- var position = positionProperty.getValueCartesian(time, positions[0]);
+ var position = positionProperty.getValue(time, positions[0]);
var direction = directionProperty.getValue(time, positions[1]);
var length = lengthProperty.getValue(time);
if (typeof position !== 'undefined' && typeof direction !== 'undefined' && typeof length !== 'undefined') {
diff --git a/Source/DynamicScene/DynamicVertexPositionsProperty.js b/Source/DynamicScene/DynamicVertexPositionsProperty.js
index 26b7141ed4ff..ea50ba82669c 100644
--- a/Source/DynamicScene/DynamicVertexPositionsProperty.js
+++ b/Source/DynamicScene/DynamicVertexPositionsProperty.js
@@ -47,14 +47,7 @@ define([
}
}
- ValueHolder.prototype.getValueCartographic = function() {
- if (typeof this.cartographic === 'undefined') {
- this.cartographic = wgs84.cartesianArrayToCartographicArray(this.cartesian);
- }
- return this.cartographic;
- };
-
- ValueHolder.prototype.getValueCartesian = function() {
+ ValueHolder.prototype.getValue = function() {
if (typeof this.cartesian === 'undefined') {
this.cartesian = wgs84.cartographicArrayToCartesianArray(this.cartographic);
}
@@ -102,34 +95,6 @@ define([
}
};
- /**
- * Retrieves the values at the supplied time as Cartographic coordinates.
- * @memberof DynamicVertexPositionsProperty
- *
- * @param {JulianDate} time The time for which to retrieve the value.
- * @returns An array of Cartographic coordinates for the provided time.
- */
- DynamicVertexPositionsProperty.prototype.getValueCartographic = function(time) {
- var interval = this._propertyIntervals.findIntervalContainingDate(time);
- if (typeof interval === 'undefined') {
- return undefined;
- }
- var interval_data = interval.data;
- if (Array.isArray(interval_data)) {
- var result = [];
- for ( var i = 0, len = interval_data.length; i < len; i++) {
- var value = interval_data[i].getValueCartographic(time);
- if (typeof value !== 'undefined') {
- result.push(value);
- }
- }
- return result;
- }
-
- return interval_data.getValueCartographic();
-
- };
-
/**
* Retrieves the values at the supplied time as Cartesian coordinates.
* @memberof DynamicVertexPositionsProperty
@@ -137,7 +102,7 @@ define([
* @param {JulianDate} time The time for which to retrieve the value.
* @returns An array of Cartesian coordinates for the provided time.
*/
- DynamicVertexPositionsProperty.prototype.getValueCartesian = function(time) {
+ DynamicVertexPositionsProperty.prototype.getValue = function(time) {
var interval = this._propertyIntervals.findIntervalContainingDate(time);
if (typeof interval === 'undefined') {
return undefined;
@@ -146,7 +111,7 @@ define([
if (Array.isArray(interval_data)) {
var result = [];
for ( var i = 0, len = interval_data.length; i < len; i++) {
- var value = interval_data[i].getValueCartesian(time);
+ var value = interval_data[i].getValue(time);
if (typeof value !== 'undefined') {
result.push(value);
}
@@ -154,7 +119,7 @@ define([
return result;
}
- return interval_data.getValueCartesian();
+ return interval_data.getValue();
};
DynamicVertexPositionsProperty.prototype._addCzmlInterval = function(czmlInterval, constrainedInterval, dynamicObjectCollection) {
diff --git a/Source/DynamicScene/GeoJsonDataSource.js b/Source/DynamicScene/GeoJsonDataSource.js
index 737e6545269e..16c5e1c63b37 100644
--- a/Source/DynamicScene/GeoJsonDataSource.js
+++ b/Source/DynamicScene/GeoJsonDataSource.js
@@ -40,7 +40,7 @@ define(['../Core/createGuid',
this._value = value;
};
- ConstantPositionProperty.prototype.getValueCartesian = function(time, result) {
+ ConstantPositionProperty.prototype.getValue = function(time, result) {
var value = this._value;
if (typeof value.clone === 'function') {
return value.clone(result);
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index 5304121009ff..61534fc59c80 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -114,19 +114,6 @@ define([
return typeof targetProperty !== 'undefined' && this._targetObject.isAvailable(time) ? targetProperty.getValue(time, result) : undefined;
};
- /**
- * Retrieves the Cartographic value or values of the property at the specified time if the linked property
- * is a DynamicPositionProperty or DynamicVertexPositionsProperty.
- *
- * @param time The time to evaluate the property.
- * @param [result] The object to store the result in, if undefined a new instance will be created.
- * @returns The result parameter or a new instance if the parameter was omitted.
- */
- ReferenceProperty.prototype.getValueCartographic = function(time, result) {
- var targetProperty = resolve(this);
- return typeof targetProperty !== 'undefined' && this._targetObject.isAvailable(time) ? targetProperty.getValueCartographic(time, result) : undefined;
- };
-
/**
* Retrieves the Cartesian value or values of the property at the specified time if the linked property
* is a DynamicPositionProperty, DynamicVertexPositionsProperty, or DynamicDirectionsProperty.
@@ -135,9 +122,9 @@ define([
* @param [result] The object to store the result in, if undefined a new instance will be created.
* @returns The result parameter or a new instance if the parameter was omitted.
*/
- ReferenceProperty.prototype.getValueCartesian = function(time, result) {
+ ReferenceProperty.prototype.getValue = function(time, result) {
var targetProperty = resolve(this);
- return typeof targetProperty !== 'undefined' && this._targetObject.isAvailable(time) ? targetProperty.getValueCartesian(time, result) : undefined;
+ return typeof targetProperty !== 'undefined' && this._targetObject.isAvailable(time) ? targetProperty.getValue(time, result) : undefined;
};
/**
diff --git a/Specs/DynamicScene/DynamicBillboardVisualizerSpec.js b/Specs/DynamicScene/DynamicBillboardVisualizerSpec.js
index 175083201ae3..0b563160f01f 100644
--- a/Specs/DynamicScene/DynamicBillboardVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicBillboardVisualizerSpec.js
@@ -157,7 +157,7 @@ defineSuite([
waitsFor(function() {
visualizer.update(time);
if (bb.getShow()) {
- expect(bb.getPosition()).toEqual(testObject.position.getValueCartesian(time));
+ expect(bb.getPosition()).toEqual(testObject.position.getValue(time));
expect(bb.getColor()).toEqual(testObject.billboard.color.getValue(time));
expect(bb.getEyeOffset()).toEqual(testObject.billboard.eyeOffset.getValue(time));
expect(bb.getScale()).toEqual(testObject.billboard.scale.getValue(time));
@@ -184,7 +184,7 @@ defineSuite([
visualizer.update(time);
var imageReady = bb.getImageIndex() === 1; //true once the green image is loaded
if (imageReady) {
- expect(bb.getPosition()).toEqual(testObject.position.getValueCartesian(time));
+ expect(bb.getPosition()).toEqual(testObject.position.getValue(time));
expect(bb.getColor()).toEqual(testObject.billboard.color.getValue(time));
expect(bb.getEyeOffset()).toEqual(testObject.billboard.eyeOffset.getValue(time));
expect(bb.getScale()).toEqual(testObject.billboard.scale.getValue(time));
diff --git a/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js b/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
index 07b2d9d8793e..d9c2d773c7e5 100644
--- a/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
+++ b/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
@@ -166,7 +166,7 @@ defineSuite([
expect(c.radius).toEqual(testObject.cone.radius.getValue(time));
expect(c.show).toEqual(testObject.cone.show.getValue(time));
expect(c.material).toEqual(testObject.cone.outerMaterial.getValue(time));
- expect(c.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time).conjugate()), testObject.position.getValueCartesian(time)));
+ expect(c.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time).conjugate()), testObject.position.getValue(time)));
cone.show.value = false;
visualizer.update(time);
diff --git a/Specs/DynamicScene/DynamicDirectionsPropertySpec.js b/Specs/DynamicScene/DynamicDirectionsPropertySpec.js
index 4b1f2256043e..b4ab5b1b471d 100644
--- a/Specs/DynamicScene/DynamicDirectionsPropertySpec.js
+++ b/Specs/DynamicScene/DynamicDirectionsPropertySpec.js
@@ -20,22 +20,22 @@ defineSuite([
unitCartesian : [1, 0, 0, 0, 1, 0, 0, 0, 1]
};
- it('getValueCartesian returns undefined if no data exists', function() {
+ it('getValue returns undefined if no data exists', function() {
var property = new DynamicDirectionsProperty();
- expect(property.getValueCartesian(new JulianDate())).toBeUndefined();
+ expect(property.getValue(new JulianDate())).toBeUndefined();
});
- it('getValueCartesian throw if no time supplied', function() {
+ it('getValue throw if no time supplied', function() {
var property = new DynamicDirectionsProperty();
expect(function() {
- property.getValueCartesian();
+ property.getValue();
}).toThrow();
});
- it('getValueCartesian works for cartesian data', function() {
+ it('getValue works for cartesian data', function() {
var property = new DynamicDirectionsProperty();
property.processCzmlIntervals(cartesianInterval);
- var result = property.getValueCartesian(new JulianDate());
+ var result = property.getValue(new JulianDate());
expect(result.length).toEqual(3);
expect(result[0].x).toEqual(cartesianInterval.unitCartesian[0]);
expect(result[0].y).toEqual(cartesianInterval.unitCartesian[1]);
@@ -50,10 +50,10 @@ defineSuite([
expect(result[2].z).toEqual(cartesianInterval.unitCartesian[8]);
});
- it('getValueCartesian works for spherical data', function() {
+ it('getValue works for spherical data', function() {
var property = new DynamicDirectionsProperty();
property.processCzmlIntervals(sphericalInterval);
- var result = property.getValueCartesian(new JulianDate());
+ var result = property.getValue(new JulianDate());
var expected = property.getValueSpherical(new JulianDate());
for ( var i = expected.length - 1; i > -1; i--) {
@@ -79,7 +79,7 @@ defineSuite([
property.processCzmlIntervals(cartesianInterval);
var result = property.getValueSpherical(new JulianDate());
- var expected = property.getValueCartesian(new JulianDate());
+ var expected = property.getValue(new JulianDate());
for ( var i = expected.length - 1; i > -1; i--) {
expected[i] = Spherical.fromCartesian3(expected[i]);
}
diff --git a/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js b/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js
index 0d2e527828fc..7c2d75605ddb 100644
--- a/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js
@@ -151,7 +151,7 @@ defineSuite([
expect(p.radii).toEqual(testObject.ellipsoid.radii.getValue(time));
expect(p.show).toEqual(testObject.ellipsoid.show.getValue(time));
expect(p.material).toEqual(testObject.ellipsoid.material.getValue(time));
- expect(p.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time).conjugate()), testObject.position.getValueCartesian(time)));
+ expect(p.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time).conjugate()), testObject.position.getValue(time)));
ellipsoid.show.value = false;
visualizer.update(time);
diff --git a/Specs/DynamicScene/DynamicLabelVisualizerSpec.js b/Specs/DynamicScene/DynamicLabelVisualizerSpec.js
index e259e25c8112..1ac09902534a 100644
--- a/Specs/DynamicScene/DynamicLabelVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicLabelVisualizerSpec.js
@@ -156,7 +156,7 @@ defineSuite([
l = labelCollection.get(0);
visualizer.update(time);
- expect(l.getPosition()).toEqual(testObject.position.getValueCartesian(time));
+ expect(l.getPosition()).toEqual(testObject.position.getValue(time));
expect(l.getText()).toEqual(testObject.label.text.getValue(time));
expect(l.getFont()).toEqual(testObject.label.font.getValue(time));
expect(l.getStyle()).toEqual(testObject.label.style.getValue(time));
@@ -185,7 +185,7 @@ defineSuite([
label.show = new MockProperty(true);
visualizer.update(time);
- expect(l.getPosition()).toEqual(testObject.position.getValueCartesian(time));
+ expect(l.getPosition()).toEqual(testObject.position.getValue(time));
expect(l.getText()).toEqual(testObject.label.text.getValue(time));
expect(l.getFont()).toEqual(testObject.label.font.getValue(time));
expect(l.getStyle()).toEqual(testObject.label.style.getValue(time));
diff --git a/Specs/DynamicScene/DynamicObjectSpec.js b/Specs/DynamicScene/DynamicObjectSpec.js
index 2084fe965d78..aaaa02fc11a6 100644
--- a/Specs/DynamicScene/DynamicObjectSpec.js
+++ b/Specs/DynamicScene/DynamicObjectSpec.js
@@ -49,7 +49,7 @@ defineSuite([
var dynamicObject = new DynamicObject('dynamicObject');
expect(DynamicObject.processCzmlPacketPosition(dynamicObject, packet)).toEqual(true);
- expect(dynamicObject.position.getValueCartesian(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian3(1.0, 2.0, 3.0));
+ expect(dynamicObject.position.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian3(1.0, 2.0, 3.0));
});
it('processCzmlPacketPosition returns false if no data.', function() {
@@ -87,7 +87,7 @@ defineSuite([
var dynamicObject = new DynamicObject('dynamicObject');
expect(DynamicObject.processCzmlPacketVertexPositions(dynamicObject, packet)).toEqual(true);
- expect(dynamicObject.vertexPositions.getValueCartesian(Iso8601.MINIMUM_VALUE)).toEqual([new Cartesian3(1.0, 2.0, 3.0), new Cartesian3(5.0, 6.0, 7.0)]);
+ expect(dynamicObject.vertexPositions.getValue(Iso8601.MINIMUM_VALUE)).toEqual([new Cartesian3(1.0, 2.0, 3.0), new Cartesian3(5.0, 6.0, 7.0)]);
});
it('processCzmlPacketVertexPositions returns false if no data.', function() {
diff --git a/Specs/DynamicScene/DynamicPathVisualizerSpec.js b/Specs/DynamicScene/DynamicPathVisualizerSpec.js
index 5713697f25f3..4410c87d411c 100644
--- a/Specs/DynamicScene/DynamicPathVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPathVisualizerSpec.js
@@ -123,7 +123,7 @@ defineSuite([
expect(testObject.position.lastStart).toEqual(time.addSeconds(-path.trailTime.getValue()));
expect(testObject.position.lastStop).toEqual(time.addSeconds(path.leadTime.getValue()));
expect(primitive.getShow()).toEqual(testObject.path.show.getValue(time));
- expect(primitive.getPositions()).toEqual(testObject.position.getValueRangeCartesian(time));
+ expect(primitive.getPositions()).toEqual(testObject.position.getValue(time));
expect(primitive.getWidth()).toEqual(testObject.path.width.getValue(time));
var material = primitive.getMaterial();
@@ -139,7 +139,7 @@ defineSuite([
visualizer.update(time);
expect(primitive.getShow()).toEqual(testObject.path.show.getValue(time));
- expect(primitive.getPositions()).toEqual(testObject.position.getValueRangeCartesian(time));
+ expect(primitive.getPositions()).toEqual(testObject.position.getValue(time));
expect(primitive.getWidth()).toEqual(testObject.path.width.getValue(time));
expect(material.uniforms.color).toEqual(testObject.path.color.getValue(time));
diff --git a/Specs/DynamicScene/DynamicPointVisualizerSpec.js b/Specs/DynamicScene/DynamicPointVisualizerSpec.js
index 037042d6e2e8..4c6fd9551ba8 100644
--- a/Specs/DynamicScene/DynamicPointVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPointVisualizerSpec.js
@@ -127,7 +127,7 @@ defineSuite([
visualizer.update(time);
expect(bb.getShow()).toEqual(testObject.point.show.getValue(time));
- expect(bb.getPosition()).toEqual(testObject.position.getValueCartesian(time));
+ expect(bb.getPosition()).toEqual(testObject.position.getValue(time));
expect(bb._visualizerColor).toEqual(testObject.point.color.getValue(time));
expect(bb._visualizerOutlineColor).toEqual(testObject.point.outlineColor.getValue(time));
expect(bb._visualizerOutlineWidth).toEqual(testObject.point.outlineWidth.getValue(time));
@@ -144,7 +144,7 @@ defineSuite([
visualizer.update(time);
expect(bb.getShow()).toEqual(testObject.point.show.getValue(time));
- expect(bb.getPosition()).toEqual(testObject.position.getValueCartesian(time));
+ expect(bb.getPosition()).toEqual(testObject.position.getValue(time));
expect(bb._visualizerColor).toEqual(testObject.point.color.getValue(time));
expect(bb._visualizerOutlineColor).toEqual(testObject.point.outlineColor.getValue(time));
expect(bb._visualizerOutlineWidth).toEqual(testObject.point.outlineWidth.getValue(time));
diff --git a/Specs/DynamicScene/DynamicPolylineVisualizerSpec.js b/Specs/DynamicScene/DynamicPolylineVisualizerSpec.js
index bbc37a717174..d33460537811 100644
--- a/Specs/DynamicScene/DynamicPolylineVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPolylineVisualizerSpec.js
@@ -198,7 +198,7 @@ defineSuite([
var primitive = polylineCollection.get(0);
visualizer.update(time);
expect(primitive.getShow()).toEqual(testObject.polyline.show.getValue(time));
- expect(primitive.getPositions()).toEqual(testObject.vertexPositions.getValueCartesian(time));
+ expect(primitive.getPositions()).toEqual(testObject.vertexPositions.getValue(time));
expect(primitive.getWidth()).toEqual(testObject.polyline.width.getValue(time));
var material = primitive.getMaterial();
@@ -214,7 +214,7 @@ defineSuite([
visualizer.update(time);
expect(primitive.getShow()).toEqual(testObject.polyline.show.getValue(time));
- expect(primitive.getPositions()).toEqual(testObject.vertexPositions.getValueCartesian(time));
+ expect(primitive.getPositions()).toEqual(testObject.vertexPositions.getValue(time));
expect(primitive.getWidth()).toEqual(testObject.polyline.width.getValue(time));
material = primitive.getMaterial();
diff --git a/Specs/DynamicScene/DynamicPositionPropertySpec.js b/Specs/DynamicScene/DynamicPositionPropertySpec.js
index 2cda571dc87d..fcd3cd0de9e7 100644
--- a/Specs/DynamicScene/DynamicPositionPropertySpec.js
+++ b/Specs/DynamicScene/DynamicPositionPropertySpec.js
@@ -31,67 +31,34 @@ defineSuite([
var epoch = JulianDate.fromIso8601(cartesianInterval.epoch);
- it('getValueCartesian returns undefined if no data exists', function() {
+ it('getValue returns undefined if no data exists', function() {
var property = new DynamicPositionProperty();
- expect(property.getValueCartesian(new JulianDate())).toBeUndefined();
+ expect(property.getValue(new JulianDate())).toBeUndefined();
});
- it('getValueCartesian throw if no time supplied', function() {
+ it('getValue throw if no time supplied', function() {
var property = new DynamicPositionProperty();
expect(function() {
- property.getValueCartesian();
+ property.getValue();
}).toThrow();
});
- it('getValueCartesian works for cartesian data', function() {
+ it('getValue works for cartesian data', function() {
var property = new DynamicPositionProperty();
property.processCzmlIntervals(cartesianInterval);
- var result = property.getValueCartesian(epoch);
+ var result = property.getValue(epoch);
expect(result.x).toEqual(100000);
expect(result.y).toEqual(100001);
expect(result.z).toEqual(100002);
});
- it('getValueCartographic returns undefined if no data exists', function() {
- var property = new DynamicPositionProperty();
- expect(property.getValueCartographic(new JulianDate())).toBeUndefined();
- });
-
- it('getValueCartographic throw if no time supplied', function() {
- var property = new DynamicPositionProperty();
- expect(function() {
- property.getValueCartographic();
- }).toThrow();
- });
-
- it('getValueCartographic works for cartesian data', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianInterval);
-
- var cartographic = Ellipsoid.WGS84.cartesianToCartographic(property.getValueCartesian(epoch));
- var result = property.getValueCartographic(epoch);
- expect(result.longitude).toEqual(cartographic.longitude);
- expect(result.latitude).toEqual(cartographic.latitude);
- expect(result.height).toEqual(cartographic.height);
- });
-
- it('getValueCartographic works for cartographic data', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartographicInterval);
-
- var result = property.getValueCartographic(epoch);
- expect(result.longitude).toEqualEpsilon(0.1, CesiumMath.EPSILON16);
- expect(result.latitude).toEqualEpsilon(0.2, CesiumMath.EPSILON16);
- expect(result.height).toEqualEpsilon(1000, CesiumMath.EPSILON8);
- });
-
- it('getValueCartesian works for cartographic data', function() {
+ it('getValue works for cartographic data', function() {
var property = new DynamicPositionProperty();
property.processCzmlIntervals(cartographicInterval);
- var cartesian = Ellipsoid.WGS84.cartographicToCartesian(property.getValueCartographic(epoch));
- var result = property.getValueCartesian(epoch);
+ var cartesian = Ellipsoid.WGS84.cartographicToCartesian(new Cartographic(0.1, 0.2, 1000));
+ var result = property.getValue(epoch);
expect(result.x).toEqualEpsilon(cartesian.x, CesiumMath.EPSILON9);
expect(result.y).toEqualEpsilon(cartesian.y, CesiumMath.EPSILON9);
expect(result.z).toEqualEpsilon(cartesian.z, CesiumMath.EPSILON9);
@@ -106,7 +73,7 @@ defineSuite([
var cartesian6 = new Cartesian3(6.0, 6.0, 6.0);
var cartographic7 = new Cartographic(0.7, 0.7, 0.7);
- var cartesianForgetValueRangeCartesian = {
+ var cartesianFor_getValueRangeInReferenceFrame = {
interval : '2012-08-01T00:00:00Z/2012-08-01T00:00:02Z',
epoch : '2012-08-01T00:00:00Z',
cartesian : [0, cartesian0.x, cartesian0.y, cartesian0.z, 1, cartesian1.x, cartesian1.y, cartesian1.z, 2, cartesian2.x, cartesian2.y, cartesian2.z],
@@ -114,7 +81,7 @@ defineSuite([
interpolationDegree : 1
};
- var cartographicForgetValueRangeCartesian = {
+ var cartographicFor_getValueRangeInReferenceFrame = {
interval : '2012-08-01T00:00:02Z/2012-08-01T00:00:04Z',
epoch : '2012-08-01T00:00:02Z',
cartographicRadians : [0, cartographic3.longitude, cartographic3.latitude, cartographic3.height, 1, cartographic4.longitude, cartographic4.latitude, cartographic4.height, 2, cartographic5.longitude, cartographic5.latitude, cartographic5.height],
@@ -132,25 +99,25 @@ defineSuite([
cartographicRadians : [cartographic7.longitude, cartographic7.latitude, cartographic7.height]
};
- it('getValueRangeCartesian works with single cartesian interval', function() {
+ it('_getValueRangeInReferenceFrame works with single cartesian interval', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianForgetValueRangeCartesian);
- var start = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(0);
- var stop = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(2);
- var result = property.getValueRangeCartesian(start, stop);
+ property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
+ var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(0);
+ var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(2);
+ var result = property._getValueRangeInReferenceFrame(start, stop);
expect(result.length).toEqual(3);
expect(result[0]).toEqual(cartesian0);
expect(result[1]).toEqual(cartesian1);
expect(result[2]).toEqual(cartesian2);
});
- it('getValueRangeCartesian works with single cartesian interval and currentTime', function() {
+ it('_getValueRangeInReferenceFrame works with single cartesian interval and currentTime', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianForgetValueRangeCartesian);
- var start = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(0);
- var stop = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(2);
- var currentTime = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(1.5);
- var result = property.getValueRangeCartesian(start, stop, currentTime);
+ property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
+ var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(0);
+ var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(2);
+ var currentTime = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(1.5);
+ var result = property._getValueRangeInReferenceFrame(start, stop, currentTime);
expect(result.length).toEqual(4);
expect(result[0]).toEqual(cartesian0);
expect(result[1]).toEqual(cartesian1);
@@ -158,18 +125,18 @@ defineSuite([
expect(result[3]).toEqual(cartesian2);
});
- it('getValueRangeCartesian works with a result parameter', function() {
+ it('_getValueRangeInReferenceFrame works with a result parameter', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianForgetValueRangeCartesian);
+ property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
- var start = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(0);
- var stop = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(2);
+ var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(0);
+ var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(2);
var existingCartesian0 = new Cartesian3();
var existingCartesian1 = new Cartesian3();
var existingCartesian2 = new Cartesian3();
var result = [existingCartesian0, existingCartesian1, existingCartesian2, new Cartesian3(), new Cartesian3()];
- var returnedResult = property.getValueRangeCartesian(start, stop, undefined, result);
+ var returnedResult = property._getValueRangeInReferenceFrame(start, stop, undefined, undefined, undefined, result);
expect(result.length).toEqual(3);
expect(result[0]).toEqual(cartesian0);
expect(result[1]).toEqual(cartesian1);
@@ -180,63 +147,63 @@ defineSuite([
expect(result[2]).toBe(existingCartesian2);
});
- it('getValueRangeCartesian does not sample currentTime outside of start/stop time', function() {
+ it('_getValueRangeInReferenceFrame does not sample currentTime outside of start/stop time', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianForgetValueRangeCartesian);
- var start = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(0);
- var stop = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(2);
- var currentTime = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(30);
- var result = property.getValueRangeCartesian(start, stop, currentTime);
+ property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
+ var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(0);
+ var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(2);
+ var currentTime = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(30);
+ var result = property._getValueRangeInReferenceFrame(start, stop, currentTime);
expect(result.length).toEqual(3);
expect(result[0]).toEqual(cartesian0);
expect(result[1]).toEqual(cartesian1);
expect(result[2]).toEqual(cartesian2);
});
- it('getValueRangeCartesian does not sample start/stop if outside of data', function() {
+ it('_getValueRangeInReferenceFrame does not sample start/stop if outside of data', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianForgetValueRangeCartesian);
- var start = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(-100);
- var stop = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(+200);
- var result = property.getValueRangeCartesian(start, stop);
+ property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
+ var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(-100);
+ var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(+200);
+ var result = property._getValueRangeInReferenceFrame(start, stop);
expect(result.length).toEqual(3);
expect(result[0]).toEqual(cartesian0);
expect(result[1]).toEqual(cartesian1);
expect(result[2]).toEqual(cartesian2);
});
- it('getValueRangeCartesian works with single cartographic interval', function() {
+ it('_getValueRangeInReferenceFrame works with single cartographic interval', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartographicForgetValueRangeCartesian);
- var start = JulianDate.fromIso8601(cartographicForgetValueRangeCartesian.epoch).addSeconds(0);
- var stop = JulianDate.fromIso8601(cartographicForgetValueRangeCartesian.epoch).addSeconds(2);
- var result = property.getValueRangeCartesian(start, stop);
+ property.processCzmlIntervals(cartographicFor_getValueRangeInReferenceFrame);
+ var start = JulianDate.fromIso8601(cartographicFor_getValueRangeInReferenceFrame.epoch).addSeconds(0);
+ var stop = JulianDate.fromIso8601(cartographicFor_getValueRangeInReferenceFrame.epoch).addSeconds(2);
+ var result = property._getValueRangeInReferenceFrame(start, stop);
expect(result.length).toEqual(3);
expect(result[0]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic3));
expect(result[1]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic4));
expect(result[2]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic5));
});
- it('getValueRangeCartesian works across intervals', function() {
+ it('_getValueRangeInReferenceFrame works across intervals', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals([cartesianForgetValueRangeCartesian, cartographicForgetValueRangeCartesian]);
+ property.processCzmlIntervals([cartesianFor_getValueRangeInReferenceFrame, cartographicFor_getValueRangeInReferenceFrame]);
- var start = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(1);
- var stop = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(3);
- var result = property.getValueRangeCartesian(start, stop);
+ var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(1);
+ var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(3);
+ var result = property._getValueRangeInReferenceFrame(start, stop);
expect(result.length).toEqual(3);
expect(result[0]).toEqual(cartesian1);
expect(result[1]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic3));
expect(result[2]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic4));
});
- it('getValueRangeCartesian works across non-sampled intervals', function() {
+ it('_getValueRangeInReferenceFrame works across non-sampled intervals', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals([cartesianForgetValueRangeCartesian, cartographicForgetValueRangeCartesian, staticIntervalCartesian]);
+ property.processCzmlIntervals([cartesianFor_getValueRangeInReferenceFrame, cartographicFor_getValueRangeInReferenceFrame, staticIntervalCartesian]);
- var start = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(1);
- var stop = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(6);
- var result = property.getValueRangeCartesian(start, stop);
+ var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(1);
+ var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(6);
+ var result = property._getValueRangeInReferenceFrame(start, stop);
expect(result.length).toEqual(6);
expect(result[0]).toEqual(cartesian1);
expect(result[1]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic3));
@@ -246,13 +213,13 @@ defineSuite([
expect(result[5]).toEqual(cartesian6);
});
- it('getValueRangeCartesian works across non-sampled cartographic intervals', function() {
+ it('_getValueRangeInReferenceFrame works across non-sampled cartographic intervals', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals([cartesianForgetValueRangeCartesian, cartographicForgetValueRangeCartesian, staticIntervalCartographic]);
+ property.processCzmlIntervals([cartesianFor_getValueRangeInReferenceFrame, cartographicFor_getValueRangeInReferenceFrame, staticIntervalCartographic]);
- var start = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(1);
- var stop = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(5);
- var result = property.getValueRangeCartesian(start, stop);
+ var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(1);
+ var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(5);
+ var result = property._getValueRangeInReferenceFrame(start, stop);
expect(result.length).toEqual(5);
expect(result[0]).toEqual(cartesian1);
expect(result[1]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic3));
@@ -261,41 +228,41 @@ defineSuite([
expect(result[4]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic7));
});
- it('getValueRangeCartesian works with no data', function() {
+ it('_getValueRangeInReferenceFrame works with no data', function() {
var property = new DynamicPositionProperty();
- var result = property.getValueRangeCartesian(new JulianDate(), new JulianDate());
+ var result = property._getValueRangeInReferenceFrame(new JulianDate(), new JulianDate());
expect(result.length).toEqual(0);
});
- it('getValueRangeCartesian works if requested interval is before any data.', function() {
+ it('_getValueRangeInReferenceFrame works if requested interval is before any data.', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianForgetValueRangeCartesian);
- var start = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(-10);
- var stop = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(-5);
- var result = property.getValueRangeCartesian(start, stop);
+ property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
+ var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(-10);
+ var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(-5);
+ var result = property._getValueRangeInReferenceFrame(start, stop);
expect(result.length).toEqual(0);
});
- it('getValueRangeCartesian works if requested interval is after all data.', function() {
+ it('_getValueRangeInReferenceFrame works if requested interval is after all data.', function() {
var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianForgetValueRangeCartesian);
- var start = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(10);
- var stop = JulianDate.fromIso8601(cartesianForgetValueRangeCartesian.epoch).addSeconds(5);
- var result = property.getValueRangeCartesian(start, stop);
+ property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
+ var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(10);
+ var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(5);
+ var result = property._getValueRangeInReferenceFrame(start, stop);
expect(result.length).toEqual(0);
});
- it('getValueRangeCartesian throws with no start time', function() {
+ it('_getValueRangeInReferenceFrame throws with no start time', function() {
var property = new DynamicPositionProperty();
expect(function() {
- property.getValueRangeCartesian(undefined, new JulianDate());
+ property._getValueRangeInReferenceFrame(undefined, new JulianDate());
}).toThrow();
});
- it('getValueRangeCartesian throws with no stop time', function() {
+ it('_getValueRangeInReferenceFrame throws with no stop time', function() {
var property = new DynamicPositionProperty();
expect(function() {
- property.getValueRangeCartesian(new JulianDate(), undefined);
+ property._getValueRangeInReferenceFrame(new JulianDate(), undefined);
}).toThrow();
});
});
diff --git a/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js b/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js
index 06128014a6c9..d13a3c825fcf 100644
--- a/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js
@@ -143,7 +143,7 @@ defineSuite([
expect(p.radius).toEqual(testObject.pyramid.radius.getValue(time));
expect(p.show).toEqual(testObject.pyramid.show.getValue(time));
expect(p.material).toEqual(testObject.pyramid.material.getValue(time));
- expect(p.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time).conjugate()), testObject.position.getValueCartesian(time)));
+ expect(p.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time).conjugate()), testObject.position.getValue(time)));
pyramid.show.value = false;
visualizer.update(time);
diff --git a/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js b/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js
index 28fcb0aac30c..9ea08b7a7fd6 100644
--- a/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js
+++ b/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js
@@ -3,6 +3,7 @@ defineSuite([
'DynamicScene/DynamicVertexPositionsProperty',
'DynamicScene/DynamicObjectCollection',
'DynamicScene/processCzml',
+ 'Core/Cartographic',
'Core/JulianDate',
'Core/Math',
'Core/Ellipsoid'
@@ -10,6 +11,7 @@ defineSuite([
DynamicVertexPositionsProperty,
DynamicObjectCollection,
processCzml,
+ Cartographic,
JulianDate,
CesiumMath,
Ellipsoid) {
@@ -50,22 +52,22 @@ defineSuite([
references : ['test1.position', 'test2.position', 'test3.position']
};
- it('getValueCartesian returns undefined if no data exists', function() {
+ it('getValue returns undefined if no data exists', function() {
var property = new DynamicVertexPositionsProperty();
- expect(property.getValueCartesian(new JulianDate())).toBeUndefined();
+ expect(property.getValue(new JulianDate())).toBeUndefined();
});
- it('getValueCartesian throw if no time supplied', function() {
+ it('getValue throw if no time supplied', function() {
var property = new DynamicVertexPositionsProperty();
expect(function() {
- property.getValueCartesian();
+ property.getValue();
}).toThrow();
});
- it('getValueCartesian works for cartesian data', function() {
+ it('getValue works for cartesian data', function() {
var property = new DynamicVertexPositionsProperty();
property.processCzmlIntervals(cartesianInterval);
- var result = property.getValueCartesian(new JulianDate());
+ var result = property.getValue(new JulianDate());
expect(result.length).toEqual(3);
expect(result[0].x).toEqual(cartesianInterval.cartesian[0]);
expect(result[0].y).toEqual(cartesianInterval.cartesian[1]);
@@ -80,12 +82,12 @@ defineSuite([
expect(result[2].z).toEqual(cartesianInterval.cartesian[8]);
});
- it('getValueCartesian works for cartographic degrees data', function() {
+ it('getValue works for cartographic degrees data', function() {
var property = new DynamicVertexPositionsProperty();
property.processCzmlIntervals(cartographicDegreesInterval);
- var result = property.getValueCartesian(new JulianDate());
+ var result = property.getValue(new JulianDate());
- var expected = Ellipsoid.WGS84.cartographicArrayToCartesianArray(property.getValueCartographic(new JulianDate()));
+ var expected = Ellipsoid.WGS84.cartographicArrayToCartesianArray([new Cartographic(CesiumMath.toRadians(10.1), CesiumMath.toRadians(10.2), 10.3), new Cartographic(CesiumMath.toRadians(10.4), CesiumMath.toRadians(10.5), 10.6), new Cartographic(CesiumMath.toRadians(10.7), CesiumMath.toRadians(10.8), 10.9)]);
expect(result.length).toEqual(3);
expect(result[0].x).toEqual(expected[0].x);
@@ -101,12 +103,12 @@ defineSuite([
expect(result[2].z).toEqual(expected[2].z);
});
- it('getValueCartesian works for cartographic radians data', function() {
+ it('getValue works for cartographic radians data', function() {
var property = new DynamicVertexPositionsProperty();
property.processCzmlIntervals(cartographicRadiansInterval);
- var result = property.getValueCartesian(new JulianDate());
+ var result = property.getValue(new JulianDate());
- var expected = Ellipsoid.WGS84.cartographicArrayToCartesianArray(property.getValueCartographic(new JulianDate()));
+ var expected = Ellipsoid.WGS84.cartographicArrayToCartesianArray([new Cartographic(1.1, 1.2, 1.3), new Cartographic(1.4, 1.5, 1.6), new Cartographic(1.7, 1.8, 1.9)]);
expect(result.length).toEqual(3);
expect(result[0].x).toEqual(expected[0].x);
@@ -122,102 +124,7 @@ defineSuite([
expect(result[2].z).toEqual(expected[2].z);
});
- it('getValueCartographic works for cartesian data', function() {
- var property = new DynamicVertexPositionsProperty();
- property.processCzmlIntervals(cartesianInterval);
- var result = property.getValueCartographic(new JulianDate());
-
- var expected = Ellipsoid.WGS84.cartesianArrayToCartographicArray(property.getValueCartesian(new JulianDate()));
-
- expect(result.length).toEqual(3);
- expect(result[0].longitude).toEqual(expected[0].longitude);
- expect(result[0].latitude).toEqual(expected[0].latitude);
- expect(result[0].height).toEqual(expected[0].height);
-
- expect(result[1].longitude).toEqual(expected[1].longitude);
- expect(result[1].latitude).toEqual(expected[1].latitude);
- expect(result[1].height).toEqual(expected[1].height);
-
- expect(result[2].longitude).toEqual(expected[2].longitude);
- expect(result[2].latitude).toEqual(expected[2].latitude);
- expect(result[2].height).toEqual(expected[2].height);
- });
-
- it('getValueCartographic works for cartographic degrees data', function() {
- var property = new DynamicVertexPositionsProperty();
- property.processCzmlIntervals(cartographicDegreesInterval);
- var result = property.getValueCartographic(new JulianDate());
-
- expect(result.length).toEqual(3);
- expect(result[0].longitude).toEqual(CesiumMath.toRadians(cartographicDegreesInterval.cartographicDegrees[0]));
- expect(result[0].latitude).toEqual(CesiumMath.toRadians(cartographicDegreesInterval.cartographicDegrees[1]));
- expect(result[0].height).toEqual(cartographicDegreesInterval.cartographicDegrees[2]);
-
- expect(result[1].longitude).toEqual(CesiumMath.toRadians(cartographicDegreesInterval.cartographicDegrees[3]));
- expect(result[1].latitude).toEqual(CesiumMath.toRadians(cartographicDegreesInterval.cartographicDegrees[4]));
- expect(result[1].height).toEqual(cartographicDegreesInterval.cartographicDegrees[5]);
-
- expect(result[2].longitude).toEqual(CesiumMath.toRadians(cartographicDegreesInterval.cartographicDegrees[6]));
- expect(result[2].latitude).toEqual(CesiumMath.toRadians(cartographicDegreesInterval.cartographicDegrees[7]));
- expect(result[2].height).toEqual(cartographicDegreesInterval.cartographicDegrees[8]);
- });
-
- it('getValueCartographic works for cartographic radians data', function() {
- var property = new DynamicVertexPositionsProperty();
- property.processCzmlIntervals(cartographicRadiansInterval);
- var result = property.getValueCartographic(new JulianDate());
-
- expect(result.length).toEqual(3);
- expect(result[0].longitude).toEqual(cartographicRadiansInterval.cartographicRadians[0]);
- expect(result[0].latitude).toEqual(cartographicRadiansInterval.cartographicRadians[1]);
- expect(result[0].height).toEqual(cartographicRadiansInterval.cartographicRadians[2]);
-
- expect(result[1].longitude).toEqual(cartographicRadiansInterval.cartographicRadians[3]);
- expect(result[1].latitude).toEqual(cartographicRadiansInterval.cartographicRadians[4]);
- expect(result[1].height).toEqual(cartographicRadiansInterval.cartographicRadians[5]);
-
- expect(result[2].longitude).toEqual(cartographicRadiansInterval.cartographicRadians[6]);
- expect(result[2].latitude).toEqual(cartographicRadiansInterval.cartographicRadians[7]);
- expect(result[2].height).toEqual(cartographicRadiansInterval.cartographicRadians[8]);
- });
-
- it('getValueCartographic returns undefined if no data exists', function() {
- var property = new DynamicVertexPositionsProperty();
- expect(property.getValueCartographic(new JulianDate())).toBeUndefined();
- });
-
- it('getValueCartographic throws if no time supplied', function() {
- var property = new DynamicVertexPositionsProperty();
- expect(function() {
- property.getValueCartographic();
- }).toThrow();
- });
-
- it('getValueCartographic works for reference data', function() {
- var objects = new DynamicObjectCollection();
- processCzml(testObjects, objects);
- var test1 = objects.getObject('test1');
- var test2 = objects.getObject('test2');
- var test3 = objects.getObject('test3');
-
- var property = new DynamicVertexPositionsProperty();
- property.processCzmlIntervals(referenceInterval, undefined, objects);
-
- var time = JulianDate.fromIso8601('2011-04-18T15:59:00Z');
- var result = property.getValueCartographic(time);
- expect(result.length).toEqual(2);
- expect(result[0]).toEqual(test1.position.getValueCartographic(time));
- expect(result[1]).toEqual(test2.position.getValueCartographic(time));
-
- time = JulianDate.fromIso8601('2012-04-18T15:59:00Z');
- result = property.getValueCartographic(time);
- expect(result.length).toEqual(3);
- expect(result[0]).toEqual(test1.position.getValueCartographic(time));
- expect(result[1]).toEqual(test2.position.getValueCartographic(time));
- expect(result[2]).toEqual(test3.position.getValueCartographic(time));
- });
-
- it('getValueCartesian works for reference data', function() {
+ it('getValue works for reference data', function() {
var objects = new DynamicObjectCollection();
processCzml(testObjects, objects);
var test1 = objects.getObject('test1');
@@ -228,16 +135,16 @@ defineSuite([
property.processCzmlIntervals(referenceInterval, undefined, objects);
var time = JulianDate.fromIso8601('2011-04-18T15:59:00Z');
- var result = property.getValueCartesian(time);
+ var result = property.getValue(time);
expect(result.length).toEqual(2);
- expect(result[0]).toEqual(test1.position.getValueCartesian(time));
- expect(result[1]).toEqual(test2.position.getValueCartesian(time));
+ expect(result[0]).toEqual(test1.position.getValue(time));
+ expect(result[1]).toEqual(test2.position.getValue(time));
time = JulianDate.fromIso8601('2012-04-18T15:59:00Z');
- result = property.getValueCartesian(time);
+ result = property.getValue(time);
expect(result.length).toEqual(3);
- expect(result[0]).toEqual(test1.position.getValueCartesian(time));
- expect(result[1]).toEqual(test2.position.getValueCartesian(time));
- expect(result[2]).toEqual(test3.position.getValueCartesian(time));
+ expect(result[0]).toEqual(test1.position.getValue(time));
+ expect(result[1]).toEqual(test2.position.getValue(time));
+ expect(result[2]).toEqual(test3.position.getValue(time));
});
});
diff --git a/Specs/DynamicScene/GeoJsonDataSourceSpec.js b/Specs/DynamicScene/GeoJsonDataSourceSpec.js
index 0a72438a9cb3..bd45c805dce8 100644
--- a/Specs/DynamicScene/GeoJsonDataSourceSpec.js
+++ b/Specs/DynamicScene/GeoJsonDataSourceSpec.js
@@ -191,7 +191,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
runs(function() {
var pointObject = dynamicObjectCollection.getObjects()[0];
expect(pointObject.geoJson).toBe(feature);
- expect(pointObject.position.getValueCartesian()).toEqual(coordinatesToCartesian(feature.geometry.coordinates));
+ expect(pointObject.position.getValue()).toEqual(coordinatesToCartesian(feature.geometry.coordinates));
expect(pointObject.point).toBeDefined();
});
});
@@ -223,7 +223,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
runs(function() {
var pointObject = dynamicObjectCollection.getObjects()[0];
expect(pointObject.geoJson).toBe(point);
- expect(pointObject.position.getValueCartesian()).toEqual(coordinatesToCartesian(point.coordinates));
+ expect(pointObject.position.getValue()).toEqual(coordinatesToCartesian(point.coordinates));
expect(pointObject.point).toBeDefined();
});
});
@@ -242,7 +242,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
for ( var i = 0; i < multiPoint.coordinates.length; i++) {
var object = objects[i];
expect(object.geoJson).toBe(multiPoint);
- expect(object.position.getValueCartesian()).toEqual(expectedPositions[i]);
+ expect(object.position.getValue()).toEqual(expectedPositions[i]);
expect(object.point).toBeDefined();
}
});
@@ -259,7 +259,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
runs(function() {
var object = dynamicObjectCollection.getObjects()[0];
expect(object.geoJson).toBe(lineString);
- expect(object.vertexPositions.getValueCartesian()).toEqual(coordinatesArrayToCartesian(lineString.coordinates));
+ expect(object.vertexPositions.getValue()).toEqual(coordinatesArrayToCartesian(lineString.coordinates));
expect(object.polyline).toBeDefined();
});
});
@@ -278,7 +278,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
for ( var i = 0; i < multiLineString.coordinates.length; i++) {
var object = objects[i];
expect(object.geoJson).toBe(multiLineString);
- expect(object.vertexPositions.getValueCartesian()).toEqual(lines[i]);
+ expect(object.vertexPositions.getValue()).toEqual(lines[i]);
expect(object.polyline).toBeDefined();
}
});
@@ -295,7 +295,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
runs(function() {
var object = dynamicObjectCollection.getObjects()[0];
expect(object.geoJson).toBe(polygon);
- expect(object.vertexPositions.getValueCartesian()).toEqual(polygonCoordinatesToCartesian(polygon.coordinates));
+ expect(object.vertexPositions.getValue()).toEqual(polygonCoordinatesToCartesian(polygon.coordinates));
expect(object.polyline).toBeDefined();
expect(object.polygon).toBeDefined();
});
@@ -312,7 +312,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
runs(function() {
var object = dynamicObjectCollection.getObjects()[0];
expect(object.geoJson).toBe(polygonWithHoles);
- expect(object.vertexPositions.getValueCartesian()).toEqual(polygonCoordinatesToCartesian(polygonWithHoles.coordinates));
+ expect(object.vertexPositions.getValue()).toEqual(polygonCoordinatesToCartesian(polygonWithHoles.coordinates));
expect(object.polyline).toBeDefined();
expect(object.polygon).toBeDefined();
});
@@ -332,7 +332,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
for ( var i = 0; i < multiPolygon.coordinates.length; i++) {
var object = objects[i];
expect(object.geoJson).toBe(multiPolygon);
- expect(object.vertexPositions.getValueCartesian()).toEqual(positions[i]);
+ expect(object.vertexPositions.getValue()).toEqual(positions[i]);
expect(object.polyline).toBeDefined();
expect(object.polygon).toBeDefined();
}
@@ -350,12 +350,12 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
runs(function() {
var object = dynamicObjectCollection.getObjects()[0];
expect(object.geoJson).toBe(geometryCollection);
- expect(object.position.getValueCartesian()).toEqual(coordinatesToCartesian(geometryCollection.geometries[0].coordinates));
+ expect(object.position.getValue()).toEqual(coordinatesToCartesian(geometryCollection.geometries[0].coordinates));
expect(object.point).toBeDefined();
object = dynamicObjectCollection.getObjects()[1];
expect(object.geoJson).toBe(geometryCollection);
- expect(object.vertexPositions.getValueCartesian()).toEqual(coordinatesArrayToCartesian(geometryCollection.geometries[1].coordinates));
+ expect(object.vertexPositions.getValue()).toEqual(coordinatesArrayToCartesian(geometryCollection.geometries[1].coordinates));
expect(object.polyline).toBeDefined();
});
});
@@ -370,7 +370,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
});
runs(function() {
var pointObject = dynamicObjectCollection.getObjects()[0];
- expect(pointObject.position.getValueCartesian()).toEqual(coordinatesToCartesian(point.coordinates));
+ expect(pointObject.position.getValue()).toEqual(coordinatesToCartesian(point.coordinates));
});
});
@@ -395,7 +395,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
});
runs(function() {
var pointObject = dynamicObjectCollection.getObjects()[0];
- expect(pointObject.position.getValueCartesian()).toEqual(projectedPosition);
+ expect(pointObject.position.getValue()).toEqual(projectedPosition);
});
});
diff --git a/Specs/DynamicScene/ReferencePropertySpec.js b/Specs/DynamicScene/ReferencePropertySpec.js
index dcd5540c3e12..e90431d41a59 100644
--- a/Specs/DynamicScene/ReferencePropertySpec.js
+++ b/Specs/DynamicScene/ReferencePropertySpec.js
@@ -73,14 +73,9 @@ defineSuite([
expect(property.getValue()).toBeUndefined();
});
- it('getValueCartographic returned undefined for unresolved property', function() {
- var property = ReferenceProperty.fromString(new DynamicObjectCollection(), 'object.property');
- expect(property.getValueCartographic()).toBeUndefined();
- });
-
- it('getValueCartesian returned undefined for unresolved property', function() {
+ it('getValue returned undefined for unresolved property', function() {
var property = ReferenceProperty.fromString(new DynamicObjectCollection(), 'object.property');
- expect(property.getValueCartesian()).toBeUndefined();
+ expect(property.getValue()).toBeUndefined();
});
it('getValueSpherical returned undefined for unresolved property', function() {
@@ -123,26 +118,15 @@ defineSuite([
expect(property.getValue(invalidTime, result)).toBeUndefined();
});
- it('Resolves getValueCartographic property on direct collection', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- createTestObject(dynamicObjectCollection, 'getValueCartographic');
- var property = ReferenceProperty.fromString(dynamicObjectCollection, testObjectLink);
- var result = {};
- expect(property.getValueCartographic(validTime, result)).toEqual(result);
- expect(result.expectedValue).toEqual(true);
- expect(result.expectedTime).toEqual(validTime);
- expect(property.getValueCartographic(invalidTime, result)).toBeUndefined();
- });
-
- it('Resolves getValueCartesian property on direct collection', function() {
+ it('Resolves getValue property on direct collection', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
- createTestObject(dynamicObjectCollection, 'getValueCartesian');
+ createTestObject(dynamicObjectCollection, 'getValue');
var property = ReferenceProperty.fromString(dynamicObjectCollection, testObjectLink);
var result = {};
- expect(property.getValueCartesian(validTime, result)).toEqual(result);
+ expect(property.getValue(validTime, result)).toEqual(result);
expect(result.expectedValue).toEqual(true);
expect(result.expectedTime).toEqual(validTime);
- expect(property.getValueCartesian(invalidTime, result)).toBeUndefined();
+ expect(property.getValue(invalidTime, result)).toBeUndefined();
});
it('Resolves getValueSpherical property on direct collection', function() {
diff --git a/Specs/MockProperty.js b/Specs/MockProperty.js
index a16bc7821a7f..96a3b50898b5 100644
--- a/Specs/MockProperty.js
+++ b/Specs/MockProperty.js
@@ -13,13 +13,6 @@ define(['Core/ReferenceFrame'], function(ReferenceFrame) {
return this.value;
};
- MockProperty.prototype.getValueCartesian = function(time, result) {
- if (typeof this.value !== 'undefined' && typeof this.value.clone === 'function') {
- return this.value.clone(result);
- }
- return this.value;
- };
-
MockProperty.prototype.getValueSpherical = function(time, result) {
if (typeof this.value !== 'undefined' && typeof this.value.clone === 'function') {
return this.value.clone(result);
@@ -31,14 +24,12 @@ define(['Core/ReferenceFrame'], function(ReferenceFrame) {
return ReferenceFrame.FIXED;
};
- MockProperty.prototype.getValueRangeCartesian = function(start, stop, currentTime, result) {
+ MockProperty.prototype._getValueRangeInReferenceFrame = function(start, stop, currentTime, result) {
this.lastStart = start;
this.lastStop = stop;
this.lastCurrentTime = currentTime;
return this.value;
};
- MockProperty.prototype._getValueRangeInReferenceFrame = MockProperty.prototype.getValueRangeCartesian;
-
return MockProperty;
});
\ No newline at end of file
From ebdf1a423321ed0998b6c59867acf224ec0d7dbf Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 24 Jun 2013 14:54:39 -0400
Subject: [PATCH 02/65] Remove getValueSpherical and make it the default result
of getValue for DynamicDirectionsProperty.
In reality, I might abandon what I've done so far in favor of a new approach.
---
.../DynamicScene/DynamicDirectionsProperty.js | 30 +----
.../DynamicScene/DynamicPyramidVisualizer.js | 2 +-
Source/DynamicScene/ReferenceProperty.js | 26 ----
.../DynamicDirectionsPropertySpec.js | 113 +++++-------------
Specs/DynamicScene/DynamicPyramidSpec.js | 6 +-
Specs/DynamicScene/ReferencePropertySpec.js | 21 ----
Specs/MockProperty.js | 7 --
7 files changed, 34 insertions(+), 171 deletions(-)
diff --git a/Source/DynamicScene/DynamicDirectionsProperty.js b/Source/DynamicScene/DynamicDirectionsProperty.js
index 38344e9bd246..0ea05adf6de2 100644
--- a/Source/DynamicScene/DynamicDirectionsProperty.js
+++ b/Source/DynamicScene/DynamicDirectionsProperty.js
@@ -34,7 +34,7 @@ define([
}
}
- ValueHolder.prototype.getValueSpherical = function() {
+ ValueHolder.prototype.getValue = function() {
var sphericals = this.spherical;
if (typeof sphericals === 'undefined') {
sphericals = [];
@@ -47,19 +47,6 @@ define([
return sphericals;
};
- ValueHolder.prototype.getValue = function() {
- var cartesians = this.cartesian;
- if (typeof cartesians === 'undefined') {
- cartesians = [];
- this.cartesian = cartesians;
- var sphericals = this.spherical;
- for ( var i = 0, len = sphericals.length; i < len; i++) {
- cartesians.push(Cartesian3.fromSpherical(sphericals[i]));
- }
- }
- return cartesians;
- };
-
/**
* A dynamic property which maintains an array of directions that can change over time.
* The directions can be represented as both Cartesian and Spherical coordinates.
@@ -109,21 +96,6 @@ define([
* @param {JulianDate} time The time for which to retrieve the value.
* @returns An array of spherical coordinates for the provided time.
*/
- DynamicDirectionsProperty.prototype.getValueSpherical = function(time) {
- var interval = this._propertyIntervals.findIntervalContainingDate(time);
- if (typeof interval === 'undefined') {
- return undefined;
- }
- return interval.data.getValueSpherical();
- };
-
- /**
- * Retrieves the values at the supplied time as unit cartesian coordinates.
- * @memberof DynamicDirectionsProperty
- *
- * @param {JulianDate} time The time for which to retrieve the value.
- * @returns An array of unit cartesian coordinates for the provided time.
- */
DynamicDirectionsProperty.prototype.getValue = function(time) {
var interval = this._propertyIntervals.findIntervalContainingDate(time);
if (typeof interval === 'undefined') {
diff --git a/Source/DynamicScene/DynamicPyramidVisualizer.js b/Source/DynamicScene/DynamicPyramidVisualizer.js
index 92e2a8d608ba..f2f6b586bdf3 100644
--- a/Source/DynamicScene/DynamicPyramidVisualizer.js
+++ b/Source/DynamicScene/DynamicPyramidVisualizer.js
@@ -243,7 +243,7 @@ define([
pyramid.show = true;
- var directions = directionsProperty.getValueSpherical(time);
+ var directions = directionsProperty.getValue(time);
if (typeof directions !== 'undefined' && pyramid._visualizerDirections !== directions) {
pyramid.setDirections(directions);
pyramid._visualizerDirections = directions;
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index 61534fc59c80..e62b92e99679 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -114,31 +114,5 @@ define([
return typeof targetProperty !== 'undefined' && this._targetObject.isAvailable(time) ? targetProperty.getValue(time, result) : undefined;
};
- /**
- * Retrieves the Cartesian value or values of the property at the specified time if the linked property
- * is a DynamicPositionProperty, DynamicVertexPositionsProperty, or DynamicDirectionsProperty.
- *
- * @param time The time to evaluate the property.
- * @param [result] The object to store the result in, if undefined a new instance will be created.
- * @returns The result parameter or a new instance if the parameter was omitted.
- */
- ReferenceProperty.prototype.getValue = function(time, result) {
- var targetProperty = resolve(this);
- return typeof targetProperty !== 'undefined' && this._targetObject.isAvailable(time) ? targetProperty.getValue(time, result) : undefined;
- };
-
- /**
- * Retrieves the Spherical value or values of the property at the specified time if the linked property
- * is a DynamicDirectionsProperty.
- *
- * @param time The time to evaluate the property.
- * @param [result] The object to store the result in, if undefined a new instance will be created.
- * @returns The result parameter or a new instance if the parameter was omitted.
- */
- ReferenceProperty.prototype.getValueSpherical = function(time, result) {
- var targetProperty = resolve(this);
- return typeof targetProperty !== 'undefined' && this._targetObject.isAvailable(time) ? targetProperty.getValueSpherical(time, result) : undefined;
- };
-
return ReferenceProperty;
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/DynamicDirectionsPropertySpec.js b/Specs/DynamicScene/DynamicDirectionsPropertySpec.js
index b4ab5b1b471d..5c8ac4d5a862 100644
--- a/Specs/DynamicScene/DynamicDirectionsPropertySpec.js
+++ b/Specs/DynamicScene/DynamicDirectionsPropertySpec.js
@@ -12,13 +12,23 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- var sphericalInterval = {
- unitSpherical : [0.1, 0.2, 0.3, 0.4, 0.5, 0.6]
- };
-
- var cartesianInterval = {
- unitCartesian : [1, 0, 0, 0, 1, 0, 0, 0, 1]
- };
+ var sphericals;
+ var cartesians;
+ var sphericalInterval;
+ var cartesianInterval;
+
+ beforeAll(function() {
+ cartesians = [new Cartesian3(1, 0, 0), new Cartesian3(0, 1, 0), new Cartesian3(0, 0, 1)];
+ sphericals = [Spherical.fromCartesian3(cartesians[0]), Spherical.fromCartesian3(cartesians[1]), Spherical.fromCartesian3(cartesians[2])];
+
+ sphericalInterval = {
+ unitSpherical : [sphericals[0].clock, sphericals[0].cone, sphericals[1].clock, sphericals[1].cone, sphericals[2].clock, sphericals[2].cone]
+ };
+
+ cartesianInterval = {
+ unitCartesian : [cartesians[0].x, cartesians[0].y, cartesians[0].z, cartesians[1].x, cartesians[1].y, cartesians[1].z, cartesians[2].x, cartesians[2].y, cartesians[2].z]
+ };
+ });
it('getValue returns undefined if no data exists', function() {
var property = new DynamicDirectionsProperty();
@@ -36,96 +46,31 @@ defineSuite([
var property = new DynamicDirectionsProperty();
property.processCzmlIntervals(cartesianInterval);
var result = property.getValue(new JulianDate());
- expect(result.length).toEqual(3);
- expect(result[0].x).toEqual(cartesianInterval.unitCartesian[0]);
- expect(result[0].y).toEqual(cartesianInterval.unitCartesian[1]);
- expect(result[0].z).toEqual(cartesianInterval.unitCartesian[2]);
-
- expect(result[1].x).toEqual(cartesianInterval.unitCartesian[3]);
- expect(result[1].y).toEqual(cartesianInterval.unitCartesian[4]);
- expect(result[1].z).toEqual(cartesianInterval.unitCartesian[5]);
-
- expect(result[2].x).toEqual(cartesianInterval.unitCartesian[6]);
- expect(result[2].y).toEqual(cartesianInterval.unitCartesian[7]);
- expect(result[2].z).toEqual(cartesianInterval.unitCartesian[8]);
+ expect(result.length).toEqual(cartesians.length);
+ expect(result[0]).toEqual(sphericals[0]);
+ expect(result[1]).toEqual(sphericals[1]);
+ expect(result[2]).toEqual(sphericals[2]);
});
it('getValue works for spherical data', function() {
var property = new DynamicDirectionsProperty();
property.processCzmlIntervals(sphericalInterval);
var result = property.getValue(new JulianDate());
-
- var expected = property.getValueSpherical(new JulianDate());
- for ( var i = expected.length - 1; i > -1; i--) {
- expected[i] = Cartesian3.fromSpherical(expected[i]);
- }
-
- expect(result.length).toEqual(3);
- expect(result[0].x).toEqual(expected[0].x);
- expect(result[0].y).toEqual(expected[0].y);
- expect(result[0].z).toEqual(expected[0].z);
-
- expect(result[1].x).toEqual(expected[1].x);
- expect(result[1].y).toEqual(expected[1].y);
- expect(result[1].z).toEqual(expected[1].z);
-
- expect(result[2].x).toEqual(expected[2].x);
- expect(result[2].y).toEqual(expected[2].y);
- expect(result[2].z).toEqual(expected[2].z);
- });
-
- it('getValueSpherical works for cartesian data', function() {
- var property = new DynamicDirectionsProperty();
- property.processCzmlIntervals(cartesianInterval);
- var result = property.getValueSpherical(new JulianDate());
-
- var expected = property.getValue(new JulianDate());
- for ( var i = expected.length - 1; i > -1; i--) {
- expected[i] = Spherical.fromCartesian3(expected[i]);
- }
-
- expect(result.length).toEqual(3);
- expect(result[0].clock).toEqual(expected[0].clock);
- expect(result[0].cone).toEqual(expected[0].cone);
- expect(result[0].magnitude).toEqual(expected[0].magnitude);
-
- expect(result[1].clock).toEqual(expected[1].clock);
- expect(result[1].cone).toEqual(expected[1].cone);
- expect(result[1].magnitude).toEqual(expected[1].magnitude);
-
- expect(result[2].clock).toEqual(expected[2].clock);
- expect(result[2].cone).toEqual(expected[2].cone);
- expect(result[2].magnitude).toEqual(expected[2].magnitude);
+ expect(result.length).toEqual(sphericals.length);
+ expect(result[0]).toEqual(sphericals[0]);
+ expect(result[1]).toEqual(sphericals[1]);
+ expect(result[2]).toEqual(sphericals[2]);
});
- it('getValueSpherical works for spherical data', function() {
- var property = new DynamicDirectionsProperty();
- property.processCzmlIntervals(sphericalInterval);
- var result = property.getValueSpherical(new JulianDate());
-
- expect(result.length).toEqual(3);
- expect(result[0].clock).toEqual(sphericalInterval.unitSpherical[0]);
- expect(result[0].cone).toEqual(sphericalInterval.unitSpherical[1]);
- expect(result[0].magnitude).toEqual(1.0);
-
- expect(result[1].clock).toEqual(sphericalInterval.unitSpherical[2]);
- expect(result[1].cone).toEqual(sphericalInterval.unitSpherical[3]);
- expect(result[1].magnitude).toEqual(1.0);
-
- expect(result[2].clock).toEqual(sphericalInterval.unitSpherical[4]);
- expect(result[2].cone).toEqual(sphericalInterval.unitSpherical[5]);
- expect(result[2].magnitude).toEqual(1.0);
- });
-
- it('getValueSpherical returns undefined if no data exists', function() {
+ it('getValue returns undefined if no data exists', function() {
var property = new DynamicDirectionsProperty();
- expect(property.getValueSpherical(new JulianDate())).toBeUndefined();
+ expect(property.getValue(new JulianDate())).toBeUndefined();
});
- it('getValueSpherical throws if no time supplied', function() {
+ it('getValue throws if no time supplied', function() {
var property = new DynamicDirectionsProperty();
expect(function() {
- property.getValueSpherical();
+ property.getValue();
}).toThrow();
});
});
diff --git a/Specs/DynamicScene/DynamicPyramidSpec.js b/Specs/DynamicScene/DynamicPyramidSpec.js
index cf4f71e491d0..fe9bf099aed5 100644
--- a/Specs/DynamicScene/DynamicPyramidSpec.js
+++ b/Specs/DynamicScene/DynamicPyramidSpec.js
@@ -44,7 +44,7 @@ defineSuite([
expect(DynamicPyramid.processCzmlPacket(dynamicObject, pyramidPacket)).toEqual(true);
expect(dynamicObject.pyramid).toBeDefined();
- expect(dynamicObject.pyramid.directions.getValueSpherical(Iso8601.MINIMUM_VALUE)).toEqual(
+ expect(dynamicObject.pyramid.directions.getValue(Iso8601.MINIMUM_VALUE)).toEqual(
[new Spherical(pyramidPacket.pyramid.directions.unitSpherical[0], pyramidPacket.pyramid.directions.unitSpherical[1]),
new Spherical(pyramidPacket.pyramid.directions.unitSpherical[2], pyramidPacket.pyramid.directions.unitSpherical[3])]);
expect(dynamicObject.pyramid.radius.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.radius);
@@ -84,7 +84,7 @@ defineSuite([
expect(DynamicPyramid.processCzmlPacket(dynamicObject, pyramidPacket)).toEqual(true);
expect(dynamicObject.pyramid).toBeDefined();
- expect(dynamicObject.pyramid.directions.getValueSpherical(validTime)).toEqual(
+ expect(dynamicObject.pyramid.directions.getValue(validTime)).toEqual(
[new Spherical(pyramidPacket.pyramid.directions.unitSpherical[0], pyramidPacket.pyramid.directions.unitSpherical[1]),
new Spherical(pyramidPacket.pyramid.directions.unitSpherical[2], pyramidPacket.pyramid.directions.unitSpherical[3])]);
expect(dynamicObject.pyramid.radius.getValue(validTime)).toEqual(pyramidPacket.pyramid.radius);
@@ -93,7 +93,7 @@ defineSuite([
expect(dynamicObject.pyramid.material.getValue(validTime).uniforms.color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
expect(dynamicObject.pyramid.intersectionColor.getValue(validTime)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
- expect(dynamicObject.pyramid.directions.getValueSpherical(invalidTime)).toBeUndefined();
+ expect(dynamicObject.pyramid.directions.getValue(invalidTime)).toBeUndefined();
expect(dynamicObject.pyramid.radius.getValue(invalidTime)).toBeUndefined();
expect(dynamicObject.pyramid.show.getValue(invalidTime)).toBeUndefined();
expect(dynamicObject.pyramid.showIntersection.getValue(invalidTime)).toBeUndefined();
diff --git a/Specs/DynamicScene/ReferencePropertySpec.js b/Specs/DynamicScene/ReferencePropertySpec.js
index e90431d41a59..ee82a8f991da 100644
--- a/Specs/DynamicScene/ReferencePropertySpec.js
+++ b/Specs/DynamicScene/ReferencePropertySpec.js
@@ -73,16 +73,6 @@ defineSuite([
expect(property.getValue()).toBeUndefined();
});
- it('getValue returned undefined for unresolved property', function() {
- var property = ReferenceProperty.fromString(new DynamicObjectCollection(), 'object.property');
- expect(property.getValue()).toBeUndefined();
- });
-
- it('getValueSpherical returned undefined for unresolved property', function() {
- var property = ReferenceProperty.fromString(new DynamicObjectCollection(), 'object.property');
- expect(property.getValueSpherical()).toBeUndefined();
- });
-
it('Resolves getValue property on direct collection', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
createTestObject(dynamicObjectCollection, 'getValue');
@@ -128,15 +118,4 @@ defineSuite([
expect(result.expectedTime).toEqual(validTime);
expect(property.getValue(invalidTime, result)).toBeUndefined();
});
-
- it('Resolves getValueSpherical property on direct collection', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- createTestObject(dynamicObjectCollection, 'getValueSpherical');
- var property = ReferenceProperty.fromString(dynamicObjectCollection, testObjectLink);
- var result = {};
- expect(property.getValueSpherical(validTime, result)).toEqual(result);
- expect(result.expectedValue).toEqual(true);
- expect(result.expectedTime).toEqual(validTime);
- expect(property.getValueSpherical(invalidTime, result)).toBeUndefined();
- });
});
\ No newline at end of file
diff --git a/Specs/MockProperty.js b/Specs/MockProperty.js
index 96a3b50898b5..03ed7578359a 100644
--- a/Specs/MockProperty.js
+++ b/Specs/MockProperty.js
@@ -13,13 +13,6 @@ define(['Core/ReferenceFrame'], function(ReferenceFrame) {
return this.value;
};
- MockProperty.prototype.getValueSpherical = function(time, result) {
- if (typeof this.value !== 'undefined' && typeof this.value.clone === 'function') {
- return this.value.clone(result);
- }
- return this.value;
- };
-
MockProperty.prototype._getReferenceFrame = function() {
return ReferenceFrame.FIXED;
};
From 3242803aa3816e7befcd0d494fc3675a330b5135 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 27 Jun 2013 11:43:56 -0400
Subject: [PATCH 03/65] Some boilerplate code for a new property system that's
not at all ready yet.
---
Source/DynamicScene/ConstantProperty.js | 21 ++++++-
Source/DynamicScene/Property.js | 54 ++++++++++++++++++
.../TimeIntervalCollectionProperty.js | 56 +++++++++++++++++++
3 files changed, 128 insertions(+), 3 deletions(-)
create mode 100644 Source/DynamicScene/Property.js
create mode 100644 Source/DynamicScene/TimeIntervalCollectionProperty.js
diff --git a/Source/DynamicScene/ConstantProperty.js b/Source/DynamicScene/ConstantProperty.js
index 5f068cf3511e..9e58afa31beb 100644
--- a/Source/DynamicScene/ConstantProperty.js
+++ b/Source/DynamicScene/ConstantProperty.js
@@ -3,18 +3,24 @@ define(function() {
"use strict";
/**
- * Represents a single value which does not change with regard to simulation time.
+ * A {@link Property} which does not change with regard to simulation time.
*
* @alias ConstantProperty
* @constructor
- *
- * @see DynamicProperty
*/
var ConstantProperty = function(value) {
this._value = value;
this._clonable = typeof value !== 'undefined' && typeof value.clone === 'function';
};
+ /**
+ * @memberof ConstantProperty
+ * @returns {Boolean} Always returns false, since this property never varies with simulation time.
+ */
+ ConstantProperty.prototype.getIsTimeVarying = function() {
+ return false;
+ };
+
/**
* Gets the value of the property, optionally cloning it.
* @memberof ConstantProperty
@@ -31,5 +37,14 @@ define(function() {
return value;
};
+ ConstantProperty.prototype.sampleValue = function(start, stop, maximumStep, requiredTimes, resultTimes, resultValues) {
+ resultTimes[0] = start.clone();
+ resultTimes[1] = stop.clone();
+ resultTimes.length = 2;
+ resultValues[0] = this.getValue(start, resultValues[0]);
+ resultValues[1] = this.getValue(stop, resultValues[1]);
+ resultValues.length = 2;
+ };
+
return ConstantProperty;
});
\ No newline at end of file
diff --git a/Source/DynamicScene/Property.js b/Source/DynamicScene/Property.js
new file mode 100644
index 000000000000..13bffbd35924
--- /dev/null
+++ b/Source/DynamicScene/Property.js
@@ -0,0 +1,54 @@
+/*global define*/
+define(['../Core/DeveloperError'
+ ], function(
+ DeveloperError) {
+ "use strict";
+
+ function throwInstantiationError() {
+ throw new DeveloperError('This type should not be instantiated directly.');
+ }
+
+ /**
+ * The base class for all properties, which represent a single value that can optionally
+ * vary over simulation time. This type cannot be instantiated directly.
+ *
+ * @alias Property
+ * @constructor
+ *
+ * @see ConstantProperty
+ * @see DynamicProperty
+ * @see PositionProperty
+ */
+ var Property = throwInstantiationError();
+
+ /**
+ * @memberof Property
+ * @returns {Boolean} True if the property varies with simulation time, false otherwise.
+ */
+ Property.prototype.getIsTimeVarying = throwInstantiationError();
+
+ /**
+ * Returns the value of the property at the specified simulation time.
+ * @memberof Property
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ Property.prototype.getValue = throwInstantiationError();
+
+ /**
+ * Samples the value of the property over time using the specified options.
+ * @memberof Property
+ *
+ * @param {JulianDate} start The time of the first sample. If there is no data at this time, the next earliest time is used.
+ * @param {JulianDate} stop The time of the last sample. If there is no data at this time, the latest previous time is used.
+ * @param {Number} [maximumStep] The suggested maximum step size to take between samples, specific implementations can ignore this value if it can produce an equivalent and optimal set of values.
+ * @param {Array} [requiredTimes] An array of JulianDate instances, sorted by time, earliest first, that must be sampled in addition to any other steps taken by the sampling function.
+ * @param {Object} [resultTimes] An array containing all of the sampled times which corresponds to the result at the same index in resultValues.
+ * @param {Object} [resultValues] An array containing all of the samples values, which correspond to the times
+ */
+ Property.prototype.sampleValue = throwInstantiationError();
+
+ return Property;
+});
\ No newline at end of file
diff --git a/Source/DynamicScene/TimeIntervalCollectionProperty.js b/Source/DynamicScene/TimeIntervalCollectionProperty.js
new file mode 100644
index 000000000000..4ec375e95159
--- /dev/null
+++ b/Source/DynamicScene/TimeIntervalCollectionProperty.js
@@ -0,0 +1,56 @@
+/*global define*/
+define(['../Core/DeveloperError'
+ ], function(
+ DeveloperError) {
+ "use strict";
+
+ function throwInstantiationError() {
+ throw new DeveloperError('This type should not be instantiated directly.');
+ }
+
+ /**
+ * The base class for all properties, which represent a single value that can optionally
+ * vary over simulation time. This type cannot be instantiated directly.
+ *
+ * @alias Property
+ * @constructor
+ *
+ * @see ConstantProperty
+ * @see DynamicProperty
+ * @see PositionProperty
+ */
+ var Property = throwInstantiationError();
+
+ /**
+ * Returns a value indicating if this property varies with simulation time.
+ * @memberof Property
+ *
+ * @returns {Boolean} True if the property varies with simulation time, false otherwise.
+ */
+ Property.prototype.getIsTimeVarying = throwInstantiationError();
+
+ /**
+ * Returns the value of the property at the specified simulation time.
+ * @memberof Property
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ Property.prototype.getValue = throwInstantiationError();
+
+ /**
+ * Returns the value of the property.
+ * @memberof Property
+ *
+ * @param {JulianDate} start The time of the first sample. If there is no data at this time, the next earliest time is used.
+ * @param {JulianDate} stop The time of the last sample. If there is no data at this time, the latest available previous time is used.
+ * @param {Number} [maximumStep] The recommended maximum step size to take between samples, the specific implementation can ignore this value if it can produce an equivalent optimal set of values.
+ * @param {Array} [requiredTimes] An array of JulianDate instances, sorted by time, earliest first, that must be sampled in addition to any other steps taken by the sampling function.
+ * @param {Object} [resultTimes] An array containing all of the sampled times which corresponds to the result at the same index in resultValues.
+ * @param {Object} [resultValues] An array containing all of the samples values, which correspond to the times
+ */
+ Property.prototype.sampleValue = throwInstantiationError();
+
+ return Property;
+});
\ No newline at end of file
From fe597dfc8877bcd44dee991f1033dda3950eb4c0 Mon Sep 17 00:00:00 2001
From: mramato
Date: Wed, 10 Jul 2013 22:03:59 -0400
Subject: [PATCH 04/65] More Property prototyping.
---
Source/DynamicScene/ConstantProperty.js | 10 ++-
Source/DynamicScene/GeoJsonDataSource.js | 27 ++------
Source/DynamicScene/Property.js | 12 +++-
Source/DynamicScene/ReferenceProperty.js | 15 +++++
.../TimeIntervalCollectionProperty.js | 65 ++++++++++++++-----
Specs/DynamicScene/GeoJsonDataSourceSpec.js | 2 +-
6 files changed, 86 insertions(+), 45 deletions(-)
diff --git a/Source/DynamicScene/ConstantProperty.js b/Source/DynamicScene/ConstantProperty.js
index 9e58afa31beb..73830d54e815 100644
--- a/Source/DynamicScene/ConstantProperty.js
+++ b/Source/DynamicScene/ConstantProperty.js
@@ -9,8 +9,9 @@ define(function() {
* @constructor
*/
var ConstantProperty = function(value) {
- this._value = value;
- this._clonable = typeof value !== 'undefined' && typeof value.clone === 'function';
+ this._value = undefined;
+ this._clonable = false;
+ this.setValue(value);
};
/**
@@ -37,6 +38,11 @@ define(function() {
return value;
};
+ ConstantProperty.prototype.setValue = function(value) {
+ this._value = value;
+ this._clonable = typeof value !== 'undefined' && typeof value.clone === 'function';
+ };
+
ConstantProperty.prototype.sampleValue = function(start, stop, maximumStep, requiredTimes, resultTimes, resultValues) {
resultTimes[0] = start.clone();
resultTimes[1] = stop.clone();
diff --git a/Source/DynamicScene/GeoJsonDataSource.js b/Source/DynamicScene/GeoJsonDataSource.js
index 2867bb57901b..bc94653bac40 100644
--- a/Source/DynamicScene/GeoJsonDataSource.js
+++ b/Source/DynamicScene/GeoJsonDataSource.js
@@ -37,21 +37,6 @@ define(['../Core/createGuid',
topojson) {
"use strict";
- //DynamicPositionProperty is pretty hard to use with non-CZML based data
- //For now we create two of our own properties for exposing GeoJSON
- //data.
- var ConstantPositionProperty = function(value) {
- this._value = value;
- };
-
- ConstantPositionProperty.prototype.getValue = function(time, result) {
- var value = this._value;
- if (typeof value.clone === 'function') {
- return value.clone(result);
- }
- return value;
- };
-
//GeoJSON specifies only the Feature object has a usable id property
//But since "multi" geometries create multiple dynamicObject,
//we can't use it for them either.
@@ -123,7 +108,7 @@ define(['../Core/createGuid',
function processPoint(dataSource, geoJson, geometry, crsFunction, source) {
var dynamicObject = createObject(geoJson, dataSource._dynamicObjectCollection);
dynamicObject.merge(dataSource.defaultPoint);
- dynamicObject.position = new ConstantPositionProperty(crsFunction(geometry.coordinates));
+ dynamicObject.position = new ConstantProperty(crsFunction(geometry.coordinates));
}
function processMultiPoint(dataSource, geoJson, geometry, crsFunction, source) {
@@ -131,14 +116,14 @@ define(['../Core/createGuid',
for ( var i = 0; i < coordinates.length; i++) {
var dynamicObject = createObject(geoJson, dataSource._dynamicObjectCollection);
dynamicObject.merge(dataSource.defaultPoint);
- dynamicObject.position = new ConstantPositionProperty(crsFunction(coordinates[i]));
+ dynamicObject.position = new ConstantProperty(crsFunction(coordinates[i]));
}
}
function processLineString(dataSource, geoJson, geometry, crsFunction, source) {
var dynamicObject = createObject(geoJson, dataSource._dynamicObjectCollection);
dynamicObject.merge(dataSource.defaultLine);
- dynamicObject.vertexPositions = new ConstantPositionProperty(coordinatesArrayToCartesianArray(geometry.coordinates, crsFunction));
+ dynamicObject.vertexPositions = new ConstantProperty(coordinatesArrayToCartesianArray(geometry.coordinates, crsFunction));
}
function processMultiLineString(dataSource, geoJson, geometry, crsFunction, source) {
@@ -146,7 +131,7 @@ define(['../Core/createGuid',
for ( var i = 0; i < lineStrings.length; i++) {
var dynamicObject = createObject(geoJson, dataSource._dynamicObjectCollection);
dynamicObject.merge(dataSource.defaultLine);
- dynamicObject.vertexPositions = new ConstantPositionProperty(coordinatesArrayToCartesianArray(lineStrings[i], crsFunction));
+ dynamicObject.vertexPositions = new ConstantProperty(coordinatesArrayToCartesianArray(lineStrings[i], crsFunction));
}
}
@@ -154,7 +139,7 @@ define(['../Core/createGuid',
//TODO Holes
var dynamicObject = createObject(geoJson, dataSource._dynamicObjectCollection);
dynamicObject.merge(dataSource.defaultPolygon);
- dynamicObject.vertexPositions = new ConstantPositionProperty(coordinatesArrayToCartesianArray(geometry.coordinates[0], crsFunction));
+ dynamicObject.vertexPositions = new ConstantProperty(coordinatesArrayToCartesianArray(geometry.coordinates[0], crsFunction));
}
function processTopology(dataSource, geoJson, geometry, crsFunction, source) {
@@ -174,7 +159,7 @@ define(['../Core/createGuid',
var polygon = polygons[i];
var dynamicObject = createObject(geoJson, dataSource._dynamicObjectCollection);
dynamicObject.merge(dataSource.defaultPolygon);
- dynamicObject.vertexPositions = new ConstantPositionProperty(coordinatesArrayToCartesianArray(polygon[0], crsFunction));
+ dynamicObject.vertexPositions = new ConstantProperty(coordinatesArrayToCartesianArray(polygon[0], crsFunction));
}
}
diff --git a/Source/DynamicScene/Property.js b/Source/DynamicScene/Property.js
index 13bffbd35924..c1d03fa1c4a8 100644
--- a/Source/DynamicScene/Property.js
+++ b/Source/DynamicScene/Property.js
@@ -9,19 +9,25 @@ define(['../Core/DeveloperError'
}
/**
- * The base class for all properties, which represent a single value that can optionally
- * vary over simulation time. This type cannot be instantiated directly.
+ * The base class for all properties, which represent a value that can optionally
+ * vary over time. This type cannot be instantiated directly.
*
* @alias Property
* @constructor
*
* @see ConstantProperty
- * @see DynamicProperty
+ * @see SampledProperty
+ * @see CompositeProperty
+ * @see TimeIntervalCollectionProperty
* @see PositionProperty
+ * @see CompositePositionProperty
*/
var Property = throwInstantiationError();
/**
+ * If the property varies with simulation time, this function returns true. If the property
+ * is constant or changes in ways not related to simulation time, this function returns false.
+ *
* @memberof Property
* @returns {Boolean} True if the property varies with simulation time, false otherwise.
*/
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index e62b92e99679..d32e533869a0 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -102,6 +102,18 @@ define([
return new ReferenceProperty(dynamicObjectCollection, parts[0], parts[1]);
};
+ /**
+ * If the property varies with simulation time, this function returns true. If the property
+ * is constant or changes in ways not related to simulation time, this function returns false.
+ *
+ * @memberof Property
+ * @returns {Boolean} True if the property varies with simulation time, false otherwise.
+ */
+ ReferenceProperty.prototype.getIsTimeVarying = function() {
+ var targetProperty = resolve(this);
+ return typeof targetProperty !== 'undefined' ? targetProperty.getIsTimeVarying() : undefined;
+ };
+
/**
* Retrieves the value of the property at the specified time.
*
@@ -114,5 +126,8 @@ define([
return typeof targetProperty !== 'undefined' && this._targetObject.isAvailable(time) ? targetProperty.getValue(time, result) : undefined;
};
+ ReferenceProperty.prototype.sampleValue = function() {
+ };
+
return ReferenceProperty;
});
\ No newline at end of file
diff --git a/Source/DynamicScene/TimeIntervalCollectionProperty.js b/Source/DynamicScene/TimeIntervalCollectionProperty.js
index 4ec375e95159..84eeea59511b 100644
--- a/Source/DynamicScene/TimeIntervalCollectionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionProperty.js
@@ -1,25 +1,37 @@
/*global define*/
-define(['../Core/DeveloperError'
+define(['../Core/defineProperties',
+ '../Core/DeveloperError',
+ '../Core/TimeIntervalCollection'
], function(
- DeveloperError) {
+ defineProperties,
+ DeveloperError,
+ TimeIntervalCollection) {
"use strict";
- function throwInstantiationError() {
- throw new DeveloperError('This type should not be instantiated directly.');
- }
-
/**
- * The base class for all properties, which represent a single value that can optionally
- * vary over simulation time. This type cannot be instantiated directly.
+ * A {@link Property} which is defined by an TimeIntervalCollection, where the
+ * data property of the interval represents the value at simulation time.
*
- * @alias Property
+ * @alias TimeIntervalCollectionProperty
* @constructor
- *
- * @see ConstantProperty
- * @see DynamicProperty
- * @see PositionProperty
*/
- var Property = throwInstantiationError();
+ var TimeIntervalCollectionProperty = function() {
+ this._intervals = new TimeIntervalCollection();
+ };
+
+ defineProperties(TimeIntervalCollectionProperty.prototype, {
+ /**
+ * Gets the interval collection.
+ * @memberof TimeIntervalCollectionProperty.prototype
+ *
+ * @type {TimeIntervalCollection}
+ */
+ interval : {
+ get : function() {
+ return this._intervals;
+ }
+ }
+ });
/**
* Returns a value indicating if this property varies with simulation time.
@@ -27,7 +39,9 @@ define(['../Core/DeveloperError'
*
* @returns {Boolean} True if the property varies with simulation time, false otherwise.
*/
- Property.prototype.getIsTimeVarying = throwInstantiationError();
+ TimeIntervalCollectionProperty.prototype.getIsTimeVarying = function() {
+ return true;
+ };
/**
* Returns the value of the property at the specified simulation time.
@@ -37,7 +51,21 @@ define(['../Core/DeveloperError'
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*/
- Property.prototype.getValue = throwInstantiationError();
+ TimeIntervalCollectionProperty.prototype.getValue = function(time, result) {
+ if (typeof time === 'undefined') {
+ throw new DeveloperError('time is required');
+ }
+
+ var data;
+ var interval = this._intervals.findIntervalContainingDate(time);
+ if (typeof interval !== 'undefined') {
+ data = interval.data;
+ if (typeof data !== 'undefined' && typeof data.clone === 'function') {
+ return data.clone(result);
+ }
+ }
+ return data;
+ };
/**
* Returns the value of the property.
@@ -50,7 +78,8 @@ define(['../Core/DeveloperError'
* @param {Object} [resultTimes] An array containing all of the sampled times which corresponds to the result at the same index in resultValues.
* @param {Object} [resultValues] An array containing all of the samples values, which correspond to the times
*/
- Property.prototype.sampleValue = throwInstantiationError();
+ TimeIntervalCollectionProperty.prototype.sampleValue = function() {
+ };
- return Property;
+ return TimeIntervalCollectionProperty;
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/GeoJsonDataSourceSpec.js b/Specs/DynamicScene/GeoJsonDataSourceSpec.js
index f65db1c25806..da38a3f1ef7d 100644
--- a/Specs/DynamicScene/GeoJsonDataSourceSpec.js
+++ b/Specs/DynamicScene/GeoJsonDataSourceSpec.js
@@ -468,7 +468,7 @@ defineSuite(['DynamicScene/GeoJsonDataSource',
});
runs(function() {
var pointObject = dynamicObjectCollection.getObjects()[0];
- expect(pointObject.position.getValueCartesian()).toEqual(coordinatesToCartesian(point.coordinates));
+ expect(pointObject.position.getValue()).toEqual(coordinatesToCartesian(point.coordinates));
});
});
From 958aae19b15f14c3162ca026f8db1de2f2a6d568 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 30 Jul 2013 11:10:31 -0400
Subject: [PATCH 05/65] Specs for ConstantProperty and
TimeIntervalCollectionProperty.
---
Source/DynamicScene/ConstantProperty.js | 30 ++++----
Source/DynamicScene/Property.js | 6 +-
.../TimeIntervalCollectionProperty.js | 26 +++----
Specs/DynamicScene/ConstantPropertySpec.js | 44 ++++++++++++
.../TimeIntervalCollectionPropertySpec.js | 70 +++++++++++++++++++
5 files changed, 144 insertions(+), 32 deletions(-)
create mode 100644 Specs/DynamicScene/ConstantPropertySpec.js
create mode 100644 Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
diff --git a/Source/DynamicScene/ConstantProperty.js b/Source/DynamicScene/ConstantProperty.js
index 73830d54e815..e05519f1ca91 100644
--- a/Source/DynamicScene/ConstantProperty.js
+++ b/Source/DynamicScene/ConstantProperty.js
@@ -1,17 +1,21 @@
/*global define*/
-define(function() {
+define(['../Core/DeveloperError'], function(DeveloperError) {
"use strict";
/**
- * A {@link Property} which does not change with regard to simulation time.
+ * A {@link Property} whose value never changes.
*
* @alias ConstantProperty
* @constructor
+ *
+ * @exception {DeveloperError} value is required.
*/
var ConstantProperty = function(value) {
- this._value = undefined;
- this._clonable = false;
- this.setValue(value);
+ if (typeof value === 'undefined') {
+ throw new DeveloperError('value is required.');
+ }
+ this._value = value;
+ this._clonable = typeof value !== 'undefined' && typeof value.clone === 'function';
};
/**
@@ -38,18 +42,16 @@ define(function() {
return value;
};
- ConstantProperty.prototype.setValue = function(value) {
- this._value = value;
- this._clonable = typeof value !== 'undefined' && typeof value.clone === 'function';
- };
-
- ConstantProperty.prototype.sampleValue = function(start, stop, maximumStep, requiredTimes, resultTimes, resultValues) {
- resultTimes[0] = start.clone();
- resultTimes[1] = stop.clone();
- resultTimes.length = 2;
+ ConstantProperty.prototype.sampleValue = function(start, stop, resultValues, resultTimes, requiredTimes, maximumStep) {
resultValues[0] = this.getValue(start, resultValues[0]);
resultValues[1] = this.getValue(stop, resultValues[1]);
resultValues.length = 2;
+
+ if (typeof resultTimes !== 'undefined') {
+ resultTimes[0] = start.clone();
+ resultTimes[1] = stop.clone();
+ resultTimes.length = 2;
+ }
};
return ConstantProperty;
diff --git a/Source/DynamicScene/Property.js b/Source/DynamicScene/Property.js
index c1d03fa1c4a8..0fa6f78db83e 100644
--- a/Source/DynamicScene/Property.js
+++ b/Source/DynamicScene/Property.js
@@ -49,10 +49,10 @@ define(['../Core/DeveloperError'
*
* @param {JulianDate} start The time of the first sample. If there is no data at this time, the next earliest time is used.
* @param {JulianDate} stop The time of the last sample. If there is no data at this time, the latest previous time is used.
- * @param {Number} [maximumStep] The suggested maximum step size to take between samples, specific implementations can ignore this value if it can produce an equivalent and optimal set of values.
- * @param {Array} [requiredTimes] An array of JulianDate instances, sorted by time, earliest first, that must be sampled in addition to any other steps taken by the sampling function.
- * @param {Object} [resultTimes] An array containing all of the sampled times which corresponds to the result at the same index in resultValues.
* @param {Object} [resultValues] An array containing all of the samples values, which correspond to the times
+ * @param {Object} [resultTimes] An array containing all of the sampled times which corresponds to the result at the same index in resultValues.
+ * @param {Array} [requiredTimes] An array of JulianDate instances, sorted by time, earliest first, that must be sampled in addition to any other steps taken by the sampling function.
+ * @param {Number} [maximumStep] The suggested maximum step size to take between samples, specific implementations can ignore this value if it can produce an equivalent and optimal set of values.
*/
Property.prototype.sampleValue = throwInstantiationError();
diff --git a/Source/DynamicScene/TimeIntervalCollectionProperty.js b/Source/DynamicScene/TimeIntervalCollectionProperty.js
index 84eeea59511b..aa0ded4901c7 100644
--- a/Source/DynamicScene/TimeIntervalCollectionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionProperty.js
@@ -19,20 +19,6 @@ define(['../Core/defineProperties',
this._intervals = new TimeIntervalCollection();
};
- defineProperties(TimeIntervalCollectionProperty.prototype, {
- /**
- * Gets the interval collection.
- * @memberof TimeIntervalCollectionProperty.prototype
- *
- * @type {TimeIntervalCollection}
- */
- interval : {
- get : function() {
- return this._intervals;
- }
- }
- });
-
/**
* Returns a value indicating if this property varies with simulation time.
* @memberof Property
@@ -78,7 +64,17 @@ define(['../Core/defineProperties',
* @param {Object} [resultTimes] An array containing all of the sampled times which corresponds to the result at the same index in resultValues.
* @param {Object} [resultValues] An array containing all of the samples values, which correspond to the times
*/
- TimeIntervalCollectionProperty.prototype.sampleValue = function() {
+ TimeIntervalCollectionProperty.prototype.sampleValue = function(start, stop, resultValues, resultTimes, requiredTimes, maximumStep) {
+ };
+
+ /**
+ * Gets the interval collection.
+ * @memberof TimeIntervalCollectionProperty.prototype
+ *
+ * @type {TimeIntervalCollection}
+ */
+ TimeIntervalCollectionProperty.prototype.getIntervals = function() {
+ return this._intervals;
};
return TimeIntervalCollectionProperty;
diff --git a/Specs/DynamicScene/ConstantPropertySpec.js b/Specs/DynamicScene/ConstantPropertySpec.js
new file mode 100644
index 000000000000..4260f002fb77
--- /dev/null
+++ b/Specs/DynamicScene/ConstantPropertySpec.js
@@ -0,0 +1,44 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/ConstantProperty',
+ 'Core/Cartesian3'
+ ], function(
+ ConstantProperty,
+ Cartesian3) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('works with non-clonable objects', function() {
+ var expected = {};
+ var property = new ConstantProperty(expected);
+ expect(property.getIsTimeVarying()).toEqual(false);
+ expect(property.getValue()).toBe(expected);
+ });
+
+ it('works with clonable objects', function() {
+ var value = new Cartesian3(1, 2, 3);
+ var property = new ConstantProperty(value);
+ expect(property.getIsTimeVarying()).toEqual(false);
+
+ var result = property.getValue();
+ expect(result).not.toBe(value);
+ expect(result).toEqual(value);
+ });
+
+ it('works with clonable objects with result parameter', function() {
+ var value = new Cartesian3(1, 2, 3);
+ var property = new ConstantProperty(value);
+ expect(property.getIsTimeVarying()).toEqual(false);
+
+ var expected = new Cartesian3();
+ var result = property.getValue(undefined, expected);
+ expect(result).toBe(expected);
+ expect(expected).toEqual(value);
+ });
+
+ it('constructor throws with undefined value', function() {
+ expect(function() {
+ return new ConstantProperty(undefined);
+ }).toThrow();
+ });
+});
\ No newline at end of file
diff --git a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
new file mode 100644
index 000000000000..8ae05a034f3d
--- /dev/null
+++ b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
@@ -0,0 +1,70 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/TimeIntervalCollectionProperty',
+ 'Core/Cartesian3',
+ 'Core/JulianDate',
+ 'Core/TimeInterval',
+ 'Core/TimeIntervalCollection'
+ ], function(
+ TimeIntervalCollectionProperty,
+ Cartesian3,
+ JulianDate,
+ TimeInterval,
+ TimeIntervalCollection) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('default constructor has expected values', function() {
+ var property = new TimeIntervalCollectionProperty();
+ expect(property.getIsTimeVarying()).toEqual(true);
+ expect(property.getIntervals()).toBeInstanceOf(TimeIntervalCollection);
+ expect(property.getValue(new JulianDate())).toBeUndefined();
+ });
+
+ it('works with non-clonable objects', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, {});
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, {});
+
+ var property = new TimeIntervalCollectionProperty();
+ property.getIntervals().addInterval(interval1);
+ property.getIntervals().addInterval(interval2);
+
+ expect(property.getValue(interval1.start)).toBe(interval1.data);
+ expect(property.getValue(interval2.stop)).toBe(interval2.data);
+ });
+
+ it('works with clonable objects', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new Cartesian3(1, 2, 3));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new Cartesian3(4, 5, 6));
+
+ var property = new TimeIntervalCollectionProperty();
+ property.getIntervals().addInterval(interval1);
+ property.getIntervals().addInterval(interval2);
+
+ var result1 = property.getValue(interval1.start);
+ expect(result1).not.toBe(interval1.data);
+ expect(result1).toEqual(interval1.data);
+
+ var result2 = property.getValue(interval2.stop);
+ expect(result2).not.toBe(interval2.data);
+ expect(result2).toEqual(interval2.data);
+ });
+
+ it('works with clonable objects with result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new Cartesian3(1, 2, 3));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new Cartesian3(4, 5, 6));
+
+ var property = new TimeIntervalCollectionProperty();
+ property.getIntervals().addInterval(interval1);
+ property.getIntervals().addInterval(interval2);
+
+ var expected = new Cartesian3();
+ var result1 = property.getValue(interval1.start, expected);
+ expect(result1).toBe(expected);
+ expect(result1).toEqual(interval1.data);
+
+ var result2 = property.getValue(interval2.stop, expected);
+ expect(result2).toBe(expected);
+ expect(result2).toEqual(interval2.data);
+ });
+});
\ No newline at end of file
From 9af153299d6ba81ade0726838ea9c44116a9b336 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 30 Jul 2013 13:07:49 -0400
Subject: [PATCH 06/65] Add a simple CompositeProperty
---
Source/DynamicScene/CompositeProperty.js | 82 +++++++++++++++++++
Specs/DynamicScene/CompositePropertySpec.js | 79 ++++++++++++++++++
.../TimeIntervalCollectionPropertySpec.js | 7 ++
3 files changed, 168 insertions(+)
create mode 100644 Source/DynamicScene/CompositeProperty.js
create mode 100644 Specs/DynamicScene/CompositePropertySpec.js
diff --git a/Source/DynamicScene/CompositeProperty.js b/Source/DynamicScene/CompositeProperty.js
new file mode 100644
index 000000000000..ed1adac614cd
--- /dev/null
+++ b/Source/DynamicScene/CompositeProperty.js
@@ -0,0 +1,82 @@
+/*global define*/
+define(['../Core/defineProperties',
+ '../Core/DeveloperError',
+ '../Core/TimeIntervalCollection'
+ ], function(
+ defineProperties,
+ DeveloperError,
+ TimeIntervalCollection) {
+ "use strict";
+
+ /**
+ * A {@link Property} which is defined by an TimeIntervalCollection, where the
+ * data property of the interval is another Property instance which is evaluated
+ * at the provided time.
+ *
+ * @alias CompositeProperty
+ * @constructor
+ */
+ var CompositeProperty = function() {
+ this._intervals = new TimeIntervalCollection();
+ };
+
+ /**
+ * Returns a value indicating if this property varies with simulation time.
+ * @memberof Property
+ *
+ * @returns {Boolean} True if the property varies with simulation time, false otherwise.
+ */
+ CompositeProperty.prototype.getIsTimeVarying = function() {
+ return true;
+ };
+
+ /**
+ * Returns the value of the property at the specified simulation time.
+ * @memberof Property
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ CompositeProperty.prototype.getValue = function(time, result) {
+ if (typeof time === 'undefined') {
+ throw new DeveloperError('time is required');
+ }
+
+ var data;
+ var interval = this._intervals.findIntervalContainingDate(time);
+ if (typeof interval !== 'undefined') {
+ data = interval.data;
+ if (typeof data !== 'undefined') {
+ return data.getValue(time, result);
+ }
+ }
+ return undefined;
+ };
+
+ /**
+ * Returns the value of the property.
+ * @memberof Property
+ *
+ * @param {JulianDate} start The time of the first sample. If there is no data at this time, the next earliest time is used.
+ * @param {JulianDate} stop The time of the last sample. If there is no data at this time, the latest available previous time is used.
+ * @param {Number} [maximumStep] The recommended maximum step size to take between samples, the specific implementation can ignore this value if it can produce an equivalent optimal set of values.
+ * @param {Array} [requiredTimes] An array of JulianDate instances, sorted by time, earliest first, that must be sampled in addition to any other steps taken by the sampling function.
+ * @param {Object} [resultTimes] An array containing all of the sampled times which corresponds to the result at the same index in resultValues.
+ * @param {Object} [resultValues] An array containing all of the samples values, which correspond to the times
+ */
+ CompositeProperty.prototype.sampleValue = function(start, stop, resultValues, resultTimes, requiredTimes, maximumStep) {
+ };
+
+ /**
+ * Gets the interval collection.
+ * @memberof CompositeProperty.prototype
+ *
+ * @type {TimeIntervalCollection}
+ */
+ CompositeProperty.prototype.getIntervals = function() {
+ return this._intervals;
+ };
+
+ return CompositeProperty;
+});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CompositePropertySpec.js b/Specs/DynamicScene/CompositePropertySpec.js
new file mode 100644
index 000000000000..4aa0adddaa45
--- /dev/null
+++ b/Specs/DynamicScene/CompositePropertySpec.js
@@ -0,0 +1,79 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/CompositeProperty',
+ 'DynamicScene/ConstantProperty',
+ 'Core/Cartesian3',
+ 'Core/JulianDate',
+ 'Core/TimeInterval',
+ 'Core/TimeIntervalCollection'
+ ], function(
+ CompositeProperty,
+ ConstantProperty,
+ Cartesian3,
+ JulianDate,
+ TimeInterval,
+ TimeIntervalCollection) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('default constructor has expected values', function() {
+ var property = new CompositeProperty();
+ expect(property.getIsTimeVarying()).toEqual(true);
+ expect(property.getIntervals()).toBeInstanceOf(TimeIntervalCollection);
+ expect(property.getValue(new JulianDate())).toBeUndefined();
+ });
+
+ it('works with non-clonable objects', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantProperty({}));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantProperty({}));
+
+ var property = new CompositeProperty();
+ property.getIntervals().addInterval(interval1);
+ property.getIntervals().addInterval(interval2);
+
+ expect(property.getValue(interval1.start)).toBe(interval1.data.getValue());
+ expect(property.getValue(interval2.stop)).toBe(interval2.data.getValue());
+ });
+
+ it('works with clonable objects', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantProperty(new Cartesian3(1, 2, 3)));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantProperty(new Cartesian3(4, 5, 6)));
+
+ var property = new CompositeProperty();
+ property.getIntervals().addInterval(interval1);
+ property.getIntervals().addInterval(interval2);
+
+ var result1 = property.getValue(interval1.start);
+ expect(result1).not.toBe(interval1.data.getValue());
+ expect(result1).toEqual(interval1.data.getValue());
+
+ var result2 = property.getValue(interval2.stop);
+ expect(result2).not.toBe(interval2.data.getValue());
+ expect(result2).toEqual(interval2.data.getValue());
+ });
+
+ it('works with clonable objects with result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantProperty(new Cartesian3(1, 2, 3)));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantProperty(new Cartesian3(4, 5, 6)));
+
+ var property = new CompositeProperty();
+ property.getIntervals().addInterval(interval1);
+ property.getIntervals().addInterval(interval2);
+
+ var expected = new Cartesian3();
+ var result1 = property.getValue(interval1.start, expected);
+ expect(result1).toBe(expected);
+ expect(result1).toEqual(interval1.data.getValue());
+
+ var result2 = property.getValue(interval2.stop, expected);
+ expect(result2).toBe(expected);
+ expect(result2).toEqual(interval2.data.getValue());
+ });
+
+ it('throws with no time parameter', function() {
+ var property = new CompositeProperty();
+ expect(function() {
+ property.getValue(undefined);
+ }).toThrow();
+ });
+});
\ No newline at end of file
diff --git a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
index 8ae05a034f3d..c215bdbb308b 100644
--- a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
+++ b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
@@ -67,4 +67,11 @@ defineSuite([
expect(result2).toBe(expected);
expect(result2).toEqual(interval2.data);
});
+
+ it('throws with no time parameter', function() {
+ var property = new TimeIntervalCollectionProperty();
+ expect(function() {
+ property.getValue(undefined);
+ }).toThrow();
+ });
});
\ No newline at end of file
From 9f00ea8518d5529dd74ab42e8be67a5ae1d11865 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 30 Jul 2013 14:14:29 -0400
Subject: [PATCH 07/65] Start of SampledProperty, no where near done.
---
Source/DynamicScene/Property.js | 8 +-
Source/DynamicScene/SampledProperty.js | 233 ++++++++++++++++++++++
Specs/DynamicScene/SampledPropertySpec.js | 22 ++
3 files changed, 259 insertions(+), 4 deletions(-)
create mode 100644 Source/DynamicScene/SampledProperty.js
create mode 100644 Specs/DynamicScene/SampledPropertySpec.js
diff --git a/Source/DynamicScene/Property.js b/Source/DynamicScene/Property.js
index 0fa6f78db83e..0487885e3627 100644
--- a/Source/DynamicScene/Property.js
+++ b/Source/DynamicScene/Property.js
@@ -22,7 +22,7 @@ define(['../Core/DeveloperError'
* @see PositionProperty
* @see CompositePositionProperty
*/
- var Property = throwInstantiationError();
+ var Property = throwInstantiationError;
/**
* If the property varies with simulation time, this function returns true. If the property
@@ -31,7 +31,7 @@ define(['../Core/DeveloperError'
* @memberof Property
* @returns {Boolean} True if the property varies with simulation time, false otherwise.
*/
- Property.prototype.getIsTimeVarying = throwInstantiationError();
+ Property.prototype.getIsTimeVarying = throwInstantiationError;
/**
* Returns the value of the property at the specified simulation time.
@@ -41,7 +41,7 @@ define(['../Core/DeveloperError'
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*/
- Property.prototype.getValue = throwInstantiationError();
+ Property.prototype.getValue = throwInstantiationError;
/**
* Samples the value of the property over time using the specified options.
@@ -54,7 +54,7 @@ define(['../Core/DeveloperError'
* @param {Array} [requiredTimes] An array of JulianDate instances, sorted by time, earliest first, that must be sampled in addition to any other steps taken by the sampling function.
* @param {Number} [maximumStep] The suggested maximum step size to take between samples, specific implementations can ignore this value if it can produce an equivalent and optimal set of values.
*/
- Property.prototype.sampleValue = throwInstantiationError();
+ Property.prototype.sampleValue = throwInstantiationError;
return Property;
});
\ No newline at end of file
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
new file mode 100644
index 000000000000..d222f8d6aedd
--- /dev/null
+++ b/Source/DynamicScene/SampledProperty.js
@@ -0,0 +1,233 @@
+/*global define*/
+define([
+ '../Core/defaultValue',
+ '../Core/DeveloperError',
+ '../Core/JulianDate',
+ '../Core/binarySearch',
+ '../Core/LinearApproximation'
+ ], function(
+ defaultValue,
+ DeveloperError,
+ JulianDate,
+ binarySearch,
+ LinearApproximation) {
+ "use strict";
+
+ var interpolationScratch;
+
+ //We can't use splice for inserting new elements because function apply can't handle
+ //a huge number of arguments. See https://code.google.com/p/chromium/issues/detail?id=56588
+ function arrayInsert(array, startIndex, items) {
+ var i;
+ var arrayLength = array.length;
+ var itemsLength = items.length;
+ var newLength = arrayLength + itemsLength;
+
+ array.length = newLength;
+ if (arrayLength !== startIndex) {
+ var q = arrayLength - 1;
+ for (i = newLength - 1; i >= startIndex; i--) {
+ array[i] = array[q--];
+ }
+ }
+
+ for (i = 0; i < itemsLength; i++) {
+ array[startIndex++] = items[i];
+ }
+ }
+
+ //Converts a CZML defined data into a JulianDate, regardless of whether it was
+ //specified in epoch seconds or as an ISO8601 string.
+ function czmlDateToJulianDate(date, epoch) {
+ if (typeof date === 'string') {
+ return JulianDate.fromIso8601(date);
+ }
+ return epoch.addSeconds(date);
+ }
+
+ var _mergeNewSamples = function(epoch, times, values, newData, doublesPerValue) {
+ var newDataIndex = 0;
+ var i;
+ var prevItem;
+ var timesInsertionPoint;
+ var valuesInsertionPoint;
+ var timesSpliceArgs;
+ var valuesSpliceArgs;
+ var currentTime;
+ var nextTime;
+
+ while (newDataIndex < newData.length) {
+ currentTime = czmlDateToJulianDate(newData[newDataIndex], epoch);
+ timesInsertionPoint = binarySearch(times, currentTime, JulianDate.compare);
+
+ if (timesInsertionPoint < 0) {
+ //Doesn't exist, insert as many additional values as we can.
+ timesInsertionPoint = ~timesInsertionPoint;
+ timesSpliceArgs = [];
+
+ valuesInsertionPoint = timesInsertionPoint * doublesPerValue;
+ valuesSpliceArgs = [];
+ prevItem = undefined;
+ nextTime = times[timesInsertionPoint];
+ while (newDataIndex < newData.length) {
+ currentTime = czmlDateToJulianDate(newData[newDataIndex], epoch);
+ if ((typeof prevItem !== 'undefined' && JulianDate.compare(prevItem, currentTime) >= 0) || (typeof nextTime !== 'undefined' && JulianDate.compare(currentTime, nextTime) >= 0)) {
+ break;
+ }
+ timesSpliceArgs.push(currentTime);
+ newDataIndex = newDataIndex + 1;
+ for (i = 0; i < doublesPerValue; i++) {
+ valuesSpliceArgs.push(newData[newDataIndex]);
+ newDataIndex = newDataIndex + 1;
+ }
+ prevItem = currentTime;
+ }
+
+ arrayInsert(values, valuesInsertionPoint, valuesSpliceArgs);
+ arrayInsert(times, timesInsertionPoint, timesSpliceArgs);
+ } else {
+ //Found an exact match
+ for (i = 0; i < doublesPerValue; i++) {
+ newDataIndex++;
+ values[(timesInsertionPoint * doublesPerValue) + i] = newData[newDataIndex];
+ }
+ newDataIndex++;
+ }
+ }
+ };
+
+ /**
+ * A {@link Property} whose value never changes.
+ *
+ * @alias SampledProperty
+ * @constructor
+ *
+ * @exception {DeveloperError} value is required.
+ */
+ var SampledProperty = function(valueType) {
+ this.interpolationAlgorithm = LinearApproximation;
+ this.interpolationDegree = 1;
+ this.numberOfPoints = LinearApproximation.getRequiredDataPoints(1);
+ this.times = [];
+ this.values = [];
+ this.xTable = new Array(this.numberOfPoints);
+ this.yTable = new Array(this.numberOfPoints * valueType.doublesPerInterpolationValue, 1);
+ this.valueType = valueType;
+ };
+
+ /**
+ * @memberof SampledProperty
+ * @returns {Boolean} Always returns false, since this property never varies with simulation time.
+ */
+ SampledProperty.prototype.getIsTimeVarying = function() {
+ return true;
+ };
+
+ /**
+ * Gets the value of the property, optionally cloning it.
+ * @memberof SampledProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the value. This parameter is unused.
+ * @param {Object} [result] The object to store the value into if the value is clonable. If the result is omitted or the value does not implement clone, the actual value is returned.
+ * @returns The modified result parameter or the actual value instance if the value is not clonable.
+ */
+ SampledProperty.prototype.getValue = function(time, result) {
+ var valueType = this.valueType;
+ var times = this.times;
+ var values = this.values;
+ var doublesPerValue = valueType.doublesPerValue;
+ var index = binarySearch(times, time, JulianDate.compare);
+ if (index < 0) {
+ if (this.numberOfPoints < 2) {
+ return undefined;
+ }
+ index = ~index;
+
+ if (index >= times.length) {
+ index = times.length - 1;
+ }
+
+ var firstIndex = 0;
+ var lastIndex = times.length - 1;
+
+ var degree = this.numberOfPoints - 1;
+ var pointsInCollection = lastIndex - firstIndex + 1;
+
+ if (pointsInCollection < degree + 1) {
+ // Use the entire range.
+ } else {
+ var computedFirstIndex = index - ((degree / 2) | 0) - 1;
+ if (computedFirstIndex < firstIndex) {
+ computedFirstIndex = firstIndex;
+ }
+ var computedLastIndex = computedFirstIndex + degree;
+ if (computedLastIndex > lastIndex) {
+ computedLastIndex = lastIndex;
+ computedFirstIndex = computedLastIndex - degree;
+ if (computedFirstIndex < firstIndex) {
+ computedFirstIndex = firstIndex;
+ }
+ }
+
+ firstIndex = computedFirstIndex;
+ lastIndex = computedLastIndex;
+ }
+
+ var length = lastIndex - firstIndex + 1;
+
+ var doublesPerInterpolationValue = valueType.doublesPerInterpolationValue;
+ var xTable = this.xTable;
+ var yTable = this.yTable;
+
+ if (typeof xTable === 'undefined') {
+ xTable = this.xTable = new Array(this.numberOfPoints);
+ yTable = this.yTable = new Array(this.numberOfPoints * doublesPerInterpolationValue);
+ }
+
+ // Build the tables
+ for ( var i = 0; i < length; ++i) {
+ xTable[i] = times[lastIndex].getSecondsDifference(times[firstIndex + i]);
+ }
+ var specializedPackFunction = valueType.packValuesForInterpolation;
+ if (typeof specializedPackFunction === 'undefined') {
+ var destinationIndex = 0;
+ var sourceIndex = firstIndex * doublesPerValue;
+ var stop = (lastIndex + 1) * doublesPerValue;
+
+ while (sourceIndex < stop) {
+ yTable[destinationIndex] = values[sourceIndex];
+ sourceIndex++;
+ destinationIndex++;
+ }
+ } else {
+ specializedPackFunction(values, yTable, firstIndex, lastIndex);
+ }
+
+ // Interpolate!
+ var x = times[lastIndex].getSecondsDifference(time);
+ interpolationScratch = this.interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, doublesPerInterpolationValue, interpolationScratch);
+
+ var specializedGetFunction = valueType.getValueFromInterpolationResult;
+ if (typeof specializedGetFunction === 'undefined') {
+ return valueType.getValueFromArray(interpolationScratch, 0, result);
+ }
+ return specializedGetFunction(interpolationScratch, result, values, firstIndex, lastIndex);
+ }
+ return valueType.getValueFromArray(this.values, index * doublesPerValue, result);
+ };
+
+ SampledProperty.prototype.sampleValue = function(start, stop, resultValues, resultTimes, requiredTimes, maximumStep) {
+ };
+
+ SampledProperty.prototype.addSample = function(time, value) {
+ };
+
+ SampledProperty.prototype.addSamples = function(times, values) {
+ };
+
+ SampledProperty.prototype.addSamplesFlatArray = function(data, epoch) {
+ _mergeNewSamples(epoch, this.times, this.values, data, this.valueType.doublesPerValue);
+ };
+
+ return SampledProperty;
+});
\ No newline at end of file
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
new file mode 100644
index 000000000000..2a288ec2dcef
--- /dev/null
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -0,0 +1,22 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/SampledProperty',
+ 'DynamicScene/CzmlNumber',
+ 'Core/JulianDate'
+ ], function(
+ SampledProperty,
+ CzmlNumber,
+ JulianDate) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('works with non-clonable objects', function() {
+ var data = [0, 7, 1, 8, 2, 9];
+ var epoch = new JulianDate();
+
+ var property = new SampledProperty(CzmlNumber);
+ property.addSamplesFlatArray(data, epoch);
+ expect(property.getIsTimeVarying()).toEqual(true);
+ expect(property.getValue(epoch)).toEqual(7);
+ });
+});
\ No newline at end of file
From 6f9d62da976c3ac66987e36282cd7481286612ac Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 6 Aug 2013 15:22:58 -0400
Subject: [PATCH 08/65] Ongoing SampledProperty work.
---
Source/DynamicScene/SampledProperty.js | 235 +++++++++++++++++++---
Specs/DynamicScene/SampledPropertySpec.js | 36 +++-
2 files changed, 234 insertions(+), 37 deletions(-)
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index d222f8d6aedd..462be402a26e 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -1,20 +1,163 @@
/*global define*/
define([
+ '../Core/binarySearch',
'../Core/defaultValue',
+ '../Core/Cartesian2',
+ '../Core/Cartesian3',
+ '../Core/Color',
'../Core/DeveloperError',
'../Core/JulianDate',
- '../Core/binarySearch',
- '../Core/LinearApproximation'
- ], function(
+ '../Core/LinearApproximation',
+ '../Core/Quaternion'
+ ], function(
+ binarySearch,
defaultValue,
+ Cartesian2,
+ Cartesian3,
+ Color,
DeveloperError,
JulianDate,
- binarySearch,
- LinearApproximation) {
+ LinearApproximation,
+ Quaternion) {
"use strict";
var interpolationScratch;
+ var SampledCartesian2 = {
+ doublesPerValue : 2,
+ doublesPerInterpolationValue : 2,
+ flatten : function(array, value) {
+ array.push(value.x);
+ array.push(value.y);
+ },
+ inflate : function(array, startingIndex, result) {
+ if (typeof result === 'undefined') {
+ result = new Cartesian2();
+ }
+ result.x = array[startingIndex];
+ result.y = array[startingIndex + 1];
+ return result;
+ }
+ };
+
+ var SampledCartesian3 = {
+ doublesPerValue : 3,
+ doublesPerInterpolationValue : 3,
+ flatten : function(array, value) {
+ array.push(value.x);
+ array.push(value.y);
+ array.push(value.z);
+ },
+ inflate : function(array, startingIndex, result) {
+ if (typeof result === 'undefined') {
+ result = new Cartesian3();
+ }
+ result.x = array[startingIndex];
+ result.y = array[startingIndex + 1];
+ result.z = array[startingIndex + 2];
+ return result;
+ }
+ };
+
+ var SampledColor = {
+ doublesPerValue : 4,
+ doublesPerInterpolationValue : 4,
+ flatten : function(array, startingIndex, result) {
+ if (typeof result === 'undefined') {
+ result = new Color();
+ }
+ result.red = array[startingIndex];
+ result.green = array[startingIndex + 1];
+ result.blue = array[startingIndex + 2];
+ result.alpha = array[startingIndex + 3];
+ return result;
+ },
+ inflate : function(array, startingIndex, result) {
+ if (typeof result === 'undefined') {
+ result = new Color();
+ }
+ result.red = array[startingIndex];
+ result.green = array[startingIndex + 1];
+ result.blue = array[startingIndex + 2];
+ result.alpha = array[startingIndex + 3];
+ return result;
+ }
+ };
+
+ var SampledNumber = {
+ doublesPerValue : 1,
+ doublesPerInterpolationValue : 1,
+ flatten : function(array, value) {
+ array.push(value);
+ },
+ inflate : function(array, startingIndex) {
+ return array[startingIndex];
+ }
+ };
+
+ var sampledQuaternionAxis = new Cartesian3();
+ var sampledQuaternionRotation = new Cartesian3();
+ var sampledQuaternionTempQuaternion = new Quaternion();
+ var sampledQuaternionQuaternion0 = new Quaternion();
+ var sampledQuaternionQuaternion0Conjugate = new Quaternion();
+
+ var SampledQuaternion = {
+ doublesPerValue : 4,
+ doublesPerInterpolationValue : 3,
+ packValuesForInterpolation : function(sourceArray, destinationArray, firstIndex, lastIndex) {
+ SampledQuaternion.inflate(sourceArray, lastIndex * 4, sampledQuaternionQuaternion0Conjugate);
+ sampledQuaternionQuaternion0Conjugate.conjugate(sampledQuaternionQuaternion0Conjugate);
+
+ for ( var i = 0, len = lastIndex - firstIndex + 1; i < len; i++) {
+ var offset = i * 3;
+ SampledQuaternion.inflate(sourceArray, (firstIndex + i) * 4, sampledQuaternionTempQuaternion);
+
+ sampledQuaternionTempQuaternion.multiply(sampledQuaternionQuaternion0Conjugate, sampledQuaternionTempQuaternion);
+
+ if (sampledQuaternionTempQuaternion.w < 0) {
+ sampledQuaternionTempQuaternion.negate(sampledQuaternionTempQuaternion);
+ }
+
+ sampledQuaternionTempQuaternion.getAxis(sampledQuaternionAxis);
+ var angle = sampledQuaternionTempQuaternion.getAngle();
+ destinationArray[offset] = sampledQuaternionAxis.x * angle;
+ destinationArray[offset + 1] = sampledQuaternionAxis.y * angle;
+ destinationArray[offset + 2] = sampledQuaternionAxis.z * angle;
+ }
+ },
+ inflate : function(array, startingIndex, result) {
+ if (typeof result === 'undefined') {
+ result = new Quaternion();
+ }
+ result.x = array[startingIndex];
+ result.y = array[startingIndex + 1];
+ result.z = array[startingIndex + 2];
+ result.w = array[startingIndex + 3];
+ return result;
+ },
+ inflateInterpolationResult : function(array, result, sourceArray, firstIndex, lastIndex) {
+ if (typeof result === 'undefined') {
+ result = new Quaternion();
+ }
+ sampledQuaternionRotation.x = array[0];
+ sampledQuaternionRotation.y = array[1];
+ sampledQuaternionRotation.z = array[2];
+ var magnitude = sampledQuaternionRotation.magnitude();
+
+ SampledQuaternion.inflate(sourceArray, lastIndex * 4, sampledQuaternionQuaternion0);
+
+ if (magnitude === 0) {
+ //Can't just use Quaternion.IDENTITY here because sampledQuaternionTempQuaternion may be modified in the future.
+ sampledQuaternionTempQuaternion.x = sampledQuaternionTempQuaternion.y = sampledQuaternionTempQuaternion.z = 0.0;
+ sampledQuaternionTempQuaternion.w = 1.0;
+ } else {
+ Quaternion.fromAxisAngle(sampledQuaternionRotation, magnitude, sampledQuaternionTempQuaternion);
+ }
+
+ return sampledQuaternionTempQuaternion.multiply(sampledQuaternionQuaternion0, result);
+ }
+ };
+
//We can't use splice for inserting new elements because function apply can't handle
//a huge number of arguments. See https://code.google.com/p/chromium/issues/detail?id=56588
function arrayInsert(array, startIndex, items) {
@@ -36,9 +179,10 @@ define([
}
}
- //Converts a CZML defined data into a JulianDate, regardless of whether it was
- //specified in epoch seconds or as an ISO8601 string.
- function czmlDateToJulianDate(date, epoch) {
+ function convertDate(date, epoch) {
+ if (date instanceof JulianDate) {
+ return date;
+ }
if (typeof date === 'string') {
return JulianDate.fromIso8601(date);
}
@@ -57,7 +201,7 @@ define([
var nextTime;
while (newDataIndex < newData.length) {
- currentTime = czmlDateToJulianDate(newData[newDataIndex], epoch);
+ currentTime = convertDate(newData[newDataIndex], epoch);
timesInsertionPoint = binarySearch(times, currentTime, JulianDate.compare);
if (timesInsertionPoint < 0) {
@@ -70,7 +214,7 @@ define([
prevItem = undefined;
nextTime = times[timesInsertionPoint];
while (newDataIndex < newData.length) {
- currentTime = czmlDateToJulianDate(newData[newDataIndex], epoch);
+ currentTime = convertDate(newData[newDataIndex], epoch);
if ((typeof prevItem !== 'undefined' && JulianDate.compare(prevItem, currentTime) >= 0) || (typeof nextTime !== 'undefined' && JulianDate.compare(currentTime, nextTime) >= 0)) {
break;
}
@@ -104,15 +248,31 @@ define([
*
* @exception {DeveloperError} value is required.
*/
- var SampledProperty = function(valueType) {
+ var SampledProperty = function(type) {
+ var typeHandler;
+ if (typeof type === 'undefined') {
+ typeHandler = SampledNumber;
+ } else if (type === Cartesian2) {
+ typeHandler = SampledCartesian2;
+ } else if (type === Cartesian3) {
+ typeHandler = SampledCartesian3;
+ } else if (type === Color) {
+ typeHandler = SampledColor;
+ } else if (type === Quaternion) {
+ typeHandler = Quaternion;
+ } else {
+ throw new DeveloperError('unknown type');
+ }
+
+ this.type = type;
+ this._typeHandler = typeHandler;
this.interpolationAlgorithm = LinearApproximation;
this.interpolationDegree = 1;
this.numberOfPoints = LinearApproximation.getRequiredDataPoints(1);
- this.times = [];
- this.values = [];
- this.xTable = new Array(this.numberOfPoints);
- this.yTable = new Array(this.numberOfPoints * valueType.doublesPerInterpolationValue, 1);
- this.valueType = valueType;
+ this._times = [];
+ this._values = [];
+ this._xTable = new Array(this.numberOfPoints);
+ this._yTable = new Array(this.numberOfPoints * typeHandler.doublesPerInterpolationValue, 1);
};
/**
@@ -132,10 +292,10 @@ define([
* @returns The modified result parameter or the actual value instance if the value is not clonable.
*/
SampledProperty.prototype.getValue = function(time, result) {
- var valueType = this.valueType;
- var times = this.times;
- var values = this.values;
- var doublesPerValue = valueType.doublesPerValue;
+ var typeHandler = this._typeHandler;
+ var times = this._times;
+ var values = this._values;
+ var doublesPerValue = typeHandler.doublesPerValue;
var index = binarySearch(times, time, JulianDate.compare);
if (index < 0) {
if (this.numberOfPoints < 2) {
@@ -175,20 +335,20 @@ define([
var length = lastIndex - firstIndex + 1;
- var doublesPerInterpolationValue = valueType.doublesPerInterpolationValue;
- var xTable = this.xTable;
- var yTable = this.yTable;
+ var doublesPerInterpolationValue = typeHandler.doublesPerInterpolationValue;
+ var xTable = this._xTable;
+ var yTable = this._yTable;
if (typeof xTable === 'undefined') {
- xTable = this.xTable = new Array(this.numberOfPoints);
- yTable = this.yTable = new Array(this.numberOfPoints * doublesPerInterpolationValue);
+ xTable = this._xTable = new Array(this.numberOfPoints);
+ yTable = this._yTable = new Array(this.numberOfPoints * doublesPerInterpolationValue);
}
// Build the tables
for ( var i = 0; i < length; ++i) {
xTable[i] = times[lastIndex].getSecondsDifference(times[firstIndex + i]);
}
- var specializedPackFunction = valueType.packValuesForInterpolation;
+ var specializedPackFunction = typeHandler.packValuesForInterpolation;
if (typeof specializedPackFunction === 'undefined') {
var destinationIndex = 0;
var sourceIndex = firstIndex * doublesPerValue;
@@ -207,26 +367,37 @@ define([
var x = times[lastIndex].getSecondsDifference(time);
interpolationScratch = this.interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, doublesPerInterpolationValue, interpolationScratch);
- var specializedGetFunction = valueType.getValueFromInterpolationResult;
- if (typeof specializedGetFunction === 'undefined') {
- return valueType.getValueFromArray(interpolationScratch, 0, result);
+ if (typeof typeHandler.inflateInterpolationResult === 'undefined') {
+ return typeHandler.inflate(interpolationScratch, 0, result);
}
- return specializedGetFunction(interpolationScratch, result, values, firstIndex, lastIndex);
+ return typeHandler.inflateInterpolationResult(interpolationScratch, result, values, firstIndex, lastIndex);
}
- return valueType.getValueFromArray(this.values, index * doublesPerValue, result);
+ return typeHandler.inflate(this._values, index * doublesPerValue, result);
};
SampledProperty.prototype.sampleValue = function(start, stop, resultValues, resultTimes, requiredTimes, maximumStep) {
};
SampledProperty.prototype.addSample = function(time, value) {
+ var typeHandler = this._typeHandler;
+ var data = [time];
+ typeHandler.flatten(data, value);
+ _mergeNewSamples(undefined, this._times, this._values, data, typeHandler.doublesPerValue);
};
SampledProperty.prototype.addSamples = function(times, values) {
+ var typeHandler = this._typeHandler;
+ var length = times.length;
+ var data = [];
+ for ( var i = 0; i < length; i++) {
+ data.push(times[i]);
+ typeHandler.flatten(data, values[i]);
+ }
+ _mergeNewSamples(undefined, this._times, this._values, data, typeHandler.doublesPerValue);
};
SampledProperty.prototype.addSamplesFlatArray = function(data, epoch) {
- _mergeNewSamples(epoch, this.times, this.values, data, this.valueType.doublesPerValue);
+ _mergeNewSamples(epoch, this._times, this._values, data, this._typeHandler.doublesPerValue);
};
return SampledProperty;
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index 2a288ec2dcef..6c5dcd16d7ba 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -1,22 +1,48 @@
/*global defineSuite*/
defineSuite([
'DynamicScene/SampledProperty',
- 'DynamicScene/CzmlNumber',
'Core/JulianDate'
], function(
SampledProperty,
- CzmlNumber,
JulianDate) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('works with non-clonable objects', function() {
+ it('addSamplesFlatArray works', function() {
var data = [0, 7, 1, 8, 2, 9];
- var epoch = new JulianDate();
+ var epoch = new JulianDate(0, 0);
- var property = new SampledProperty(CzmlNumber);
+ var property = new SampledProperty();
property.addSamplesFlatArray(data, epoch);
expect(property.getIsTimeVarying()).toEqual(true);
expect(property.getValue(epoch)).toEqual(7);
+ expect(property.getValue(new JulianDate(0, 0.5))).toEqual(7.5);
+ });
+
+ it('addSample works', function() {
+ var values = [7, 8, 9];
+ var times = [new JulianDate(0, 0), new JulianDate(1, 0), new JulianDate(2, 0)];
+
+ var property = new SampledProperty();
+ property.addSample(times[0], values[0]);
+ property.addSample(times[1], values[1]);
+ property.addSample(times[2], values[2]);
+
+ expect(property.getValue(times[0])).toEqual(values[0]);
+ expect(property.getValue(times[1])).toEqual(values[1]);
+ expect(property.getValue(times[2])).toEqual(values[2]);
+ expect(property.getValue(new JulianDate(0.5, 0))).toEqual(7.5);
+ });
+
+ it('addSamples works', function() {
+ var values = [7, 8, 9];
+ var times = [new JulianDate(0, 0), new JulianDate(1, 0), new JulianDate(2, 0)];
+
+ var property = new SampledProperty();
+ property.addSamples(times, values);
+ expect(property.getValue(times[0])).toEqual(values[0]);
+ expect(property.getValue(times[1])).toEqual(values[1]);
+ expect(property.getValue(times[2])).toEqual(values[2]);
+ expect(property.getValue(new JulianDate(0.5, 0))).toEqual(7.5);
});
});
\ No newline at end of file
From d457ff6d92d8a1e83433e9240a52097f295b2ae4 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 8 Aug 2013 11:34:19 -0400
Subject: [PATCH 09/65] Start major overhaul of CZML processing to use new
property system.
---
Source/DynamicScene/DynamicBillboard.js | 112 +++---------------
Source/DynamicScene/DynamicPolyline.js | 64 ++--------
Source/DynamicScene/processPacketData.js | 95 +++++++++++++++
.../CompositeDynamicObjectCollectionSpec.js | 4 +-
4 files changed, 125 insertions(+), 150 deletions(-)
create mode 100644 Source/DynamicScene/processPacketData.js
diff --git a/Source/DynamicScene/DynamicBillboard.js b/Source/DynamicScene/DynamicBillboard.js
index d30c45e6a7d0..2e44584393c7 100644
--- a/Source/DynamicScene/DynamicBillboard.js
+++ b/Source/DynamicScene/DynamicBillboard.js
@@ -10,7 +10,7 @@ define([
'./CzmlHorizontalOrigin',
'./CzmlVerticalOrigin',
'./CzmlColor',
- './DynamicProperty'
+ './processPacketData'
], function(
TimeInterval,
defaultValue,
@@ -22,7 +22,7 @@ define([
CzmlHorizontalOrigin,
CzmlVerticalOrigin,
CzmlColor,
- DynamicProperty) {
+ processPacketData) {
"use strict";
/**
@@ -128,107 +128,27 @@ define([
return false;
}
- var billboardUpdated = false;
- var billboard = dynamicObject.billboard;
- billboardUpdated = typeof billboard === 'undefined';
- if (billboardUpdated) {
- dynamicObject.billboard = billboard = new DynamicBillboard();
- }
-
var interval = billboardData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof billboardData.color !== 'undefined') {
- var color = billboard.color;
- if (typeof color === 'undefined') {
- billboard.color = color = new DynamicProperty(CzmlColor);
- billboardUpdated = true;
- }
- color.processCzmlIntervals(billboardData.color, interval);
- }
-
- if (typeof billboardData.eyeOffset !== 'undefined') {
- var eyeOffset = billboard.eyeOffset;
- if (typeof eyeOffset === 'undefined') {
- billboard.eyeOffset = eyeOffset = new DynamicProperty(CzmlCartesian3);
- billboardUpdated = true;
- }
- eyeOffset.processCzmlIntervals(billboardData.eyeOffset, interval);
- }
-
- if (typeof billboardData.horizontalOrigin !== 'undefined') {
- var horizontalOrigin = billboard.horizontalOrigin;
- if (typeof horizontalOrigin === 'undefined') {
- billboard.horizontalOrigin = horizontalOrigin = new DynamicProperty(CzmlHorizontalOrigin);
- billboardUpdated = true;
- }
- horizontalOrigin.processCzmlIntervals(billboardData.horizontalOrigin, interval);
- }
-
- if (typeof billboardData.image !== 'undefined') {
- var image = billboard.image;
- if (typeof image === 'undefined') {
- billboard.image = image = new DynamicProperty(CzmlImage);
- billboardUpdated = true;
- }
- image.processCzmlIntervals(billboardData.image, interval, sourceUri);
- }
-
- if (typeof billboardData.pixelOffset !== 'undefined') {
- var pixelOffset = billboard.pixelOffset;
- if (typeof pixelOffset === 'undefined') {
- billboard.pixelOffset = pixelOffset = new DynamicProperty(CzmlCartesian2);
- billboardUpdated = true;
- }
- pixelOffset.processCzmlIntervals(billboardData.pixelOffset, interval);
- }
-
- if (typeof billboardData.scale !== 'undefined') {
- var scale = billboard.scale;
- if (typeof scale === 'undefined') {
- billboard.scale = scale = new DynamicProperty(CzmlNumber);
- billboardUpdated = true;
- }
- scale.processCzmlIntervals(billboardData.scale, interval);
- }
-
- if (typeof billboardData.rotation !== 'undefined') {
- var rotation = billboard.rotation;
- if (typeof rotation === 'undefined') {
- billboard.rotation = rotation = new DynamicProperty(CzmlNumber);
- billboardUpdated = true;
- }
- rotation.processCzmlIntervals(billboardData.rotation, interval);
- }
-
- if (typeof billboardData.alignedAxis !== 'undefined') {
- var alignedAxis = billboard.alignedAxis;
- if (typeof alignedAxis === 'undefined') {
- billboard.alignedAxis = alignedAxis = new DynamicProperty(CzmlCartesian3);
- billboardUpdated = true;
- }
- alignedAxis.processCzmlIntervals(billboardData.alignedAxis, interval);
- }
-
- if (typeof billboardData.show !== 'undefined') {
- var show = billboard.show;
- if (typeof show === 'undefined') {
- billboard.show = show = new DynamicProperty(CzmlBoolean);
- billboardUpdated = true;
- }
- show.processCzmlIntervals(billboardData.show, interval);
+ var billboard = dynamicObject.billboard;
+ var billboardUpdated = typeof billboard === 'undefined';
+ if (billboardUpdated) {
+ dynamicObject.billboard = billboard = new DynamicBillboard();
}
- if (typeof billboardData.verticalOrigin !== 'undefined') {
- var verticalOrigin = billboard.verticalOrigin;
- if (typeof verticalOrigin === 'undefined') {
- billboard.verticalOrigin = verticalOrigin = new DynamicProperty(CzmlVerticalOrigin);
- billboardUpdated = true;
- }
- verticalOrigin.processCzmlIntervals(billboardData.verticalOrigin, interval);
- }
+ billboardUpdated = processPacketData(CzmlColor, billboard, 'color', billboardData.color, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(CzmlCartesian3, billboard, 'eyeOffset', billboardData.eyeOffset, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(CzmlHorizontalOrigin, billboard, 'horizontalOrigin', billboardData.horizontalOrigin, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(CzmlImage, billboard, 'image', billboardData.image, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(CzmlCartesian2, billboard, 'pixelOffset', billboardData.pixelOffset, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(CzmlNumber, billboard, 'scale', billboardData.scale, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(CzmlNumber, billboard, 'rotation', billboardData.rotation, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(CzmlCartesian3, billboard, 'alignedAxis', billboardData.alignedAxis, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(CzmlBoolean, billboard, 'show', billboardData.show, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(CzmlVerticalOrigin, billboard, 'verticalOrigin', billboardData.verticalOrigin, interval, sourceUri) || billboardUpdated;
return billboardUpdated;
};
diff --git a/Source/DynamicScene/DynamicPolyline.js b/Source/DynamicScene/DynamicPolyline.js
index e775601b6b80..9a352ed7ceae 100644
--- a/Source/DynamicScene/DynamicPolyline.js
+++ b/Source/DynamicScene/DynamicPolyline.js
@@ -5,14 +5,14 @@ define([
'./CzmlBoolean',
'./CzmlNumber',
'./CzmlColor',
- './DynamicProperty'],
+ './processPacketData'],
function(
TimeInterval,
defaultValue,
CzmlBoolean,
CzmlNumber,
CzmlColor,
- DynamicProperty) {
+ processPacketData) {
"use strict";
/**
@@ -78,68 +78,28 @@ function(
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicPolyline.processCzmlPacket = function(dynamicObject, packet) {
+ DynamicPolyline.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var polylineData = packet.polyline;
if (typeof polylineData === 'undefined') {
return false;
}
- var polylineUpdated = false;
- var polyline = dynamicObject.polyline;
- polylineUpdated = typeof polyline === 'undefined';
- if (polylineUpdated) {
- dynamicObject.polyline = polyline = new DynamicPolyline();
- }
-
var interval = polylineData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof polylineData.color !== 'undefined') {
- var color = polyline.color;
- if (typeof color === 'undefined') {
- polyline.color = color = new DynamicProperty(CzmlColor);
- polylineUpdated = true;
- }
- color.processCzmlIntervals(polylineData.color, interval);
- }
-
- if (typeof polylineData.width !== 'undefined') {
- var width = polyline.width;
- if (typeof width === 'undefined') {
- polyline.width = width = new DynamicProperty(CzmlNumber);
- polylineUpdated = true;
- }
- width.processCzmlIntervals(polylineData.width, interval);
- }
-
- if (typeof polylineData.outlineColor !== 'undefined') {
- var outlineColor = polyline.outlineColor;
- if (typeof outlineColor === 'undefined') {
- polyline.outlineColor = outlineColor = new DynamicProperty(CzmlColor);
- polylineUpdated = true;
- }
- outlineColor.processCzmlIntervals(polylineData.outlineColor, interval);
- }
-
- if (typeof polylineData.outlineWidth !== 'undefined') {
- var outlineWidth = polyline.outlineWidth;
- if (typeof outlineWidth === 'undefined') {
- polyline.outlineWidth = outlineWidth = new DynamicProperty(CzmlNumber);
- polylineUpdated = true;
- }
- outlineWidth.processCzmlIntervals(polylineData.outlineWidth, interval);
+ var polyline = dynamicObject.polyline;
+ var polylineUpdated = typeof polyline === 'undefined';
+ if (polylineUpdated) {
+ dynamicObject.polyline = polyline = new DynamicPolyline();
}
- if (typeof polylineData.show !== 'undefined') {
- var show = polyline.show;
- if (typeof show === 'undefined') {
- polyline.show = show = new DynamicProperty(CzmlBoolean);
- polylineUpdated = true;
- }
- show.processCzmlIntervals(polylineData.show, interval);
- }
+ polylineUpdated = processPacketData(CzmlColor, polyline, 'color', polylineData.color, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(CzmlNumber, polyline, 'width', polylineData.width, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(CzmlColor, polyline, 'outlineColor', polylineData.outlineColor, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(CzmlNumber, polyline, 'outlineWidth', polylineData.outlineWidth, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(CzmlBoolean, polyline, 'show', polylineData.show, interval, sourceUri) || polylineUpdated;
return polylineUpdated;
};
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
new file mode 100644
index 000000000000..bc399652ee94
--- /dev/null
+++ b/Source/DynamicScene/processPacketData.js
@@ -0,0 +1,95 @@
+/*global define*/
+define([
+ '../Core/TimeInterval',
+ '../Core/Iso8601',
+ './CompositeProperty',
+ './ConstantProperty',
+ './SampledProperty',
+ './TimeIntervalCollectionProperty'
+ ], function(
+ TimeInterval,
+ Iso8601,
+ CompositeProperty,
+ ConstantProperty,
+ SampledProperty,
+ TimeIntervalCollectionProperty) {
+ "use strict";
+
+ function processProperty(type, object, propertyName, packetData, interval, sourceUri) {
+ var combinedInterval;
+ var packetInterval = packetData.interval;
+ if (typeof packetInterval !== 'undefined') {
+ combinedInterval = TimeInterval.fromIso8601(packetInterval);
+ if (typeof interval !== 'undefined') {
+ combinedInterval = combinedInterval.intersect(interval);
+ }
+ } else if (typeof interval !== 'undefined') {
+ combinedInterval = interval;
+ }
+
+ var unwrappedInterval = type.unwrapInterval(packetData, sourceUri);
+
+ var hasInterval = typeof combinedInterval !== 'undefined' && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
+ var isSampled = type.isSampled(unwrappedInterval);
+ if (!isSampled && !hasInterval) {
+ object[propertyName] = new ConstantProperty(type.getValue(unwrappedInterval));
+ return true;
+ }
+
+ var propertyCreated = false;
+ var property = object[propertyName];
+ if (!isSampled && hasInterval) {
+ combinedInterval = combinedInterval.clone();
+ combinedInterval.data = type.getValue(unwrappedInterval);
+
+ if (typeof property === 'undefined') {
+ property = new TimeIntervalCollectionProperty();
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+
+ if (property instanceof TimeIntervalCollectionProperty) {
+ property.getIntervals().addInterval(combinedInterval);
+ } else {
+ //TODO
+ }
+ } else if (isSampled && !hasInterval) {
+ if (!(property instanceof SampledProperty)) {
+ property = new SampledProperty();
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ property.addSamplesFlatArray(unwrappedInterval, packetData.epoch);
+ } else if (isSampled && hasInterval) {
+ if (typeof property === 'undefined') {
+ property = new CompositeProperty();
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ if (property instanceof CompositeProperty) {
+ property.addSamplesFlatArray(unwrappedInterval, packetData.epoch);
+ } else {
+ //TODO
+ }
+ }
+ return propertyCreated;
+ }
+
+ function processPacketData(type, object, propertyName, packetData, interval, sourceUri) {
+ if (typeof packetData === 'undefined') {
+ return false;
+ }
+
+ var updated = false;
+ if (Array.isArray(packetData)) {
+ for ( var i = 0, len = packetData.length; i < len; i++) {
+ updated = processProperty(type, object, propertyName, packetData[i], interval, sourceUri) || updated;
+ }
+ } else {
+ updated = processProperty(type, object, propertyName, packetData, interval, sourceUri) || updated;
+ }
+ return updated;
+ }
+
+ return processPacketData;
+});
diff --git a/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js b/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
index bd605a9d1de3..20fa52470f8e 100644
--- a/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
+++ b/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
@@ -191,7 +191,7 @@ defineSuite([
var czml4 = {
'id' : 'testBillboard',
'billboard' : {
- 'horizontalOrigin' : 'TOP',
+ 'horizontalOrigin' : 'LEFT',
'scale' : 3.0
}
};
@@ -206,6 +206,6 @@ defineSuite([
expect(object.billboard.show.getValue(new JulianDate())).toEqual(true);
expect(object.billboard.scale.getValue(new JulianDate())).toEqual(3.0);
- expect(object.billboard.horizontalOrigin.getValue(new JulianDate())).toEqual(HorizontalOrigin.TOP);
+ expect(object.billboard.horizontalOrigin.getValue(new JulianDate())).toEqual(HorizontalOrigin.LEFT);
});
});
From 393236abd13fb5e152eb572003585ed8642ab2be Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 8 Aug 2013 14:34:50 -0400
Subject: [PATCH 10/65] Remove almost all DynamicProperty usage.
DynamicPositionProperty is still using it, but that will change shortly.
---
Source/DynamicScene/CzmlCartesian2.js | 1 +
Source/DynamicScene/CzmlCartesian3.js | 1 +
Source/DynamicScene/CzmlColor.js | 1 +
Source/DynamicScene/CzmlDirection.js | 1 +
Source/DynamicScene/CzmlPosition.js | 1 +
Source/DynamicScene/CzmlUnitCartesian3.js | 1 +
Source/DynamicScene/CzmlUnitQuaternion.js | 2 +
Source/DynamicScene/CzmlUnitSpherical.js | 98 ---------------
Source/DynamicScene/DynamicColorMaterial.js | 16 +--
Source/DynamicScene/DynamicCone.js | 104 +++------------
Source/DynamicScene/DynamicEllipse.js | 44 ++-----
Source/DynamicScene/DynamicEllipsoid.js | 34 ++---
Source/DynamicScene/DynamicGridMaterial.js | 57 ++-------
Source/DynamicScene/DynamicImageMaterial.js | 30 +----
Source/DynamicScene/DynamicLabel.js | 133 +++-----------------
Source/DynamicScene/DynamicObject.js | 25 +---
Source/DynamicScene/DynamicPath.js | 95 +++-----------
Source/DynamicScene/DynamicPoint.js | 63 ++--------
Source/DynamicScene/DynamicPolygon.js | 25 ++--
Source/DynamicScene/DynamicPyramid.js | 65 ++--------
Source/DynamicScene/DynamicVector.js | 63 ++--------
Source/DynamicScene/SampledProperty.js | 2 +-
Source/DynamicScene/processPacketData.js | 33 +++--
Specs/DynamicScene/CzmlUnitSphericalSpec.js | 41 ------
24 files changed, 173 insertions(+), 763 deletions(-)
delete mode 100644 Source/DynamicScene/CzmlUnitSpherical.js
delete mode 100644 Specs/DynamicScene/CzmlUnitSphericalSpec.js
diff --git a/Source/DynamicScene/CzmlCartesian2.js b/Source/DynamicScene/CzmlCartesian2.js
index 4df3a485b174..765517f4411e 100644
--- a/Source/DynamicScene/CzmlCartesian2.js
+++ b/Source/DynamicScene/CzmlCartesian2.js
@@ -28,6 +28,7 @@ define([
* @see CzmlVerticalOrigin
*/
var CzmlCartesian2 = {
+ type : Cartesian2,
/**
* The number of doubles per packed Cartesian2 value.
*/
diff --git a/Source/DynamicScene/CzmlCartesian3.js b/Source/DynamicScene/CzmlCartesian3.js
index bd2950dc56a6..77aa9b4fdbe7 100644
--- a/Source/DynamicScene/CzmlCartesian3.js
+++ b/Source/DynamicScene/CzmlCartesian3.js
@@ -29,6 +29,7 @@ define([
* @see CzmlVerticalOrigin
*/
var CzmlCartesian3 = {
+ type : Cartesian3,
/**
* The number of doubles per packed Cartesian3 value.
*/
diff --git a/Source/DynamicScene/CzmlColor.js b/Source/DynamicScene/CzmlColor.js
index 939ec235fa75..758c155041c9 100644
--- a/Source/DynamicScene/CzmlColor.js
+++ b/Source/DynamicScene/CzmlColor.js
@@ -29,6 +29,7 @@ define([
* @see CzmlVerticalOrigin
*/
var CzmlColor = {
+ type : Color,
/**
* The number of doubles per packed Color value.
*/
diff --git a/Source/DynamicScene/CzmlDirection.js b/Source/DynamicScene/CzmlDirection.js
index b0598df80247..e7bd5f758d3d 100644
--- a/Source/DynamicScene/CzmlDirection.js
+++ b/Source/DynamicScene/CzmlDirection.js
@@ -37,6 +37,7 @@ define([
* @see CzmlVerticalOrigin
*/
var CzmlDirection = {
+ type : Cartesian3,
/**
* The number of doubles per packed Cartesian3 value.
*/
diff --git a/Source/DynamicScene/CzmlPosition.js b/Source/DynamicScene/CzmlPosition.js
index 4fd528b05924..eec6323e3fde 100644
--- a/Source/DynamicScene/CzmlPosition.js
+++ b/Source/DynamicScene/CzmlPosition.js
@@ -37,6 +37,7 @@ define([
* @see CzmlVerticalOrigin
*/
var CzmlPosition = {
+ type : Cartesian3,
/**
* The number of doubles per packed Cartesian3 value.
*/
diff --git a/Source/DynamicScene/CzmlUnitCartesian3.js b/Source/DynamicScene/CzmlUnitCartesian3.js
index 9331abe0ebd8..0258e653a1f5 100644
--- a/Source/DynamicScene/CzmlUnitCartesian3.js
+++ b/Source/DynamicScene/CzmlUnitCartesian3.js
@@ -29,6 +29,7 @@ define([
* @see CzmlVerticalOrigin
*/
var CzmlUnitCartesian3 = {
+ type : Cartesian3,
/**
* The number of doubles per packed Cartesian3 value.
*/
diff --git a/Source/DynamicScene/CzmlUnitQuaternion.js b/Source/DynamicScene/CzmlUnitQuaternion.js
index 8d80555cd336..992d509dafd5 100644
--- a/Source/DynamicScene/CzmlUnitQuaternion.js
+++ b/Source/DynamicScene/CzmlUnitQuaternion.js
@@ -36,6 +36,8 @@ define([
* @see CzmlVerticalOrigin
*/
var CzmlUnitQuaternion = {
+ type : Quaternion,
+
/**
* The number of doubles per packed Quaternion value.
*/
diff --git a/Source/DynamicScene/CzmlUnitSpherical.js b/Source/DynamicScene/CzmlUnitSpherical.js
deleted file mode 100644
index b7fb87e17e87..000000000000
--- a/Source/DynamicScene/CzmlUnitSpherical.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/*global define*/
-define([
- '../Core/Spherical'
- ], function(
- Spherical) {
- "use strict";
-
- var doublesPerValue = 2;
-
- /**
- * Provides methods for working with a unit Spherical defined in CZML.
- *
- * @exports CzmlUnitSpherical
- *
- * @see Spherical
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlVerticalOrigin
- */
- var CzmlUnitSpherical = {
- /**
- * The number of doubles per packed Spherical value.
- */
- doublesPerValue : doublesPerValue,
-
- /**
- * The number of doubles per packed value used for interpolation.
- */
- doublesPerInterpolationValue : doublesPerValue,
-
- /**
- * Returns the packed Spherical representation contained within the provided CZML interval
- * or undefined if the interval does not contain Spherical data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- return czmlInterval.unitSpherical;
- },
-
- /**
- * Returns true if this interval represents data that should be interpolated by the client
- * or false if it's a single value.
- *
- * @param {Object} unwrappedInterval The result of CzmlUnitSpherical.unwrapInterval.
- */
- isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > doublesPerValue;
- },
-
- /**
- * Given a non-sampled unwrapped interval, returns a Spherical instance of the data.
- *
- * @param {Object} unwrappedInterval The result of CzmlUnitSpherical.unwrapInterval.
- * @param {Spherical} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Spherical instance if result was not defined.
- */
- getValue : function(unwrappedInterval, spherical) {
- if (typeof spherical === 'undefined') {
- spherical = new Spherical();
- }
- spherical.clock = unwrappedInterval[0];
- spherical.cone = unwrappedInterval[1];
- spherical.magnitude = 1.0;
- return spherical;
- },
-
- /**
- * Given a packed array of clock and cone values, extracts a Spherical instance.
- *
- * @param {Array} array A packed array of Spherical values, where every two elements represents a Spherical.
- * @param {Number} startingIndex The index into the array that contains the clock value of the Spherical you would like.
- * @param {Spherical} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Spherical instance if result was not defined.
- */
- getValueFromArray : function(array, startingIndex, spherical) {
- if (typeof spherical === 'undefined') {
- spherical = new Spherical();
- }
- spherical.clock = array[startingIndex];
- spherical.cone = array[startingIndex + 1];
- spherical.magnitude = 1.0;
- return spherical;
- }
- };
-
- return CzmlUnitSpherical;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/DynamicColorMaterial.js b/Source/DynamicScene/DynamicColorMaterial.js
index bf78cbd4b165..a510debf84bb 100644
--- a/Source/DynamicScene/DynamicColorMaterial.js
+++ b/Source/DynamicScene/DynamicColorMaterial.js
@@ -1,12 +1,12 @@
/*global define*/
define([
- './DynamicProperty',
'./CzmlColor',
+ './processPacketData',
'../Scene/Material'
], function(
- DynamicProperty,
- CzmlColor,
- Material) {
+ CzmlColor,
+ processPacketData,
+ Material) {
"use strict";
/**
@@ -49,13 +49,7 @@ define([
DynamicColorMaterial.prototype.processCzmlIntervals = function(czmlInterval) {
var materialData = czmlInterval.solidColor;
if (typeof materialData !== 'undefined') {
- if (typeof materialData.color !== 'undefined') {
- var color = this.color;
- if (typeof color === 'undefined') {
- this.color = color = new DynamicProperty(CzmlColor);
- }
- color.processCzmlIntervals(materialData.color);
- }
+ processPacketData(CzmlColor, this, 'color', materialData.color);
}
};
diff --git a/Source/DynamicScene/DynamicCone.js b/Source/DynamicScene/DynamicCone.js
index 96db0a83988e..6f07ce16a34f 100644
--- a/Source/DynamicScene/DynamicCone.js
+++ b/Source/DynamicScene/DynamicCone.js
@@ -5,7 +5,7 @@ define([
'./CzmlBoolean',
'./CzmlNumber',
'./CzmlColor',
- './DynamicProperty',
+ './processPacketData',
'./DynamicMaterialProperty'
], function(
TimeInterval,
@@ -13,7 +13,7 @@ define([
CzmlBoolean,
CzmlNumber,
CzmlColor,
- DynamicProperty,
+ processPacketData,
DynamicMaterialProperty) {
"use strict";
@@ -128,104 +128,32 @@ define([
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicCone.processCzmlPacket = function(dynamicObject, packet) {
+ DynamicCone.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var coneData = packet.cone;
if (typeof coneData === 'undefined') {
return false;
}
- var coneUpdated = false;
- var cone = dynamicObject.cone;
- coneUpdated = typeof cone === 'undefined';
- if (coneUpdated) {
- dynamicObject.cone = cone = new DynamicCone();
- }
-
var interval = coneData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof coneData.show !== 'undefined') {
- var show = cone.show;
- if (typeof show === 'undefined') {
- cone.show = show = new DynamicProperty(CzmlBoolean);
- coneUpdated = true;
- }
- show.processCzmlIntervals(coneData.show, interval);
- }
-
- if (typeof coneData.innerHalfAngle !== 'undefined') {
- var innerHalfAngle = cone.innerHalfAngle;
- if (typeof innerHalfAngle === 'undefined') {
- cone.innerHalfAngle = innerHalfAngle = new DynamicProperty(CzmlNumber);
- coneUpdated = true;
- }
- innerHalfAngle.processCzmlIntervals(coneData.innerHalfAngle, interval);
- }
-
- if (typeof coneData.outerHalfAngle !== 'undefined') {
- var outerHalfAngle = cone.outerHalfAngle;
- if (typeof outerHalfAngle === 'undefined') {
- cone.outerHalfAngle = outerHalfAngle = new DynamicProperty(CzmlNumber);
- coneUpdated = true;
- }
- outerHalfAngle.processCzmlIntervals(coneData.outerHalfAngle, interval);
- }
-
- if (typeof coneData.minimumClockAngle !== 'undefined') {
- var minimumClockAngle = cone.minimumClockAngle;
- if (typeof minimumClockAngle === 'undefined') {
- cone.minimumClockAngle = minimumClockAngle = new DynamicProperty(CzmlNumber);
- coneUpdated = true;
- }
- minimumClockAngle.processCzmlIntervals(coneData.minimumClockAngle, interval);
- }
-
- if (typeof coneData.maximumClockAngle !== 'undefined') {
- var maximumClockAngle = cone.maximumClockAngle;
- if (typeof maximumClockAngle === 'undefined') {
- cone.maximumClockAngle = maximumClockAngle = new DynamicProperty(CzmlNumber);
- coneUpdated = true;
- }
- maximumClockAngle.processCzmlIntervals(coneData.maximumClockAngle, interval);
- }
-
- if (typeof coneData.radius !== 'undefined') {
- var radius = cone.radius;
- if (typeof radius === 'undefined') {
- cone.radius = radius = new DynamicProperty(CzmlNumber);
- coneUpdated = true;
- }
- radius.processCzmlIntervals(coneData.radius, interval);
- }
-
- if (typeof coneData.showIntersection !== 'undefined') {
- var showIntersection = cone.showIntersection;
- if (typeof showIntersection === 'undefined') {
- cone.showIntersection = showIntersection = new DynamicProperty(CzmlBoolean);
- coneUpdated = true;
- }
- showIntersection.processCzmlIntervals(coneData.showIntersection, interval);
- }
-
- if (typeof coneData.intersectionColor !== 'undefined') {
- var intersectionColor = cone.intersectionColor;
- if (typeof intersectionColor === 'undefined') {
- cone.intersectionColor = intersectionColor = new DynamicProperty(CzmlColor);
- coneUpdated = true;
- }
- intersectionColor.processCzmlIntervals(coneData.intersectionColor, interval);
+ var cone = dynamicObject.cone;
+ var coneUpdated = typeof cone === 'undefined';
+ if (coneUpdated) {
+ dynamicObject.cone = cone = new DynamicCone();
}
- if (typeof coneData.intersectionWidth !== 'undefined') {
- var intersectionWidth = cone.intersectionWidth;
- if (typeof intersectionWidth === 'undefined') {
- cone.intersectionWidth = intersectionWidth = new DynamicProperty(CzmlNumber);
- coneUpdated = true;
- }
- intersectionWidth.processCzmlIntervals(coneData.intersectionWidth, interval);
- }
+ coneUpdated = processPacketData(CzmlBoolean, cone, 'show', coneData.show, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(CzmlNumber, cone, 'radius', coneData.radius, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(CzmlBoolean, cone, 'showIntersection', coneData.showIntersection, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(CzmlColor, cone, 'intersectionColor', coneData.intersectionColor, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(CzmlNumber, cone, 'intersectionWidth', coneData.intersectionWidth, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(CzmlNumber, cone, 'innerHalfAngle', coneData.innerHalfAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(CzmlNumber, cone, 'outerHalfAngle', coneData.outerHalfAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(CzmlNumber, cone, 'minimumClockAngle', coneData.minimumClockAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(CzmlNumber, cone, 'maximumClockAngle', coneData.maximumClockAngle, interval, sourceUri) || coneUpdated;
if (typeof coneData.capMaterial !== 'undefined') {
var capMaterial = cone.capMaterial;
diff --git a/Source/DynamicScene/DynamicEllipse.js b/Source/DynamicScene/DynamicEllipse.js
index a8814ce69be4..f469118d8147 100644
--- a/Source/DynamicScene/DynamicEllipse.js
+++ b/Source/DynamicScene/DynamicEllipse.js
@@ -5,7 +5,7 @@ define(['../Core/TimeInterval',
'../Core/Ellipsoid',
'../Core/Shapes',
'./CzmlNumber',
- './DynamicProperty'
+ './processPacketData'
], function (
TimeInterval,
defaultValue,
@@ -13,7 +13,7 @@ define(['../Core/TimeInterval',
Ellipsoid,
Shapes,
CzmlNumber,
- DynamicProperty) {
+ processPacketData) {
"use strict";
/**
@@ -75,50 +75,26 @@ define(['../Core/TimeInterval',
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicEllipse.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection) {
+ DynamicEllipse.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var ellipseData = packet.ellipse;
if (typeof ellipseData === 'undefined') {
return false;
}
- var ellipseUpdated = false;
- var ellipse = dynamicObject.ellipse;
- ellipseUpdated = typeof ellipse === 'undefined';
- if (ellipseUpdated) {
- dynamicObject.ellipse = ellipse = new DynamicEllipse();
- }
-
var interval = ellipseData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof ellipseData.bearing !== 'undefined') {
- var bearing = ellipse.bearing;
- if (typeof bearing === 'undefined') {
- ellipse.bearing = bearing = new DynamicProperty(CzmlNumber);
- ellipseUpdated = true;
- }
- bearing.processCzmlIntervals(ellipseData.bearing, interval);
- }
-
- if (typeof ellipseData.semiMajorAxis !== 'undefined') {
- var semiMajorAxis = ellipse.semiMajorAxis;
- if (typeof semiMajorAxis === 'undefined') {
- ellipse.semiMajorAxis = semiMajorAxis = new DynamicProperty(CzmlNumber);
- ellipseUpdated = true;
- }
- semiMajorAxis.processCzmlIntervals(ellipseData.semiMajorAxis, interval);
+ var ellipse = dynamicObject.ellipse;
+ var ellipseUpdated = typeof ellipse === 'undefined';
+ if (ellipseUpdated) {
+ dynamicObject.ellipse = ellipse = new DynamicEllipse();
}
- if (typeof ellipseData.semiMinorAxis !== 'undefined') {
- var semiMinorAxis = ellipse.semiMinorAxis;
- if (typeof semiMinorAxis === 'undefined') {
- ellipse.semiMinorAxis = semiMinorAxis = new DynamicProperty(CzmlNumber);
- ellipseUpdated = true;
- }
- semiMinorAxis.processCzmlIntervals(ellipseData.semiMinorAxis, interval);
- }
+ ellipseUpdated = processPacketData(CzmlNumber, ellipse, 'bearing', ellipseData.bearing, interval, sourceUri) || ellipseUpdated;
+ ellipseUpdated = processPacketData(CzmlNumber, ellipse, 'semiMajorAxis', ellipseData.semiMajorAxis, interval, sourceUri) || ellipseUpdated;
+ ellipseUpdated = processPacketData(CzmlNumber, ellipse, 'semiMinorAxis', ellipseData.semiMinorAxis, interval, sourceUri) || ellipseUpdated;
return ellipseUpdated;
};
diff --git a/Source/DynamicScene/DynamicEllipsoid.js b/Source/DynamicScene/DynamicEllipsoid.js
index cbe85156b06a..baa5f168a330 100644
--- a/Source/DynamicScene/DynamicEllipsoid.js
+++ b/Source/DynamicScene/DynamicEllipsoid.js
@@ -4,14 +4,14 @@ define([
'../Core/defaultValue',
'./CzmlBoolean',
'./CzmlCartesian3',
- './DynamicProperty',
+ './processPacketData',
'./DynamicMaterialProperty'
], function(
TimeInterval,
defaultValue,
CzmlBoolean,
CzmlCartesian3,
- DynamicProperty,
+ processPacketData,
DynamicMaterialProperty) {
"use strict";
@@ -68,41 +68,25 @@ define([
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicEllipsoid.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection) {
+ DynamicEllipsoid.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var ellipsoidData = packet.ellipsoid;
if (typeof ellipsoidData === 'undefined') {
return false;
}
- var ellipsoidUpdated = false;
- var ellipsoid = dynamicObject.ellipsoid;
- ellipsoidUpdated = typeof ellipsoid === 'undefined';
- if (ellipsoidUpdated) {
- dynamicObject.ellipsoid = ellipsoid = new DynamicEllipsoid();
- }
-
var interval = ellipsoidData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof ellipsoidData.show !== 'undefined') {
- var show = ellipsoid.show;
- if (typeof show === 'undefined') {
- ellipsoid.show = show = new DynamicProperty(CzmlBoolean);
- ellipsoidUpdated = true;
- }
- show.processCzmlIntervals(ellipsoidData.show, interval);
+ var ellipsoid = dynamicObject.ellipsoid;
+ var ellipsoidUpdated = typeof ellipsoid === 'undefined';
+ if (ellipsoidUpdated) {
+ dynamicObject.ellipsoid = ellipsoid = new DynamicEllipsoid();
}
- if (typeof ellipsoidData.radii !== 'undefined') {
- var radii = ellipsoid.radii;
- if (typeof radii === 'undefined') {
- ellipsoid.radii = radii = new DynamicProperty(CzmlCartesian3);
- ellipsoidUpdated = true;
- }
- radii.processCzmlIntervals(ellipsoidData.radii, interval);
- }
+ ellipsoidUpdated = processPacketData(CzmlBoolean, ellipsoid, 'show', ellipsoidData.show, interval, sourceUri) || ellipsoidUpdated;
+ ellipsoidUpdated = processPacketData(CzmlCartesian3, ellipsoid, 'radii', ellipsoidData.radii, interval, sourceUri) || ellipsoidUpdated;
if (typeof ellipsoidData.material !== 'undefined') {
var material = ellipsoid.material;
diff --git a/Source/DynamicScene/DynamicGridMaterial.js b/Source/DynamicScene/DynamicGridMaterial.js
index 4a5e55361163..8fcd113c8dd4 100644
--- a/Source/DynamicScene/DynamicGridMaterial.js
+++ b/Source/DynamicScene/DynamicGridMaterial.js
@@ -1,11 +1,11 @@
/*global define*/
define([
- './DynamicProperty',
+ './processPacketData',
'./CzmlColor',
'./CzmlNumber',
'../Scene/Material'
], function(
- DynamicProperty,
+ processPacketData,
CzmlColor,
CzmlNumber,
Material) {
@@ -90,53 +90,12 @@ define([
return;
}
- if (typeof materialData.color !== 'undefined') {
- var color = this.color;
- if (typeof color === 'undefined') {
- this.color = color = new DynamicProperty(CzmlColor);
- }
- color.processCzmlIntervals(materialData.color, undefined, sourceUri);
- }
-
- if (typeof materialData.cellAlpha !== 'undefined') {
- var cellAlpha = this.cellAlpha;
- if (typeof cellAlpha === 'undefined') {
- this.cellAlpha = cellAlpha = new DynamicProperty(CzmlNumber);
- }
- cellAlpha.processCzmlIntervals(materialData.cellAlpha, undefined, sourceUri);
- }
-
- if (typeof materialData.rowCount !== 'undefined') {
- var rowCount = this.rowCount;
- if (typeof rowCount === 'undefined') {
- this.rowCount = rowCount = new DynamicProperty(CzmlNumber);
- }
- rowCount.processCzmlIntervals(materialData.rowCount, undefined, sourceUri);
- }
-
- if (typeof materialData.columnCount !== 'undefined') {
- var columnCount = this.columnCount;
- if (typeof columnCount === 'undefined') {
- this.columnCount = columnCount = new DynamicProperty(CzmlNumber);
- }
- columnCount.processCzmlIntervals(materialData.columnCount, undefined, sourceUri);
- }
-
- if (typeof materialData.rowThickness !== 'undefined') {
- var rowThickness = this.rowThickness;
- if (typeof rowThickness === 'undefined') {
- this.rowThickness = rowThickness = new DynamicProperty(CzmlNumber);
- }
- rowThickness.processCzmlIntervals(materialData.rowThickness, undefined, sourceUri);
- }
-
- if (typeof materialData.columnThickness !== 'undefined') {
- var columnThickness = this.columnThickness;
- if (typeof columnThickness === 'undefined') {
- this.columnThickness = columnThickness = new DynamicProperty(CzmlNumber);
- }
- columnThickness.processCzmlIntervals(materialData.columnThickness, undefined, sourceUri);
- }
+ processPacketData(CzmlColor, this, 'color', materialData.color, undefined, sourceUri);
+ processPacketData(CzmlNumber, this, 'cellAlpha', materialData.cellAlpha, undefined, sourceUri);
+ processPacketData(CzmlNumber, this, 'rowCount', materialData.rowCount, undefined, sourceUri);
+ processPacketData(CzmlNumber, this, 'columnCount', materialData.columnCount, undefined, sourceUri);
+ processPacketData(CzmlNumber, this, 'rowThickness', materialData.rowThickness, undefined, sourceUri);
+ processPacketData(CzmlNumber, this, 'columnThickness', materialData.columnThickness, undefined, sourceUri);
};
/**
diff --git a/Source/DynamicScene/DynamicImageMaterial.js b/Source/DynamicScene/DynamicImageMaterial.js
index ee005a111763..aead5d68b173 100644
--- a/Source/DynamicScene/DynamicImageMaterial.js
+++ b/Source/DynamicScene/DynamicImageMaterial.js
@@ -1,11 +1,11 @@
/*global define*/
define([
- './DynamicProperty',
+ './processPacketData',
'./CzmlImage',
'./CzmlNumber',
'../Scene/Material'
], function(
- DynamicProperty,
+ processPacketData,
CzmlImage,
CzmlNumber,
Material) {
@@ -68,29 +68,9 @@ define([
return;
}
- if (typeof materialData.image !== 'undefined') {
- var image = this.image;
- if (typeof image === 'undefined') {
- this.image = image = new DynamicProperty(CzmlImage);
- }
- image.processCzmlIntervals(materialData.image, undefined, sourceUri);
- }
-
- if (typeof materialData.verticalRepeat !== 'undefined') {
- var verticalRepeat = this.verticalRepeat;
- if (typeof verticalRepeat === 'undefined') {
- this.verticalRepeat = verticalRepeat = new DynamicProperty(CzmlNumber);
- }
- verticalRepeat.processCzmlIntervals(materialData.verticalRepeat);
- }
-
- if (typeof materialData.horizontalRepeat !== 'undefined') {
- var horizontalRepeat = this.horizontalRepeat;
- if (typeof horizontalRepeat === 'undefined') {
- this.horizontalRepeat = horizontalRepeat = new DynamicProperty(CzmlNumber);
- }
- horizontalRepeat.processCzmlIntervals(materialData.horizontalRepeat);
- }
+ processPacketData(CzmlImage, this, 'image', materialData.image, undefined, sourceUri);
+ processPacketData(CzmlNumber, this, 'verticalRepeat', materialData.verticalRepeat, undefined, sourceUri);
+ processPacketData(CzmlNumber, this, 'horizontalRepeat', materialData.horizontalRepeat, undefined, sourceUri);
};
/**
diff --git a/Source/DynamicScene/DynamicLabel.js b/Source/DynamicScene/DynamicLabel.js
index 9db52bcabb08..4e7cc79cbb48 100644
--- a/Source/DynamicScene/DynamicLabel.js
+++ b/Source/DynamicScene/DynamicLabel.js
@@ -11,7 +11,7 @@ define([
'./CzmlVerticalOrigin',
'./CzmlLabelStyle',
'./CzmlColor',
- './DynamicProperty'
+ './processPacketData'
], function(
TimeInterval,
defaultValue,
@@ -24,7 +24,7 @@ define([
CzmlVerticalOrigin,
CzmlLabelStyle,
CzmlColor,
- DynamicProperty) {
+ processPacketData) {
"use strict";
/**
@@ -133,131 +133,36 @@ define([
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicLabel.processCzmlPacket = function(dynamicObject, packet) {
+ DynamicLabel.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var labelData = packet.label;
if (typeof labelData === 'undefined') {
return false;
}
- var labelUpdated = false;
- var label = dynamicObject.label;
- labelUpdated = typeof label === 'undefined';
- if (labelUpdated) {
- dynamicObject.label = label = new DynamicLabel();
- }
-
var interval = labelData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof labelData.fillColor !== 'undefined') {
- var fillColor = label.fillColor;
- if (typeof fillColor === 'undefined') {
- label.fillColor = fillColor = new DynamicProperty(CzmlColor);
- labelUpdated = true;
- }
- fillColor.processCzmlIntervals(labelData.fillColor, interval);
- }
-
- if (typeof labelData.outlineColor !== 'undefined') {
- var outlineColor = label.outlineColor;
- if (typeof outlineColor === 'undefined') {
- label.outlineColor = outlineColor = new DynamicProperty(CzmlColor);
- labelUpdated = true;
- }
- outlineColor.processCzmlIntervals(labelData.outlineColor, interval);
- }
-
- if (typeof labelData.outlineWidth !== 'undefined') {
- var outlineWidth = label.outlineWidth;
- if (typeof outlineWidth === 'undefined') {
- label.outlineWidth = outlineWidth = new DynamicProperty(CzmlNumber);
- labelUpdated = true;
- }
- outlineWidth.processCzmlIntervals(labelData.outlineWidth, interval);
- }
-
- if (typeof labelData.eyeOffset !== 'undefined') {
- var eyeOffset = label.eyeOffset;
- if (typeof eyeOffset === 'undefined') {
- label.eyeOffset = eyeOffset = new DynamicProperty(CzmlCartesian3);
- labelUpdated = true;
- }
- eyeOffset.processCzmlIntervals(labelData.eyeOffset, interval);
- }
-
- if (typeof labelData.horizontalOrigin !== 'undefined') {
- var horizontalOrigin = label.horizontalOrigin;
- if (typeof horizontalOrigin === 'undefined') {
- label.horizontalOrigin = horizontalOrigin = new DynamicProperty(CzmlHorizontalOrigin);
- labelUpdated = true;
- }
- horizontalOrigin.processCzmlIntervals(labelData.horizontalOrigin, interval);
- }
-
- if (typeof labelData.text !== 'undefined') {
- var text = label.text;
- if (typeof text === 'undefined') {
- label.text = text = new DynamicProperty(CzmlString);
- labelUpdated = true;
- }
- text.processCzmlIntervals(labelData.text, interval);
- }
-
- if (typeof labelData.pixelOffset !== 'undefined') {
- var pixelOffset = label.pixelOffset;
- if (typeof pixelOffset === 'undefined') {
- label.pixelOffset = pixelOffset = new DynamicProperty(CzmlCartesian2);
- labelUpdated = true;
- }
- pixelOffset.processCzmlIntervals(labelData.pixelOffset, interval);
- }
-
- if (typeof labelData.scale !== 'undefined') {
- var scale = label.scale;
- if (typeof scale === 'undefined') {
- label.scale = scale = new DynamicProperty(CzmlNumber);
- labelUpdated = true;
- }
- scale.processCzmlIntervals(labelData.scale, interval);
- }
-
- if (typeof labelData.show !== 'undefined') {
- var show = label.show;
- if (typeof show === 'undefined') {
- label.show = show = new DynamicProperty(CzmlBoolean);
- labelUpdated = true;
- }
- show.processCzmlIntervals(labelData.show, interval);
- }
-
- if (typeof labelData.verticalOrigin !== 'undefined') {
- var verticalOrigin = label.verticalOrigin;
- if (typeof verticalOrigin === 'undefined') {
- label.verticalOrigin = verticalOrigin = new DynamicProperty(CzmlVerticalOrigin);
- labelUpdated = true;
- }
- verticalOrigin.processCzmlIntervals(labelData.verticalOrigin, interval);
+ var label = dynamicObject.label;
+ var labelUpdated = typeof label === 'undefined';
+ if (labelUpdated) {
+ dynamicObject.label = label = new DynamicLabel();
}
- if (typeof labelData.font !== 'undefined') {
- var font = label.font;
- if (typeof font === 'undefined') {
- label.font = font = new DynamicProperty(CzmlString);
- labelUpdated = true;
- }
- font.processCzmlIntervals(labelData.font, interval);
- }
+ labelUpdated = processPacketData(CzmlColor, label, 'fillColor', labelData.fillColor, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlColor, label, 'outlineColor', labelData.outlineColor, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlNumber, label, 'outlineWidth', labelData.outlineWidth, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlCartesian3, label, 'eyeOffset', labelData.eyeOffset, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlHorizontalOrigin, label, 'horizontalOrigin', labelData.horizontalOrigin, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlString, label, 'text', labelData.text, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlCartesian2, label, 'pixelOffset', labelData.pixelOffset, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlNumber, label, 'scale', labelData.scale, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlBoolean, label, 'show', labelData.show, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlVerticalOrigin, label, 'verticalOrigin', labelData.verticalOrigin, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlString, label, 'font', labelData.font, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(CzmlLabelStyle, label, 'style', labelData.style, interval, sourceUri) || labelUpdated;
- if (typeof labelData.style !== 'undefined') {
- var style = label.style;
- if (typeof style === 'undefined') {
- label.style = style = new DynamicProperty(CzmlLabelStyle);
- labelUpdated = true;
- }
- style.processCzmlIntervals(labelData.style, interval);
- }
return labelUpdated;
};
diff --git a/Source/DynamicScene/DynamicObject.js b/Source/DynamicScene/DynamicObject.js
index 7c7fca4a3c86..717e0c6df481 100644
--- a/Source/DynamicScene/DynamicObject.js
+++ b/Source/DynamicScene/DynamicObject.js
@@ -5,7 +5,7 @@ define([
'../Core/DeveloperError',
'../Core/JulianDate',
'../Core/TimeInterval',
- './DynamicProperty',
+ './processPacketData',
'./DynamicPositionProperty',
'./DynamicVertexPositionsProperty',
'./CzmlUnitQuaternion',
@@ -16,7 +16,7 @@ define([
DeveloperError,
JulianDate,
TimeInterval,
- DynamicProperty,
+ processPacketData,
DynamicPositionProperty,
DynamicVertexPositionsProperty,
CzmlUnitQuaternion,
@@ -266,19 +266,12 @@ define([
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicObject.processCzmlPacketViewFrom = function(dynamicObject, packet) {
+ DynamicObject.processCzmlPacketViewFrom = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var viewFromData = packet.viewFrom;
if (typeof viewFromData === 'undefined') {
return false;
}
-
- var viewFrom = dynamicObject.viewFrom;
- var propertyCreated = typeof viewFrom === 'undefined';
- if (propertyCreated) {
- dynamicObject.viewFrom = viewFrom = new DynamicProperty(CzmlCartesian3);
- }
- viewFrom.processCzmlIntervals(viewFromData);
- return propertyCreated;
+ return processPacketData(CzmlCartesian3, dynamicObject, 'viewFrom', viewFromData, undefined, sourceUri);
};
/**
@@ -294,19 +287,13 @@ define([
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicObject.processCzmlPacketOrientation = function(dynamicObject, packet) {
+ DynamicObject.processCzmlPacketOrientation = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var orientationData = packet.orientation;
if (typeof orientationData === 'undefined') {
return false;
}
- var orientation = dynamicObject.orientation;
- var propertyCreated = typeof orientation === 'undefined';
- if (propertyCreated) {
- dynamicObject.orientation = orientation = new DynamicProperty(CzmlUnitQuaternion);
- }
- orientation.processCzmlIntervals(orientationData);
- return propertyCreated;
+ return processPacketData(CzmlUnitQuaternion, dynamicObject, 'orientation', orientationData, undefined, sourceUri);
};
/**
diff --git a/Source/DynamicScene/DynamicPath.js b/Source/DynamicScene/DynamicPath.js
index acca7260146d..07048c963718 100644
--- a/Source/DynamicScene/DynamicPath.js
+++ b/Source/DynamicScene/DynamicPath.js
@@ -5,14 +5,14 @@ define([
'./CzmlBoolean',
'./CzmlNumber',
'./CzmlColor',
- './DynamicProperty'],
+ './processPacketData'],
function(
TimeInterval,
defaultValue,
CzmlBoolean,
CzmlNumber,
CzmlColor,
- DynamicProperty) {
+ processPacketData) {
"use strict";
/**
@@ -96,96 +96,31 @@ function(
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicPath.processCzmlPacket = function(dynamicObject, packet) {
+ DynamicPath.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var pathData = packet.path;
if (typeof pathData === 'undefined') {
return false;
}
- var pathUpdated = false;
- var path = dynamicObject.path;
- pathUpdated = typeof path === 'undefined';
- if (pathUpdated) {
- dynamicObject.path = path = new DynamicPath();
- }
-
var interval = pathData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof pathData.color !== 'undefined') {
- var color = path.color;
- if (typeof color === 'undefined') {
- path.color = color = new DynamicProperty(CzmlColor);
- pathUpdated = true;
- }
- color.processCzmlIntervals(pathData.color, interval);
- }
-
- if (typeof pathData.width !== 'undefined') {
- var width = path.width;
- if (typeof width === 'undefined') {
- path.width = width = new DynamicProperty(CzmlNumber);
- pathUpdated = true;
- }
- width.processCzmlIntervals(pathData.width, interval);
- }
-
- if (typeof pathData.resolution !== 'undefined') {
- var resolution = path.resolution;
- if (typeof resolution === 'undefined') {
- path.resolution = resolution = new DynamicProperty(CzmlNumber);
- pathUpdated = true;
- }
- resolution.processCzmlIntervals(pathData.resolution, interval);
- }
-
- if (typeof pathData.outlineColor !== 'undefined') {
- var outlineColor = path.outlineColor;
- if (typeof outlineColor === 'undefined') {
- path.outlineColor = outlineColor = new DynamicProperty(CzmlColor);
- pathUpdated = true;
- }
- outlineColor.processCzmlIntervals(pathData.outlineColor, interval);
- }
-
- if (typeof pathData.outlineWidth !== 'undefined') {
- var outlineWidth = path.outlineWidth;
- if (typeof outlineWidth === 'undefined') {
- path.outlineWidth = outlineWidth = new DynamicProperty(CzmlNumber);
- pathUpdated = true;
- }
- outlineWidth.processCzmlIntervals(pathData.outlineWidth, interval);
- }
-
- if (typeof pathData.show !== 'undefined') {
- var show = path.show;
- if (typeof show === 'undefined') {
- path.show = show = new DynamicProperty(CzmlBoolean);
- pathUpdated = true;
- }
- show.processCzmlIntervals(pathData.show, interval);
- }
-
- if (typeof pathData.leadTime !== 'undefined') {
- var leadTime = path.leadTime;
- if (typeof leadTime === 'undefined') {
- path.leadTime = leadTime = new DynamicProperty(CzmlNumber);
- pathUpdated = true;
- }
- leadTime.processCzmlIntervals(pathData.leadTime, interval);
- }
-
- if (typeof pathData.trailTime !== 'undefined') {
- var trailTime = path.trailTime;
- if (typeof trailTime === 'undefined') {
- path.trailTime = trailTime = new DynamicProperty(CzmlNumber);
- pathUpdated = true;
- }
- trailTime.processCzmlIntervals(pathData.trailTime, interval);
+ var path = dynamicObject.path;
+ var pathUpdated = typeof path === 'undefined';
+ if (pathUpdated) {
+ dynamicObject.path = path = new DynamicPath();
}
+ pathUpdated = processPacketData(CzmlColor, path, 'color', pathData.color, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(CzmlNumber, path, 'width', pathData.width, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(CzmlColor, path, 'outlineColor', pathData.outlineColor, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(CzmlNumber, path, 'outlineWidth', pathData.outlineWidth, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(CzmlBoolean, path, 'show', pathData.show, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(CzmlNumber, path, 'resolution', pathData.resolution, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(CzmlNumber, path, 'leadTime', pathData.leadTime, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(CzmlNumber, path, 'trailTime', pathData.trailTime, interval, sourceUri) || pathUpdated;
return pathUpdated;
};
diff --git a/Source/DynamicScene/DynamicPoint.js b/Source/DynamicScene/DynamicPoint.js
index 9b965849b5fa..2d9a56570a30 100644
--- a/Source/DynamicScene/DynamicPoint.js
+++ b/Source/DynamicScene/DynamicPoint.js
@@ -5,14 +5,14 @@ define([
'./CzmlBoolean',
'./CzmlNumber',
'./CzmlColor',
- './DynamicProperty'
+ './processPacketData'
], function(
TimeInterval,
defaultValue,
CzmlBoolean,
CzmlNumber,
CzmlColor,
- DynamicProperty) {
+ processPacketData) {
"use strict";
/**
@@ -74,68 +74,29 @@ define([
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicPoint.processCzmlPacket = function(dynamicObject, packet) {
+ DynamicPoint.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var pointData = packet.point;
if (typeof pointData === 'undefined') {
return false;
}
- var pointUpdated = false;
- var point = dynamicObject.point;
- pointUpdated = typeof point === 'undefined';
- if (pointUpdated) {
- dynamicObject.point = point = new DynamicPoint();
- }
-
var interval = pointData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof pointData.color !== 'undefined') {
- var color = point.color;
- if (typeof color === 'undefined') {
- point.color = color = new DynamicProperty(CzmlColor);
- pointUpdated = true;
- }
- color.processCzmlIntervals(pointData.color, interval);
- }
-
- if (typeof pointData.pixelSize !== 'undefined') {
- var pixelSize = point.pixelSize;
- if (typeof pixelSize === 'undefined') {
- point.pixelSize = pixelSize = new DynamicProperty(CzmlNumber);
- pointUpdated = true;
- }
- pixelSize.processCzmlIntervals(pointData.pixelSize, interval);
- }
-
- if (typeof pointData.outlineColor !== 'undefined') {
- var outlineColor = point.outlineColor;
- if (typeof outlineColor === 'undefined') {
- point.outlineColor = outlineColor = new DynamicProperty(CzmlColor);
- pointUpdated = true;
- }
- outlineColor.processCzmlIntervals(pointData.outlineColor, interval);
+ var point = dynamicObject.point;
+ var pointUpdated = typeof point === 'undefined';
+ if (pointUpdated) {
+ dynamicObject.point = point = new DynamicPoint();
}
- if (typeof pointData.outlineWidth !== 'undefined') {
- var outlineWidth = point.outlineWidth;
- if (typeof outlineWidth === 'undefined') {
- point.outlineWidth = outlineWidth = new DynamicProperty(CzmlNumber);
- pointUpdated = true;
- }
- outlineWidth.processCzmlIntervals(pointData.outlineWidth, interval);
- }
+ pointUpdated = processPacketData(CzmlColor, point, 'color', pointData.color, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(CzmlNumber, point, 'pixelSize', pointData.pixelSize, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(CzmlColor, point, 'outlineColor', pointData.outlineColor, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(CzmlNumber, point, 'outlineWidth', pointData.outlineWidth, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(CzmlBoolean, point, 'show', pointData.show, interval, sourceUri) || pointUpdated;
- if (typeof pointData.show !== 'undefined') {
- var show = point.show;
- if (typeof show === 'undefined') {
- point.show = show = new DynamicProperty(CzmlBoolean);
- pointUpdated = true;
- }
- show.processCzmlIntervals(pointData.show, interval);
- }
return pointUpdated;
};
diff --git a/Source/DynamicScene/DynamicPolygon.js b/Source/DynamicScene/DynamicPolygon.js
index 0db1549729c9..5f7b88317f01 100644
--- a/Source/DynamicScene/DynamicPolygon.js
+++ b/Source/DynamicScene/DynamicPolygon.js
@@ -3,13 +3,13 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'./CzmlBoolean',
- './DynamicProperty',
+ './processPacketData',
'./DynamicMaterialProperty'
], function(
TimeInterval,
defaultValue,
CzmlBoolean,
- DynamicProperty,
+ processPacketData,
DynamicMaterialProperty) {
"use strict";
@@ -66,27 +66,19 @@ define([
return false;
}
- var polygonUpdated = false;
- var polygon = dynamicObject.polygon;
- polygonUpdated = typeof polygon === 'undefined';
- if (polygonUpdated) {
- dynamicObject.polygon = polygon = new DynamicPolygon();
- }
-
var interval = polygonData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof polygonData.show !== 'undefined') {
- var show = polygon.show;
- if (typeof show === 'undefined') {
- polygon.show = show = new DynamicProperty(CzmlBoolean);
- polygonUpdated = true;
- }
- show.processCzmlIntervals(polygonData.show, interval);
+ var polygon = dynamicObject.polygon;
+ var polygonUpdated = typeof polygon === 'undefined';
+ if (polygonUpdated) {
+ dynamicObject.polygon = polygon = new DynamicPolygon();
}
+ polygonUpdated = processPacketData(CzmlBoolean, polygon, 'show', polygonData.show, interval, sourceUri) || polygonUpdated;
+
if (typeof polygonData.material !== 'undefined') {
var material = polygon.material;
if (typeof material === 'undefined') {
@@ -95,6 +87,7 @@ define([
}
material.processCzmlIntervals(polygonData.material, interval, sourceUri);
}
+
return polygonUpdated;
};
diff --git a/Source/DynamicScene/DynamicPyramid.js b/Source/DynamicScene/DynamicPyramid.js
index 1bb9e4a994a4..9f40aa99048f 100644
--- a/Source/DynamicScene/DynamicPyramid.js
+++ b/Source/DynamicScene/DynamicPyramid.js
@@ -5,7 +5,7 @@ define([
'./CzmlBoolean',
'./CzmlNumber',
'./CzmlColor',
- './DynamicProperty',
+ './processPacketData',
'./DynamicDirectionsProperty',
'./DynamicMaterialProperty'
], function(
@@ -14,7 +14,7 @@ define([
CzmlBoolean,
CzmlNumber,
CzmlColor,
- DynamicProperty,
+ processPacketData,
DynamicDirectionsProperty,
DynamicMaterialProperty) {
"use strict";
@@ -96,68 +96,28 @@ define([
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicPyramid.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection) {
+ DynamicPyramid.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var pyramidData = packet.pyramid;
if (typeof pyramidData === 'undefined') {
return false;
}
- var pyramidUpdated = false;
- var pyramid = dynamicObject.pyramid;
- pyramidUpdated = typeof pyramid === 'undefined';
- if (pyramidUpdated) {
- dynamicObject.pyramid = pyramid = new DynamicPyramid();
- }
-
var interval = pyramidData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof pyramidData.show !== 'undefined') {
- var show = pyramid.show;
- if (typeof show === 'undefined') {
- pyramid.show = show = new DynamicProperty(CzmlBoolean);
- pyramidUpdated = true;
- }
- show.processCzmlIntervals(pyramidData.show, interval);
- }
-
- if (typeof pyramidData.radius !== 'undefined') {
- var radius = pyramid.radius;
- if (typeof radius === 'undefined') {
- pyramid.radius = radius = new DynamicProperty(CzmlNumber);
- pyramidUpdated = true;
- }
- radius.processCzmlIntervals(pyramidData.radius, interval);
- }
-
- if (typeof pyramidData.showIntersection !== 'undefined') {
- var showIntersection = pyramid.showIntersection;
- if (typeof showIntersection === 'undefined') {
- pyramid.showIntersection = showIntersection = new DynamicProperty(CzmlBoolean);
- pyramidUpdated = true;
- }
- showIntersection.processCzmlIntervals(pyramidData.showIntersection, interval);
- }
-
- if (typeof pyramidData.intersectionColor !== 'undefined') {
- var intersectionColor = pyramid.intersectionColor;
- if (typeof intersectionColor === 'undefined') {
- pyramid.intersectionColor = intersectionColor = new DynamicProperty(CzmlColor);
- pyramidUpdated = true;
- }
- intersectionColor.processCzmlIntervals(pyramidData.intersectionColor, interval);
+ var pyramid = dynamicObject.pyramid;
+ var pyramidUpdated = typeof pyramid === 'undefined';
+ if (pyramidUpdated) {
+ dynamicObject.pyramid = pyramid = new DynamicPyramid();
}
- if (typeof pyramidData.intersectionWidth !== 'undefined') {
- var intersectionWidth = pyramid.intersectionWidth;
- if (typeof intersectionWidth === 'undefined') {
- pyramid.intersectionWidth = intersectionWidth = new DynamicProperty(CzmlNumber);
- pyramidUpdated = true;
- }
- intersectionWidth.processCzmlIntervals(pyramidData.intersectionWidth, interval);
- }
+ pyramidUpdated = processPacketData(CzmlBoolean, pyramid, 'show', pyramidData.show, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(CzmlNumber, pyramid, 'radius', pyramidData.radius, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(CzmlBoolean, pyramid, 'showIntersection', pyramidData.showIntersection, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(CzmlColor, pyramid, 'intersectionColor', pyramidData.intersectionColor, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(CzmlNumber, pyramid, 'intersectionWidth', pyramidData.intersectionWidth, interval, sourceUri) || pyramidUpdated;
if (typeof pyramidData.material !== 'undefined') {
var material = pyramid.material;
@@ -176,6 +136,7 @@ define([
}
directions.processCzmlIntervals(pyramidData.directions, interval);
}
+
return pyramidUpdated;
};
diff --git a/Source/DynamicScene/DynamicVector.js b/Source/DynamicScene/DynamicVector.js
index e04909b0792d..bf8a50a3f774 100644
--- a/Source/DynamicScene/DynamicVector.js
+++ b/Source/DynamicScene/DynamicVector.js
@@ -6,7 +6,7 @@ define([
'./CzmlDirection',
'./CzmlNumber',
'./CzmlColor',
- './DynamicProperty'],
+ './processPacketData'],
function(
TimeInterval,
defaultValue,
@@ -14,7 +14,7 @@ function(
CzmlDirection,
CzmlNumber,
CzmlColor,
- DynamicProperty) {
+ processPacketData) {
"use strict";
/**
@@ -79,68 +79,29 @@ function(
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicVector.processCzmlPacket = function(dynamicObject, packet) {
+ DynamicVector.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var vectorData = packet.vector;
if (typeof vectorData === 'undefined') {
return false;
}
- var vectorUpdated = false;
- var vector = dynamicObject.vector;
- vectorUpdated = typeof vector === 'undefined';
- if (vectorUpdated) {
- dynamicObject.vector = vector = new DynamicVector();
- }
-
var interval = vectorData.interval;
if (typeof interval !== 'undefined') {
interval = TimeInterval.fromIso8601(interval);
}
- if (typeof vectorData.color !== 'undefined') {
- var color = vector.color;
- if (typeof color === 'undefined') {
- vector.color = color = new DynamicProperty(CzmlColor);
- vectorUpdated = true;
- }
- color.processCzmlIntervals(vectorData.color, interval);
- }
-
- if (typeof vectorData.width !== 'undefined') {
- var width = vector.width;
- if (typeof width === 'undefined') {
- vector.width = width = new DynamicProperty(CzmlNumber);
- vectorUpdated = true;
- }
- width.processCzmlIntervals(vectorData.width, interval);
- }
-
- if (typeof vectorData.direction !== 'undefined') {
- var direction = vector.direction;
- if (typeof direction === 'undefined') {
- vector.direction = direction = new DynamicProperty(CzmlDirection);
- vectorUpdated = true;
- }
- direction.processCzmlIntervals(vectorData.direction, interval);
+ var vector = dynamicObject.vector;
+ var vectorUpdated = typeof vector === 'undefined';
+ if (vectorUpdated) {
+ dynamicObject.vector = vector = new DynamicVector();
}
- if (typeof vectorData.length !== 'undefined') {
- var length = vector.length;
- if (typeof length === 'undefined') {
- vector.length = length = new DynamicProperty(CzmlNumber);
- vectorUpdated = true;
- }
- length.processCzmlIntervals(vectorData.length, interval);
- }
+ vectorUpdated = processPacketData(CzmlColor, vector, 'color', vectorData.color, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(CzmlBoolean, vector, 'show', vectorData.show, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(CzmlNumber, vector, 'width', vectorData.width, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(CzmlDirection, vector, 'direction', vectorData.direction, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(CzmlNumber, vector, 'length', vectorData.length, interval, sourceUri) || vectorUpdated;
- if (typeof vectorData.show !== 'undefined') {
- var show = vector.show;
- if (typeof show === 'undefined') {
- vector.show = show = new DynamicProperty(CzmlBoolean);
- vectorUpdated = true;
- }
- show.processCzmlIntervals(vectorData.show, interval);
- }
return vectorUpdated;
};
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 462be402a26e..a02f657766ac 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -259,7 +259,7 @@ define([
} else if (type === Color) {
typeHandler = SampledColor;
} else if (type === Quaternion) {
- typeHandler = Quaternion;
+ typeHandler = SampledQuaternion;
} else {
throw new DeveloperError('unknown type');
}
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
index bc399652ee94..82919cae8b8b 100644
--- a/Source/DynamicScene/processPacketData.js
+++ b/Source/DynamicScene/processPacketData.js
@@ -2,6 +2,7 @@
define([
'../Core/TimeInterval',
'../Core/Iso8601',
+ '../Core/JulianDate',
'./CompositeProperty',
'./ConstantProperty',
'./SampledProperty',
@@ -9,22 +10,23 @@ define([
], function(
TimeInterval,
Iso8601,
+ JulianDate,
CompositeProperty,
ConstantProperty,
SampledProperty,
TimeIntervalCollectionProperty) {
"use strict";
- function processProperty(type, object, propertyName, packetData, interval, sourceUri) {
+ function processProperty(type, object, propertyName, packetData, constrainedInterval, sourceUri) {
var combinedInterval;
var packetInterval = packetData.interval;
if (typeof packetInterval !== 'undefined') {
combinedInterval = TimeInterval.fromIso8601(packetInterval);
- if (typeof interval !== 'undefined') {
- combinedInterval = combinedInterval.intersect(interval);
+ if (typeof constrainedInterval !== 'undefined') {
+ combinedInterval = combinedInterval.intersect(constrainedInterval);
}
- } else if (typeof interval !== 'undefined') {
- combinedInterval = interval;
+ } else if (typeof constrainedInterval !== 'undefined') {
+ combinedInterval = constrainedInterval;
}
var unwrappedInterval = type.unwrapInterval(packetData, sourceUri);
@@ -55,11 +57,11 @@ define([
}
} else if (isSampled && !hasInterval) {
if (!(property instanceof SampledProperty)) {
- property = new SampledProperty();
+ property = new SampledProperty(type.type);
object[propertyName] = property;
propertyCreated = true;
}
- property.addSamplesFlatArray(unwrappedInterval, packetData.epoch);
+ property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
} else if (isSampled && hasInterval) {
if (typeof property === 'undefined') {
property = new CompositeProperty();
@@ -67,7 +69,22 @@ define([
propertyCreated = true;
}
if (property instanceof CompositeProperty) {
- property.addSamplesFlatArray(unwrappedInterval, packetData.epoch);
+ var intervals = property.getIntervals();
+ var interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
+ var intervalData;
+ if (typeof interval !== 'undefined') {
+ intervalData = interval.data;
+ } else {
+ interval = combinedInterval.clone();
+ intervalData = new SampledProperty(type.type);
+ interval.data = intervalData;
+ intervals.addInterval(interval);
+ }
+ if (!(intervalData instanceof SampledProperty)) {
+ intervalData = new SampledProperty(type.type);
+ interval.Data = intervalData;
+ }
+ intervalData.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
} else {
//TODO
}
diff --git a/Specs/DynamicScene/CzmlUnitSphericalSpec.js b/Specs/DynamicScene/CzmlUnitSphericalSpec.js
deleted file mode 100644
index d4d14c57762a..000000000000
--- a/Specs/DynamicScene/CzmlUnitSphericalSpec.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlUnitSpherical',
- 'Core/Spherical',
- 'Core/Math'
- ], function(
- CzmlUnitSpherical,
- Spherical,
- CesiumMath) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var spherical1 = new Spherical(2, 3, 1.0);
- var spherical2 = new Spherical(4, 5, 1.0);
-
- var constantSphericalInterval = {
- unitSpherical : [spherical1.clock, spherical1.cone]
- };
-
- var sampledSphericalInterval = {
- unitSpherical : [0, spherical1.clock, spherical1.cone, 1, spherical2.clock, spherical2.cone]
- };
-
- it('unwrapInterval', function() {
- expect(CzmlUnitSpherical.unwrapInterval(constantSphericalInterval)).toEqual(constantSphericalInterval.unitSpherical);
- expect(CzmlUnitSpherical.unwrapInterval(sampledSphericalInterval)).toEqual(sampledSphericalInterval.unitSpherical);
- });
-
- it('isSampled', function() {
- expect(CzmlUnitSpherical.isSampled(constantSphericalInterval.unitSpherical)).toEqual(false);
- expect(CzmlUnitSpherical.isSampled(sampledSphericalInterval.unitSpherical)).toEqual(true);
- });
-
- it('getValue', function() {
- expect(CzmlUnitSpherical.getValue(constantSphericalInterval.unitSpherical)).toEqual(spherical1);
- });
-
- it('getValueFromArray', function() {
- expect(CzmlUnitSpherical.getValueFromArray(sampledSphericalInterval.unitSpherical, 4)).toEqual(spherical2);
- });
-});
\ No newline at end of file
From b576cc7ad31a47743b70fb5436885d26d4b36f32 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 12 Aug 2013 16:48:35 -0400
Subject: [PATCH 11/65] Ongoing Property work.
---
Source/DynamicScene/CompositeProperty.js | 27 ++----
.../DynamicScene/ConstantPositionProperty.js | 76 +++++++++++++++
Source/DynamicScene/ConstantProperty.js | 61 +++++++-----
Source/DynamicScene/PositionProperty.js | 96 +++++++++++++++++++
Source/DynamicScene/Property.js | 24 ++---
Source/DynamicScene/ReferenceProperty.js | 3 -
Source/DynamicScene/SampledProperty.js | 7 +-
.../TimeIntervalCollectionProperty.js | 48 +++++-----
Specs/DynamicScene/CompositePropertySpec.js | 16 +---
Specs/DynamicScene/ConstantPropertySpec.js | 26 ++++-
.../TimeIntervalCollectionPropertySpec.js | 12 ++-
11 files changed, 282 insertions(+), 114 deletions(-)
create mode 100644 Source/DynamicScene/ConstantPositionProperty.js
create mode 100644 Source/DynamicScene/PositionProperty.js
diff --git a/Source/DynamicScene/CompositeProperty.js b/Source/DynamicScene/CompositeProperty.js
index ed1adac614cd..779d046c45b3 100644
--- a/Source/DynamicScene/CompositeProperty.js
+++ b/Source/DynamicScene/CompositeProperty.js
@@ -9,7 +9,7 @@ define(['../Core/defineProperties',
"use strict";
/**
- * A {@link Property} which is defined by an TimeIntervalCollection, where the
+ * A {@link Property} which is defined by a TimeIntervalCollection, where the
* data property of the interval is another Property instance which is evaluated
* at the provided time.
*
@@ -21,10 +21,8 @@ define(['../Core/defineProperties',
};
/**
- * Returns a value indicating if this property varies with simulation time.
- * @memberof Property
- *
- * @returns {Boolean} True if the property varies with simulation time, false otherwise.
+ * @memberof ConstantProperty
+ * @returns {Boolean} Always returns true, since this property always varies with simulation time.
*/
CompositeProperty.prototype.getIsTimeVarying = function() {
return true;
@@ -37,16 +35,17 @@ define(['../Core/defineProperties',
* @param {JulianDate} time The simulation time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
*/
CompositeProperty.prototype.getValue = function(time, result) {
if (typeof time === 'undefined') {
throw new DeveloperError('time is required');
}
- var data;
var interval = this._intervals.findIntervalContainingDate(time);
if (typeof interval !== 'undefined') {
- data = interval.data;
+ var data = interval.data;
if (typeof data !== 'undefined') {
return data.getValue(time, result);
}
@@ -54,20 +53,6 @@ define(['../Core/defineProperties',
return undefined;
};
- /**
- * Returns the value of the property.
- * @memberof Property
- *
- * @param {JulianDate} start The time of the first sample. If there is no data at this time, the next earliest time is used.
- * @param {JulianDate} stop The time of the last sample. If there is no data at this time, the latest available previous time is used.
- * @param {Number} [maximumStep] The recommended maximum step size to take between samples, the specific implementation can ignore this value if it can produce an equivalent optimal set of values.
- * @param {Array} [requiredTimes] An array of JulianDate instances, sorted by time, earliest first, that must be sampled in addition to any other steps taken by the sampling function.
- * @param {Object} [resultTimes] An array containing all of the sampled times which corresponds to the result at the same index in resultValues.
- * @param {Object} [resultValues] An array containing all of the samples values, which correspond to the times
- */
- CompositeProperty.prototype.sampleValue = function(start, stop, resultValues, resultTimes, requiredTimes, maximumStep) {
- };
-
/**
* Gets the interval collection.
* @memberof CompositeProperty.prototype
diff --git a/Source/DynamicScene/ConstantPositionProperty.js b/Source/DynamicScene/ConstantPositionProperty.js
new file mode 100644
index 000000000000..5a61a3409b4b
--- /dev/null
+++ b/Source/DynamicScene/ConstantPositionProperty.js
@@ -0,0 +1,76 @@
+/*global define*/
+define([
+ './ConstantProperty',
+ './PositionProperty',
+ '../Core/Cartesian3',
+ '../Core/defaultValue',
+ '../Core/DeveloperError',
+ '../Core/ReferenceFrame'
+ ], function(
+ ConstantProperty,
+ PositionProperty,
+ Cartesian3,
+ defaultValue,
+ DeveloperError,
+ ReferenceFrame) {
+ "use strict";
+
+ /**
+ * A {@link PositionProperty} whose value never changes.
+ *
+ * @alias ConstantPositionProperty
+ * @constructor
+ *
+ * @exception {DeveloperError} value is required.
+ */
+ var ConstantPositionProperty = function(value, referenceFrame) {
+ this._property = new ConstantProperty(value, Cartesian3.clone);
+ this._referenceFrame = defaultValue(referenceFrame, ReferenceFrame.FIXED);
+ };
+
+ /**
+ * @memberof ConstantPositionProperty
+ * @returns {Boolean} Always returns false, since this property never varies with simulation time.
+ */
+ ConstantPositionProperty.prototype.getIsTimeVarying = function() {
+ return this._property.getIsTimeVarying();
+ };
+
+ /**
+ * Gets the reference frame that the position is defined in.
+ *
+ * @memberof PositionProperty
+ * @returns {ReferenceFrame} The reference frame that the position is defined in.
+ */
+ ConstantPositionProperty.prototype.getReferenceFrame = function() {
+ return this._referenceFrame;
+ };
+
+ /**
+ * Returns the value of the property at the specified simulation time in the fixed frame.
+ * @memberof PositionProperty
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ ConstantPositionProperty.prototype.getValue = function(time, result, referenceFrame) {
+ return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result);
+ };
+
+ /**
+ * Returns the value of the property at the specified simulation time in the specified reference frame.
+ * @memberof PositionProperty
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The desired referenceFrame of the result.
+ * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ ConstantPositionProperty.prototype.getValueInReferenceFrame = function(time, result, referenceFrame) {
+ var value = this._property.getValue(time, result);
+ return PositionProperty.convertToReferenceFrame(time, value, this._referenceFrame, referenceFrame, value);
+ };
+
+ return ConstantPositionProperty;
+});
\ No newline at end of file
diff --git a/Source/DynamicScene/ConstantProperty.js b/Source/DynamicScene/ConstantProperty.js
index e05519f1ca91..9b3dc531d0a6 100644
--- a/Source/DynamicScene/ConstantProperty.js
+++ b/Source/DynamicScene/ConstantProperty.js
@@ -1,21 +1,50 @@
/*global define*/
-define(['../Core/DeveloperError'], function(DeveloperError) {
+define([
+ '../Core/defaultValue',
+ '../Core/DeveloperError',
+ '../Core/Enumeration'
+ ], function(
+ defaultValue,
+ DeveloperError,
+ Enumeration) {
"use strict";
+ function prototypeClone(value, result) {
+ return value.clone(result);
+ }
+
+ function noClone(value, result) {
+ return value;
+ }
+
/**
* A {@link Property} whose value never changes.
*
* @alias ConstantProperty
* @constructor
*
+ * @param {Object|Number|String} value The property value.
+ * @param {Function} [clone=value.clone] A function which takes the value and result parameter and clones it.
+ * This parameter is only required if the value is not a number or string and does not have a clone function.
+ *
* @exception {DeveloperError} value is required.
+ * @exception {DeveloperError} clone is a required function.
*/
- var ConstantProperty = function(value) {
+ var ConstantProperty = function(value, clone) {
if (typeof value === 'undefined') {
throw new DeveloperError('value is required.');
}
+
+ if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean' && !(value instanceof Enumeration) && !Array.isArray(value)) {
+ if (typeof value.clone !== 'function' && typeof clone !== 'function') {
+ throw new DeveloperError('clone is a required function.');
+ }
+
+ clone = defaultValue(clone, prototypeClone);
+ }
+
this._value = value;
- this._clonable = typeof value !== 'undefined' && typeof value.clone === 'function';
+ this._clone = defaultValue(clone, noClone);
};
/**
@@ -27,31 +56,15 @@ define(['../Core/DeveloperError'], function(DeveloperError) {
};
/**
- * Gets the value of the property, optionally cloning it.
+ * Returns the value of the property at the specified simulation time.
* @memberof ConstantProperty
*
- * @param {JulianDate} time The time for which to retrieve the value. This parameter is unused.
- * @param {Object} [result] The object to store the value into if the value is clonable. If the result is omitted or the value does not implement clone, the actual value is returned.
- * @returns The modified result parameter or the actual value instance if the value is not clonable.
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*/
ConstantProperty.prototype.getValue = function(time, result) {
- var value = this._value;
- if (this._clonable) {
- return value.clone(result);
- }
- return value;
- };
-
- ConstantProperty.prototype.sampleValue = function(start, stop, resultValues, resultTimes, requiredTimes, maximumStep) {
- resultValues[0] = this.getValue(start, resultValues[0]);
- resultValues[1] = this.getValue(stop, resultValues[1]);
- resultValues.length = 2;
-
- if (typeof resultTimes !== 'undefined') {
- resultTimes[0] = start.clone();
- resultTimes[1] = stop.clone();
- resultTimes.length = 2;
- }
+ return this._clone(this._value, result);
};
return ConstantProperty;
diff --git a/Source/DynamicScene/PositionProperty.js b/Source/DynamicScene/PositionProperty.js
new file mode 100644
index 000000000000..9759eb1b4e4c
--- /dev/null
+++ b/Source/DynamicScene/PositionProperty.js
@@ -0,0 +1,96 @@
+/*global define*/
+define([
+ '../Core/Cartesian3',
+ '../Core/DeveloperError',
+ '../Core/Matrix3',
+ '../Core/ReferenceFrame',
+ '../Core/Transforms'
+ ], function(
+ Cartesian3,
+ DeveloperError,
+ Matrix3,
+ ReferenceFrame,
+ Transforms) {
+ "use strict";
+
+ function throwInstantiationError() {
+ throw new DeveloperError('This type should not be instantiated directly.');
+ }
+
+ /**
+ * The base class for position properties, which are {@link Property} objects
+ * with an associated {@link ReferenceFrame} and {@link Cartesian3} value.
+ * This type defines an interface and cannot be instantiated directly.
+ *
+ * @alias PositionProperty
+ * @constructor
+ *
+ * @see CompositePositionProperty
+ * @see ConstantPositionProperty
+ * @see SampledPositionProperty
+ * @see TimeIntervalCollectionPositionProperty
+ */
+ var PositionProperty = throwInstantiationError;
+
+ /**
+ * If the property varies with simulation time, this function returns true. If the property
+ * is constant or changes in ways not related to simulation time, this function returns false.
+ *
+ * @memberof PositionProperty
+ * @returns {Boolean} True if the property varies with simulation time, false otherwise.
+ */
+ PositionProperty.prototype.getIsTimeVarying = throwInstantiationError;
+
+ /**
+ * Gets the reference frame that the position is defined in.
+ *
+ * @memberof PositionProperty
+ * @returns {ReferenceFrame} The reference frame that the position is defined in.
+ */
+ PositionProperty.prototype.getReferenceFrame = throwInstantiationError;
+
+ /**
+ * Returns the value of the property at the specified simulation time in the fixed frame.
+ * @memberof PositionProperty
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ PositionProperty.prototype.getValue = throwInstantiationError;
+
+ /**
+ * Returns the value of the property at the specified simulation time in the specified reference frame.
+ * @memberof PositionProperty
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The desired referenceFrame of the result.
+ * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ PositionProperty.prototype.getValueInReferenceFrame = throwInstantiationError;
+
+ var scratchMatrix3 = new Matrix3();
+
+ /**
+ * @private
+ */
+ PositionProperty.convertToReferenceFrame = function(time, value, inputFrame, outputFrame, result) {
+ if (inputFrame === outputFrame) {
+ return Cartesian3.clone(value, result);
+ }
+
+ var icrfToFixed = Transforms.computeIcrfToFixedMatrix(time, scratchMatrix3);
+ if (typeof icrfToFixed === 'undefined') {
+ icrfToFixed = Transforms.computeTemeToPseudoFixedMatrix(time, scratchMatrix3);
+ }
+ if (inputFrame === ReferenceFrame.INERTIAL) {
+ return icrfToFixed(scratchMatrix3).multiplyByVector(value, result);
+ }
+ if (inputFrame === ReferenceFrame.FIXED) {
+ return icrfToFixed.transpose(scratchMatrix3).multiplyByVector(value, result);
+ }
+ };
+
+ return PositionProperty;
+});
\ No newline at end of file
diff --git a/Source/DynamicScene/Property.js b/Source/DynamicScene/Property.js
index 0487885e3627..5910f00bf0ca 100644
--- a/Source/DynamicScene/Property.js
+++ b/Source/DynamicScene/Property.js
@@ -10,17 +10,18 @@ define(['../Core/DeveloperError'
/**
* The base class for all properties, which represent a value that can optionally
- * vary over time. This type cannot be instantiated directly.
+ * vary over time.
+ * This type defines an interface and cannot be instantiated directly.
*
* @alias Property
* @constructor
*
+ * @see CompositeProperty
* @see ConstantProperty
+ * @see PositionProperty
+ * @see RefereenceProperty
* @see SampledProperty
- * @see CompositeProperty
* @see TimeIntervalCollectionProperty
- * @see PositionProperty
- * @see CompositePositionProperty
*/
var Property = throwInstantiationError;
@@ -40,21 +41,10 @@ define(['../Core/DeveloperError'
* @param {JulianDate} time The simulation time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
- */
- Property.prototype.getValue = throwInstantiationError;
-
- /**
- * Samples the value of the property over time using the specified options.
- * @memberof Property
*
- * @param {JulianDate} start The time of the first sample. If there is no data at this time, the next earliest time is used.
- * @param {JulianDate} stop The time of the last sample. If there is no data at this time, the latest previous time is used.
- * @param {Object} [resultValues] An array containing all of the samples values, which correspond to the times
- * @param {Object} [resultTimes] An array containing all of the sampled times which corresponds to the result at the same index in resultValues.
- * @param {Array} [requiredTimes] An array of JulianDate instances, sorted by time, earliest first, that must be sampled in addition to any other steps taken by the sampling function.
- * @param {Number} [maximumStep] The suggested maximum step size to take between samples, specific implementations can ignore this value if it can produce an equivalent and optimal set of values.
+ * @exception {DeveloperError} time is required.
*/
- Property.prototype.sampleValue = throwInstantiationError;
+ Property.prototype.getValue = throwInstantiationError;
return Property;
});
\ No newline at end of file
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index d32e533869a0..290480ee453d 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -126,8 +126,5 @@ define([
return typeof targetProperty !== 'undefined' && this._targetObject.isAvailable(time) ? targetProperty.getValue(time, result) : undefined;
};
- ReferenceProperty.prototype.sampleValue = function() {
- };
-
return ReferenceProperty;
});
\ No newline at end of file
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index a02f657766ac..2f5a17834a88 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -277,7 +277,7 @@ define([
/**
* @memberof SampledProperty
- * @returns {Boolean} Always returns false, since this property never varies with simulation time.
+ * @returns {Boolean} Always returns true, since this property always varies with simulation time.
*/
SampledProperty.prototype.getIsTimeVarying = function() {
return true;
@@ -290,6 +290,8 @@ define([
* @param {JulianDate} time The time for which to retrieve the value. This parameter is unused.
* @param {Object} [result] The object to store the value into if the value is clonable. If the result is omitted or the value does not implement clone, the actual value is returned.
* @returns The modified result parameter or the actual value instance if the value is not clonable.
+ *
+ * @exception {DeveloperError} time is required.
*/
SampledProperty.prototype.getValue = function(time, result) {
var typeHandler = this._typeHandler;
@@ -375,9 +377,6 @@ define([
return typeHandler.inflate(this._values, index * doublesPerValue, result);
};
- SampledProperty.prototype.sampleValue = function(start, stop, resultValues, resultTimes, requiredTimes, maximumStep) {
- };
-
SampledProperty.prototype.addSample = function(time, value) {
var typeHandler = this._typeHandler;
var data = [time];
diff --git a/Source/DynamicScene/TimeIntervalCollectionProperty.js b/Source/DynamicScene/TimeIntervalCollectionProperty.js
index aa0ded4901c7..7d6de068c185 100644
--- a/Source/DynamicScene/TimeIntervalCollectionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionProperty.js
@@ -1,10 +1,12 @@
/*global define*/
define(['../Core/defineProperties',
'../Core/DeveloperError',
+ '../Core/Enumeration',
'../Core/TimeIntervalCollection'
], function(
defineProperties,
DeveloperError,
+ Enumeration,
TimeIntervalCollection) {
"use strict";
@@ -14,16 +16,19 @@ define(['../Core/defineProperties',
*
* @alias TimeIntervalCollectionProperty
* @constructor
+ *
+ * @param {Function} [clone=value.clone] A function which takes the value and result parameter and clones it.
+ * This parameter is only required if the value is not a number or string and does not have a clone function.
+ *
*/
- var TimeIntervalCollectionProperty = function() {
+ var TimeIntervalCollectionProperty = function(clone) {
this._intervals = new TimeIntervalCollection();
+ this._clone = clone;
};
/**
- * Returns a value indicating if this property varies with simulation time.
- * @memberof Property
- *
- * @returns {Boolean} True if the property varies with simulation time, false otherwise.
+ * @memberof TimeIntervalCollectionProperty
+ * @returns {Boolean} Always returns true, since this property always varies with simulation time.
*/
TimeIntervalCollectionProperty.prototype.getIsTimeVarying = function() {
return true;
@@ -31,45 +36,36 @@ define(['../Core/defineProperties',
/**
* Returns the value of the property at the specified simulation time.
- * @memberof Property
+ * @memberof TimeIntervalCollectionProperty
*
* @param {JulianDate} time The simulation time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
*/
TimeIntervalCollectionProperty.prototype.getValue = function(time, result) {
if (typeof time === 'undefined') {
throw new DeveloperError('time is required');
}
- var data;
var interval = this._intervals.findIntervalContainingDate(time);
if (typeof interval !== 'undefined') {
- data = interval.data;
- if (typeof data !== 'undefined' && typeof data.clone === 'function') {
- return data.clone(result);
+ var value = interval.data;
+ if (typeof value !== 'undefined' && typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean' && !(value instanceof Enumeration) && !Array.isArray(value)) {
+ if (typeof value.clone === 'function') {
+ return value.clone(result);
+ }
+ return this._clone(value, result);
}
+ return value;
}
- return data;
- };
-
- /**
- * Returns the value of the property.
- * @memberof Property
- *
- * @param {JulianDate} start The time of the first sample. If there is no data at this time, the next earliest time is used.
- * @param {JulianDate} stop The time of the last sample. If there is no data at this time, the latest available previous time is used.
- * @param {Number} [maximumStep] The recommended maximum step size to take between samples, the specific implementation can ignore this value if it can produce an equivalent optimal set of values.
- * @param {Array} [requiredTimes] An array of JulianDate instances, sorted by time, earliest first, that must be sampled in addition to any other steps taken by the sampling function.
- * @param {Object} [resultTimes] An array containing all of the sampled times which corresponds to the result at the same index in resultValues.
- * @param {Object} [resultValues] An array containing all of the samples values, which correspond to the times
- */
- TimeIntervalCollectionProperty.prototype.sampleValue = function(start, stop, resultValues, resultTimes, requiredTimes, maximumStep) {
+ return undefined;
};
/**
* Gets the interval collection.
- * @memberof TimeIntervalCollectionProperty.prototype
+ * @memberof TimeIntervalCollectionProperty
*
* @type {TimeIntervalCollection}
*/
diff --git a/Specs/DynamicScene/CompositePropertySpec.js b/Specs/DynamicScene/CompositePropertySpec.js
index 4aa0adddaa45..b873d4d4f318 100644
--- a/Specs/DynamicScene/CompositePropertySpec.js
+++ b/Specs/DynamicScene/CompositePropertySpec.js
@@ -23,19 +23,7 @@ defineSuite([
expect(property.getValue(new JulianDate())).toBeUndefined();
});
- it('works with non-clonable objects', function() {
- var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantProperty({}));
- var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantProperty({}));
-
- var property = new CompositeProperty();
- property.getIntervals().addInterval(interval1);
- property.getIntervals().addInterval(interval2);
-
- expect(property.getValue(interval1.start)).toBe(interval1.data.getValue());
- expect(property.getValue(interval2.stop)).toBe(interval2.data.getValue());
- });
-
- it('works with clonable objects', function() {
+ it('works without a result parameter', function() {
var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantProperty(new Cartesian3(1, 2, 3)));
var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantProperty(new Cartesian3(4, 5, 6)));
@@ -52,7 +40,7 @@ defineSuite([
expect(result2).toEqual(interval2.data.getValue());
});
- it('works with clonable objects with result parameter', function() {
+ it('works with a result parameter', function() {
var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantProperty(new Cartesian3(1, 2, 3)));
var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantProperty(new Cartesian3(4, 5, 6)));
diff --git a/Specs/DynamicScene/ConstantPropertySpec.js b/Specs/DynamicScene/ConstantPropertySpec.js
index 4260f002fb77..42f727592154 100644
--- a/Specs/DynamicScene/ConstantPropertySpec.js
+++ b/Specs/DynamicScene/ConstantPropertySpec.js
@@ -8,13 +8,26 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('works with non-clonable objects', function() {
- var expected = {};
+ it('works with basic types', function() {
+ var expected = 5;
var property = new ConstantProperty(expected);
expect(property.getIsTimeVarying()).toEqual(false);
expect(property.getValue()).toBe(expected);
});
+ it('works with clone function', function() {
+ var expected = {};
+ var cloneCalled = false;
+ var cloneFunction = function() {
+ cloneCalled = true;
+ return expected;
+ };
+ var property = new ConstantProperty(expected, cloneFunction);
+ expect(property.getIsTimeVarying()).toEqual(false);
+ expect(property.getValue()).toBe(expected);
+ expect(cloneCalled).toEqual(true);
+ });
+
it('works with clonable objects', function() {
var value = new Cartesian3(1, 2, 3);
var property = new ConstantProperty(value);
@@ -38,7 +51,14 @@ defineSuite([
it('constructor throws with undefined value', function() {
expect(function() {
- return new ConstantProperty(undefined);
+ return new ConstantProperty(undefined, function() {
+ });
+ }).toThrow();
+ });
+
+ it('constructor throws with undefined clone function on non-basic type', function() {
+ expect(function() {
+ return new ConstantProperty({}, undefined);
}).toThrow();
});
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
index c215bdbb308b..9e16114e1976 100644
--- a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
+++ b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
@@ -25,12 +25,20 @@ defineSuite([
var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, {});
var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, {});
- var property = new TimeIntervalCollectionProperty();
+ var timesCalled = 0;
+ function noClone(value, result) {
+ timesCalled++;
+ return value;
+ }
+
+ var property = new TimeIntervalCollectionProperty(noClone);
property.getIntervals().addInterval(interval1);
property.getIntervals().addInterval(interval2);
expect(property.getValue(interval1.start)).toBe(interval1.data);
+ expect(timesCalled).toEqual(1);
expect(property.getValue(interval2.stop)).toBe(interval2.data);
+ expect(timesCalled).toEqual(2);
});
it('works with clonable objects', function() {
@@ -50,7 +58,7 @@ defineSuite([
expect(result2).toEqual(interval2.data);
});
- it('works with clonable objects with result parameter', function() {
+ it('works with a result parameter', function() {
var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new Cartesian3(1, 2, 3));
var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new Cartesian3(4, 5, 6));
From 13bc5c9131976fbd4e0aaad0f4e20a59f6c8735e Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 13 Aug 2013 13:27:08 -0400
Subject: [PATCH 12/65] Update new code to use `defined`
---
Source/DynamicScene/CompositeProperty.js | 19 ++++++++-------
Source/DynamicScene/ConstantProperty.js | 4 +++-
Source/DynamicScene/DynamicBillboard.js | 2 +-
Source/DynamicScene/DynamicColorMaterial.js | 2 +-
Source/DynamicScene/DynamicCone.js | 2 +-
Source/DynamicScene/DynamicEllipse.js | 2 +-
Source/DynamicScene/DynamicEllipsoid.js | 2 +-
Source/DynamicScene/DynamicLabel.js | 2 +-
Source/DynamicScene/DynamicObjectView.js | 4 ++--
Source/DynamicScene/DynamicPath.js | 2 +-
Source/DynamicScene/DynamicPoint.js | 2 +-
Source/DynamicScene/DynamicPolygon.js | 4 ++--
Source/DynamicScene/DynamicPolyline.js | 2 +-
Source/DynamicScene/DynamicPyramid.js | 2 +-
Source/DynamicScene/DynamicVector.js | 2 +-
Source/DynamicScene/PositionProperty.js | 4 +++-
Source/DynamicScene/ReferenceProperty.js | 4 ++--
Source/DynamicScene/SampledProperty.js | 24 ++++++++++---------
.../TimeIntervalCollectionProperty.js | 21 +++++++++-------
Source/DynamicScene/processPacketData.js | 18 +++++++-------
20 files changed, 69 insertions(+), 55 deletions(-)
diff --git a/Source/DynamicScene/CompositeProperty.js b/Source/DynamicScene/CompositeProperty.js
index 779d046c45b3..f1cf5d853e22 100644
--- a/Source/DynamicScene/CompositeProperty.js
+++ b/Source/DynamicScene/CompositeProperty.js
@@ -1,11 +1,14 @@
/*global define*/
-define(['../Core/defineProperties',
+define([
+ '../Core/defined',
+ '../Core/defineProperties',
'../Core/DeveloperError',
'../Core/TimeIntervalCollection'
- ], function(
- defineProperties,
- DeveloperError,
- TimeIntervalCollection) {
+ ], function(
+ defined,
+ defineProperties,
+ DeveloperError,
+ TimeIntervalCollection) {
"use strict";
/**
@@ -39,14 +42,14 @@ define(['../Core/defineProperties',
* @exception {DeveloperError} time is required.
*/
CompositeProperty.prototype.getValue = function(time, result) {
- if (typeof time === 'undefined') {
+ if (!defined(time)) {
throw new DeveloperError('time is required');
}
var interval = this._intervals.findIntervalContainingDate(time);
- if (typeof interval !== 'undefined') {
+ if (defined(interval)) {
var data = interval.data;
- if (typeof data !== 'undefined') {
+ if (defined(data)) {
return data.getValue(time, result);
}
}
diff --git a/Source/DynamicScene/ConstantProperty.js b/Source/DynamicScene/ConstantProperty.js
index 58295ca458c5..e37c58aa5bc7 100644
--- a/Source/DynamicScene/ConstantProperty.js
+++ b/Source/DynamicScene/ConstantProperty.js
@@ -1,10 +1,12 @@
/*global define*/
define([
'../Core/defaultValue',
+ '../Core/defined',
'../Core/DeveloperError',
'../Core/Enumeration'
], function(
defaultValue,
+ defined,
DeveloperError,
Enumeration) {
"use strict";
@@ -31,7 +33,7 @@ define([
* @exception {DeveloperError} clone is a required function.
*/
var ConstantProperty = function(value, clone) {
- if (typeof value === 'undefined') {
+ if (!defined(value)) {
throw new DeveloperError('value is required.');
}
diff --git a/Source/DynamicScene/DynamicBillboard.js b/Source/DynamicScene/DynamicBillboard.js
index ace1d7261f27..e10a802bce20 100644
--- a/Source/DynamicScene/DynamicBillboard.js
+++ b/Source/DynamicScene/DynamicBillboard.js
@@ -136,7 +136,7 @@ define([
}
var billboard = dynamicObject.billboard;
- var billboardUpdated = typeof billboard === 'undefined';
+ var billboardUpdated = !defined(billboard);
if (billboardUpdated) {
dynamicObject.billboard = billboard = new DynamicBillboard();
}
diff --git a/Source/DynamicScene/DynamicColorMaterial.js b/Source/DynamicScene/DynamicColorMaterial.js
index d1239ccf790c..0fb496ce1d74 100644
--- a/Source/DynamicScene/DynamicColorMaterial.js
+++ b/Source/DynamicScene/DynamicColorMaterial.js
@@ -50,7 +50,7 @@ define([
*/
DynamicColorMaterial.prototype.processCzmlIntervals = function(czmlInterval) {
var materialData = czmlInterval.solidColor;
- if (typeof materialData !== 'undefined') {
+ if (defined(materialData)) {
processPacketData(CzmlColor, this, 'color', materialData.color);
}
};
diff --git a/Source/DynamicScene/DynamicCone.js b/Source/DynamicScene/DynamicCone.js
index c786e90f461b..6465b6da319b 100644
--- a/Source/DynamicScene/DynamicCone.js
+++ b/Source/DynamicScene/DynamicCone.js
@@ -142,7 +142,7 @@ define([
}
var cone = dynamicObject.cone;
- var coneUpdated = typeof cone === 'undefined';
+ var coneUpdated = !defined(cone);
if (coneUpdated) {
dynamicObject.cone = cone = new DynamicCone();
}
diff --git a/Source/DynamicScene/DynamicEllipse.js b/Source/DynamicScene/DynamicEllipse.js
index d07bf87b79a6..b6241847aded 100644
--- a/Source/DynamicScene/DynamicEllipse.js
+++ b/Source/DynamicScene/DynamicEllipse.js
@@ -90,7 +90,7 @@ define([
}
var ellipse = dynamicObject.ellipse;
- var ellipseUpdated = typeof ellipse === 'undefined';
+ var ellipseUpdated = !defined(ellipse);
if (ellipseUpdated) {
dynamicObject.ellipse = ellipse = new DynamicEllipse();
}
diff --git a/Source/DynamicScene/DynamicEllipsoid.js b/Source/DynamicScene/DynamicEllipsoid.js
index ca419f7b1fa8..c6011bfb3595 100644
--- a/Source/DynamicScene/DynamicEllipsoid.js
+++ b/Source/DynamicScene/DynamicEllipsoid.js
@@ -82,7 +82,7 @@ define([
}
var ellipsoid = dynamicObject.ellipsoid;
- var ellipsoidUpdated = typeof ellipsoid === 'undefined';
+ var ellipsoidUpdated = !defined(ellipsoid);
if (ellipsoidUpdated) {
dynamicObject.ellipsoid = ellipsoid = new DynamicEllipsoid();
}
diff --git a/Source/DynamicScene/DynamicLabel.js b/Source/DynamicScene/DynamicLabel.js
index 948fc81c2411..1fe50bf6fc15 100644
--- a/Source/DynamicScene/DynamicLabel.js
+++ b/Source/DynamicScene/DynamicLabel.js
@@ -147,7 +147,7 @@ define([
}
var label = dynamicObject.label;
- var labelUpdated = typeof label === 'undefined';
+ var labelUpdated = !defined(label);
if (labelUpdated) {
dynamicObject.label = label = new DynamicLabel();
}
diff --git a/Source/DynamicScene/DynamicObjectView.js b/Source/DynamicScene/DynamicObjectView.js
index 033d2c64a565..1d7f617d6b52 100644
--- a/Source/DynamicScene/DynamicObjectView.js
+++ b/Source/DynamicScene/DynamicObjectView.js
@@ -49,7 +49,7 @@ define([
}
var cartesian = positionProperty.getValue(time, that._lastCartesian);
- if (typeof cartesian !== 'undefined') {
+ if (defined(cartesian)) {
var cartographic = ellipsoid.cartesianToCartographic(cartesian, that._lastCartographic);
//We are assigning the position of the camera, not of the object, so modify the height appropriately.
cartographic.height = viewDistance;
@@ -171,7 +171,7 @@ define([
//The swizzling here is intentional because ColumbusView uses a different coordinate system.
var cartesian = positionProperty.getValue(time, that._lastCartesian);
- if (typeof cartesian !== 'undefined') {
+ if (defined(cartesian)) {
var cartographic = ellipsoid.cartesianToCartographic(cartesian, that._lastCartographic);
var projectedPosition = projection.project(cartographic);
diff --git a/Source/DynamicScene/DynamicPath.js b/Source/DynamicScene/DynamicPath.js
index bf6bbf896166..749aaf7ea73d 100644
--- a/Source/DynamicScene/DynamicPath.js
+++ b/Source/DynamicScene/DynamicPath.js
@@ -110,7 +110,7 @@ function(
}
var path = dynamicObject.path;
- var pathUpdated = typeof path === 'undefined';
+ var pathUpdated = !defined(path);
if (pathUpdated) {
dynamicObject.path = path = new DynamicPath();
}
diff --git a/Source/DynamicScene/DynamicPoint.js b/Source/DynamicScene/DynamicPoint.js
index b61ab1944d87..d264247b2404 100644
--- a/Source/DynamicScene/DynamicPoint.js
+++ b/Source/DynamicScene/DynamicPoint.js
@@ -88,7 +88,7 @@ define([
}
var point = dynamicObject.point;
- var pointUpdated = typeof point === 'undefined';
+ var pointUpdated = !defined(point);
if (pointUpdated) {
dynamicObject.point = point = new DynamicPoint();
}
diff --git a/Source/DynamicScene/DynamicPolygon.js b/Source/DynamicScene/DynamicPolygon.js
index 3839234c642e..5a64e0933a0d 100644
--- a/Source/DynamicScene/DynamicPolygon.js
+++ b/Source/DynamicScene/DynamicPolygon.js
@@ -74,14 +74,14 @@ define([
}
var polygon = dynamicObject.polygon;
- var polygonUpdated = typeof polygon === 'undefined';
+ var polygonUpdated = !defined(polygon);
if (polygonUpdated) {
dynamicObject.polygon = polygon = new DynamicPolygon();
}
polygonUpdated = processPacketData(CzmlBoolean, polygon, 'show', polygonData.show, interval, sourceUri) || polygonUpdated;
- if (typeof polygonData.material !== 'undefined') {
+ if (defined(polygonData.material)) {
var material = polygon.material;
if (!defined(material)) {
polygon.material = material = new DynamicMaterialProperty();
diff --git a/Source/DynamicScene/DynamicPolyline.js b/Source/DynamicScene/DynamicPolyline.js
index 07db07db6f53..80f47fd7fe09 100644
--- a/Source/DynamicScene/DynamicPolyline.js
+++ b/Source/DynamicScene/DynamicPolyline.js
@@ -92,7 +92,7 @@ function(
}
var polyline = dynamicObject.polyline;
- var polylineUpdated = typeof polyline === 'undefined';
+ var polylineUpdated = !defined(polyline);
if (polylineUpdated) {
dynamicObject.polyline = polyline = new DynamicPolyline();
}
diff --git a/Source/DynamicScene/DynamicPyramid.js b/Source/DynamicScene/DynamicPyramid.js
index dbe7f47d4c7f..2c5feecf980b 100644
--- a/Source/DynamicScene/DynamicPyramid.js
+++ b/Source/DynamicScene/DynamicPyramid.js
@@ -110,7 +110,7 @@ define([
}
var pyramid = dynamicObject.pyramid;
- var pyramidUpdated = typeof pyramid === 'undefined';
+ var pyramidUpdated = !defined(pyramid);
if (pyramidUpdated) {
dynamicObject.pyramid = pyramid = new DynamicPyramid();
}
diff --git a/Source/DynamicScene/DynamicVector.js b/Source/DynamicScene/DynamicVector.js
index 59ba56208cc5..8406abb9e876 100644
--- a/Source/DynamicScene/DynamicVector.js
+++ b/Source/DynamicScene/DynamicVector.js
@@ -93,7 +93,7 @@ function(
}
var vector = dynamicObject.vector;
- var vectorUpdated = typeof vector === 'undefined';
+ var vectorUpdated = !defined(vector);
if (vectorUpdated) {
dynamicObject.vector = vector = new DynamicVector();
}
diff --git a/Source/DynamicScene/PositionProperty.js b/Source/DynamicScene/PositionProperty.js
index 9759eb1b4e4c..abd02916a96f 100644
--- a/Source/DynamicScene/PositionProperty.js
+++ b/Source/DynamicScene/PositionProperty.js
@@ -1,12 +1,14 @@
/*global define*/
define([
'../Core/Cartesian3',
+ '../Core/defined',
'../Core/DeveloperError',
'../Core/Matrix3',
'../Core/ReferenceFrame',
'../Core/Transforms'
], function(
Cartesian3,
+ defined,
DeveloperError,
Matrix3,
ReferenceFrame,
@@ -81,7 +83,7 @@ define([
}
var icrfToFixed = Transforms.computeIcrfToFixedMatrix(time, scratchMatrix3);
- if (typeof icrfToFixed === 'undefined') {
+ if (defined(icrfToFixed)) {
icrfToFixed = Transforms.computeTemeToPseudoFixedMatrix(time, scratchMatrix3);
}
if (inputFrame === ReferenceFrame.INERTIAL) {
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index 9c4c57aca223..bffc651b060a 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -113,7 +113,7 @@ define([
*/
ReferenceProperty.prototype.getIsTimeVarying = function() {
var targetProperty = resolve(this);
- return typeof targetProperty !== 'undefined' ? targetProperty.getIsTimeVarying() : undefined;
+ return defined(targetProperty) ? targetProperty.getIsTimeVarying() : undefined;
};
/**
@@ -125,7 +125,7 @@ define([
*/
ReferenceProperty.prototype.getValue = function(time, result) {
var targetProperty = resolve(this);
- return typeof targetProperty !== 'undefined' && this._targetObject.isAvailable(time) ? targetProperty.getValue(time, result) : undefined;
+ return defined(targetProperty) && this._targetObject.isAvailable(time) ? targetProperty.getValue(time, result) : undefined;
};
return ReferenceProperty;
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 2f5a17834a88..1fa7892f3c58 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -5,6 +5,7 @@ define([
'../Core/Cartesian2',
'../Core/Cartesian3',
'../Core/Color',
+ '../Core/defined',
'../Core/DeveloperError',
'../Core/JulianDate',
'../Core/LinearApproximation',
@@ -15,6 +16,7 @@ define([
Cartesian2,
Cartesian3,
Color,
+ defined,
DeveloperError,
JulianDate,
LinearApproximation,
@@ -31,7 +33,7 @@ define([
array.push(value.y);
},
inflate : function(array, startingIndex, result) {
- if (typeof result === 'undefined') {
+ if (!defined(result)) {
result = new Cartesian2();
}
result.x = array[startingIndex];
@@ -49,7 +51,7 @@ define([
array.push(value.z);
},
inflate : function(array, startingIndex, result) {
- if (typeof result === 'undefined') {
+ if (!defined(result)) {
result = new Cartesian3();
}
result.x = array[startingIndex];
@@ -63,7 +65,7 @@ define([
doublesPerValue : 4,
doublesPerInterpolationValue : 4,
flatten : function(array, startingIndex, result) {
- if (typeof result === 'undefined') {
+ if (!defined(result)) {
result = new Color();
}
result.red = array[startingIndex];
@@ -73,7 +75,7 @@ define([
return result;
},
inflate : function(array, startingIndex, result) {
- if (typeof result === 'undefined') {
+ if (!defined(result)) {
result = new Color();
}
result.red = array[startingIndex];
@@ -126,7 +128,7 @@ define([
}
},
inflate : function(array, startingIndex, result) {
- if (typeof result === 'undefined') {
+ if (!defined(result)) {
result = new Quaternion();
}
result.x = array[startingIndex];
@@ -136,7 +138,7 @@ define([
return result;
},
inflateInterpolationResult : function(array, result, sourceArray, firstIndex, lastIndex) {
- if (typeof result === 'undefined') {
+ if (!defined(result)) {
result = new Quaternion();
}
sampledQuaternionRotation.x = array[0];
@@ -215,7 +217,7 @@ define([
nextTime = times[timesInsertionPoint];
while (newDataIndex < newData.length) {
currentTime = convertDate(newData[newDataIndex], epoch);
- if ((typeof prevItem !== 'undefined' && JulianDate.compare(prevItem, currentTime) >= 0) || (typeof nextTime !== 'undefined' && JulianDate.compare(currentTime, nextTime) >= 0)) {
+ if ((defined(prevItem) && JulianDate.compare(prevItem, currentTime) >= 0) || (defined(nextTime) && JulianDate.compare(currentTime, nextTime) >= 0)) {
break;
}
timesSpliceArgs.push(currentTime);
@@ -250,7 +252,7 @@ define([
*/
var SampledProperty = function(type) {
var typeHandler;
- if (typeof type === 'undefined') {
+ if (!defined(type)) {
typeHandler = SampledNumber;
} else if (type === Cartesian2) {
typeHandler = SampledCartesian2;
@@ -341,7 +343,7 @@ define([
var xTable = this._xTable;
var yTable = this._yTable;
- if (typeof xTable === 'undefined') {
+ if (!defined(xTable)) {
xTable = this._xTable = new Array(this.numberOfPoints);
yTable = this._yTable = new Array(this.numberOfPoints * doublesPerInterpolationValue);
}
@@ -351,7 +353,7 @@ define([
xTable[i] = times[lastIndex].getSecondsDifference(times[firstIndex + i]);
}
var specializedPackFunction = typeHandler.packValuesForInterpolation;
- if (typeof specializedPackFunction === 'undefined') {
+ if (!defined(specializedPackFunction)) {
var destinationIndex = 0;
var sourceIndex = firstIndex * doublesPerValue;
var stop = (lastIndex + 1) * doublesPerValue;
@@ -369,7 +371,7 @@ define([
var x = times[lastIndex].getSecondsDifference(time);
interpolationScratch = this.interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, doublesPerInterpolationValue, interpolationScratch);
- if (typeof typeHandler.inflateInterpolationResult === 'undefined') {
+ if (!defined(typeHandler.inflateInterpolationResult)) {
return typeHandler.inflate(interpolationScratch, 0, result);
}
return typeHandler.inflateInterpolationResult(interpolationScratch, result, values, firstIndex, lastIndex);
diff --git a/Source/DynamicScene/TimeIntervalCollectionProperty.js b/Source/DynamicScene/TimeIntervalCollectionProperty.js
index 7d6de068c185..32977963f90b 100644
--- a/Source/DynamicScene/TimeIntervalCollectionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionProperty.js
@@ -1,13 +1,16 @@
/*global define*/
-define(['../Core/defineProperties',
+define([
+ '../Core/defined',
+ '../Core/defineProperties',
'../Core/DeveloperError',
'../Core/Enumeration',
'../Core/TimeIntervalCollection'
- ], function(
- defineProperties,
- DeveloperError,
- Enumeration,
- TimeIntervalCollection) {
+ ], function(
+ defined,
+ defineProperties,
+ DeveloperError,
+ Enumeration,
+ TimeIntervalCollection) {
"use strict";
/**
@@ -45,14 +48,14 @@ define(['../Core/defineProperties',
* @exception {DeveloperError} time is required.
*/
TimeIntervalCollectionProperty.prototype.getValue = function(time, result) {
- if (typeof time === 'undefined') {
+ if (!defined(time)) {
throw new DeveloperError('time is required');
}
var interval = this._intervals.findIntervalContainingDate(time);
- if (typeof interval !== 'undefined') {
+ if (defined(interval)) {
var value = interval.data;
- if (typeof value !== 'undefined' && typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean' && !(value instanceof Enumeration) && !Array.isArray(value)) {
+ if (defined(value) && typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean' && !(value instanceof Enumeration) && !Array.isArray(value)) {
if (typeof value.clone === 'function') {
return value.clone(result);
}
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
index 82919cae8b8b..9062e745af6b 100644
--- a/Source/DynamicScene/processPacketData.js
+++ b/Source/DynamicScene/processPacketData.js
@@ -1,5 +1,6 @@
/*global define*/
define([
+ '../Core/defined',
'../Core/TimeInterval',
'../Core/Iso8601',
'../Core/JulianDate',
@@ -8,6 +9,7 @@ define([
'./SampledProperty',
'./TimeIntervalCollectionProperty'
], function(
+ defined,
TimeInterval,
Iso8601,
JulianDate,
@@ -20,18 +22,18 @@ define([
function processProperty(type, object, propertyName, packetData, constrainedInterval, sourceUri) {
var combinedInterval;
var packetInterval = packetData.interval;
- if (typeof packetInterval !== 'undefined') {
+ if (defined(packetInterval)) {
combinedInterval = TimeInterval.fromIso8601(packetInterval);
- if (typeof constrainedInterval !== 'undefined') {
+ if (defined(constrainedInterval)) {
combinedInterval = combinedInterval.intersect(constrainedInterval);
}
- } else if (typeof constrainedInterval !== 'undefined') {
+ } else if (defined(constrainedInterval)) {
combinedInterval = constrainedInterval;
}
var unwrappedInterval = type.unwrapInterval(packetData, sourceUri);
- var hasInterval = typeof combinedInterval !== 'undefined' && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
+ var hasInterval = defined(combinedInterval) && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
var isSampled = type.isSampled(unwrappedInterval);
if (!isSampled && !hasInterval) {
object[propertyName] = new ConstantProperty(type.getValue(unwrappedInterval));
@@ -44,7 +46,7 @@ define([
combinedInterval = combinedInterval.clone();
combinedInterval.data = type.getValue(unwrappedInterval);
- if (typeof property === 'undefined') {
+ if (!defined(property)) {
property = new TimeIntervalCollectionProperty();
object[propertyName] = property;
propertyCreated = true;
@@ -63,7 +65,7 @@ define([
}
property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
} else if (isSampled && hasInterval) {
- if (typeof property === 'undefined') {
+ if (!defined(property)) {
property = new CompositeProperty();
object[propertyName] = property;
propertyCreated = true;
@@ -72,7 +74,7 @@ define([
var intervals = property.getIntervals();
var interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
var intervalData;
- if (typeof interval !== 'undefined') {
+ if (defined(interval)) {
intervalData = interval.data;
} else {
interval = combinedInterval.clone();
@@ -93,7 +95,7 @@ define([
}
function processPacketData(type, object, propertyName, packetData, interval, sourceUri) {
- if (typeof packetData === 'undefined') {
+ if (!defined(packetData)) {
return false;
}
From b90ecd4994ebe43e3a6fe046ec67a10a4279ef25 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 13 Aug 2013 13:53:58 -0400
Subject: [PATCH 13/65] Remove `DynamicPoperty` and related specs.
1. Move some of the specs to SampledPropertySpec.
2. Temporarily comment out path visualizer.
3. Use a regular property for now instead of position properties.
---
Source/DynamicScene/CzmlCartesian3.js | 1 -
Source/DynamicScene/CzmlColor.js | 1 -
Source/DynamicScene/CzmlDefaults.js | 2 +-
Source/DynamicScene/CzmlPosition.js | 1 -
Source/DynamicScene/CzmlUnitCartesian3.js | 1 -
.../DynamicScene/DynamicDirectionsProperty.js | 1 -
.../DynamicScene/DynamicMaterialProperty.js | 1 -
Source/DynamicScene/DynamicObject.js | 17 +-
Source/DynamicScene/DynamicPathVisualizer.js | 2 +-
.../DynamicScene/DynamicPositionProperty.js | 346 ---------------
Source/DynamicScene/DynamicProperty.js | 397 ------------------
.../DynamicVertexPositionsProperty.js | 1 -
Source/DynamicScene/ReferenceProperty.js | 2 -
Source/DynamicScene/SampledProperty.js | 5 +-
.../DynamicPositionPropertySpec.js | 268 ------------
Specs/DynamicScene/DynamicPropertySpec.js | 334 ---------------
Specs/DynamicScene/SampledPropertySpec.js | 155 +++++++
17 files changed, 164 insertions(+), 1371 deletions(-)
delete mode 100644 Source/DynamicScene/DynamicPositionProperty.js
delete mode 100644 Source/DynamicScene/DynamicProperty.js
delete mode 100644 Specs/DynamicScene/DynamicPositionPropertySpec.js
delete mode 100644 Specs/DynamicScene/DynamicPropertySpec.js
diff --git a/Source/DynamicScene/CzmlCartesian3.js b/Source/DynamicScene/CzmlCartesian3.js
index 3e6b0a0e0c3d..1f8208525121 100644
--- a/Source/DynamicScene/CzmlCartesian3.js
+++ b/Source/DynamicScene/CzmlCartesian3.js
@@ -16,7 +16,6 @@ define([
*
* @see Cartesian3
* @see DynamicProperty
- * @see DynamicPositionProperty
* @see CzmlBoolean
* @see CzmlCartesian2
* @see CzmlPosition
diff --git a/Source/DynamicScene/CzmlColor.js b/Source/DynamicScene/CzmlColor.js
index fae7be62ed34..678349129f8a 100644
--- a/Source/DynamicScene/CzmlColor.js
+++ b/Source/DynamicScene/CzmlColor.js
@@ -16,7 +16,6 @@ define([
*
* @see Color
* @see DynamicProperty
- * @see DynamicPositionProperty
* @see CzmlBoolean
* @see CzmlCartesian2
* @see CzmlCartesian3
diff --git a/Source/DynamicScene/CzmlDefaults.js b/Source/DynamicScene/CzmlDefaults.js
index 8b84bab58e38..4745f109f1a6 100644
--- a/Source/DynamicScene/CzmlDefaults.js
+++ b/Source/DynamicScene/CzmlDefaults.js
@@ -75,7 +75,7 @@ define([
DynamicEllipsoid.processCzmlPacket,
DynamicCone.processCzmlPacket,
DynamicLabel.processCzmlPacket,
- DynamicPath.processCzmlPacket,
+ //DynamicPath.processCzmlPacket,
DynamicPoint.processCzmlPacket,
DynamicPolygon.processCzmlPacket,
DynamicPolyline.processCzmlPacket,
diff --git a/Source/DynamicScene/CzmlPosition.js b/Source/DynamicScene/CzmlPosition.js
index ad33ec49f9f0..18b34dcbdf5b 100644
--- a/Source/DynamicScene/CzmlPosition.js
+++ b/Source/DynamicScene/CzmlPosition.js
@@ -25,7 +25,6 @@ define([
* @see Cartesian3
* @see Cartographic
* @see DynamicProperty
- * @see DynamicPositionProperty
* @see CzmlBoolean
* @see CzmlCartesian2
* @see CzmlColor
diff --git a/Source/DynamicScene/CzmlUnitCartesian3.js b/Source/DynamicScene/CzmlUnitCartesian3.js
index 958629d1e8ff..e421f538b849 100644
--- a/Source/DynamicScene/CzmlUnitCartesian3.js
+++ b/Source/DynamicScene/CzmlUnitCartesian3.js
@@ -16,7 +16,6 @@ define([
*
* @see Cartesian3
* @see DynamicProperty
- * @see DynamicPositionProperty
* @see CzmlBoolean
* @see CzmlCartesian2
* @see CzmlCartesian3
diff --git a/Source/DynamicScene/DynamicDirectionsProperty.js b/Source/DynamicScene/DynamicDirectionsProperty.js
index 103d03160b67..178bb8fe7879 100644
--- a/Source/DynamicScene/DynamicDirectionsProperty.js
+++ b/Source/DynamicScene/DynamicDirectionsProperty.js
@@ -65,7 +65,6 @@ define([
* @see DynamicProperty
* @see ReferenceProperty
* @see DynamicMaterialProperty
- * @see DynamicPositionProperty
* @see DynamicVertexPositionsProperty
*/
var DynamicDirectionsProperty = function() {
diff --git a/Source/DynamicScene/DynamicMaterialProperty.js b/Source/DynamicScene/DynamicMaterialProperty.js
index 3b16d92cf309..64127fc3d856 100644
--- a/Source/DynamicScene/DynamicMaterialProperty.js
+++ b/Source/DynamicScene/DynamicMaterialProperty.js
@@ -31,7 +31,6 @@ define([
* @see DynamicObject
* @see DynamicProperty
* @see ReferenceProperty
- * @see DynamicPositionProperty
* @see DynamicDirectionsProperty
* @see DynamicVertexPositionsProperty
*/
diff --git a/Source/DynamicScene/DynamicObject.js b/Source/DynamicScene/DynamicObject.js
index e48dc141a1b9..383e2ef44744 100644
--- a/Source/DynamicScene/DynamicObject.js
+++ b/Source/DynamicScene/DynamicObject.js
@@ -7,7 +7,6 @@ define([
'../Core/JulianDate',
'../Core/TimeInterval',
'./processPacketData',
- './DynamicPositionProperty',
'./DynamicVertexPositionsProperty',
'./CzmlUnitQuaternion',
'./CzmlCartesian3'
@@ -19,7 +18,6 @@ define([
JulianDate,
TimeInterval,
processPacketData,
- DynamicPositionProperty,
DynamicVertexPositionsProperty,
CzmlUnitQuaternion,
CzmlCartesian3) {
@@ -35,7 +33,6 @@ define([
* @param {Object} [id] A unique identifier for this object. If no id is provided, a GUID is generated.
*
* @see DynamicProperty
- * @see DynamicPositionProperty
* @see DynamicVertexiPositionsProperty
* @see DynamicObjectCollection
* @see CompositeDynamicObjectCollection
@@ -78,7 +75,7 @@ define([
/**
* Gets or sets the position.
- * @type {DynamicPositionProperty}
+ * @type {PositionProperty}
* @default undefined
*/
this.position = undefined;
@@ -236,23 +233,15 @@ define([
* @param {Object} packet The CZML packet to process.
* @returns {Boolean} true if the property was newly created while processing the packet, false otherwise.
*
- * @see DynamicPositionProperty
* @see DynamicObjectCollection
* @see CzmlDefaults#updaters
*/
- DynamicObject.processCzmlPacketPosition = function(dynamicObject, packet) {
+ DynamicObject.processCzmlPacketPosition = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var positionData = packet.position;
if (!defined(positionData)) {
return false;
}
-
- var position = dynamicObject.position;
- var propertyCreated = !defined(position);
- if (propertyCreated) {
- dynamicObject.position = position = new DynamicPositionProperty();
- }
- position.processCzmlIntervals(positionData);
- return propertyCreated;
+ return processPacketData(CzmlCartesian3, dynamicObject, 'position', positionData, undefined, sourceUri);
};
/**
diff --git a/Source/DynamicScene/DynamicPathVisualizer.js b/Source/DynamicScene/DynamicPathVisualizer.js
index 0ab42733bb18..1970b608570d 100644
--- a/Source/DynamicScene/DynamicPathVisualizer.js
+++ b/Source/DynamicScene/DynamicPathVisualizer.js
@@ -313,7 +313,7 @@ define([
var frameToVisualize = ReferenceFrame.FIXED;
if (this._scene.mode === SceneMode.SCENE3D) {
- frameToVisualize = positionProperty._getReferenceFrame();
+ frameToVisualize = positionProperty.getReferenceFrame();
}
var currentUpdater = this._updaters[frameToVisualize];
diff --git a/Source/DynamicScene/DynamicPositionProperty.js b/Source/DynamicScene/DynamicPositionProperty.js
deleted file mode 100644
index d892cb381fc3..000000000000
--- a/Source/DynamicScene/DynamicPositionProperty.js
+++ /dev/null
@@ -1,346 +0,0 @@
-/*global define*/
-define([
- '../Core/defined',
- '../Core/DeveloperError',
- '../Core/Ellipsoid',
- '../Core/Iso8601',
- '../Core/JulianDate',
- '../Core/Matrix3',
- '../Core/ReferenceFrame',
- '../Core/TimeInterval',
- '../Core/TimeIntervalCollection',
- '../Core/Transforms',
- './CzmlPosition',
- './DynamicProperty'
- ], function(
- defined,
- DeveloperError,
- Ellipsoid,
- Iso8601,
- JulianDate,
- Matrix3,
- ReferenceFrame,
- TimeInterval,
- TimeIntervalCollection,
- Transforms,
- CzmlPosition,
- DynamicProperty) {
- "use strict";
-
- var scratchMatrix3 = new Matrix3();
-
- function convertToFixed(time, value) {
- var icrfToFixed = Transforms.computeIcrfToFixedMatrix(time, scratchMatrix3);
- if (!defined(icrfToFixed)) {
- icrfToFixed = Transforms.computeTemeToPseudoFixedMatrix(time, scratchMatrix3);
- }
- return icrfToFixed.multiplyByVector(value, value);
- }
-
- /**
- * A dynamic property which stores both Cartesian and Cartographic data
- * and can convert and return the desired type of data for a desired time.
- * Rather than creating instances of this object directly, it's typically
- * created and managed via loading CZML data into a DynamicObjectCollection.
- * Instances of this type are exposed via DynamicObject and it's sub-objects
- * and are responsible for interpreting and interpolating the data for visualization.
- *
- * @alias DynamicPositionProperty
- * @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see ReferenceProperty
- * @see DynamicMaterialProperty
- * @see DynamicDirectionsProperty
- * @see DynamicVertexPositionsProperty
- */
- var DynamicPositionProperty = function() {
- this._dynamicProperties = [];
- this._propertyIntervals = new TimeIntervalCollection();
- this._cachedTime = undefined;
- this._cachedInterval = undefined;
- };
-
- /**
- * Processes the provided CZML interval or intervals into this property.
- *
- * @memberof DynamicPositionProperty
- *
- * @param {Object} czmlIntervals The CZML data to process.
- * @param {TimeInterval} [constrainedInterval] Constrains the processing so that any times outside of this interval are ignored.
- */
- DynamicPositionProperty.prototype.processCzmlIntervals = function(czmlIntervals, constrainedInterval) {
- if (Array.isArray(czmlIntervals)) {
- for ( var i = 0, len = czmlIntervals.length; i < len; i++) {
- this._addCzmlInterval(czmlIntervals[i], constrainedInterval);
- }
- } else {
- this._addCzmlInterval(czmlIntervals, constrainedInterval);
- }
- };
-
- /**
- * Retrieves the value of the object at the supplied time as a Cartesian3.
- * @memberof DynamicPositionProperty
- *
- * @param {JulianDate} time The time for which to retrieve the value.
- * @param {Cartesian3} [result] The object to store the result onto, if undefined a new instance will be created.
- * @returns The modified result property, or a new instance if result was undefined.
- */
- DynamicPositionProperty.prototype.getValue = function(time, result) {
- if (!defined(time)) {
- throw new DeveloperError('time is required.');
- }
-
- var interval = this._cachedInterval;
- if (!JulianDate.equals(this._cachedTime, time)) {
- this._cachedTime = JulianDate.clone(time, this._cachedTime);
- if (!defined(interval) || !interval.contains(time)) {
- interval = this._propertyIntervals.findIntervalContainingDate(time);
- this._cachedInterval = interval;
- }
- }
-
- if (!defined(interval)) {
- return undefined;
- }
- var property = interval.data;
- result = property.getValue(time, result);
- if (interval.data.referenceFrame === ReferenceFrame.INERTIAL) {
- return convertToFixed(time, result);
- }
- return result;
- };
-
- DynamicPositionProperty.prototype._addCzmlInterval = function(czmlInterval, constrainedInterval) {
- this._cachedTime = undefined;
- this._cachedInterval = undefined;
-
- var iso8601Interval = czmlInterval.interval, property, unwrappedInterval;
- if (!defined(iso8601Interval)) {
- iso8601Interval = Iso8601.MAXIMUM_INTERVAL.clone();
- } else {
- iso8601Interval = TimeInterval.fromIso8601(iso8601Interval);
- }
-
- if (defined(constrainedInterval)) {
- iso8601Interval = iso8601Interval.intersect(constrainedInterval);
- }
-
- //See if we already have data at that interval.
- var thisIntervals = this._propertyIntervals;
- var existingInterval = thisIntervals.findInterval(iso8601Interval.start, iso8601Interval.stop);
-
- if (defined(existingInterval)) {
- //If so, see if the new data is the same type.
- property = existingInterval.data;
- if (defined(property)) {
- unwrappedInterval = CzmlPosition.unwrapInterval(czmlInterval);
- }
- } else {
- //If not, create it.
- existingInterval = iso8601Interval;
- thisIntervals.addInterval(existingInterval);
- }
-
- if (!defined(unwrappedInterval)) {
- unwrappedInterval = CzmlPosition.unwrapInterval(czmlInterval);
- if (defined(unwrappedInterval)) {
- property = new DynamicProperty(CzmlPosition);
- this._dynamicProperties.push(property);
- existingInterval.data = property;
- property.referenceFrame = ReferenceFrame.FIXED;
- }
- }
-
- //We could handle the data, add it to the property.
- if (defined(unwrappedInterval)) {
- if (defined(czmlInterval.referenceFrame)) {
- existingInterval.data.referenceFrame = ReferenceFrame[czmlInterval.referenceFrame];
- }
- property._addCzmlIntervalUnwrapped(iso8601Interval.start, iso8601Interval.stop, unwrappedInterval, czmlInterval.epoch, czmlInterval.interpolationAlgorithm, czmlInterval.interpolationDegree);
- }
- };
-
- DynamicPositionProperty.prototype._getReferenceFrame = function() {
- var propertyIntervals = this._propertyIntervals;
- if (propertyIntervals.getLength() > 0) {
- return propertyIntervals.get(0).data.referenceFrame;
- }
- return undefined;
- };
-
- DynamicPositionProperty.prototype._getValueInReferenceFrame = function(time, referenceFrame, result) {
- if (!defined(time)) {
- throw new DeveloperError('time is required.');
- }
-
- var interval = this._cachedInterval;
- if (!JulianDate.equals(this._cachedTime, time)) {
- this._cachedTime = JulianDate.clone(time, this._cachedTime);
- if (!defined(interval) || !interval.contains(time)) {
- interval = this._propertyIntervals.findIntervalContainingDate(time);
- this._cachedInterval = interval;
- }
- }
-
- if (!defined(interval)) {
- return undefined;
- }
- var property = interval.data;
- result = property.getValue(time, result);
-
- if (interval.data.referenceFrame !== referenceFrame) {
- if (referenceFrame === ReferenceFrame.FIXED) {
- return convertToFixed(time, result);
- }
- if (referenceFrame === ReferenceFrame.INERTIAL) {
- var fixedToIcrf = Transforms.computeFixedToIcrfMatrix(time, scratchMatrix3);
- if (!defined(fixedToIcrf)) {
- return undefined;
- }
- return fixedToIcrf.multiplyByVector(result, result);
- }
- }
- return result;
- };
-
- DynamicPositionProperty.prototype._getValueRangeInReferenceFrame = function(start, stop, currentTime, referenceFrame, maximumStep, result) {
- if (!defined(start)) {
- throw new DeveloperError('start is required');
- }
-
- if (!defined(stop)) {
- throw new DeveloperError('stop is required');
- }
-
- if (!defined(result)) {
- result = [];
- }
-
- var propertyIntervals = this._propertyIntervals;
-
- var startIndex = defined(start) ? propertyIntervals.indexOf(start) : 0;
- var stopIndex = defined(stop) ? propertyIntervals.indexOf(stop) : propertyIntervals.length - 1;
- if (startIndex < 0) {
- startIndex = ~startIndex;
- }
-
- if (startIndex === propertyIntervals.getLength()) {
- result.length = 0;
- return result;
- }
-
- if (stopIndex < 0) {
- stopIndex = ~stopIndex;
- if (stopIndex !== propertyIntervals.getLength()) {
- result.length = 0;
- return result;
- }
- stopIndex -= 1;
- }
-
- var r = 0;
- //Always step exactly on start (but only use it if it exists.)
- var tmp;
- tmp = this._getValueInReferenceFrame(start, referenceFrame, result[r]);
- if (defined(tmp)) {
- result[r++] = tmp;
- }
-
- var steppedOnNow = !defined(currentTime) || currentTime.lessThan(start) || currentTime.greaterThan(stop);
- for ( var i = startIndex; i < stopIndex + 1; i++) {
- var current;
- var interval = propertyIntervals.get(i);
- var nextInterval = propertyIntervals.get(i + 1);
- var loopStop = stop;
- if (defined(nextInterval) && stop.greaterThan(nextInterval.start)) {
- loopStop = nextInterval.start;
- }
-
- var sampling = false;
- var sampleStepsToTake;
- var sampleStepsTaken;
- var sampleStepSize;
-
- var property = interval.data;
- var currentInterval = property._intervals.get(0);
- var times = currentInterval.data.times;
- if (defined(times)) {
- //Iterate over all interval times and add the ones that fall in our
- //time range. Note that times can contain data outside of
- //the intervals range. This is by design for use with interpolation.
- var t = 0;
- var len = times.length;
- current = times[t];
- while(t < len) {
- if (!steppedOnNow && current.greaterThanOrEquals(currentTime)) {
- tmp = this._getValueInReferenceFrame(currentTime, referenceFrame, result[r]);
- if (defined(tmp)) {
- result[r++] = tmp;
- }
- steppedOnNow = true;
- }
- if (current.greaterThan(start) && current.lessThan(loopStop)) {
- tmp = this._getValueInReferenceFrame(current, referenceFrame, result[r]);
- if (defined(tmp)) {
- result[r++] = tmp;
- }
- }
-
- if (t < (len - 1)) {
- if (!sampling) {
- var next = times[t + 1];
- var secondsUntilNext = current.getSecondsDifference(next);
- sampling = secondsUntilNext > maximumStep;
-
- if (sampling) {
- sampleStepsToTake = Math.floor(secondsUntilNext / maximumStep);
- sampleStepsTaken = 0;
- sampleStepSize = secondsUntilNext / Math.max(sampleStepsToTake, 2);
- sampleStepsToTake = Math.max(sampleStepsToTake - 2, 1);
- }
- }
-
- if (sampling && sampleStepsTaken < sampleStepsToTake) {
- current = current.addSeconds(sampleStepSize);
- sampleStepsTaken++;
- continue;
- }
- }
- sampling = false;
- t++;
- current = times[t];
- }
- } else {
- //If times is undefined, it's because the interval contains a single position
- //at which it stays for the duration of the interval.
- current = interval.start;
-
- //We don't need to actually step on now in this case, since the next value
- //will be the same; but we do still need to check for it.
- steppedOnNow = steppedOnNow || current.greaterThanOrEquals(currentTime);
-
- //Finally, get the value at this non-sampled interval.
- if (current.lessThan(loopStop)) {
- tmp = this._getValueInReferenceFrame(current, referenceFrame, result[r]);
- if (defined(tmp)) {
- result[r++] = tmp;
- }
- }
- }
- }
-
- //Always step exactly on stop (but only use it if it exists.)
- tmp = this._getValueInReferenceFrame(stop, referenceFrame, result[r]);
- if (defined(tmp)) {
- result[r++] = tmp;
- }
-
- result.length = r;
- return result;
- };
-
- return DynamicPositionProperty;
-});
diff --git a/Source/DynamicScene/DynamicProperty.js b/Source/DynamicScene/DynamicProperty.js
deleted file mode 100644
index 71e9efdb699d..000000000000
--- a/Source/DynamicScene/DynamicProperty.js
+++ /dev/null
@@ -1,397 +0,0 @@
-/*global define*/
-define([
- '../Core/defined',
- '../Core/DeveloperError',
- '../Core/Iso8601',
- '../Core/JulianDate',
- '../Core/TimeInterval',
- '../Core/TimeIntervalCollection',
- '../Core/binarySearch',
- '../Core/HermitePolynomialApproximation',
- '../Core/LinearApproximation',
- '../Core/LagrangePolynomialApproximation'
- ], function(
- defined,
- DeveloperError,
- Iso8601,
- JulianDate,
- TimeInterval,
- TimeIntervalCollection,
- binarySearch,
- HermitePolynomialApproximation,
- LinearApproximation,
- LagrangePolynomialApproximation) {
- "use strict";
-
-
- //CZML_TODO This is more of an idea than a to-do, but currently DynamicProperty requires
- //you know the type of data being loaded up-front by passing valueType. We could take
- //a similar approach to DynamicMaterialProperty and have a list of potential valueTypes
- //that we check for when we encounter data. This would make it possible to support
- //properties that are defined in a CZML document but not part of the official spec. This
- //would be helpful in cases where a CZML document has $ or # links to other properties,
- //but that property itself is not part of another to-spec CZML object. We could still
- //allow the user to pass a default valueType if they want to make sure the data
- //being processed is only the data of the expected type.
-
- //Map CZML interval types to their implementation.
- var interpolators = {
- HERMITE : HermitePolynomialApproximation,
- LAGRANGE : LagrangePolynomialApproximation,
- LINEAR : LinearApproximation
- };
-
- //The data associated with each DynamicProperty interval.
- function IntervalData() {
- this.interpolationAlgorithm = LinearApproximation;
- this.numberOfPoints = LinearApproximation.getRequiredDataPoints(1);
- this.interpolationDegree = 1;
- this.times = undefined;
- this.values = undefined;
- this.isSampled = false;
- this.xTable = undefined;
- this.yTable = undefined;
- }
-
- //Converts a CZML defined data into a JulianDate, regardless of whether it was
- //specified in epoch seconds or as an ISO8601 string.
- function czmlDateToJulianDate(date, epoch) {
- if (typeof date === 'string') {
- return JulianDate.fromIso8601(date);
- }
- return epoch.addSeconds(date);
- }
-
- //We can't use splice for inserting new elements because function apply can't handle
- //a huge number of arguments. See https://code.google.com/p/chromium/issues/detail?id=56588
- function arrayInsert(array, startIndex, items) {
- var i;
- var arrayLength = array.length;
- var itemsLength = items.length;
- var newLength = arrayLength + itemsLength;
-
- array.length = newLength;
- if (arrayLength !== startIndex) {
- var q = arrayLength - 1;
- for (i = newLength - 1; i >= startIndex; i--) {
- array[i] = array[q--];
- }
- }
-
- for (i = 0; i < itemsLength; i++) {
- array[startIndex++] = items[i];
- }
- }
-
- /**
- *
- * DynamicProperty represents a single value that changes over time.
- * Rather than creating instances of this object directly, it's typically
- * created and managed via loading CZML data into a DynamicObjectCollection.
- * Instances of this type are exposed via DynamicObject and it's sub-objects
- * and are responsible for interpreting and interpolating the data for visualization.
- *
- *
- * The type of value exposed by this property must be provided during construction
- * by passing in an object which performs all the necessary operations needed to
- * properly store, retrieve, and interpolate the data. For more specialized needs
- * other types of dynamic properties exist, such as DynamicMaterialProperty,
- * which as the name implies, handles materials.
- *
- *
- * @alias DynamicProperty
- * @constructor
- *
- * @param {Object} valueType A CZML type object which contains the methods needed to interpret and interpolate CZML data of the same type.
- *
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
- * @see DynamicObject
- * @see ReferenceProperty
- * @see DynamicMaterialProperty
- * @see DynamicPositionProperty
- * @see DynamicDirectionsProperty
- * @see DynamicVertexPositionsProperty
- */
- var DynamicProperty = function(valueType) {
- if (!defined(valueType)) {
- throw new DeveloperError('valueType is required.');
- }
- this.valueType = valueType;
- this._intervals = new TimeIntervalCollection();
- this._cachedTime = undefined;
- this._cachedInterval = undefined;
- };
-
- /**
- * Processes the provided CZML interval or intervals into this property.
- *
- * @memberof DynamicProperty
- *
- * @param {Object} czmlIntervals The CZML data to process.
- * @param {TimeInterval} [constrainedInterval] Constrains the processing so that any times outside of this interval are ignored.
- * @param {String} [sourceUri] The originating url of the CZML being processed.
- */
- DynamicProperty.prototype.processCzmlIntervals = function(czmlIntervals, constrainedInterval, sourceUri) {
- if (Array.isArray(czmlIntervals)) {
- for ( var i = 0, len = czmlIntervals.length; i < len; i++) {
- this._addCzmlInterval(czmlIntervals[i], constrainedInterval, sourceUri);
- }
- } else {
- this._addCzmlInterval(czmlIntervals, constrainedInterval, sourceUri);
- }
- };
-
- var interpolationScratch;
-
- /**
- * Returns the value of the property at the specified time.
- * @memberof DynamicProperty
- *
- * @param {JulianDate} time The time for which to retrieve the value.
- * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
- * @returns The modified result parameter or a new instance if the result parameter was not supplied.
- */
- DynamicProperty.prototype.getValue = function(time, result) {
- var valueType = this.valueType;
-
- if (defined(this._staticValue)) {
- return valueType.getValue(this._staticValue, result);
- }
-
- var interval = this._cachedInterval;
- if (!JulianDate.equals(this._cachedTime, time)) {
- this._cachedTime = JulianDate.clone(time, this._cachedTime);
- if (!defined(interval) || !interval.contains(time)) {
- interval = this._intervals.findIntervalContainingDate(time);
- this._cachedInterval = interval;
- }
- }
-
- if (!defined(interval)) {
- return undefined;
- }
-
- var intervalData = interval.data;
- var times = intervalData.times;
- var values = intervalData.values;
- if (intervalData.isSampled && times.length >= 0 && values.length > 0) {
- var doublesPerValue = valueType.doublesPerValue;
- var index = binarySearch(times, time, JulianDate.compare);
- if (index < 0) {
- if (intervalData.numberOfPoints < 2) {
- return undefined;
- }
- index = ~index;
-
- if (index >= times.length) {
- index = times.length - 1;
- }
-
- var firstIndex = 0;
- var lastIndex = times.length - 1;
-
- var degree = intervalData.numberOfPoints - 1;
- var pointsInCollection = lastIndex - firstIndex + 1;
-
- if (pointsInCollection < degree + 1) {
- // Use the entire range.
- } else {
- var computedFirstIndex = index - ((degree / 2) | 0) - 1;
- if (computedFirstIndex < firstIndex) {
- computedFirstIndex = firstIndex;
- }
- var computedLastIndex = computedFirstIndex + degree;
- if (computedLastIndex > lastIndex) {
- computedLastIndex = lastIndex;
- computedFirstIndex = computedLastIndex - degree;
- if (computedFirstIndex < firstIndex) {
- computedFirstIndex = firstIndex;
- }
- }
-
- firstIndex = computedFirstIndex;
- lastIndex = computedLastIndex;
- }
-
- var length = lastIndex - firstIndex + 1;
-
- var doublesPerInterpolationValue = valueType.doublesPerInterpolationValue;
- var xTable = intervalData.xTable;
- var yTable = intervalData.yTable;
-
- if (!defined(xTable)) {
- xTable = intervalData.xTable = new Array(intervalData.numberOfPoints);
- yTable = intervalData.yTable = new Array(intervalData.numberOfPoints * doublesPerInterpolationValue);
- }
-
- // Build the tables
- for ( var i = 0; i < length; ++i) {
- xTable[i] = times[lastIndex].getSecondsDifference(times[firstIndex + i]);
- }
- var specializedPackFunction = valueType.packValuesForInterpolation;
- if (!defined(specializedPackFunction)) {
- var destinationIndex = 0;
- var sourceIndex = firstIndex * doublesPerValue;
- var stop = (lastIndex + 1) * doublesPerValue;
-
- while (sourceIndex < stop) {
- yTable[destinationIndex] = values[sourceIndex];
- sourceIndex++;
- destinationIndex++;
- }
- } else {
- specializedPackFunction(values, yTable, firstIndex, lastIndex);
- }
-
- // Interpolate!
- var x = times[lastIndex].getSecondsDifference(time);
- interpolationScratch = intervalData.interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, doublesPerInterpolationValue, interpolationScratch);
-
- var specializedGetFunction = valueType.getValueFromInterpolationResult;
- if (!defined(specializedGetFunction)) {
- return valueType.getValueFromArray(interpolationScratch, 0, result);
- }
- return specializedGetFunction(interpolationScratch, result, values, firstIndex, lastIndex);
- }
- return valueType.getValueFromArray(intervalData.values, index * doublesPerValue, result);
- }
- return valueType.getValue(intervalData.values, result);
- };
-
- DynamicProperty._mergeNewSamples = function(epoch, times, values, newData, doublesPerValue) {
- var newDataIndex = 0;
- var i;
- var prevItem;
- var timesInsertionPoint;
- var valuesInsertionPoint;
- var timesSpliceArgs;
- var valuesSpliceArgs;
- var currentTime;
- var nextTime;
-
- while (newDataIndex < newData.length) {
- currentTime = czmlDateToJulianDate(newData[newDataIndex], epoch);
- timesInsertionPoint = binarySearch(times, currentTime, JulianDate.compare);
-
- if (timesInsertionPoint < 0) {
- //Doesn't exist, insert as many additional values as we can.
- timesInsertionPoint = ~timesInsertionPoint;
- timesSpliceArgs = [];
-
- valuesInsertionPoint = timesInsertionPoint * doublesPerValue;
- valuesSpliceArgs = [];
- prevItem = undefined;
- nextTime = times[timesInsertionPoint];
- while (newDataIndex < newData.length) {
- currentTime = czmlDateToJulianDate(newData[newDataIndex], epoch);
- if ((defined(prevItem) && JulianDate.compare(prevItem, currentTime) >= 0) ||
- (defined(nextTime) && JulianDate.compare(currentTime, nextTime) >= 0)) {
- break;
- }
- timesSpliceArgs.push(currentTime);
- newDataIndex = newDataIndex + 1;
- for (i = 0; i < doublesPerValue; i++) {
- valuesSpliceArgs.push(newData[newDataIndex]);
- newDataIndex = newDataIndex + 1;
- }
- prevItem = currentTime;
- }
-
- arrayInsert(values, valuesInsertionPoint, valuesSpliceArgs);
- arrayInsert(times, timesInsertionPoint, timesSpliceArgs);
- } else {
- //Found an exact match
- for (i = 0; i < doublesPerValue; i++) {
- newDataIndex++;
- values[(timesInsertionPoint * doublesPerValue) + i] = newData[newDataIndex];
- }
- newDataIndex++;
- }
- }
- };
-
- DynamicProperty.prototype._addCzmlInterval = function(czmlInterval, constrainedInterval, sourceUri) {
- var iso8601Interval = czmlInterval.interval;
- if (!defined(iso8601Interval)) {
- iso8601Interval = Iso8601.MAXIMUM_INTERVAL;
- } else {
- iso8601Interval = TimeInterval.fromIso8601(iso8601Interval);
- }
-
- if (defined(constrainedInterval)) {
- iso8601Interval = iso8601Interval.intersect(constrainedInterval);
- }
-
- var unwrappedInterval = this.valueType.unwrapInterval(czmlInterval, sourceUri);
- if (defined(unwrappedInterval)) {
- this._addCzmlIntervalUnwrapped(iso8601Interval.start, iso8601Interval.stop, unwrappedInterval, czmlInterval.epoch, czmlInterval.interpolationAlgorithm, czmlInterval.interpolationDegree);
- }
- };
-
- DynamicProperty.prototype._addCzmlIntervalUnwrapped = function(start, stop, unwrappedInterval, epoch, interpolationAlgorithmType, interpolationDegree) {
- var thisIntervals = this._intervals;
- var existingInterval = thisIntervals.findInterval(start, stop);
- this._cachedTime = undefined;
- this._cachedInterval = undefined;
-
- var intervalData;
- if (!defined(existingInterval)) {
- intervalData = new IntervalData();
- existingInterval = new TimeInterval(start, stop, true, true, intervalData);
- thisIntervals.addInterval(existingInterval);
- } else {
- intervalData = existingInterval.data;
- }
-
- var valueType = this.valueType;
- if (valueType.isSampled(unwrappedInterval)) {
- var interpolationAlgorithm;
- if (defined(interpolationAlgorithmType)) {
- interpolationAlgorithm = interpolators[interpolationAlgorithmType];
- intervalData.interpolationAlgorithm = interpolationAlgorithm;
- }
- if (defined(interpolationAlgorithm) && defined(interpolationDegree)) {
- intervalData.interpolationDegree = interpolationDegree;
- intervalData.xTable = undefined;
- intervalData.yTable = undefined;
- }
-
- if (!intervalData.isSampled) {
- intervalData.times = [];
- intervalData.values = [];
- intervalData.isSampled = true;
- }
- if (defined(epoch)) {
- epoch = JulianDate.fromIso8601(epoch);
- }
- DynamicProperty._mergeNewSamples(epoch, intervalData.times, intervalData.values, unwrappedInterval, valueType.doublesPerValue, valueType);
- intervalData.numberOfPoints = Math.min(intervalData.interpolationAlgorithm.getRequiredDataPoints(intervalData.interpolationDegree), intervalData.times.length);
- this._staticValue = undefined;
- } else {
- //Packet itself is a constant value
- intervalData.times = undefined;
- intervalData.values = unwrappedInterval;
- intervalData.isSampled = false;
-
- if (existingInterval.equals(Iso8601.MAXIMUM_INTERVAL)) {
- this._staticValue = unwrappedInterval;
- } else {
- this._staticValue = undefined;
- }
- }
- };
-
- return DynamicProperty;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/DynamicVertexPositionsProperty.js b/Source/DynamicScene/DynamicVertexPositionsProperty.js
index 1c0065519c9c..824132f6c91f 100644
--- a/Source/DynamicScene/DynamicVertexPositionsProperty.js
+++ b/Source/DynamicScene/DynamicVertexPositionsProperty.js
@@ -71,7 +71,6 @@ define([
* @see DynamicProperty
* @see ReferenceProperty
* @see DynamicMaterialProperty
- * @see DynamicPositionProperty
* @see DynamicDirectionsProperty
*/
var DynamicVertexPositionsProperty = function() {
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index bffc651b060a..4c150a8144c7 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -41,7 +41,6 @@ define([
*
* @see ReferenceProperty#fromString
* @see DynamicProperty
- * @see DynamicPositionProperty
* @see DynamicDirectionsProperty
* @see DynamicVertexPositionsProperty
* @see DynamicObjectCollection
@@ -79,7 +78,6 @@ define([
*
* @see ReferenceProperty#fromString
* @see DynamicProperty
- * @see DynamicPositionProperty
* @see DynamicDirectionsProperty
* @see DynamicVertexPositionsProperty
* @see DynamicObjectCollection
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 1fa7892f3c58..8cc091a3023b 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -302,7 +302,7 @@ define([
var doublesPerValue = typeHandler.doublesPerValue;
var index = binarySearch(times, time, JulianDate.compare);
if (index < 0) {
- if (this.numberOfPoints < 2) {
+ if (times.length < this.numberOfPoints) {
return undefined;
}
index = ~index;
@@ -401,5 +401,8 @@ define([
_mergeNewSamples(epoch, this._times, this._values, data, this._typeHandler.doublesPerValue);
};
+ //Exposed for testing.
+ SampledProperty._mergeNewSamples = _mergeNewSamples;
+
return SampledProperty;
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/DynamicPositionPropertySpec.js b/Specs/DynamicScene/DynamicPositionPropertySpec.js
deleted file mode 100644
index fcd3cd0de9e7..000000000000
--- a/Specs/DynamicScene/DynamicPositionPropertySpec.js
+++ /dev/null
@@ -1,268 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/DynamicPositionProperty',
- 'Core/JulianDate',
- 'Core/Ellipsoid',
- 'Core/Cartesian3',
- 'Core/Cartographic',
- 'Core/Math'
- ], function(
- DynamicPositionProperty,
- JulianDate,
- Ellipsoid,
- Cartesian3,
- Cartographic,
- CesiumMath) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var cartesianInterval = {
- epoch : '2012-04-18T15:59:00Z',
- cartesian : [0, 100000, 100001, 100002, 3600, 100010, 100011, 100012, 7200, 100020, 100021, 100022],
- interpolationAlgorithm : 'LINEAR',
- interpolationDegree : 1
- };
-
- var cartographicInterval = {
- cartographicRadians: ['2012-04-18T15:59:00Z', 0.1, 0.2, 1000, '2012-04-18T16:59:00Z', 0.3, 0.4, 500, '2012-04-18T17:59:00Z', 0.5, 0.6, 750],
- interpolationAlgorithm : 'LINEAR',
- interpolationDegree : 1
- };
-
- var epoch = JulianDate.fromIso8601(cartesianInterval.epoch);
-
- it('getValue returns undefined if no data exists', function() {
- var property = new DynamicPositionProperty();
- expect(property.getValue(new JulianDate())).toBeUndefined();
- });
-
- it('getValue throw if no time supplied', function() {
- var property = new DynamicPositionProperty();
- expect(function() {
- property.getValue();
- }).toThrow();
- });
-
- it('getValue works for cartesian data', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianInterval);
-
- var result = property.getValue(epoch);
- expect(result.x).toEqual(100000);
- expect(result.y).toEqual(100001);
- expect(result.z).toEqual(100002);
- });
-
- it('getValue works for cartographic data', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartographicInterval);
-
- var cartesian = Ellipsoid.WGS84.cartographicToCartesian(new Cartographic(0.1, 0.2, 1000));
- var result = property.getValue(epoch);
- expect(result.x).toEqualEpsilon(cartesian.x, CesiumMath.EPSILON9);
- expect(result.y).toEqualEpsilon(cartesian.y, CesiumMath.EPSILON9);
- expect(result.z).toEqualEpsilon(cartesian.z, CesiumMath.EPSILON9);
- });
-
- var cartesian0 = new Cartesian3(0.0, 0.0, 0.0);
- var cartesian1 = new Cartesian3(1.0, 1.0, 1.0);
- var cartesian2 = new Cartesian3(2.0, 2.0, 2.0);
- var cartographic3 = new Cartographic(0.3, 0.3, 0.3);
- var cartographic4 = new Cartographic(0.4, 0.4, 0.4);
- var cartographic5 = new Cartographic(0.5, 0.5, 0.5);
- var cartesian6 = new Cartesian3(6.0, 6.0, 6.0);
- var cartographic7 = new Cartographic(0.7, 0.7, 0.7);
-
- var cartesianFor_getValueRangeInReferenceFrame = {
- interval : '2012-08-01T00:00:00Z/2012-08-01T00:00:02Z',
- epoch : '2012-08-01T00:00:00Z',
- cartesian : [0, cartesian0.x, cartesian0.y, cartesian0.z, 1, cartesian1.x, cartesian1.y, cartesian1.z, 2, cartesian2.x, cartesian2.y, cartesian2.z],
- interpolationAlgorithm : 'LINEAR',
- interpolationDegree : 1
- };
-
- var cartographicFor_getValueRangeInReferenceFrame = {
- interval : '2012-08-01T00:00:02Z/2012-08-01T00:00:04Z',
- epoch : '2012-08-01T00:00:02Z',
- cartographicRadians : [0, cartographic3.longitude, cartographic3.latitude, cartographic3.height, 1, cartographic4.longitude, cartographic4.latitude, cartographic4.height, 2, cartographic5.longitude, cartographic5.latitude, cartographic5.height],
- interpolationAlgorithm : 'LINEAR',
- interpolationDegree : 1
- };
-
- var staticIntervalCartesian = {
- interval : '2012-08-01T00:00:05Z/2012-08-01T00:00:06Z',
- cartesian : [cartesian6.x, cartesian6.y, cartesian6.z]
- };
-
- var staticIntervalCartographic = {
- interval : '2012-08-01T00:00:05Z/2012-08-01T00:00:06Z',
- cartographicRadians : [cartographic7.longitude, cartographic7.latitude, cartographic7.height]
- };
-
- it('_getValueRangeInReferenceFrame works with single cartesian interval', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
- var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(0);
- var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(2);
- var result = property._getValueRangeInReferenceFrame(start, stop);
- expect(result.length).toEqual(3);
- expect(result[0]).toEqual(cartesian0);
- expect(result[1]).toEqual(cartesian1);
- expect(result[2]).toEqual(cartesian2);
- });
-
- it('_getValueRangeInReferenceFrame works with single cartesian interval and currentTime', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
- var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(0);
- var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(2);
- var currentTime = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(1.5);
- var result = property._getValueRangeInReferenceFrame(start, stop, currentTime);
- expect(result.length).toEqual(4);
- expect(result[0]).toEqual(cartesian0);
- expect(result[1]).toEqual(cartesian1);
- expect(result[2]).toEqual(Cartesian3.lerp(cartesian1, cartesian2, 0.5));
- expect(result[3]).toEqual(cartesian2);
- });
-
- it('_getValueRangeInReferenceFrame works with a result parameter', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
-
- var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(0);
- var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(2);
- var existingCartesian0 = new Cartesian3();
- var existingCartesian1 = new Cartesian3();
- var existingCartesian2 = new Cartesian3();
- var result = [existingCartesian0, existingCartesian1, existingCartesian2, new Cartesian3(), new Cartesian3()];
-
- var returnedResult = property._getValueRangeInReferenceFrame(start, stop, undefined, undefined, undefined, result);
- expect(result.length).toEqual(3);
- expect(result[0]).toEqual(cartesian0);
- expect(result[1]).toEqual(cartesian1);
- expect(result[2]).toEqual(cartesian2);
- expect(returnedResult).toBe(result);
- expect(result[0]).toBe(existingCartesian0);
- expect(result[1]).toBe(existingCartesian1);
- expect(result[2]).toBe(existingCartesian2);
- });
-
- it('_getValueRangeInReferenceFrame does not sample currentTime outside of start/stop time', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
- var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(0);
- var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(2);
- var currentTime = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(30);
- var result = property._getValueRangeInReferenceFrame(start, stop, currentTime);
- expect(result.length).toEqual(3);
- expect(result[0]).toEqual(cartesian0);
- expect(result[1]).toEqual(cartesian1);
- expect(result[2]).toEqual(cartesian2);
- });
-
- it('_getValueRangeInReferenceFrame does not sample start/stop if outside of data', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
- var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(-100);
- var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(+200);
- var result = property._getValueRangeInReferenceFrame(start, stop);
- expect(result.length).toEqual(3);
- expect(result[0]).toEqual(cartesian0);
- expect(result[1]).toEqual(cartesian1);
- expect(result[2]).toEqual(cartesian2);
- });
-
- it('_getValueRangeInReferenceFrame works with single cartographic interval', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartographicFor_getValueRangeInReferenceFrame);
- var start = JulianDate.fromIso8601(cartographicFor_getValueRangeInReferenceFrame.epoch).addSeconds(0);
- var stop = JulianDate.fromIso8601(cartographicFor_getValueRangeInReferenceFrame.epoch).addSeconds(2);
- var result = property._getValueRangeInReferenceFrame(start, stop);
- expect(result.length).toEqual(3);
- expect(result[0]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic3));
- expect(result[1]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic4));
- expect(result[2]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic5));
- });
-
- it('_getValueRangeInReferenceFrame works across intervals', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals([cartesianFor_getValueRangeInReferenceFrame, cartographicFor_getValueRangeInReferenceFrame]);
-
- var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(1);
- var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(3);
- var result = property._getValueRangeInReferenceFrame(start, stop);
- expect(result.length).toEqual(3);
- expect(result[0]).toEqual(cartesian1);
- expect(result[1]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic3));
- expect(result[2]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic4));
- });
-
- it('_getValueRangeInReferenceFrame works across non-sampled intervals', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals([cartesianFor_getValueRangeInReferenceFrame, cartographicFor_getValueRangeInReferenceFrame, staticIntervalCartesian]);
-
- var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(1);
- var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(6);
- var result = property._getValueRangeInReferenceFrame(start, stop);
- expect(result.length).toEqual(6);
- expect(result[0]).toEqual(cartesian1);
- expect(result[1]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic3));
- expect(result[2]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic4));
- expect(result[3]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic5));
- expect(result[4]).toEqual(cartesian6);
- expect(result[5]).toEqual(cartesian6);
- });
-
- it('_getValueRangeInReferenceFrame works across non-sampled cartographic intervals', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals([cartesianFor_getValueRangeInReferenceFrame, cartographicFor_getValueRangeInReferenceFrame, staticIntervalCartographic]);
-
- var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(1);
- var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(5);
- var result = property._getValueRangeInReferenceFrame(start, stop);
- expect(result.length).toEqual(5);
- expect(result[0]).toEqual(cartesian1);
- expect(result[1]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic3));
- expect(result[2]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic4));
- expect(result[3]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic5));
- expect(result[4]).toEqual(Ellipsoid.WGS84.cartographicToCartesian(cartographic7));
- });
-
- it('_getValueRangeInReferenceFrame works with no data', function() {
- var property = new DynamicPositionProperty();
- var result = property._getValueRangeInReferenceFrame(new JulianDate(), new JulianDate());
- expect(result.length).toEqual(0);
- });
-
- it('_getValueRangeInReferenceFrame works if requested interval is before any data.', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
- var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(-10);
- var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(-5);
- var result = property._getValueRangeInReferenceFrame(start, stop);
- expect(result.length).toEqual(0);
- });
-
- it('_getValueRangeInReferenceFrame works if requested interval is after all data.', function() {
- var property = new DynamicPositionProperty();
- property.processCzmlIntervals(cartesianFor_getValueRangeInReferenceFrame);
- var start = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(10);
- var stop = JulianDate.fromIso8601(cartesianFor_getValueRangeInReferenceFrame.epoch).addSeconds(5);
- var result = property._getValueRangeInReferenceFrame(start, stop);
- expect(result.length).toEqual(0);
- });
-
- it('_getValueRangeInReferenceFrame throws with no start time', function() {
- var property = new DynamicPositionProperty();
- expect(function() {
- property._getValueRangeInReferenceFrame(undefined, new JulianDate());
- }).toThrow();
- });
-
- it('_getValueRangeInReferenceFrame throws with no stop time', function() {
- var property = new DynamicPositionProperty();
- expect(function() {
- property._getValueRangeInReferenceFrame(new JulianDate(), undefined);
- }).toThrow();
- });
-});
diff --git a/Specs/DynamicScene/DynamicPropertySpec.js b/Specs/DynamicScene/DynamicPropertySpec.js
deleted file mode 100644
index 0589910028fa..000000000000
--- a/Specs/DynamicScene/DynamicPropertySpec.js
+++ /dev/null
@@ -1,334 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/DynamicProperty',
- 'Core/JulianDate',
- 'DynamicScene/CzmlBoolean',
- 'DynamicScene/CzmlNumber',
- 'DynamicScene/CzmlUnitQuaternion',
- 'Core/Quaternion',
- 'Core/Math',
- 'Core/LinearApproximation',
- 'Core/HermitePolynomialApproximation',
- 'Core/LagrangePolynomialApproximation'
- ], function(
- DynamicProperty,
- JulianDate,
- CzmlBoolean,
- CzmlNumber,
- CzmlUnitQuaternion,
- Quaternion,
- CesiumMath,
- LinearApproximation,
- HermitePolynomialApproximation,
- LagrangePolynomialApproximation) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- it('Works with uninterpolatable value types.', function() {
- var dynamicProperty = new DynamicProperty(CzmlBoolean);
-
- var booleanConstant = true;
-
- var booleanVerbose = {
- boolean : false
- };
-
- var booleanInterval = {
- interval : '2012-04-18T16:00:00Z/2012-04-19T16:00:00Z',
- boolean : true
- };
-
- var booleanIntervalArray = [{
- interval : '2012-04-18T17:00:00Z/2012-04-18T18:00:00Z',
- boolean : true
- }, {
- interval : '2012-04-18T16:00:00Z/2012-04-18T16:05:00Z',
- boolean : true
- }];
-
- dynamicProperty.processCzmlIntervals(booleanConstant);
- expect(dynamicProperty.getValue(new JulianDate())).toEqual(true);
-
- dynamicProperty.processCzmlIntervals(booleanVerbose);
- expect(dynamicProperty.getValue(new JulianDate())).toEqual(false);
-
- dynamicProperty.processCzmlIntervals(booleanInterval);
- expect(dynamicProperty.getValue(JulianDate.fromIso8601('2012-04-18T15:59:00Z'))).toEqual(false);
- expect(dynamicProperty.getValue(JulianDate.fromIso8601('2012-04-18T16:00:00Z'))).toEqual(true);
- expect(dynamicProperty.getValue(JulianDate.fromIso8601('2012-04-19T16:00:00Z'))).toEqual(true);
- expect(dynamicProperty.getValue(JulianDate.fromIso8601('2012-04-19T16:01:00Z'))).toEqual(false);
-
- dynamicProperty.processCzmlIntervals(booleanIntervalArray);
- dynamicProperty.processCzmlIntervals(booleanVerbose);
- expect(dynamicProperty.getValue(JulianDate.fromIso8601('2012-04-18T16:00:00Z'))).toEqual(false);
- expect(dynamicProperty.getValue(JulianDate.fromIso8601('2012-04-18T17:30:00Z'))).toEqual(false);
- expect(dynamicProperty.getValue(JulianDate.fromIso8601('2012-04-18T16:06:00Z'))).toEqual(false);
- });
-
- it('Works with interpolatable values (default linear interpolator).', function() {
- var iso8601Epoch = '2012-04-18T15:59:00Z';
- var epoch = JulianDate.fromIso8601(iso8601Epoch);
-
- var property = new DynamicProperty(CzmlNumber);
- var czmlInterval = {
- epoch : iso8601Epoch,
- number : [0, 0, 10, 10, 20, 20]
- };
- property.processCzmlIntervals(czmlInterval);
-
- expect(property.getValue(epoch)).toEqual(0);
- expect(property.getValue(epoch.addSeconds(4))).toEqual(4);
- //Look inside to verify it's using LinearApproximation
- expect(property._intervals.get(0).data.interpolationAlgorithm).toEqual(LinearApproximation);
- });
-
- it('Works with interpolatable value types (specified linear interpolator).', function() {
- var iso8601Epoch = '2012-04-18T15:59:00Z';
- var epoch = JulianDate.fromIso8601(iso8601Epoch);
-
- var property = new DynamicProperty(CzmlNumber);
- var czmlInterval = {
- epoch : iso8601Epoch,
- number : [0, 0, 10, 10, 20, 20],
- interpolationAlgorithm : 'LINEAR',
- interpolationDegree : 1
- };
- property.processCzmlIntervals(czmlInterval);
-
- expect(property.getValue(epoch)).toEqual(0);
- expect(property.getValue(epoch.addSeconds(4))).toEqual(4);
- //Look inside to verify it's using LinearApproximation
- expect(property._intervals.get(0).data.interpolationAlgorithm).toEqual(LinearApproximation);
- });
-
- it('Works with interpolatable value types (specified lagrange interpolator).', function() {
- var iso8601Epoch = '2012-04-18T15:59:00Z';
- var epoch = JulianDate.fromIso8601(iso8601Epoch);
-
- var property = new DynamicProperty(CzmlNumber);
- var czmlInterval = {
- epoch : iso8601Epoch,
- number : [0, 0, 10, 10, 20, 20, 30, 30, 40, 40, 50, 50],
- interpolationAlgorithm : 'LAGRANGE',
- interpolationDegree : 5
- };
- property.processCzmlIntervals(czmlInterval);
-
- expect(property.getValue(epoch)).toEqual(0);
- expect(property.getValue(epoch.addSeconds(5))).toEqual(5);
-
- //Look inside to verify it's using LaGrange
- expect(property._intervals.get(0).data.interpolationAlgorithm).toEqual(LagrangePolynomialApproximation);
- });
-
-
- it('Works with interpolatable value types (specified hermite interpolator).', function() {
- var iso8601Epoch = '2012-04-18T15:59:00Z';
- var epoch = JulianDate.fromIso8601(iso8601Epoch);
-
- var property = new DynamicProperty(CzmlNumber);
- var czmlInterval = {
- epoch : iso8601Epoch,
- number : [0, 0, 10, 10, 20, 20, 30, 30, 40, 40, 50, 50],
- interpolationAlgorithm : 'HERMITE',
- interpolationDegree : 3
- };
- property.processCzmlIntervals(czmlInterval);
-
- expect(property.getValue(epoch)).toEqual(0);
- expect(property.getValue(epoch.addSeconds(4))).toEqual(4);
-
- //Look inside to verify it's using Hermite
- expect(property._intervals.get(0).data.interpolationAlgorithm).toEqual(HermitePolynomialApproximation);
- });
-
- it('Works with custom packed value types.', function() {
- var iso8601Epoch = '2012-04-18T15:59:00Z';
- var epoch = JulianDate.fromIso8601(iso8601Epoch);
-
- var property = new DynamicProperty(CzmlUnitQuaternion);
-
- var czmlInterval = {
- epoch : iso8601Epoch,
- unitQuaternion : [0, 1, 0, 0, 0, 10, 0, 1, 0, 0],
- interpolationAlgorithm : 'LINEAR',
- interpolationDegree : 1
- };
- property.processCzmlIntervals(czmlInterval);
-
- var result = property.getValue(epoch);
- expect(result.x).toEqual(1);
- expect(result.y).toEqual(0);
- expect(result.z).toEqual(0);
- expect(result.w).toEqual(0);
-
- result = property.getValue(epoch.addSeconds(5));
- var expected = new Quaternion(0.707106781186547, 0.707106781186548, 0, 0);
- expect(new Quaternion(result.x, result.y, result.z, result.w)).toEqualEpsilon(expected, CesiumMath.EPSILON15);
-
- result = property.getValue(epoch.addSeconds(10));
- expect(result.x).toEqual(0);
- expect(result.y).toEqual(1);
- expect(result.z).toEqual(0);
- expect(result.w).toEqual(0);
- });
-
- it('Returns undefined if trying to interpolate with less than two samples.', function() {
- var iso8601Epoch = '2012-04-18T15:59:00Z';
- var epoch = JulianDate.fromIso8601(iso8601Epoch);
-
- var property = new DynamicProperty(CzmlNumber);
- var czmlInterval = {
- epoch : iso8601Epoch,
- number : [0, 0]
- };
- property.processCzmlIntervals(czmlInterval);
-
- expect(property.getValue(epoch)).toEqual(0);
- expect(property.getValue(epoch.addSeconds(4))).toBeUndefined();
- });
-
- it('_mergeNewSamples works with huge data sets.', function() {
- var times = [];
- var values = [];
- var epoch = new JulianDate();
-
- var data = [];
- var expectedTimes = [];
- var expectedValues = [];
-
- for ( var i = 0; i < 200000; i++) {
- data.push(i);
- data.push(i);
- expectedTimes.push(epoch.addSeconds(i));
- expectedValues.push(i);
- }
-
- DynamicProperty._mergeNewSamples(epoch, times, values, data, 1);
-
- expect(times).toEqual(expectedTimes, JulianDate.compare);
- expect(values).toEqual(expectedValues);
- });
-
- it('_mergeNewSamples works for sorted non-intersecting data.', function() {
- var times = [];
- var values = [];
- var epoch = new JulianDate();
-
- var newData = [0, 'a', 1, 'b', 2, 'c'];
- var newData2 = [3, 'd', 4, 'e', 5, 'f'];
-
- var expectedTimes = [epoch.addSeconds(0), epoch.addSeconds(1), epoch.addSeconds(2), epoch.addSeconds(3), epoch.addSeconds(4), epoch.addSeconds(5)];
- var expectedValues = ['a', 'b', 'c', 'd', 'e', 'f'];
-
- DynamicProperty._mergeNewSamples(epoch, times, values, newData, 1);
- DynamicProperty._mergeNewSamples(epoch, times, values, newData2, 1);
-
- expect(times).toEqual(expectedTimes, JulianDate.compare);
- expect(values).toEqual(expectedValues);
- });
-
- it('_mergeNewSamples works for ISO8601 dates', function() {
- var times = [];
- var values = [];
- var epoch = JulianDate.fromIso8601('2010-01-01T12:00:00');
-
- var newData = ['2010-01-01T12:00:00', 'a', '2010-01-01T12:00:01', 'b', '2010-01-01T12:00:02', 'c'];
- var newData2 = ['2010-01-01T12:00:03', 'd', '2010-01-01T12:00:04', 'e', '2010-01-01T12:00:05', 'f'];
-
- var expectedTimes = [epoch.addSeconds(0), epoch.addSeconds(1), epoch.addSeconds(2), epoch.addSeconds(3), epoch.addSeconds(4), epoch.addSeconds(5)];
- var expectedValues = ['a', 'b', 'c', 'd', 'e', 'f'];
-
- DynamicProperty._mergeNewSamples(undefined, times, values, newData, 1);
- DynamicProperty._mergeNewSamples(undefined, times, values, newData2, 1);
-
- expect(times).toEqual(expectedTimes, JulianDate.compare);
- expect(values).toEqual(expectedValues);
- });
-
- it('_mergeNewSamples works for elements of size 2.', function() {
- var times = [];
- var values = [];
- var epoch = new JulianDate();
-
- var newData = [1, 'b', 'b', 4, 'e', 'e', 0, 'a', 'a'];
- var newData2 = [2, 'c', 'c', 3, 'd', 'd'];
-
- var expectedTimes = [epoch.addSeconds(0), epoch.addSeconds(1), epoch.addSeconds(2), epoch.addSeconds(3), epoch.addSeconds(4)];
- var expectedValues = ['a', 'a', 'b', 'b', 'c', 'c', 'd', 'd', 'e', 'e'];
-
- DynamicProperty._mergeNewSamples(epoch, times, values, newData, 2);
- DynamicProperty._mergeNewSamples(epoch, times, values, newData2, 2);
-
- expect(times).toEqual(expectedTimes, JulianDate.compare);
- expect(values).toEqual(expectedValues);
- });
-
- it('_mergeNewSamples works for unsorted intersecting data.', function() {
- var times = [];
- var values = [];
- var epoch = new JulianDate();
-
- var newData = [1, 'b', 4, 'e', 0, 'a'];
- var newData2 = [5, 'f', 2, 'c', 3, 'd'];
-
- var expectedTimes = [epoch.addSeconds(0), epoch.addSeconds(1), epoch.addSeconds(2), epoch.addSeconds(3), epoch.addSeconds(4), epoch.addSeconds(5)];
- var expectedValues = ['a', 'b', 'c', 'd', 'e', 'f'];
-
- DynamicProperty._mergeNewSamples(epoch, times, values, newData, 1);
- DynamicProperty._mergeNewSamples(epoch, times, values, newData2, 1);
-
- expect(times).toEqual(expectedTimes, JulianDate.compare);
- expect(values).toEqual(expectedValues);
- });
-
- it('_mergeNewSamples works for data with repeated values.', function() {
- var times = [];
- var values = [];
- var epoch = new JulianDate();
-
- var newData = [0, 'a', 1, 'b', 1, 'c', 0, 'd', 4, 'e', 5, 'f'];
- var expectedTimes = [epoch.addSeconds(0), epoch.addSeconds(1), epoch.addSeconds(4), epoch.addSeconds(5)];
- var expectedValues = ['d', 'c', 'e', 'f'];
- DynamicProperty._mergeNewSamples(epoch, times, values, newData, 1);
-
- expect(times).toEqual(expectedTimes, JulianDate.compare);
- expect(values).toEqual(expectedValues);
- });
-
- var interwovenData = [{
- epoch : JulianDate.fromIso8601("20130205T150405.704999999999927Z"),
- values : [0.0, 1,
- 120.0, 2,
- 240.0, 3,
- 360.0, 4,
- 480.0, 6,
- 600.0, 8,
- 720.0, 10,
- 840.0, 12,
- 960.0, 14,
- 1080.0, 16]
- }, {
- epoch : JulianDate.fromIso8601("20130205T151151.60499999999956Z"),
- values : [0.0, 5,
- 120.0, 7,
- 240.0, 9,
- 360.0, 11,
- 480.0, 13,
- 600.0, 15,
- 720.0, 17,
- 840.0, 18,
- 960.0, 19,
- 1080.0, 20]
- }];
-
- it('_mergeNewSamples works with interwoven data', function() {
- var times = [];
- var values = [];
- DynamicProperty._mergeNewSamples(interwovenData[0].epoch, times, values, interwovenData[0].values, 1);
- DynamicProperty._mergeNewSamples(interwovenData[1].epoch, times, values, interwovenData[1].values, 1);
- for ( var i = 0; i < values.length; i++) {
- expect(values[i]).toBe(i + 1);
- }
- });
-});
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index 6c5dcd16d7ba..e6b23dad06ae 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -45,4 +45,159 @@ defineSuite([
expect(property.getValue(times[2])).toEqual(values[2]);
expect(property.getValue(new JulianDate(0.5, 0))).toEqual(7.5);
});
+
+ it('Returns undefined if trying to interpolate with less than enough samples.', function() {
+ var value = 7;
+ var time = new JulianDate(0, 0);
+
+ var property = new SampledProperty();
+ property.addSample(time, value);
+
+ expect(property.getValue(time)).toEqual(value);
+ expect(property.getValue(time.addSeconds(4))).toBeUndefined();
+ });
+
+ it('_mergeNewSamples works with huge data sets.', function() {
+ var times = [];
+ var values = [];
+ var epoch = new JulianDate();
+
+ var data = [];
+ var expectedTimes = [];
+ var expectedValues = [];
+
+ for ( var i = 0; i < 200000; i++) {
+ data.push(i);
+ data.push(i);
+ expectedTimes.push(epoch.addSeconds(i));
+ expectedValues.push(i);
+ }
+
+ SampledProperty._mergeNewSamples(epoch, times, values, data, 1);
+
+ expect(times).toEqual(expectedTimes, JulianDate.compare);
+ expect(values).toEqual(expectedValues);
+ });
+
+ it('_mergeNewSamples works for sorted non-intersecting data.', function() {
+ var times = [];
+ var values = [];
+ var epoch = new JulianDate();
+
+ var newData = [0, 'a', 1, 'b', 2, 'c'];
+ var newData2 = [3, 'd', 4, 'e', 5, 'f'];
+
+ var expectedTimes = [epoch.addSeconds(0), epoch.addSeconds(1), epoch.addSeconds(2), epoch.addSeconds(3), epoch.addSeconds(4), epoch.addSeconds(5)];
+ var expectedValues = ['a', 'b', 'c', 'd', 'e', 'f'];
+
+ SampledProperty._mergeNewSamples(epoch, times, values, newData, 1);
+ SampledProperty._mergeNewSamples(epoch, times, values, newData2, 1);
+
+ expect(times).toEqual(expectedTimes, JulianDate.compare);
+ expect(values).toEqual(expectedValues);
+ });
+
+ it('_mergeNewSamples works for ISO8601 dates', function() {
+ var times = [];
+ var values = [];
+ var epoch = JulianDate.fromIso8601('2010-01-01T12:00:00');
+
+ var newData = ['2010-01-01T12:00:00', 'a', '2010-01-01T12:00:01', 'b', '2010-01-01T12:00:02', 'c'];
+ var newData2 = ['2010-01-01T12:00:03', 'd', '2010-01-01T12:00:04', 'e', '2010-01-01T12:00:05', 'f'];
+
+ var expectedTimes = [epoch.addSeconds(0), epoch.addSeconds(1), epoch.addSeconds(2), epoch.addSeconds(3), epoch.addSeconds(4), epoch.addSeconds(5)];
+ var expectedValues = ['a', 'b', 'c', 'd', 'e', 'f'];
+
+ SampledProperty._mergeNewSamples(undefined, times, values, newData, 1);
+ SampledProperty._mergeNewSamples(undefined, times, values, newData2, 1);
+
+ expect(times).toEqual(expectedTimes, JulianDate.compare);
+ expect(values).toEqual(expectedValues);
+ });
+
+ it('_mergeNewSamples works for elements of size 2.', function() {
+ var times = [];
+ var values = [];
+ var epoch = new JulianDate();
+
+ var newData = [1, 'b', 'b', 4, 'e', 'e', 0, 'a', 'a'];
+ var newData2 = [2, 'c', 'c', 3, 'd', 'd'];
+
+ var expectedTimes = [epoch.addSeconds(0), epoch.addSeconds(1), epoch.addSeconds(2), epoch.addSeconds(3), epoch.addSeconds(4)];
+ var expectedValues = ['a', 'a', 'b', 'b', 'c', 'c', 'd', 'd', 'e', 'e'];
+
+ SampledProperty._mergeNewSamples(epoch, times, values, newData, 2);
+ SampledProperty._mergeNewSamples(epoch, times, values, newData2, 2);
+
+ expect(times).toEqual(expectedTimes, JulianDate.compare);
+ expect(values).toEqual(expectedValues);
+ });
+
+ it('_mergeNewSamples works for unsorted intersecting data.', function() {
+ var times = [];
+ var values = [];
+ var epoch = new JulianDate();
+
+ var newData = [1, 'b', 4, 'e', 0, 'a'];
+ var newData2 = [5, 'f', 2, 'c', 3, 'd'];
+
+ var expectedTimes = [epoch.addSeconds(0), epoch.addSeconds(1), epoch.addSeconds(2), epoch.addSeconds(3), epoch.addSeconds(4), epoch.addSeconds(5)];
+ var expectedValues = ['a', 'b', 'c', 'd', 'e', 'f'];
+
+ SampledProperty._mergeNewSamples(epoch, times, values, newData, 1);
+ SampledProperty._mergeNewSamples(epoch, times, values, newData2, 1);
+
+ expect(times).toEqual(expectedTimes, JulianDate.compare);
+ expect(values).toEqual(expectedValues);
+ });
+
+ it('_mergeNewSamples works for data with repeated values.', function() {
+ var times = [];
+ var values = [];
+ var epoch = new JulianDate();
+
+ var newData = [0, 'a', 1, 'b', 1, 'c', 0, 'd', 4, 'e', 5, 'f'];
+ var expectedTimes = [epoch.addSeconds(0), epoch.addSeconds(1), epoch.addSeconds(4), epoch.addSeconds(5)];
+ var expectedValues = ['d', 'c', 'e', 'f'];
+ SampledProperty._mergeNewSamples(epoch, times, values, newData, 1);
+
+ expect(times).toEqual(expectedTimes, JulianDate.compare);
+ expect(values).toEqual(expectedValues);
+ });
+
+ var interwovenData = [{
+ epoch : JulianDate.fromIso8601("20130205T150405.704999999999927Z"),
+ values : [0.0, 1,
+ 120.0, 2,
+ 240.0, 3,
+ 360.0, 4,
+ 480.0, 6,
+ 600.0, 8,
+ 720.0, 10,
+ 840.0, 12,
+ 960.0, 14,
+ 1080.0, 16]
+ }, {
+ epoch : JulianDate.fromIso8601("20130205T151151.60499999999956Z"),
+ values : [0.0, 5,
+ 120.0, 7,
+ 240.0, 9,
+ 360.0, 11,
+ 480.0, 13,
+ 600.0, 15,
+ 720.0, 17,
+ 840.0, 18,
+ 960.0, 19,
+ 1080.0, 20]
+ }];
+
+ it('_mergeNewSamples works with interwoven data', function() {
+ var times = [];
+ var values = [];
+ SampledProperty._mergeNewSamples(interwovenData[0].epoch, times, values, interwovenData[0].values, 1);
+ SampledProperty._mergeNewSamples(interwovenData[1].epoch, times, values, interwovenData[1].values, 1);
+ for ( var i = 0; i < values.length; i++) {
+ expect(values[i]).toBe(i + 1);
+ }
+ });
});
\ No newline at end of file
From 01194beb2b6fa174e44c0e74b7ba52da2eb7aec2 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 13 Aug 2013 14:47:20 -0400
Subject: [PATCH 14/65] Ongoing property work
1. Introduce InterpolatableValue interface and make most basic types we support implement it.
2. Add InterpolatableNumber.
3. Update SampledProperty to use the InterpolatableValue interface rather than specialized helper classes.
---
Source/Core/Cartesian2.js | 17 ++
Source/Core/Cartesian3.js | 19 ++
Source/Core/Color.js | 21 ++
Source/Core/InterpolatableNumber.js | 19 ++
Source/Core/InterpolatableValue.js | 24 +++
Source/Core/Quaternion.js | 73 +++++++
Source/DynamicScene/CzmlCartesian2.js | 8 +-
Source/DynamicScene/CzmlCartesian3.js | 8 +-
Source/DynamicScene/CzmlColor.js | 8 +-
Source/DynamicScene/CzmlDirection.js | 8 +-
Source/DynamicScene/CzmlNumber.js | 14 +-
Source/DynamicScene/CzmlPosition.js | 8 +-
Source/DynamicScene/CzmlUnitCartesian3.js | 8 +-
Source/DynamicScene/CzmlUnitQuaternion.js | 14 +-
Source/DynamicScene/SampledProperty.js | 210 +++----------------
Specs/DynamicScene/CzmlUnitQuaternionSpec.js | 4 +-
Specs/DynamicScene/SampledPropertySpec.js | 14 +-
Specs/MockProperty.js | 2 +-
18 files changed, 251 insertions(+), 228 deletions(-)
create mode 100644 Source/Core/InterpolatableNumber.js
create mode 100644 Source/Core/InterpolatableValue.js
diff --git a/Source/Core/Cartesian2.js b/Source/Core/Cartesian2.js
index 678c3a1f0c31..a9efdb75d0dc 100644
--- a/Source/Core/Cartesian2.js
+++ b/Source/Core/Cartesian2.js
@@ -148,6 +148,23 @@ define([
*/
Cartesian2.fromCartesian4 = Cartesian2.clone;
+ Cartesian2.length = 2;
+
+ Cartesian2.pack = function(array, startingIndex, value) {
+ array[startingIndex++] = value.x;
+ array[startingIndex++] = value.y;
+ return startingIndex;
+ };
+
+ Cartesian2.unpack = function(array, startingIndex, result) {
+ if (!defined(result)) {
+ result = new Cartesian2();
+ }
+ result.x = array[startingIndex++];
+ result.y = array[startingIndex];
+ return result;
+ };
+
/**
* Computes the value of the maximum component for the supplied Cartesian.
* @memberof Cartesian2
diff --git a/Source/Core/Cartesian3.js b/Source/Core/Cartesian3.js
index b0cbbb5791f7..963308e201d3 100644
--- a/Source/Core/Cartesian3.js
+++ b/Source/Core/Cartesian3.js
@@ -173,6 +173,25 @@ define([
*/
Cartesian3.fromCartesian4 = Cartesian3.clone;
+ Cartesian3.length = 3;
+
+ Cartesian3.pack = function(array, startingIndex, value) {
+ array[startingIndex++] = value.x;
+ array[startingIndex++] = value.y;
+ array[startingIndex++] = value.z;
+ return startingIndex;
+ };
+
+ Cartesian3.unpack = function(array, startingIndex, result) {
+ if (!defined(result)) {
+ result = new Cartesian3();
+ }
+ result.x = array[startingIndex++];
+ result.y = array[startingIndex++];
+ result.z = array[startingIndex];
+ return result;
+ };
+
/**
* Computes the value of the maximum component for the supplied Cartesian.
* @memberof Cartesian3
diff --git a/Source/Core/Color.js b/Source/Core/Color.js
index 7574ac4e7e9b..7aa57b5b6d36 100644
--- a/Source/Core/Color.js
+++ b/Source/Core/Color.js
@@ -226,6 +226,27 @@ define([
return undefined;
};
+ Color.length = 4;
+
+ Color.pack = function(array, startingIndex, value) {
+ array[startingIndex++] = value.red;
+ array[startingIndex++] = value.green;
+ array[startingIndex++] = value.blue;
+ array[startingIndex++] = value.alpha;
+ return startingIndex;
+ };
+
+ Color.unpack = function(array, startingIndex, result) {
+ if (!defined(result)) {
+ result = new Color();
+ }
+ result.red = array[startingIndex++];
+ result.green = array[startingIndex++];
+ result.blue = array[startingIndex++];
+ result.alpha = array[startingIndex];
+ return result;
+ };
+
/**
* Converts a 'byte' color component in the range of 0 to 255 into
* a 'float' color component in the range of 0 to 1.0.
diff --git a/Source/Core/InterpolatableNumber.js b/Source/Core/InterpolatableNumber.js
new file mode 100644
index 000000000000..8ac356ef7ee3
--- /dev/null
+++ b/Source/Core/InterpolatableNumber.js
@@ -0,0 +1,19 @@
+/*global define*/
+define(['../Core/DeveloperError'], function(DeveloperError) {
+ "use strict";
+
+ var InterpolatableNumber = {};
+
+ InterpolatableNumber.length = 1;
+
+ InterpolatableNumber.pack = function(array, startingIndex, value) {
+ array[startingIndex++] = value;
+ return startingIndex;
+ };
+
+ InterpolatableNumber.unpack = function(array, startingIndex, result) {
+ return array[startingIndex];
+ };
+
+ return InterpolatableNumber;
+});
diff --git a/Source/Core/InterpolatableValue.js b/Source/Core/InterpolatableValue.js
new file mode 100644
index 000000000000..0370e732c455
--- /dev/null
+++ b/Source/Core/InterpolatableValue.js
@@ -0,0 +1,24 @@
+/*global define*/
+define(['../Core/DeveloperError'], function(DeveloperError) {
+ "use strict";
+
+ function throwInstantiationError() {
+ throw new DeveloperError('This type should not be instantiated directly.');
+ }
+
+ var InterpolatableValue = {};
+
+ InterpolatableValue.length = 0;
+
+ InterpolatableValue.interpolationLength = 0;
+
+ InterpolatableValue.pack = throwInstantiationError;
+
+ InterpolatableValue.unpack = throwInstantiationError;
+
+ InterpolatableValue.packForInterpolation = throwInstantiationError;
+
+ InterpolatableValue.unpackInterpolationResult = throwInstantiationError;
+
+ return InterpolatableValue;
+});
diff --git a/Source/Core/Quaternion.js b/Source/Core/Quaternion.js
index c7eebdf00526..5eec66e8d386 100644
--- a/Source/Core/Quaternion.js
+++ b/Source/Core/Quaternion.js
@@ -174,6 +174,79 @@ define([
return result;
};
+ var sampledQuaternionAxis = new Cartesian3();
+ var sampledQuaternionRotation = new Cartesian3();
+ var sampledQuaternionTempQuaternion = new Quaternion();
+ var sampledQuaternionQuaternion0 = new Quaternion();
+ var sampledQuaternionQuaternion0Conjugate = new Quaternion();
+
+ Quaternion.length = 4;
+
+ Quaternion.interpolationLength = 3;
+
+ Quaternion.pack = function(array, startingIndex, value) {
+ array[startingIndex++] = value.x;
+ array[startingIndex++] = value.y;
+ array[startingIndex++] = value.z;
+ array[startingIndex++] = value.w;
+ return startingIndex;
+ };
+
+ Quaternion.packForInterpolation = function(sourceArray, destinationArray, firstIndex, lastIndex) {
+ Quaternion.unpack(sourceArray, lastIndex * 4, sampledQuaternionQuaternion0Conjugate);
+ sampledQuaternionQuaternion0Conjugate.conjugate(sampledQuaternionQuaternion0Conjugate);
+
+ for ( var i = 0, len = lastIndex - firstIndex + 1; i < len; i++) {
+ var offset = i * 3;
+ Quaternion.unpack(sourceArray, (firstIndex + i) * 4, sampledQuaternionTempQuaternion);
+
+ sampledQuaternionTempQuaternion.multiply(sampledQuaternionQuaternion0Conjugate, sampledQuaternionTempQuaternion);
+
+ if (sampledQuaternionTempQuaternion.w < 0) {
+ sampledQuaternionTempQuaternion.negate(sampledQuaternionTempQuaternion);
+ }
+
+ sampledQuaternionTempQuaternion.getAxis(sampledQuaternionAxis);
+ var angle = sampledQuaternionTempQuaternion.getAngle();
+ destinationArray[offset] = sampledQuaternionAxis.x * angle;
+ destinationArray[offset + 1] = sampledQuaternionAxis.y * angle;
+ destinationArray[offset + 2] = sampledQuaternionAxis.z * angle;
+ }
+ };
+
+ Quaternion.unpack = function(array, startingIndex, result) {
+ if (!defined(result)) {
+ result = new Quaternion();
+ }
+ result.x = array[startingIndex];
+ result.y = array[startingIndex + 1];
+ result.z = array[startingIndex + 2];
+ result.w = array[startingIndex + 3];
+ return result;
+ };
+
+ Quaternion.unpackInterpolationResult = function(array, result, sourceArray, firstIndex, lastIndex) {
+ if (!defined(result)) {
+ result = new Quaternion();
+ }
+ sampledQuaternionRotation.x = array[0];
+ sampledQuaternionRotation.y = array[1];
+ sampledQuaternionRotation.z = array[2];
+ var magnitude = sampledQuaternionRotation.magnitude();
+
+ Quaternion.unpack(sourceArray, lastIndex * 4, sampledQuaternionQuaternion0);
+
+ if (magnitude === 0) {
+ //Can't just use Quaternion.IDENTITY here because sampledQuaternionTempQuaternion may be modified in the future.
+ sampledQuaternionTempQuaternion.x = sampledQuaternionTempQuaternion.y = sampledQuaternionTempQuaternion.z = 0.0;
+ sampledQuaternionTempQuaternion.w = 1.0;
+ } else {
+ Quaternion.fromAxisAngle(sampledQuaternionRotation, magnitude, sampledQuaternionTempQuaternion);
+ }
+
+ return sampledQuaternionTempQuaternion.multiply(sampledQuaternionQuaternion0, result);
+ };
+
/**
* Duplicates a Quaternion instance.
* @memberof Quaternion
diff --git a/Source/DynamicScene/CzmlCartesian2.js b/Source/DynamicScene/CzmlCartesian2.js
index 70d85ad5ff88..32c74cb389ec 100644
--- a/Source/DynamicScene/CzmlCartesian2.js
+++ b/Source/DynamicScene/CzmlCartesian2.js
@@ -7,7 +7,7 @@ define([
defined) {
"use strict";
- var doublesPerValue = 2;
+ var length = 2;
/**
* Provides methods for working with a Cartesian2 defined in CZML.
@@ -34,12 +34,12 @@ define([
/**
* The number of doubles per packed Cartesian2 value.
*/
- doublesPerValue : doublesPerValue,
+ length : length,
/**
* The number of doubles per packed value used for interpolation.
*/
- doublesPerInterpolationValue : doublesPerValue,
+ interpolationLength : length,
/**
* Returns the packed Cartesian2 representation contained within the provided CZML interval
@@ -58,7 +58,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlCartesian2.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > doublesPerValue;
+ return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
},
/**
diff --git a/Source/DynamicScene/CzmlCartesian3.js b/Source/DynamicScene/CzmlCartesian3.js
index 1f8208525121..bb488df153a6 100644
--- a/Source/DynamicScene/CzmlCartesian3.js
+++ b/Source/DynamicScene/CzmlCartesian3.js
@@ -7,7 +7,7 @@ define([
defined) {
"use strict";
- var doublesPerValue = 3;
+ var length = 3;
/**
* Provides methods for working with a Cartesian3 defined in CZML.
@@ -34,12 +34,12 @@ define([
/**
* The number of doubles per packed Cartesian3 value.
*/
- doublesPerValue : doublesPerValue,
+ length : length,
/**
* The number of doubles per packed value used for interpolation.
*/
- doublesPerInterpolationValue : doublesPerValue,
+ interpolationLength : length,
/**
* Returns the packed Cartesian3 representation contained within the provided CZML interval
@@ -58,7 +58,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlCartesian3.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > doublesPerValue;
+ return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
},
/**
diff --git a/Source/DynamicScene/CzmlColor.js b/Source/DynamicScene/CzmlColor.js
index 678349129f8a..13f41b9a177c 100644
--- a/Source/DynamicScene/CzmlColor.js
+++ b/Source/DynamicScene/CzmlColor.js
@@ -7,7 +7,7 @@ define([
defined) {
"use strict";
- var doublesPerValue = 4;
+ var length = 4;
/**
* Provides methods for working with a Color defined in CZML.
@@ -34,12 +34,12 @@ define([
/**
* The number of doubles per packed Color value.
*/
- doublesPerValue : doublesPerValue,
+ length : length,
/**
* The number of doubles per packed value used for interpolation.
*/
- doublesPerInterpolationValue : doublesPerValue,
+ interpolationLength : length,
/**
* Returns the packed Color representation contained within the provided CZML interval
@@ -84,7 +84,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlColor.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > doublesPerValue;
+ return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
},
/**
diff --git a/Source/DynamicScene/CzmlDirection.js b/Source/DynamicScene/CzmlDirection.js
index 7df7aca558d5..301e63c0128e 100644
--- a/Source/DynamicScene/CzmlDirection.js
+++ b/Source/DynamicScene/CzmlDirection.js
@@ -13,7 +13,7 @@ define([
Ellipsoid) {
"use strict";
- var doublesPerValue = 3;
+ var length = 3;
var scratchCartesian = new Cartesian3();
var scratchSpherical = new Spherical();
@@ -43,12 +43,12 @@ define([
/**
* The number of doubles per packed Cartesian3 value.
*/
- doublesPerValue : doublesPerValue,
+ length : length,
/**
* The number of doubles per packed value used for interpolation.
*/
- doublesPerInterpolationValue : doublesPerValue,
+ interpolationLength : length,
/**
* Returns the packed Cartesian3 representation contained within the provided CZML interval
@@ -96,7 +96,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlDirection.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > doublesPerValue;
+ return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
},
/**
diff --git a/Source/DynamicScene/CzmlNumber.js b/Source/DynamicScene/CzmlNumber.js
index 7005a022b44d..151dd52e1294 100644
--- a/Source/DynamicScene/CzmlNumber.js
+++ b/Source/DynamicScene/CzmlNumber.js
@@ -1,11 +1,13 @@
/*global define*/
define([
- '../Core/defaultValue'
+ '../Core/defaultValue',
+ '../Core/InterpolatableNumber'
], function(
- defaultValue) {
+ defaultValue,
+ InterpolatableNumber) {
"use strict";
- var doublesPerValue = 1;
+ var length = 1;
/**
* Provides methods for working with a number defined in CZML.
@@ -27,15 +29,17 @@ define([
* @see CzmlVerticalOrigin
*/
var CzmlNumber = {
+ type : InterpolatableNumber,
+
/**
* The number of doubles per packed value.
*/
- doublesPerValue : doublesPerValue,
+ length : length,
/**
* The number of doubles per packed value used for interpolation.
*/
- doublesPerInterpolationValue : doublesPerValue,
+ interpolationLength : length,
/**
* Returns the packed numerical representation contained within the provided CZML interval
diff --git a/Source/DynamicScene/CzmlPosition.js b/Source/DynamicScene/CzmlPosition.js
index 18b34dcbdf5b..83be3c66c18b 100644
--- a/Source/DynamicScene/CzmlPosition.js
+++ b/Source/DynamicScene/CzmlPosition.js
@@ -13,7 +13,7 @@ define([
Ellipsoid) {
"use strict";
- var doublesPerValue = 3;
+ var length = 3;
var scratchCartesian = new Cartesian3();
var scratchCartographic = new Cartographic();
@@ -42,12 +42,12 @@ define([
/**
* The number of doubles per packed Cartesian3 value.
*/
- doublesPerValue : doublesPerValue,
+ length : length,
/**
* The number of doubles per packed value used for interpolation.
*/
- doublesPerInterpolationValue : doublesPerValue,
+ interpolationLength : length,
/**
* Returns the packed Cartesian3 representation contained within the provided CZML interval
@@ -125,7 +125,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlPosition.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > doublesPerValue;
+ return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
},
/**
diff --git a/Source/DynamicScene/CzmlUnitCartesian3.js b/Source/DynamicScene/CzmlUnitCartesian3.js
index e421f538b849..b65516158113 100644
--- a/Source/DynamicScene/CzmlUnitCartesian3.js
+++ b/Source/DynamicScene/CzmlUnitCartesian3.js
@@ -7,7 +7,7 @@ define([
defined) {
"use strict";
- var doublesPerValue = 3;
+ var length = 3;
/**
* Provides methods for working with a unit Cartesian3 defined in CZML.
@@ -34,12 +34,12 @@ define([
/**
* The number of doubles per packed Cartesian3 value.
*/
- doublesPerValue : doublesPerValue,
+ length : length,
/**
* The number of doubles per packed value used for interpolation.
*/
- doublesPerInterpolationValue : doublesPerValue,
+ interpolationLength : length,
/**
* Returns the packed Cartesian3 representation contained within the provided CZML interval
@@ -58,7 +58,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlUnitCartesian3.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > doublesPerValue;
+ return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
},
/**
diff --git a/Source/DynamicScene/CzmlUnitQuaternion.js b/Source/DynamicScene/CzmlUnitQuaternion.js
index 80f09d2c31d2..7facf1826ea3 100644
--- a/Source/DynamicScene/CzmlUnitQuaternion.js
+++ b/Source/DynamicScene/CzmlUnitQuaternion.js
@@ -43,12 +43,12 @@ define([
/**
* The number of doubles per packed Quaternion value.
*/
- doublesPerValue : doublesPerQuaternion,
+ length : doublesPerQuaternion,
/**
* The number of doubles per packed value used for interpolation.
*/
- doublesPerInterpolationValue : doublesPerCartesian,
+ interpolationLength : doublesPerCartesian,
/**
* Returns the packed Quaternion representation contained within the provided CZML interval
@@ -79,7 +79,7 @@ define([
* @param {Number} firstIndex The index of the first element to be packed.
* @param {Number} lastIndex The index of the last element to be packed.
*/
- packValuesForInterpolation : function(sourceArray, destinationArray, firstIndex, lastIndex) {
+ packForInterpolation : function(sourceArray, destinationArray, firstIndex, lastIndex) {
CzmlUnitQuaternion.getValueFromArray(sourceArray, lastIndex * doublesPerQuaternion, quaternion0Conjugate);
quaternion0Conjugate.conjugate(quaternion0Conjugate);
@@ -139,14 +139,14 @@ define([
},
/**
- * Given a packed array of axis-angle rotations returned from CzmlUnitQuaternion.packValuesForInterpolation,
+ * Given a packed array of axis-angle rotations returned from CzmlUnitQuaternion.packForInterpolation,
* converts the desired index into a unit Quaternion.
*
* @param {Array} array The array containing the packed axis-angle rotations.
* @param {Quaternion} result The object to store the result in, if undefined a new instance will be created.
- * @param {Array} sourceArray The source array of the original Quaternion values previously passed to CzmlUnitQuaternion.packValuesForInterpolation.
- * @param {Number} firstIndex The index previously passed to CzmlUnitQuaternion.packValuesForInterpolation.
- * @param {Number} lastIndex The index previously passed to CzmlUnitQuaternion.packValuesForInterpolation
+ * @param {Array} sourceArray The source array of the original Quaternion values previously passed to CzmlUnitQuaternion.packForInterpolation.
+ * @param {Number} firstIndex The index previously passed to CzmlUnitQuaternion.packForInterpolation.
+ * @param {Number} lastIndex The index previously passed to CzmlUnitQuaternion.packForInterpolation
* @returns The modified result parameter or a new Quaternion instance if result was not defined.
*/
getValueFromInterpolationResult : function(array, result, sourceArray, firstIndex, lastIndex) {
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 8cc091a3023b..5481ce701586 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -2,164 +2,21 @@
define([
'../Core/binarySearch',
'../Core/defaultValue',
- '../Core/Cartesian2',
- '../Core/Cartesian3',
- '../Core/Color',
'../Core/defined',
'../Core/DeveloperError',
'../Core/JulianDate',
- '../Core/LinearApproximation',
- '../Core/Quaternion'
+ '../Core/LinearApproximation'
], function(
binarySearch,
defaultValue,
- Cartesian2,
- Cartesian3,
- Color,
defined,
DeveloperError,
JulianDate,
- LinearApproximation,
- Quaternion) {
+ LinearApproximation) {
"use strict";
var interpolationScratch;
- var SampledCartesian2 = {
- doublesPerValue : 2,
- doublesPerInterpolationValue : 2,
- flatten : function(array, value) {
- array.push(value.x);
- array.push(value.y);
- },
- inflate : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Cartesian2();
- }
- result.x = array[startingIndex];
- result.y = array[startingIndex + 1];
- return result;
- }
- };
-
- var SampledCartesian3 = {
- doublesPerValue : 3,
- doublesPerInterpolationValue : 3,
- flatten : function(array, value) {
- array.push(value.x);
- array.push(value.y);
- array.push(value.z);
- },
- inflate : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Cartesian3();
- }
- result.x = array[startingIndex];
- result.y = array[startingIndex + 1];
- result.z = array[startingIndex + 2];
- return result;
- }
- };
-
- var SampledColor = {
- doublesPerValue : 4,
- doublesPerInterpolationValue : 4,
- flatten : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Color();
- }
- result.red = array[startingIndex];
- result.green = array[startingIndex + 1];
- result.blue = array[startingIndex + 2];
- result.alpha = array[startingIndex + 3];
- return result;
- },
- inflate : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Color();
- }
- result.red = array[startingIndex];
- result.green = array[startingIndex + 1];
- result.blue = array[startingIndex + 2];
- result.alpha = array[startingIndex + 3];
- return result;
- }
- };
-
- var SampledNumber = {
- doublesPerValue : 1,
- doublesPerInterpolationValue : 1,
- flatten : function(array, value) {
- array.push(value);
- },
- inflate : function(array, startingIndex) {
- return array[startingIndex];
- }
- };
-
- var sampledQuaternionAxis = new Cartesian3();
- var sampledQuaternionRotation = new Cartesian3();
- var sampledQuaternionTempQuaternion = new Quaternion();
- var sampledQuaternionQuaternion0 = new Quaternion();
- var sampledQuaternionQuaternion0Conjugate = new Quaternion();
-
- var SampledQuaternion = {
- doublesPerValue : 4,
- doublesPerInterpolationValue : 3,
- packValuesForInterpolation : function(sourceArray, destinationArray, firstIndex, lastIndex) {
- SampledQuaternion.inflate(sourceArray, lastIndex * 4, sampledQuaternionQuaternion0Conjugate);
- sampledQuaternionQuaternion0Conjugate.conjugate(sampledQuaternionQuaternion0Conjugate);
-
- for ( var i = 0, len = lastIndex - firstIndex + 1; i < len; i++) {
- var offset = i * 3;
- SampledQuaternion.inflate(sourceArray, (firstIndex + i) * 4, sampledQuaternionTempQuaternion);
-
- sampledQuaternionTempQuaternion.multiply(sampledQuaternionQuaternion0Conjugate, sampledQuaternionTempQuaternion);
-
- if (sampledQuaternionTempQuaternion.w < 0) {
- sampledQuaternionTempQuaternion.negate(sampledQuaternionTempQuaternion);
- }
-
- sampledQuaternionTempQuaternion.getAxis(sampledQuaternionAxis);
- var angle = sampledQuaternionTempQuaternion.getAngle();
- destinationArray[offset] = sampledQuaternionAxis.x * angle;
- destinationArray[offset + 1] = sampledQuaternionAxis.y * angle;
- destinationArray[offset + 2] = sampledQuaternionAxis.z * angle;
- }
- },
- inflate : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Quaternion();
- }
- result.x = array[startingIndex];
- result.y = array[startingIndex + 1];
- result.z = array[startingIndex + 2];
- result.w = array[startingIndex + 3];
- return result;
- },
- inflateInterpolationResult : function(array, result, sourceArray, firstIndex, lastIndex) {
- if (!defined(result)) {
- result = new Quaternion();
- }
- sampledQuaternionRotation.x = array[0];
- sampledQuaternionRotation.y = array[1];
- sampledQuaternionRotation.z = array[2];
- var magnitude = sampledQuaternionRotation.magnitude();
-
- SampledQuaternion.inflate(sourceArray, lastIndex * 4, sampledQuaternionQuaternion0);
-
- if (magnitude === 0) {
- //Can't just use Quaternion.IDENTITY here because sampledQuaternionTempQuaternion may be modified in the future.
- sampledQuaternionTempQuaternion.x = sampledQuaternionTempQuaternion.y = sampledQuaternionTempQuaternion.z = 0.0;
- sampledQuaternionTempQuaternion.w = 1.0;
- } else {
- Quaternion.fromAxisAngle(sampledQuaternionRotation, magnitude, sampledQuaternionTempQuaternion);
- }
-
- return sampledQuaternionTempQuaternion.multiply(sampledQuaternionQuaternion0, result);
- }
- };
-
//We can't use splice for inserting new elements because function apply can't handle
//a huge number of arguments. See https://code.google.com/p/chromium/issues/detail?id=56588
function arrayInsert(array, startIndex, items) {
@@ -191,7 +48,7 @@ define([
return epoch.addSeconds(date);
}
- var _mergeNewSamples = function(epoch, times, values, newData, doublesPerValue) {
+ var _mergeNewSamples = function(epoch, times, values, newData, length) {
var newDataIndex = 0;
var i;
var prevItem;
@@ -211,7 +68,7 @@ define([
timesInsertionPoint = ~timesInsertionPoint;
timesSpliceArgs = [];
- valuesInsertionPoint = timesInsertionPoint * doublesPerValue;
+ valuesInsertionPoint = timesInsertionPoint * length;
valuesSpliceArgs = [];
prevItem = undefined;
nextTime = times[timesInsertionPoint];
@@ -222,7 +79,7 @@ define([
}
timesSpliceArgs.push(currentTime);
newDataIndex = newDataIndex + 1;
- for (i = 0; i < doublesPerValue; i++) {
+ for (i = 0; i < length; i++) {
valuesSpliceArgs.push(newData[newDataIndex]);
newDataIndex = newDataIndex + 1;
}
@@ -233,9 +90,9 @@ define([
arrayInsert(times, timesInsertionPoint, timesSpliceArgs);
} else {
//Found an exact match
- for (i = 0; i < doublesPerValue; i++) {
+ for (i = 0; i < length; i++) {
newDataIndex++;
- values[(timesInsertionPoint * doublesPerValue) + i] = newData[newDataIndex];
+ values[(timesInsertionPoint * length) + i] = newData[newDataIndex];
}
newDataIndex++;
}
@@ -251,30 +108,18 @@ define([
* @exception {DeveloperError} value is required.
*/
var SampledProperty = function(type) {
- var typeHandler;
if (!defined(type)) {
- typeHandler = SampledNumber;
- } else if (type === Cartesian2) {
- typeHandler = SampledCartesian2;
- } else if (type === Cartesian3) {
- typeHandler = SampledCartesian3;
- } else if (type === Color) {
- typeHandler = SampledColor;
- } else if (type === Quaternion) {
- typeHandler = SampledQuaternion;
- } else {
- throw new DeveloperError('unknown type');
+ throw new DeveloperError('type is required.');
}
this.type = type;
- this._typeHandler = typeHandler;
this.interpolationAlgorithm = LinearApproximation;
this.interpolationDegree = 1;
this.numberOfPoints = LinearApproximation.getRequiredDataPoints(1);
this._times = [];
this._values = [];
this._xTable = new Array(this.numberOfPoints);
- this._yTable = new Array(this.numberOfPoints * typeHandler.doublesPerInterpolationValue, 1);
+ this._yTable = new Array(this.numberOfPoints * defaultValue(type.interpolationLength, type.length), 1);
};
/**
@@ -296,10 +141,9 @@ define([
* @exception {DeveloperError} time is required.
*/
SampledProperty.prototype.getValue = function(time, result) {
- var typeHandler = this._typeHandler;
+ var type = this.type;
var times = this._times;
var values = this._values;
- var doublesPerValue = typeHandler.doublesPerValue;
var index = binarySearch(times, time, JulianDate.compare);
if (index < 0) {
if (times.length < this.numberOfPoints) {
@@ -339,24 +183,24 @@ define([
var length = lastIndex - firstIndex + 1;
- var doublesPerInterpolationValue = typeHandler.doublesPerInterpolationValue;
+ var interpolationLength = defaultValue(type.length, type.interpolationLength);
var xTable = this._xTable;
var yTable = this._yTable;
if (!defined(xTable)) {
xTable = this._xTable = new Array(this.numberOfPoints);
- yTable = this._yTable = new Array(this.numberOfPoints * doublesPerInterpolationValue);
+ yTable = this._yTable = new Array(this.numberOfPoints * interpolationLength);
}
// Build the tables
for ( var i = 0; i < length; ++i) {
xTable[i] = times[lastIndex].getSecondsDifference(times[firstIndex + i]);
}
- var specializedPackFunction = typeHandler.packValuesForInterpolation;
+ var specializedPackFunction = type.packForInterpolation;
if (!defined(specializedPackFunction)) {
var destinationIndex = 0;
- var sourceIndex = firstIndex * doublesPerValue;
- var stop = (lastIndex + 1) * doublesPerValue;
+ var sourceIndex = firstIndex * length;
+ var stop = (lastIndex + 1) * length;
while (sourceIndex < stop) {
yTable[destinationIndex] = values[sourceIndex];
@@ -369,36 +213,36 @@ define([
// Interpolate!
var x = times[lastIndex].getSecondsDifference(time);
- interpolationScratch = this.interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, doublesPerInterpolationValue, interpolationScratch);
+ interpolationScratch = this.interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, interpolationLength, interpolationScratch);
- if (!defined(typeHandler.inflateInterpolationResult)) {
- return typeHandler.inflate(interpolationScratch, 0, result);
+ if (!defined(type.unpackInterpolationResult)) {
+ return type.unpack(interpolationScratch, 0, result);
}
- return typeHandler.inflateInterpolationResult(interpolationScratch, result, values, firstIndex, lastIndex);
+ return type.unpackInterpolationResult(interpolationScratch, result, values, firstIndex, lastIndex);
}
- return typeHandler.inflate(this._values, index * doublesPerValue, result);
+ return type.unpack(this._values, index * type.length, result);
};
SampledProperty.prototype.addSample = function(time, value) {
- var typeHandler = this._typeHandler;
+ var type = this.type;
var data = [time];
- typeHandler.flatten(data, value);
- _mergeNewSamples(undefined, this._times, this._values, data, typeHandler.doublesPerValue);
+ type.pack(data, 1, value);
+ _mergeNewSamples(undefined, this._times, this._values, data, type.length);
};
SampledProperty.prototype.addSamples = function(times, values) {
- var typeHandler = this._typeHandler;
+ var type = this.type;
var length = times.length;
var data = [];
for ( var i = 0; i < length; i++) {
data.push(times[i]);
- typeHandler.flatten(data, values[i]);
+ type.pack(data, data.length, values[i]);
}
- _mergeNewSamples(undefined, this._times, this._values, data, typeHandler.doublesPerValue);
+ _mergeNewSamples(undefined, this._times, this._values, data, type.length);
};
SampledProperty.prototype.addSamplesFlatArray = function(data, epoch) {
- _mergeNewSamples(epoch, this._times, this._values, data, this._typeHandler.doublesPerValue);
+ _mergeNewSamples(epoch, this._times, this._values, data, this.type.length);
};
//Exposed for testing.
diff --git a/Specs/DynamicScene/CzmlUnitQuaternionSpec.js b/Specs/DynamicScene/CzmlUnitQuaternionSpec.js
index f5a883abe2b4..3b0c82267a88 100644
--- a/Specs/DynamicScene/CzmlUnitQuaternionSpec.js
+++ b/Specs/DynamicScene/CzmlUnitQuaternionSpec.js
@@ -39,10 +39,10 @@ defineSuite([
expect(CzmlUnitQuaternion.getValueFromArray(sampledQuaternionInterval.unitQuaternion, 6)).toEqualEpsilon(quaternion2, CesiumMath.EPSILON15);
});
- it('packValuesForInterpolation and getValueFromInterpolationResult', function() {
+ it('packForInterpolation and getValueFromInterpolationResult', function() {
var destination = [];
var source = [quaternion1.x, quaternion1.y, quaternion1.z, quaternion1.w, quaternion2.x, quaternion2.y, quaternion2.z, quaternion2.w];
- CzmlUnitQuaternion.packValuesForInterpolation(source, destination, 0, 1);
+ CzmlUnitQuaternion.packForInterpolation(source, destination, 0, 1);
expect(CzmlUnitQuaternion.getValueFromInterpolationResult(destination, undefined, source, 0, 1)).toEqualEpsilon(quaternion1, CesiumMath.EPSILON15);
});
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index e6b23dad06ae..f8babdec0278 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -1,10 +1,12 @@
/*global defineSuite*/
defineSuite([
'DynamicScene/SampledProperty',
- 'Core/JulianDate'
+ 'Core/JulianDate',
+ 'Core/InterpolatableNumber'
], function(
SampledProperty,
- JulianDate) {
+ JulianDate,
+ InterpolatableNumber) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -12,7 +14,7 @@ defineSuite([
var data = [0, 7, 1, 8, 2, 9];
var epoch = new JulianDate(0, 0);
- var property = new SampledProperty();
+ var property = new SampledProperty(InterpolatableNumber);
property.addSamplesFlatArray(data, epoch);
expect(property.getIsTimeVarying()).toEqual(true);
expect(property.getValue(epoch)).toEqual(7);
@@ -23,7 +25,7 @@ defineSuite([
var values = [7, 8, 9];
var times = [new JulianDate(0, 0), new JulianDate(1, 0), new JulianDate(2, 0)];
- var property = new SampledProperty();
+ var property = new SampledProperty(InterpolatableNumber);
property.addSample(times[0], values[0]);
property.addSample(times[1], values[1]);
property.addSample(times[2], values[2]);
@@ -38,7 +40,7 @@ defineSuite([
var values = [7, 8, 9];
var times = [new JulianDate(0, 0), new JulianDate(1, 0), new JulianDate(2, 0)];
- var property = new SampledProperty();
+ var property = new SampledProperty(InterpolatableNumber);
property.addSamples(times, values);
expect(property.getValue(times[0])).toEqual(values[0]);
expect(property.getValue(times[1])).toEqual(values[1]);
@@ -50,7 +52,7 @@ defineSuite([
var value = 7;
var time = new JulianDate(0, 0);
- var property = new SampledProperty();
+ var property = new SampledProperty(InterpolatableNumber);
property.addSample(time, value);
expect(property.getValue(time)).toEqual(value);
diff --git a/Specs/MockProperty.js b/Specs/MockProperty.js
index 6ce5b3de232f..8cc6f867a12f 100644
--- a/Specs/MockProperty.js
+++ b/Specs/MockProperty.js
@@ -18,7 +18,7 @@ define([
return this.value;
};
- MockProperty.prototype._getReferenceFrame = function() {
+ MockProperty.prototype.getReferenceFrame = function() {
return ReferenceFrame.FIXED;
};
From 5a9cc3309690cec95f6b8837f20f7c2e14524f76 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 13 Aug 2013 16:28:33 -0400
Subject: [PATCH 15/65] Ongoing CZML cleanup
1. Delete a lot of now dead code in preparation of bigger CZML parsing changes.
2. Move `processCzml` to `CzmlDataSource.processCzml` for now, but we may get rid of it entirely.
---
Source/DynamicScene/CzmlCartesian2.js | 45 +-----
Source/DynamicScene/CzmlCartesian3.js | 45 +-----
Source/DynamicScene/CzmlColor.js | 46 +-----
Source/DynamicScene/CzmlDataSource.js | 76 +++++++++-
Source/DynamicScene/CzmlDirection.js | 46 +-----
Source/DynamicScene/CzmlHorizontalOrigin.js | 15 --
Source/DynamicScene/CzmlImage.js | 14 --
Source/DynamicScene/CzmlLabelStyle.js | 15 --
Source/DynamicScene/CzmlNumber.js | 37 -----
Source/DynamicScene/CzmlPosition.js | 44 +-----
Source/DynamicScene/CzmlString.js | 14 --
Source/DynamicScene/CzmlUnitCartesian3.js | 44 +-----
Source/DynamicScene/CzmlUnitQuaternion.js | 122 +--------------
Source/DynamicScene/CzmlVerticalOrigin.js | 15 --
Source/DynamicScene/processCzml.js | 83 ----------
.../CompositeDynamicObjectCollectionSpec.js | 16 +-
Specs/DynamicScene/CzmlCartesian2Spec.js | 4 -
Specs/DynamicScene/CzmlCartesian3Spec.js | 4 -
Specs/DynamicScene/CzmlColorSpec.js | 5 -
Specs/DynamicScene/CzmlDataSourceSpec.js | 130 ++++++++++++++++
Specs/DynamicScene/CzmlDirectionSpec.js | 4 -
Specs/DynamicScene/CzmlNumberSpec.js | 4 -
Specs/DynamicScene/CzmlPositionSpec.js | 4 -
Specs/DynamicScene/CzmlUnitCartesian3Spec.js | 4 -
Specs/DynamicScene/CzmlUnitQuaternionSpec.js | 11 --
.../DynamicVertexPositionsPropertySpec.js | 6 +-
Specs/DynamicScene/processCzmlSpec.js | 143 ------------------
27 files changed, 223 insertions(+), 773 deletions(-)
delete mode 100644 Source/DynamicScene/processCzml.js
delete mode 100644 Specs/DynamicScene/processCzmlSpec.js
diff --git a/Source/DynamicScene/CzmlCartesian2.js b/Source/DynamicScene/CzmlCartesian2.js
index 32c74cb389ec..e115a145c6d0 100644
--- a/Source/DynamicScene/CzmlCartesian2.js
+++ b/Source/DynamicScene/CzmlCartesian2.js
@@ -7,39 +7,13 @@ define([
defined) {
"use strict";
- var length = 2;
-
/**
* Provides methods for working with a Cartesian2 defined in CZML.
*
* @exports CzmlCartesian2
- *
- * @see Cartesian2
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlCartesian2 = {
type : Cartesian2,
- /**
- * The number of doubles per packed Cartesian2 value.
- */
- length : length,
-
- /**
- * The number of doubles per packed value used for interpolation.
- */
- interpolationLength : length,
/**
* Returns the packed Cartesian2 representation contained within the provided CZML interval
@@ -58,7 +32,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlCartesian2.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
+ return unwrappedInterval.length > 2;
},
/**
@@ -75,23 +49,6 @@ define([
result.x = unwrappedInterval[0];
result.y = unwrappedInterval[1];
return result;
- },
-
- /**
- * Given a packed array of x and y values, extracts a Cartesian2 instance.
- *
- * @param {Array} array A packed array of Cartesian2 values, where every two elements represents an x,y pair.
- * @param {Number} startingIndex The index into the array that contains the x value of the Cartesian2 you would like.
- * @param {Cartesian2} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Cartesian2 instance if result was not defined.
- */
- getValueFromArray : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Cartesian2();
- }
- result.x = array[startingIndex];
- result.y = array[startingIndex + 1];
- return result;
}
};
diff --git a/Source/DynamicScene/CzmlCartesian3.js b/Source/DynamicScene/CzmlCartesian3.js
index bb488df153a6..f5af5a9eb5ad 100644
--- a/Source/DynamicScene/CzmlCartesian3.js
+++ b/Source/DynamicScene/CzmlCartesian3.js
@@ -13,34 +13,9 @@ define([
* Provides methods for working with a Cartesian3 defined in CZML.
*
* @exports CzmlCartesian3
- *
- * @see Cartesian3
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlCartesian3 = {
type : Cartesian3,
- /**
- * The number of doubles per packed Cartesian3 value.
- */
- length : length,
-
- /**
- * The number of doubles per packed value used for interpolation.
- */
- interpolationLength : length,
-
/**
* Returns the packed Cartesian3 representation contained within the provided CZML interval
* or undefined if the interval does not contain Cartesian3 data.
@@ -58,7 +33,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlCartesian3.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
+ return unwrappedInterval.length > length;
},
/**
@@ -76,24 +51,6 @@ define([
result.y = unwrappedInterval[1];
result.z = unwrappedInterval[2];
return result;
- },
-
- /**
- * Given a packed array of x, y, and z values, extracts a Cartesian3 instance.
- *
- * @param {Array} array A packed array of Cartesian3 values, where every three elements represents a Cartesian3.
- * @param {Number} startingIndex The index into the array that contains the x value of the Cartesian3 you would like.
- * @param {Cartesian3} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Cartesian3 instance if result was not defined.
- */
- getValueFromArray : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Cartesian3();
- }
- result.x = array[startingIndex];
- result.y = array[startingIndex + 1];
- result.z = array[startingIndex + 2];
- return result;
}
};
diff --git a/Source/DynamicScene/CzmlColor.js b/Source/DynamicScene/CzmlColor.js
index 13f41b9a177c..f39304688404 100644
--- a/Source/DynamicScene/CzmlColor.js
+++ b/Source/DynamicScene/CzmlColor.js
@@ -13,33 +13,9 @@ define([
* Provides methods for working with a Color defined in CZML.
*
* @exports CzmlColor
- *
- * @see Color
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlColor = {
type : Color,
- /**
- * The number of doubles per packed Color value.
- */
- length : length,
-
- /**
- * The number of doubles per packed value used for interpolation.
- */
- interpolationLength : length,
/**
* Returns the packed Color representation contained within the provided CZML interval
@@ -84,7 +60,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlColor.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
+ return unwrappedInterval.length > length;
},
/**
@@ -103,26 +79,6 @@ define([
result.blue = unwrappedInterval[2];
result.alpha = unwrappedInterval[3];
return result;
- },
-
-
- /**
- * Given a packed array of red, green, blue, and alpha values, extracts a Color instance.
- *
- * @param {Array} array A packed array of Color values, where every four elements represents a Color.
- * @param {Number} startingIndex The index into the array that contains the red value of the Color you would like.
- * @param {Color} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Color instance if result was not defined.
- */
- getValueFromArray : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Color();
- }
- result.red = array[startingIndex];
- result.green = array[startingIndex + 1];
- result.blue = array[startingIndex + 2];
- result.alpha = array[startingIndex + 3];
- return result;
}
};
return CzmlColor;
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index 9beb8d51cd92..0f2ad43a0319 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -2,32 +2,53 @@
define([
'../Core/ClockRange',
'../Core/ClockStep',
+ '../Core/createGuid',
'../Core/defined',
'../Core/DeveloperError',
'../Core/Event',
'../Core/Iso8601',
'../Core/loadJson',
+ './CzmlDefaults',
'./DynamicClock',
- './processCzml',
'./DynamicObjectCollection',
'../ThirdParty/when'
], function(
ClockRange,
ClockStep,
+ createGuid,
defined,
DeveloperError,
Event,
Iso8601,
loadJson,
+ CzmlDefaults,
DynamicClock,
- processCzml,
DynamicObjectCollection,
when) {
"use strict";
+ function processCzmlPacket(packet, dynamicObjectCollection, updatedObjects, updatedObjectsHash, updaterFunctions, sourceUri) {
+ var objectId = packet.id;
+ if (!defined(objectId)) {
+ objectId = createGuid();
+ }
+
+ if (packet['delete'] === true) {
+ dynamicObjectCollection.removeObject(objectId);
+ } else {
+ var object = dynamicObjectCollection.getOrCreateObject(objectId);
+ for ( var i = updaterFunctions.length - 1; i > -1; i--) {
+ if (updaterFunctions[i](object, packet, dynamicObjectCollection, sourceUri) && !defined(updatedObjectsHash[objectId])) {
+ updatedObjectsHash[objectId] = true;
+ updatedObjects.push(object);
+ }
+ }
+ }
+ }
+
function loadCzml(dataSource, czml, sourceUri) {
var dynamicObjectCollection = dataSource._dynamicObjectCollection;
- processCzml(czml, dynamicObjectCollection, sourceUri);
+ CzmlDataSource.processCzml(czml, dynamicObjectCollection, sourceUri);
var availability = dynamicObjectCollection.computeAvailability();
var clock;
@@ -200,5 +221,54 @@ define([
});
};
+ /**
+ * Processes the provided CZML, creating or updating DynamicObject instances for each
+ * corresponding CZML identifier.
+ * @exports processCzml
+ *
+ * @param {Object} czml The parsed CZML object to be processed.
+ * @param {DynamicObjectCollection} dynamicObjectCollection The collection to create or updated objects within.
+ * @param {String} [sourceUri] The uri of the file where the CZML originated from. If provided, relative uri look-ups will use this as their base.
+ * @param {Array} [updaterFunctions=CzmlDefaults.updaters] The array of updated functions to use for processing. If left undefined, all standard CZML data is processed.
+ *
+ * @exception {DeveloperError} czml is required.
+ * @exception {DeveloperError} dynamicObjectCollection is required.
+ *
+ * @returns An array containing all DynamicObject instances that were created or updated.
+ *
+ * @example
+ * var url = 'http://someUrl.com/myCzmlFile.czml';
+ * var dynamicObjectCollection = new DynamicObjectCollection();
+ * loadJson(url).then(function(czml) {
+ * CzmlDataSource.processCzml(czml, dynamicObjectCollection, url);
+ * });
+ */
+ CzmlDataSource.processCzml = function(czml, dynamicObjectCollection, sourceUri, updaterFunctions) {
+ if (!defined(czml)) {
+ throw new DeveloperError('czml is required.');
+ }
+ if (!defined(dynamicObjectCollection)) {
+ throw new DeveloperError('dynamicObjectCollection is required.');
+ }
+
+ var updatedObjects = [];
+ var updatedObjectsHash = {};
+ updaterFunctions = defined(updaterFunctions) ? updaterFunctions : CzmlDefaults.updaters;
+
+ if (Array.isArray(czml)) {
+ for ( var i = 0, len = czml.length; i < len; i++) {
+ processCzmlPacket(czml[i], dynamicObjectCollection, updatedObjects, updatedObjectsHash, updaterFunctions, sourceUri);
+ }
+ } else {
+ processCzmlPacket(czml, dynamicObjectCollection, updatedObjects, updatedObjectsHash, updaterFunctions, sourceUri);
+ }
+
+ if (updatedObjects.length > 0) {
+ dynamicObjectCollection.objectPropertiesChanged.raiseEvent(dynamicObjectCollection, updatedObjects);
+ }
+
+ return updatedObjects;
+ };
+
return CzmlDataSource;
});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlDirection.js b/Source/DynamicScene/CzmlDirection.js
index 301e63c0128e..bec55c7a3a0a 100644
--- a/Source/DynamicScene/CzmlDirection.js
+++ b/Source/DynamicScene/CzmlDirection.js
@@ -13,7 +13,6 @@ define([
Ellipsoid) {
"use strict";
- var length = 3;
var scratchCartesian = new Cartesian3();
var scratchSpherical = new Spherical();
@@ -21,34 +20,9 @@ define([
* Provides methods for working with a direction defined in CZML.
*
* @exports CzmlDirection
- *
- * @see Cartesian3
- * @see Spherical
- * @see DynamicProperty
- * @see DynamicDirectionProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlDirection = {
type : Cartesian3,
- /**
- * The number of doubles per packed Cartesian3 value.
- */
- length : length,
-
- /**
- * The number of doubles per packed value used for interpolation.
- */
- interpolationLength : length,
/**
* Returns the packed Cartesian3 representation contained within the provided CZML interval
@@ -96,7 +70,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlDirection.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
+ return unwrappedInterval.length > 3;
},
/**
@@ -114,24 +88,6 @@ define([
result.y = unwrappedInterval[1];
result.z = unwrappedInterval[2];
return result;
- },
-
- /**
- * Given a packed array of x, y, and z values, extracts a Cartesian3 instance.
- *
- * @param {Array} array A packed array of Cartesian3 values, where every three elements represents a Cartesian3.
- * @param {Number} startingIndex The index into the array that contains the x value of the Cartesian3 you would like.
- * @param {Cartesian3} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Cartesian3 instance if result was not defined.
- */
- getValueFromArray : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Cartesian3();
- }
- result.x = array[startingIndex];
- result.y = array[startingIndex + 1];
- result.z = array[startingIndex + 2];
- return result;
}
};
diff --git a/Source/DynamicScene/CzmlHorizontalOrigin.js b/Source/DynamicScene/CzmlHorizontalOrigin.js
index e053f8033c94..3893089bce67 100644
--- a/Source/DynamicScene/CzmlHorizontalOrigin.js
+++ b/Source/DynamicScene/CzmlHorizontalOrigin.js
@@ -11,21 +11,6 @@ define([
* Provides methods for working with a horizontal origin defined in CZML.
*
* @exports CzmlHorizontalOrigin
- *
- * @see HorizontalOrigin
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlHorizontalOrigin = {
/**
diff --git a/Source/DynamicScene/CzmlImage.js b/Source/DynamicScene/CzmlImage.js
index fb36f2264359..406c324105f4 100644
--- a/Source/DynamicScene/CzmlImage.js
+++ b/Source/DynamicScene/CzmlImage.js
@@ -13,20 +13,6 @@ define([
* Provides methods for working with a image defined in CZML.
*
* @exports CzmlImage
- *
- * @see DynamicProperty
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlImage
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlImage = {
/**
diff --git a/Source/DynamicScene/CzmlLabelStyle.js b/Source/DynamicScene/CzmlLabelStyle.js
index 8997a4c10282..85dfa4643ab9 100644
--- a/Source/DynamicScene/CzmlLabelStyle.js
+++ b/Source/DynamicScene/CzmlLabelStyle.js
@@ -11,21 +11,6 @@ define([
* Provides methods for working with a label style defined in CZML.
*
* @exports CzmlLabelStyle
- *
- * @see LabelStyle
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlLabelStyle = {
/**
diff --git a/Source/DynamicScene/CzmlNumber.js b/Source/DynamicScene/CzmlNumber.js
index 151dd52e1294..da0334bbd1e8 100644
--- a/Source/DynamicScene/CzmlNumber.js
+++ b/Source/DynamicScene/CzmlNumber.js
@@ -7,40 +7,14 @@ define([
InterpolatableNumber) {
"use strict";
- var length = 1;
-
/**
* Provides methods for working with a number defined in CZML.
*
* @exports CzmlNumber
- *
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlNumber = {
type : InterpolatableNumber,
- /**
- * The number of doubles per packed value.
- */
- length : length,
-
- /**
- * The number of doubles per packed value used for interpolation.
- */
- interpolationLength : length,
-
/**
* Returns the packed numerical representation contained within the provided CZML interval
* or undefined if the interval does not contain numerical data.
@@ -70,17 +44,6 @@ define([
*/
getValue : function(unwrappedInterval) {
return unwrappedInterval;
- },
-
- /**
- * Given a packed array of numerical values, returns the number at the given index..
- *
- * @param {Array} array An array of numbers.
- * @param {Number} startingIndex The index into the array that contains the value you would like.
- * @returns The value at the specified index.
- */
- getValueFromArray : function(array, startingIndex) {
- return array[startingIndex];
}
};
diff --git a/Source/DynamicScene/CzmlPosition.js b/Source/DynamicScene/CzmlPosition.js
index 83be3c66c18b..46449be2b122 100644
--- a/Source/DynamicScene/CzmlPosition.js
+++ b/Source/DynamicScene/CzmlPosition.js
@@ -21,33 +21,9 @@ define([
* Provides methods for working with a position defined in CZML.
*
* @exports CzmlPosition
- *
- * @see Cartesian3
- * @see Cartographic
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlPosition = {
type : Cartesian3,
- /**
- * The number of doubles per packed Cartesian3 value.
- */
- length : length,
-
- /**
- * The number of doubles per packed value used for interpolation.
- */
- interpolationLength : length,
/**
* Returns the packed Cartesian3 representation contained within the provided CZML interval
@@ -125,7 +101,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlPosition.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
+ return unwrappedInterval.length > length;
},
/**
@@ -143,24 +119,6 @@ define([
result.y = unwrappedInterval[1];
result.z = unwrappedInterval[2];
return result;
- },
-
- /**
- * Given a packed array of x, y, and z values, extracts a Cartesian3 instance.
- *
- * @param {Array} array A packed array of Cartesian3 values, where every three elements represents a Cartesian3.
- * @param {Number} startingIndex The index into the array that contains the x value of the Cartesian3 you would like.
- * @param {Cartesian3} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Cartesian3 instance if result was not defined.
- */
- getValueFromArray : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Cartesian3();
- }
- result.x = array[startingIndex];
- result.y = array[startingIndex + 1];
- result.z = array[startingIndex + 2];
- return result;
}
};
diff --git a/Source/DynamicScene/CzmlString.js b/Source/DynamicScene/CzmlString.js
index bbfa7be806f0..f723a3f35265 100644
--- a/Source/DynamicScene/CzmlString.js
+++ b/Source/DynamicScene/CzmlString.js
@@ -9,20 +9,6 @@ define([
* Provides methods for working with a string defined in CZML.
*
* @exports CzmlString
- *
- * @see DynamicProperty
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlString = {
/**
diff --git a/Source/DynamicScene/CzmlUnitCartesian3.js b/Source/DynamicScene/CzmlUnitCartesian3.js
index b65516158113..eb2dd355dfee 100644
--- a/Source/DynamicScene/CzmlUnitCartesian3.js
+++ b/Source/DynamicScene/CzmlUnitCartesian3.js
@@ -13,33 +13,9 @@ define([
* Provides methods for working with a unit Cartesian3 defined in CZML.
*
* @exports CzmlUnitCartesian3
- *
- * @see Cartesian3
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlUnitCartesian3 = {
type : Cartesian3,
- /**
- * The number of doubles per packed Cartesian3 value.
- */
- length : length,
-
- /**
- * The number of doubles per packed value used for interpolation.
- */
- interpolationLength : length,
/**
* Returns the packed Cartesian3 representation contained within the provided CZML interval
@@ -58,7 +34,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlUnitCartesian3.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > length;
+ return unwrappedInterval.length > length;
},
/**
@@ -76,24 +52,6 @@ define([
result.y = unwrappedInterval[1];
result.z = unwrappedInterval[2];
return result.normalize(result);
- },
-
- /**
- * Given a packed array of x, y, and z values, extracts a Cartesian3 instance.
- *
- * @param {Array} array A packed array of Cartesian3 values, where every three elements represents a Cartesian3.
- * @param {Number} startingIndex The index into the array that contains the x value of the Cartesian3 you would like.
- * @param {Cartesian3} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Cartesian3 instance if result was not defined.
- */
- getValueFromArray : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Cartesian3();
- }
- result.x = array[startingIndex];
- result.y = array[startingIndex + 1];
- result.z = array[startingIndex + 2];
- return result.normalize(result);
}
};
diff --git a/Source/DynamicScene/CzmlUnitQuaternion.js b/Source/DynamicScene/CzmlUnitQuaternion.js
index 7facf1826ea3..8b47960ce874 100644
--- a/Source/DynamicScene/CzmlUnitQuaternion.js
+++ b/Source/DynamicScene/CzmlUnitQuaternion.js
@@ -1,55 +1,22 @@
/*global define*/
define([
'../Core/Quaternion',
- '../Core/defined',
- '../Core/Cartesian3'
+ '../Core/defined'
], function(
Quaternion,
- defined,
- Cartesian3) {
+ defined) {
"use strict";
- var doublesPerCartesian = 3;
var doublesPerQuaternion = 4;
- var axis = new Cartesian3();
- var rotationVector = new Cartesian3();
- var tmpQuaternion = new Quaternion();
- var quaternion0 = new Quaternion();
- var quaternion0Conjugate = new Quaternion();
/**
* Provides methods for working with a unit Quaternion defined in CZML.
*
* @exports CzmlUnitQuaternion
- *
- * @see Quaternion
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
*/
var CzmlUnitQuaternion = {
type : Quaternion,
- /**
- * The number of doubles per packed Quaternion value.
- */
- length : doublesPerQuaternion,
-
- /**
- * The number of doubles per packed value used for interpolation.
- */
- interpolationLength : doublesPerCartesian,
-
/**
* Returns the packed Quaternion representation contained within the provided CZML interval
* or undefined if the interval does not contain Quaternion data.
@@ -67,38 +34,7 @@ define([
* @param {Object} unwrappedInterval The result of CzmlUnitQuaternion.unwrapInterval.
*/
isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval) && unwrappedInterval.length > doublesPerQuaternion;
- },
-
- /**
- * Given a packed array of x, y, z, and w values, creates a packed array of
- * Cartesian3 axis-angle rotations suitable for interpolation.
- *
- * @param {Array} sourceArray The packed array of quaternion values.
- * @param {Array} destinationArray The array to store the packed axis-angle rotations.
- * @param {Number} firstIndex The index of the first element to be packed.
- * @param {Number} lastIndex The index of the last element to be packed.
- */
- packForInterpolation : function(sourceArray, destinationArray, firstIndex, lastIndex) {
- CzmlUnitQuaternion.getValueFromArray(sourceArray, lastIndex * doublesPerQuaternion, quaternion0Conjugate);
- quaternion0Conjugate.conjugate(quaternion0Conjugate);
-
- for ( var i = 0, len = lastIndex - firstIndex + 1; i < len; i++) {
- var offset = i * doublesPerCartesian;
- CzmlUnitQuaternion.getValueFromArray(sourceArray, (firstIndex + i) * doublesPerQuaternion, tmpQuaternion);
-
- tmpQuaternion.multiply(quaternion0Conjugate, tmpQuaternion);
-
- if (tmpQuaternion.w < 0) {
- tmpQuaternion.negate(tmpQuaternion);
- }
-
- tmpQuaternion.getAxis(axis);
- var angle = tmpQuaternion.getAngle();
- destinationArray[offset] = axis.x * angle;
- destinationArray[offset + 1] = axis.y * angle;
- destinationArray[offset + 2] = axis.z * angle;
- }
+ return unwrappedInterval.length > doublesPerQuaternion;
},
/**
@@ -117,58 +53,6 @@ define([
result.z = unwrappedInterval[2];
result.w = unwrappedInterval[3];
return result.normalize(result);
- },
-
- /**
- * Given a packed array of x, y, z, and w values, extracts a Quaternion instance.
- *
- * @param {Array} array A packed array of Quaternion values, where every four elements represents a Cartesian3.
- * @param {Number} startingIndex The index into the array that contains the x value of the Quaternion you would like.
- * @param {Cartesian3} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Quaternion instance if result was not defined.
- */
- getValueFromArray : function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Quaternion();
- }
- result.x = array[startingIndex];
- result.y = array[startingIndex + 1];
- result.z = array[startingIndex + 2];
- result.w = array[startingIndex + 3];
- return result.normalize(result);
- },
-
- /**
- * Given a packed array of axis-angle rotations returned from CzmlUnitQuaternion.packForInterpolation,
- * converts the desired index into a unit Quaternion.
- *
- * @param {Array} array The array containing the packed axis-angle rotations.
- * @param {Quaternion} result The object to store the result in, if undefined a new instance will be created.
- * @param {Array} sourceArray The source array of the original Quaternion values previously passed to CzmlUnitQuaternion.packForInterpolation.
- * @param {Number} firstIndex The index previously passed to CzmlUnitQuaternion.packForInterpolation.
- * @param {Number} lastIndex The index previously passed to CzmlUnitQuaternion.packForInterpolation
- * @returns The modified result parameter or a new Quaternion instance if result was not defined.
- */
- getValueFromInterpolationResult : function(array, result, sourceArray, firstIndex, lastIndex) {
- if (!defined(result)) {
- result = new Quaternion();
- }
- rotationVector.x = array[0];
- rotationVector.y = array[1];
- rotationVector.z = array[2];
- var magnitude = rotationVector.magnitude();
-
- CzmlUnitQuaternion.getValueFromArray(sourceArray, lastIndex * doublesPerQuaternion, quaternion0);
-
- if (magnitude === 0) {
- //Can't just use Quaternion.IDENTITY here because tmpQuaternion may be modified in the future.
- tmpQuaternion.x = tmpQuaternion.y = tmpQuaternion.z = 0.0;
- tmpQuaternion.w = 1.0;
- } else {
- Quaternion.fromAxisAngle(rotationVector, magnitude, tmpQuaternion);
- }
-
- return result.normalize(tmpQuaternion.multiply(quaternion0, result), result);
}
};
diff --git a/Source/DynamicScene/CzmlVerticalOrigin.js b/Source/DynamicScene/CzmlVerticalOrigin.js
index 2c5b4d67b9af..152665e4a7e0 100644
--- a/Source/DynamicScene/CzmlVerticalOrigin.js
+++ b/Source/DynamicScene/CzmlVerticalOrigin.js
@@ -11,21 +11,6 @@ define([
* Provides methods for working with a vertical origin defined in CZML.
*
* @exports CzmlVerticalOrigin
- *
- * @see VerticalOrigin
- * @see DynamicProperty
- * @see CzmlBoolean
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
*/
var CzmlVerticalOrigin = {
/**
diff --git a/Source/DynamicScene/processCzml.js b/Source/DynamicScene/processCzml.js
deleted file mode 100644
index a09956fcc823..000000000000
--- a/Source/DynamicScene/processCzml.js
+++ /dev/null
@@ -1,83 +0,0 @@
-/*global define*/
-define([
- '../Core/createGuid',
- '../Core/defined',
- '../Core/DeveloperError',
- './CzmlDefaults'
- ], function(
- createGuid,
- defined,
- DeveloperError,
- CzmlDefaults) {
- "use strict";
-
- function processCzmlPacket(packet, dynamicObjectCollection, updatedObjects, updatedObjectsHash, updaterFunctions, sourceUri) {
- var objectId = packet.id;
- if (!defined(objectId)) {
- objectId = createGuid();
- }
-
- if (packet['delete'] === true) {
- dynamicObjectCollection.removeObject(objectId);
- } else {
- var object = dynamicObjectCollection.getOrCreateObject(objectId);
- for ( var i = updaterFunctions.length - 1; i > -1; i--) {
- if (updaterFunctions[i](object, packet, dynamicObjectCollection, sourceUri) && !defined(updatedObjectsHash[objectId])) {
- updatedObjectsHash[objectId] = true;
- updatedObjects.push(object);
- }
- }
- }
- }
-
- /**
- * Processes the provided CZML, creating or updating DynamicObject instances for each
- * corresponding CZML identifier.
- * @exports processCzml
- *
- * @param {Object} czml The parsed CZML object to be processed.
- * @param {DynamicObjectCollection} dynamicObjectCollection The collection to create or updated objects within.
- * @param {String} [sourceUri] The uri of the file where the CZML originated from. If provided, relative uri look-ups will use this as their base.
- * @param {Array} [updaterFunctions=CzmlDefaults.updaters] The array of updated functions to use for processing. If left undefined, all standard CZML data is processed.
- *
- * @exception {DeveloperError} czml is required.
- * @exception {DeveloperError} dynamicObjectCollection is required.
- *
- * @returns An array containing all DynamicObject instances that were created or updated.
- *
- * @example
- * var url = 'http://someUrl.com/myCzmlFile.czml';
- * var dynamicObjectCollection = new DynamicObjectCollection();
- * loadJson(url).then(function(czml) {
- * processCzml(czml, dynamicObjectCollection, url);
- * });
- */
- var processCzml = function(czml, dynamicObjectCollection, sourceUri, updaterFunctions) {
- if (!defined(czml)) {
- throw new DeveloperError('czml is required.');
- }
- if (!defined(dynamicObjectCollection)) {
- throw new DeveloperError('dynamicObjectCollection is required.');
- }
-
- var updatedObjects = [];
- var updatedObjectsHash = {};
- updaterFunctions = defined(updaterFunctions) ? updaterFunctions : CzmlDefaults.updaters;
-
- if (Array.isArray(czml)) {
- for ( var i = 0, len = czml.length; i < len; i++) {
- processCzmlPacket(czml[i], dynamicObjectCollection, updatedObjects, updatedObjectsHash, updaterFunctions, sourceUri);
- }
- } else {
- processCzmlPacket(czml, dynamicObjectCollection, updatedObjects, updatedObjectsHash, updaterFunctions, sourceUri);
- }
-
- if (updatedObjects.length > 0) {
- dynamicObjectCollection.objectPropertiesChanged.raiseEvent(dynamicObjectCollection, updatedObjects);
- }
-
- return updatedObjects;
- };
-
- return processCzml;
-});
diff --git a/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js b/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
index 20fa52470f8e..6a463bad8030 100644
--- a/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
+++ b/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
@@ -5,7 +5,7 @@ defineSuite([
'Core/JulianDate',
'Core/Iso8601',
'Core/TimeInterval',
- 'DynamicScene/processCzml',
+ 'DynamicScene/CzmlDataSource',
'DynamicScene/CzmlDefaults',
'Scene/HorizontalOrigin'
], function(
@@ -14,7 +14,7 @@ defineSuite([
JulianDate,
Iso8601,
TimeInterval,
- processCzml,
+ CzmlDataSource,
CzmlDefaults,
HorizontalOrigin) {
"use strict";
@@ -120,10 +120,10 @@ defineSuite([
it('setCollections works with existing dynamicObjectCollections', function() {
var dynamicObjectCollection1 = new DynamicObjectCollection();
- processCzml(czml1, dynamicObjectCollection1);
+ CzmlDataSource.processCzml(czml1, dynamicObjectCollection1);
var dynamicObjectCollection2 = new DynamicObjectCollection();
- processCzml(czml2, dynamicObjectCollection2);
+ CzmlDataSource.processCzml(czml2, dynamicObjectCollection2);
var compositeDynamicObjectCollection = new CompositeDynamicObjectCollection();
compositeDynamicObjectCollection.setCollections([dynamicObjectCollection1, dynamicObjectCollection2]);
@@ -142,10 +142,10 @@ defineSuite([
it('Constructing with existing dynamicObjectCollections merges expected objects', function() {
var dynamicObjectCollection1 = new DynamicObjectCollection();
- processCzml(czml1, dynamicObjectCollection1);
+ CzmlDataSource.processCzml(czml1, dynamicObjectCollection1);
var dynamicObjectCollection2 = new DynamicObjectCollection();
- processCzml(czml2, dynamicObjectCollection2);
+ CzmlDataSource.processCzml(czml2, dynamicObjectCollection2);
var compositeDynamicObjectCollection = new CompositeDynamicObjectCollection([dynamicObjectCollection1, dynamicObjectCollection2]);
@@ -175,7 +175,7 @@ defineSuite([
'horizontalOrigin' : 'CENTER'
}
};
- processCzml(czml3, dynamicObjectCollection1);
+ CzmlDataSource.processCzml(czml3, dynamicObjectCollection1);
var objects = compositeDynamicObjectCollection.getObjects();
expect(objects.length).toEqual(1);
@@ -195,7 +195,7 @@ defineSuite([
'scale' : 3.0
}
};
- processCzml(czml4, dynamicObjectCollection2);
+ CzmlDataSource.processCzml(czml4, dynamicObjectCollection2);
objects = compositeDynamicObjectCollection.getObjects();
expect(objects.length).toEqual(1);
diff --git a/Specs/DynamicScene/CzmlCartesian2Spec.js b/Specs/DynamicScene/CzmlCartesian2Spec.js
index 4b6d1bd1eabd..1d4c28a5b414 100644
--- a/Specs/DynamicScene/CzmlCartesian2Spec.js
+++ b/Specs/DynamicScene/CzmlCartesian2Spec.js
@@ -32,8 +32,4 @@ defineSuite([
it('getValue', function() {
expect(CzmlCartesian2.getValue(constantCartesianInterval.cartesian2)).toEqual(cartesian1);
});
-
- it('getValueFromArray', function() {
- expect(CzmlCartesian2.getValueFromArray(sampledCartesianInterval.cartesian2, 4)).toEqual(cartesian2);
- });
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CzmlCartesian3Spec.js b/Specs/DynamicScene/CzmlCartesian3Spec.js
index 19e6922ebea6..fec4f26bf7af 100644
--- a/Specs/DynamicScene/CzmlCartesian3Spec.js
+++ b/Specs/DynamicScene/CzmlCartesian3Spec.js
@@ -32,8 +32,4 @@ defineSuite([
it('getValue', function() {
expect(CzmlCartesian3.getValue(constantCartesianInterval.cartesian)).toEqual(cartesian1);
});
-
- it('getValueFromArray', function() {
- expect(CzmlCartesian3.getValueFromArray(sampledCartesianInterval.cartesian, 5)).toEqual(cartesian2);
- });
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CzmlColorSpec.js b/Specs/DynamicScene/CzmlColorSpec.js
index 6201353e2ab8..5a490c2322dd 100644
--- a/Specs/DynamicScene/CzmlColorSpec.js
+++ b/Specs/DynamicScene/CzmlColorSpec.js
@@ -25,7 +25,6 @@ defineSuite([
};
var color1 = new Color(sampledRgbafInterval.rgbaf[1], sampledRgbafInterval.rgbaf[2], sampledRgbafInterval.rgbaf[3], sampledRgbafInterval.rgbaf[4]);
- var color2 = new Color(sampledRgbafInterval.rgbaf[6], sampledRgbafInterval.rgbaf[7], sampledRgbafInterval.rgbaf[8], sampledRgbafInterval.rgbaf[9]);
it('unwrapInterval', function() {
expect(CzmlColor.unwrapInterval(constantRgbaInterval)).toEqual(constantRgbafInterval.rgbaf);
@@ -42,8 +41,4 @@ defineSuite([
it('getValue', function() {
expect(CzmlColor.getValue(constantRgbafInterval.rgbaf)).toEqual(color1);
});
-
- it('getValueFromArray', function() {
- expect(CzmlColor.getValueFromArray(sampledRgbafInterval.rgbaf, 6)).toEqual(color2);
- });
});
diff --git a/Specs/DynamicScene/CzmlDataSourceSpec.js b/Specs/DynamicScene/CzmlDataSourceSpec.js
index 6198ec74c637..c1db37619afe 100644
--- a/Specs/DynamicScene/CzmlDataSourceSpec.js
+++ b/Specs/DynamicScene/CzmlDataSourceSpec.js
@@ -1,6 +1,7 @@
/*global defineSuite*/
defineSuite([
'DynamicScene/CzmlDataSource',
+ 'DynamicScene/DynamicBillboard',
'DynamicScene/DynamicObjectCollection',
'Core/ClockRange',
'Core/ClockStep',
@@ -12,6 +13,7 @@ defineSuite([
'ThirdParty/when'
], function(
CzmlDataSource,
+ DynamicBillboard,
DynamicObjectCollection,
ClockRange,
ClockStep,
@@ -271,4 +273,132 @@ defineSuite([
expect(resolveSpy).not.toHaveBeenCalled();
});
});
+
+ var czml = {
+ 'id' : 'test',
+ 'billboard' : {
+ 'show' : true
+ },
+ 'label' : {
+ 'show' : false
+ }
+ };
+
+ var czmlDelete = {
+ 'id' : 'test',
+ 'delete' : true
+ };
+
+ var czmlArray = [{
+ 'id' : 'test',
+ 'billboard' : {
+ 'show' : true
+ }
+ }, {
+ 'id' : 'test',
+ 'label' : {
+ 'show' : false
+ }
+ }];
+
+ var czmlNoId = {
+ 'billboard' : {
+ 'show' : true
+ }
+ };
+
+ it('processCzml throws if czml is undefined', function() {
+ var dynamicObjectCollection = new DynamicObjectCollection();
+ expect(function() {
+ CzmlDataSource.processCzml(undefined, dynamicObjectCollection);
+ }).toThrow();
+ });
+
+ it('processCzml throws if dynamicObjectCollection is undefined', function() {
+ expect(function() {
+ CzmlDataSource.processCzml(czml, undefined);
+ }).toThrow();
+ });
+
+ it('processCzml populates dynamicObjectCollection with expected data for an array of packets', function() {
+ var dynamicObjectCollection = new DynamicObjectCollection();
+ CzmlDataSource.processCzml(czmlArray, dynamicObjectCollection);
+
+ var testObject = dynamicObjectCollection.getObject('test');
+ expect(testObject).toBeDefined();
+ expect(testObject.billboard).toBeDefined();
+ expect(testObject.billboard.show).toBeDefined();
+ expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
+ expect(testObject.label).toBeDefined();
+ expect(testObject.label.show).toBeDefined();
+ expect(testObject.label.show.getValue(new JulianDate())).toEqual(false);
+ });
+
+ it('processCzml deletes an existing object.', function() {
+ var dynamicObjectCollection = new DynamicObjectCollection();
+ CzmlDataSource.processCzml(czml, dynamicObjectCollection);
+
+ var objects = dynamicObjectCollection.getObjects();
+ expect(objects.length).toEqual(1);
+
+ CzmlDataSource.processCzml(czmlDelete, dynamicObjectCollection);
+ expect(dynamicObjectCollection.getObjects().length).toEqual(0);
+ expect(dynamicObjectCollection.getObject('test')).toBeUndefined();
+ });
+
+ it('processCzml populates dynamicObjectCollection with expected data for a single packet', function() {
+ var dynamicObjectCollection = new DynamicObjectCollection();
+ CzmlDataSource.processCzml(czml, dynamicObjectCollection);
+
+ var testObject = dynamicObjectCollection.getObject('test');
+ expect(testObject).toBeDefined();
+ expect(testObject.billboard).toBeDefined();
+ expect(testObject.billboard.show).toBeDefined();
+ expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
+ expect(testObject.label).toBeDefined();
+ expect(testObject.label.show).toBeDefined();
+ expect(testObject.label.show.getValue(new JulianDate())).toEqual(false);
+ });
+
+ it('processCzml uses user-supplied updater functions', function() {
+ var dynamicObjectCollection = new DynamicObjectCollection();
+ CzmlDataSource.processCzml(czml, dynamicObjectCollection, undefined, [DynamicBillboard.processCzmlPacket]);
+
+ var testObject = dynamicObjectCollection.getObject('test');
+ expect(testObject).toBeDefined();
+ expect(testObject.billboard).toBeDefined();
+ expect(testObject.billboard.show).toBeDefined();
+ expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
+ expect(testObject.label).toBeUndefined();
+ });
+
+ it('processCzml raises dynamicObjectCollection event', function() {
+ var eventTriggered = false;
+ var dynamicObjectCollection = new DynamicObjectCollection();
+ dynamicObjectCollection.objectPropertiesChanged.addEventListener(function(dynamicObjectCollectionParam, updatedObjects) {
+ expect(dynamicObjectCollectionParam).toEqual(dynamicObjectCollection);
+ expect(updatedObjects.length).toEqual(1);
+ expect(updatedObjects[0]).toEqual(dynamicObjectCollection.getObject('test'));
+ expect(eventTriggered).toEqual(false);
+ eventTriggered = true;
+ });
+ CzmlDataSource.processCzml(czml, dynamicObjectCollection);
+ waitsFor(function() {
+ return eventTriggered;
+ });
+ });
+
+ it('processCzml creates a new object for packets with no id.', function() {
+ var dynamicObjectCollection = new DynamicObjectCollection();
+ CzmlDataSource.processCzml(czmlNoId, dynamicObjectCollection);
+
+ var objects = dynamicObjectCollection.getObjects();
+ expect(objects.length).toEqual(1);
+ var testObject = objects[0];
+ expect(testObject).toBeDefined();
+ expect(testObject.id).toBeDefined();
+ expect(testObject.billboard).toBeDefined();
+ expect(testObject.billboard.show).toBeDefined();
+ expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
+ });
});
diff --git a/Specs/DynamicScene/CzmlDirectionSpec.js b/Specs/DynamicScene/CzmlDirectionSpec.js
index f5a7b958adbd..481efad3209e 100644
--- a/Specs/DynamicScene/CzmlDirectionSpec.js
+++ b/Specs/DynamicScene/CzmlDirectionSpec.js
@@ -48,10 +48,6 @@ defineSuite(['DynamicScene/CzmlDirection',
expect(CzmlDirection.getValue(constantCartesianInterval.unitCartesian)).toEqual(cartesian1);
});
- it('getValueFromArray', function() {
- expect(CzmlDirection.getValueFromArray(sampledCartesianInterval.unitCartesian, 5)).toEqual(cartesian2);
- });
-
it('Spherical unwrapInterval', function() {
expect(CzmlDirection.unwrapInterval(constantSphericalInterval)).toEqual(constantCartesianInterval.unitCartesian);
expect(CzmlDirection.unwrapInterval(sampledSphericalInterval)).toEqual(sampledCartesianInterval.unitCartesian);
diff --git a/Specs/DynamicScene/CzmlNumberSpec.js b/Specs/DynamicScene/CzmlNumberSpec.js
index 5c143857c377..eb52aee5b60a 100644
--- a/Specs/DynamicScene/CzmlNumberSpec.js
+++ b/Specs/DynamicScene/CzmlNumberSpec.js
@@ -25,8 +25,4 @@ defineSuite([
it('getValue', function() {
expect(CzmlNumber.getValue(simpleNumber)).toEqual(simpleNumber);
});
-
- it('getValueFromArray', function() {
- expect(CzmlNumber.getValueFromArray(sampledNumberInterval.number, 2)).toEqual(sampledNumberInterval.number[2]);
- });
});
diff --git a/Specs/DynamicScene/CzmlPositionSpec.js b/Specs/DynamicScene/CzmlPositionSpec.js
index ddf35d7885bc..39460869a21d 100644
--- a/Specs/DynamicScene/CzmlPositionSpec.js
+++ b/Specs/DynamicScene/CzmlPositionSpec.js
@@ -57,10 +57,6 @@ defineSuite(['DynamicScene/CzmlPosition',
expect(CzmlPosition.getValue(constantCartesianInterval.cartesian)).toEqual(cartesian1);
});
- it('getValueFromArray', function() {
- expect(CzmlPosition.getValueFromArray(sampledCartesianInterval.cartesian, 5)).toEqual(cartesian2);
- });
-
it('Cartographic unwrapInterval', function() {
expect(CzmlPosition.unwrapInterval(constantCartographicInterval)).toEqual(constantCartesianInterval.cartesian);
expect(CzmlPosition.unwrapInterval(constantCartographicDegreesInterval)).toEqual(constantCartesianInterval.cartesian);
diff --git a/Specs/DynamicScene/CzmlUnitCartesian3Spec.js b/Specs/DynamicScene/CzmlUnitCartesian3Spec.js
index 871e2088ad38..d26b0a2d2462 100644
--- a/Specs/DynamicScene/CzmlUnitCartesian3Spec.js
+++ b/Specs/DynamicScene/CzmlUnitCartesian3Spec.js
@@ -34,8 +34,4 @@ defineSuite([
it('getValue', function() {
expect(CzmlUnitCartesian3.getValue(constantCartesianInterval.unitCartesian)).toEqual(cartesian1);
});
-
- it('getValueFromArray', function() {
- expect(CzmlUnitCartesian3.getValueFromArray(sampledCartesianInterval.unitCartesian, 5)).toEqualEpsilon(cartesian2, CesiumMath.EPSILON15);
- });
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CzmlUnitQuaternionSpec.js b/Specs/DynamicScene/CzmlUnitQuaternionSpec.js
index 3b0c82267a88..79faba761512 100644
--- a/Specs/DynamicScene/CzmlUnitQuaternionSpec.js
+++ b/Specs/DynamicScene/CzmlUnitQuaternionSpec.js
@@ -34,15 +34,4 @@ defineSuite([
it('getValue', function() {
expect(CzmlUnitQuaternion.getValue(constantQuaternionInterval.unitQuaternion)).toEqualEpsilon(quaternion1, CesiumMath.EPSILON15);
});
-
- it('getValueFromArray', function() {
- expect(CzmlUnitQuaternion.getValueFromArray(sampledQuaternionInterval.unitQuaternion, 6)).toEqualEpsilon(quaternion2, CesiumMath.EPSILON15);
- });
-
- it('packForInterpolation and getValueFromInterpolationResult', function() {
- var destination = [];
- var source = [quaternion1.x, quaternion1.y, quaternion1.z, quaternion1.w, quaternion2.x, quaternion2.y, quaternion2.z, quaternion2.w];
- CzmlUnitQuaternion.packForInterpolation(source, destination, 0, 1);
- expect(CzmlUnitQuaternion.getValueFromInterpolationResult(destination, undefined, source, 0, 1)).toEqualEpsilon(quaternion1, CesiumMath.EPSILON15);
- });
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js b/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js
index 9ea08b7a7fd6..7d97963f7a1d 100644
--- a/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js
+++ b/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js
@@ -2,7 +2,7 @@
defineSuite([
'DynamicScene/DynamicVertexPositionsProperty',
'DynamicScene/DynamicObjectCollection',
- 'DynamicScene/processCzml',
+ 'DynamicScene/CzmlDataSource',
'Core/Cartographic',
'Core/JulianDate',
'Core/Math',
@@ -10,7 +10,7 @@ defineSuite([
], function(
DynamicVertexPositionsProperty,
DynamicObjectCollection,
- processCzml,
+ CzmlDataSource,
Cartographic,
JulianDate,
CesiumMath,
@@ -126,7 +126,7 @@ defineSuite([
it('getValue works for reference data', function() {
var objects = new DynamicObjectCollection();
- processCzml(testObjects, objects);
+ CzmlDataSource.processCzml(testObjects, objects);
var test1 = objects.getObject('test1');
var test2 = objects.getObject('test2');
var test3 = objects.getObject('test3');
diff --git a/Specs/DynamicScene/processCzmlSpec.js b/Specs/DynamicScene/processCzmlSpec.js
deleted file mode 100644
index 30bbb8fac0c4..000000000000
--- a/Specs/DynamicScene/processCzmlSpec.js
+++ /dev/null
@@ -1,143 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/processCzml',
- 'DynamicScene/DynamicObjectCollection',
- 'DynamicScene/DynamicBillboard',
- 'Core/JulianDate'
- ], function(
- processCzml,
- DynamicObjectCollection,
- DynamicBillboard,
- JulianDate) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var czml = {
- 'id' : 'test',
- 'billboard' : {
- 'show' : true
- },
- 'label' : {
- 'show' : false
- }
- };
-
- var czmlDelete = {
- 'id' : 'test',
- 'delete': true
- };
-
- var czmlArray = [{
- 'id' : 'test',
- 'billboard' : {
- 'show' : true
- }
- }, {
- 'id' : 'test',
- 'label' : {
- 'show' : false
- }
- }];
-
- var czmlNoId = {
- 'billboard' : {
- 'show' : true
- }
- };
-
- it('processCzml throws if czml is undefined', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- expect(function() {
- processCzml(undefined, dynamicObjectCollection);
- }).toThrow();
- });
-
- it('processCzml throws if dynamicObjectCollection is undefined', function() {
- expect(function() {
- processCzml(czml, undefined);
- }).toThrow();
- });
-
- it('processCzml populates dynamicObjectCollection with expected data for an array of packets', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- processCzml(czmlArray, dynamicObjectCollection);
-
- var testObject = dynamicObjectCollection.getObject('test');
- expect(testObject).toBeDefined();
- expect(testObject.billboard).toBeDefined();
- expect(testObject.billboard.show).toBeDefined();
- expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
- expect(testObject.label).toBeDefined();
- expect(testObject.label.show).toBeDefined();
- expect(testObject.label.show.getValue(new JulianDate())).toEqual(false);
- });
-
- it('processCzml deletes an existing object.', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- processCzml(czml, dynamicObjectCollection);
-
- var objects = dynamicObjectCollection.getObjects();
- expect(objects.length).toEqual(1);
-
- processCzml(czmlDelete, dynamicObjectCollection);
- expect(dynamicObjectCollection.getObjects().length).toEqual(0);
- expect(dynamicObjectCollection.getObject('test')).toBeUndefined();
- });
-
- it('processCzml populates dynamicObjectCollection with expected data for a single packet', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- processCzml(czml, dynamicObjectCollection);
-
- var testObject = dynamicObjectCollection.getObject('test');
- expect(testObject).toBeDefined();
- expect(testObject.billboard).toBeDefined();
- expect(testObject.billboard.show).toBeDefined();
- expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
- expect(testObject.label).toBeDefined();
- expect(testObject.label.show).toBeDefined();
- expect(testObject.label.show.getValue(new JulianDate())).toEqual(false);
- });
-
- it('processCzml uses user-supplied updater functions', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- processCzml(czml, dynamicObjectCollection, undefined, [DynamicBillboard.processCzmlPacket]);
-
- var testObject = dynamicObjectCollection.getObject('test');
- expect(testObject).toBeDefined();
- expect(testObject.billboard).toBeDefined();
- expect(testObject.billboard.show).toBeDefined();
- expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
- expect(testObject.label).toBeUndefined();
- });
-
- it('processCzml raises dynamicObjectCollection event', function() {
- var eventTriggered = false;
- var dynamicObjectCollection = new DynamicObjectCollection();
- dynamicObjectCollection.objectPropertiesChanged.addEventListener(function(dynamicObjectCollectionParam, updatedObjects) {
- expect(dynamicObjectCollectionParam).toEqual(dynamicObjectCollection);
- expect(updatedObjects.length).toEqual(1);
- expect(updatedObjects[0]).toEqual(dynamicObjectCollection.getObject('test'));
- expect(eventTriggered).toEqual(false);
- eventTriggered = true;
- });
- processCzml(czml, dynamicObjectCollection);
- waitsFor(function() {
- return eventTriggered;
- });
- });
-
- it('processCzml creates a new object for packets with no id.', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- processCzml(czmlNoId, dynamicObjectCollection);
-
- var objects = dynamicObjectCollection.getObjects();
- expect(objects.length).toEqual(1);
- var testObject = objects[0];
- expect(testObject).toBeDefined();
- expect(testObject.id).toBeDefined();
- expect(testObject.billboard).toBeDefined();
- expect(testObject.billboard.show).toBeDefined();
- expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
- });
-
-});
\ No newline at end of file
From cedc72a42f42a0eb62c32ba6ddbf14acd41dae01 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 14 Aug 2013 14:23:22 -0400
Subject: [PATCH 16/65] Get rid of all CzmlXXXX types.
Instead, use a mix of native JavaScript and Core types.
---
Source/DynamicScene/CzmlBoolean.js | 60 ---
Source/DynamicScene/CzmlCartesian2.js | 56 ---
Source/DynamicScene/CzmlCartesian3.js | 58 ---
Source/DynamicScene/CzmlColor.js | 85 ----
Source/DynamicScene/CzmlDirection.js | 95 ----
Source/DynamicScene/CzmlHorizontalOrigin.js | 45 --
Source/DynamicScene/CzmlImage.js | 54 ---
Source/DynamicScene/CzmlLabelStyle.js | 45 --
Source/DynamicScene/CzmlNumber.js | 51 ---
Source/DynamicScene/CzmlPosition.js | 126 ------
Source/DynamicScene/CzmlString.js | 44 --
Source/DynamicScene/CzmlUnitCartesian3.js | 59 ---
Source/DynamicScene/CzmlUnitQuaternion.js | 60 ---
Source/DynamicScene/CzmlVerticalOrigin.js | 45 --
Source/DynamicScene/DynamicBillboard.js | 66 ++-
Source/DynamicScene/DynamicColorMaterial.js | 8 +-
Source/DynamicScene/DynamicCone.js | 44 +-
Source/DynamicScene/DynamicEllipse.js | 14 +-
Source/DynamicScene/DynamicEllipsoid.js | 14 +-
Source/DynamicScene/DynamicGridMaterial.js | 30 +-
Source/DynamicScene/DynamicImageMaterial.js | 16 +-
Source/DynamicScene/DynamicLabel.js | 78 ++--
Source/DynamicScene/DynamicObject.js | 14 +-
Source/DynamicScene/DynamicPath.js | 40 +-
Source/DynamicScene/DynamicPoint.js | 28 +-
Source/DynamicScene/DynamicPolygon.js | 6 +-
Source/DynamicScene/DynamicPolyline.js | 28 +-
Source/DynamicScene/DynamicPyramid.js | 28 +-
Source/DynamicScene/DynamicVector.js | 32 +-
Source/DynamicScene/processPacketData.js | 221 +++++++++-
Specs/DynamicScene/CzmlBooleanSpec.js | 28 --
Specs/DynamicScene/CzmlCartesian2Spec.js | 35 --
Specs/DynamicScene/CzmlCartesian3Spec.js | 35 --
Specs/DynamicScene/CzmlColorSpec.js | 44 --
Specs/DynamicScene/CzmlDataSourceSpec.js | 404 ------------------
Specs/DynamicScene/CzmlDirectionSpec.js | 60 ---
.../DynamicScene/CzmlHorizontalOriginSpec.js | 30 --
Specs/DynamicScene/CzmlImageSpec.js | 60 ---
Specs/DynamicScene/CzmlLabelStyleSpec.js | 30 --
Specs/DynamicScene/CzmlNumberSpec.js | 28 --
Specs/DynamicScene/CzmlPositionSpec.js | 71 ---
Specs/DynamicScene/CzmlStringSpec.js | 28 --
Specs/DynamicScene/CzmlUnitCartesian3Spec.js | 37 --
Specs/DynamicScene/CzmlUnitQuaternionSpec.js | 37 --
Specs/DynamicScene/CzmlVerticalOriginSpec.js | 30 --
45 files changed, 409 insertions(+), 2098 deletions(-)
delete mode 100644 Source/DynamicScene/CzmlBoolean.js
delete mode 100644 Source/DynamicScene/CzmlCartesian2.js
delete mode 100644 Source/DynamicScene/CzmlCartesian3.js
delete mode 100644 Source/DynamicScene/CzmlColor.js
delete mode 100644 Source/DynamicScene/CzmlDirection.js
delete mode 100644 Source/DynamicScene/CzmlHorizontalOrigin.js
delete mode 100644 Source/DynamicScene/CzmlImage.js
delete mode 100644 Source/DynamicScene/CzmlLabelStyle.js
delete mode 100644 Source/DynamicScene/CzmlNumber.js
delete mode 100644 Source/DynamicScene/CzmlPosition.js
delete mode 100644 Source/DynamicScene/CzmlString.js
delete mode 100644 Source/DynamicScene/CzmlUnitCartesian3.js
delete mode 100644 Source/DynamicScene/CzmlUnitQuaternion.js
delete mode 100644 Source/DynamicScene/CzmlVerticalOrigin.js
delete mode 100644 Specs/DynamicScene/CzmlBooleanSpec.js
delete mode 100644 Specs/DynamicScene/CzmlCartesian2Spec.js
delete mode 100644 Specs/DynamicScene/CzmlCartesian3Spec.js
delete mode 100644 Specs/DynamicScene/CzmlColorSpec.js
delete mode 100644 Specs/DynamicScene/CzmlDataSourceSpec.js
delete mode 100644 Specs/DynamicScene/CzmlDirectionSpec.js
delete mode 100644 Specs/DynamicScene/CzmlHorizontalOriginSpec.js
delete mode 100644 Specs/DynamicScene/CzmlImageSpec.js
delete mode 100644 Specs/DynamicScene/CzmlLabelStyleSpec.js
delete mode 100644 Specs/DynamicScene/CzmlNumberSpec.js
delete mode 100644 Specs/DynamicScene/CzmlPositionSpec.js
delete mode 100644 Specs/DynamicScene/CzmlStringSpec.js
delete mode 100644 Specs/DynamicScene/CzmlUnitCartesian3Spec.js
delete mode 100644 Specs/DynamicScene/CzmlUnitQuaternionSpec.js
delete mode 100644 Specs/DynamicScene/CzmlVerticalOriginSpec.js
diff --git a/Source/DynamicScene/CzmlBoolean.js b/Source/DynamicScene/CzmlBoolean.js
deleted file mode 100644
index f9a06fcc853d..000000000000
--- a/Source/DynamicScene/CzmlBoolean.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*global define*/
-define([
- '../Core/defaultValue'
- ], function(
- defaultValue) {
- "use strict";
-
- /**
- * Provides methods for working with a boolean defined in CZML.
- *
- * @exports CzmlBoolean
- *
- * @see DynamicProperty
- * @see CzmlCartesian2
- * @see CzmlCartesian3
- * @see CzmlPosition
- * @see CzmlColor
- * @see CzmlHorizontalOrigin
- * @see CzmlLabelStyle
- * @see CzmlNumber
- * @see CzmlString
- * @see CzmlUnitCartesian3
- * @see CzmlUnitQuaternion
- * @see CzmlUnitSpherical
- * @see CzmlVerticalOrigin
- */
- var CzmlBoolean = {
- /**
- * Returns the packed boolean representation contained within the provided CZML interval
- * or undefined if the interval does not contain boolean data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- /*jshint sub:true*/
- // boolean is a JS reserved word
- return defaultValue(czmlInterval['boolean'], czmlInterval);
- },
-
- /**
- * Since CZML booleans can not be sampled, this method always returns false.
- */
- isSampled : function() {
- return false;
- },
-
- /**
- * Returns the boolean value contained within the unwrappedInterval. For booleans
- * this is the unwrappedInterval itself.
- *
- * @param {Object} unwrappedInterval The result of CzmlBoolean.unwrapInterval.
- * @returns The boolean value.
- */
- getValue : function(unwrappedInterval) {
- return unwrappedInterval;
- }
- };
-
- return CzmlBoolean;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlCartesian2.js b/Source/DynamicScene/CzmlCartesian2.js
deleted file mode 100644
index e115a145c6d0..000000000000
--- a/Source/DynamicScene/CzmlCartesian2.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*global define*/
-define([
- '../Core/Cartesian2',
- '../Core/defined'
- ], function(
- Cartesian2,
- defined) {
- "use strict";
-
- /**
- * Provides methods for working with a Cartesian2 defined in CZML.
- *
- * @exports CzmlCartesian2
- */
- var CzmlCartesian2 = {
- type : Cartesian2,
-
- /**
- * Returns the packed Cartesian2 representation contained within the provided CZML interval
- * or undefined if the interval does not contain Cartesian2 data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- return czmlInterval.cartesian2;
- },
-
- /**
- * Returns true if this interval represents data that should be interpolated by the client
- * or false if it's a single value.
- *
- * @param {Object} unwrappedInterval The result of CzmlCartesian2.unwrapInterval.
- */
- isSampled : function(unwrappedInterval) {
- return unwrappedInterval.length > 2;
- },
-
- /**
- * Given a non-sampled unwrapped interval, returns a Cartesian2 instance of the data.
- *
- * @param {Object} unwrappedInterval The result of CzmlCartesian2.unwrapInterval.
- * @param {Cartesian2} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Cartesian2 instance if result was not defined.
- */
- getValue : function(unwrappedInterval, result) {
- if (!defined(result)) {
- result = new Cartesian2();
- }
- result.x = unwrappedInterval[0];
- result.y = unwrappedInterval[1];
- return result;
- }
- };
-
- return CzmlCartesian2;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlCartesian3.js b/Source/DynamicScene/CzmlCartesian3.js
deleted file mode 100644
index f5af5a9eb5ad..000000000000
--- a/Source/DynamicScene/CzmlCartesian3.js
+++ /dev/null
@@ -1,58 +0,0 @@
-/*global define*/
-define([
- '../Core/Cartesian3',
- '../Core/defined'
- ], function(
- Cartesian3,
- defined) {
- "use strict";
-
- var length = 3;
-
- /**
- * Provides methods for working with a Cartesian3 defined in CZML.
- *
- * @exports CzmlCartesian3
- */
- var CzmlCartesian3 = {
- type : Cartesian3,
- /**
- * Returns the packed Cartesian3 representation contained within the provided CZML interval
- * or undefined if the interval does not contain Cartesian3 data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- return czmlInterval.cartesian;
- },
-
- /**
- * Returns true if this interval represents data that should be interpolated by the client
- * or false if it's a single value.
- *
- * @param {Object} unwrappedInterval The result of CzmlCartesian3.unwrapInterval.
- */
- isSampled : function(unwrappedInterval) {
- return unwrappedInterval.length > length;
- },
-
- /**
- * Given a non-sampled unwrapped interval, returns a Cartesian3 instance of the data.
- *
- * @param {Object} unwrappedInterval The result of CzmlCartesian3.unwrapInterval.
- * @param {Cartesian3} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Cartesian3 instance if result was not defined.
- */
- getValue : function(unwrappedInterval, result) {
- if (!defined(result)) {
- result = new Cartesian3();
- }
- result.x = unwrappedInterval[0];
- result.y = unwrappedInterval[1];
- result.z = unwrappedInterval[2];
- return result;
- }
- };
-
- return CzmlCartesian3;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlColor.js b/Source/DynamicScene/CzmlColor.js
deleted file mode 100644
index f39304688404..000000000000
--- a/Source/DynamicScene/CzmlColor.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/*global define*/
-define([
- '../Core/Color',
- '../Core/defined'
- ], function(
- Color,
- defined) {
- "use strict";
-
- var length = 4;
-
- /**
- * Provides methods for working with a Color defined in CZML.
- *
- * @exports CzmlColor
- */
- var CzmlColor = {
- type : Color,
-
- /**
- * Returns the packed Color representation contained within the provided CZML interval
- * or undefined if the interval does not contain Color data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- var rgbaf = czmlInterval.rgbaf;
- if (defined(rgbaf)) {
- return rgbaf;
- }
-
- var rgba = czmlInterval.rgba;
- if (!defined(rgba)) {
- return undefined;
- }
-
- if (!this.isSampled(rgba)) {
- return [Color.byteToFloat(rgba[0]),
- Color.byteToFloat(rgba[1]),
- Color.byteToFloat(rgba[2]),
- Color.byteToFloat(rgba[3])];
- }
-
- var len = rgba.length;
- rgbaf = new Array(len);
- for ( var i = 0; i < len; i += 5) {
- rgbaf[i] = rgba[i];
- rgbaf[i + 1] = Color.byteToFloat(rgba[i + 1]);
- rgbaf[i + 2] = Color.byteToFloat(rgba[i + 2]);
- rgbaf[i + 3] = Color.byteToFloat(rgba[i + 3]);
- rgbaf[i + 4] = Color.byteToFloat(rgba[i + 4]);
- }
- return rgbaf;
- },
-
- /**
- * Returns true if this interval represents data that should be interpolated by the client
- * or false if it's a single value.
- *
- * @param {Object} unwrappedInterval The result of CzmlColor.unwrapInterval.
- */
- isSampled : function(unwrappedInterval) {
- return unwrappedInterval.length > length;
- },
-
- /**
- * Given a non-sampled unwrapped interval, returns a Color instance of the data.
- *
- * @param {Object} unwrappedInterval The result of CzmlColor.unwrapInterval.
- * @param {Color} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Color instance if result was not defined.
- */
- getValue : function(unwrappedInterval, result) {
- if (!defined(result)) {
- result = new Color();
- }
- result.red = unwrappedInterval[0];
- result.green = unwrappedInterval[1];
- result.blue = unwrappedInterval[2];
- result.alpha = unwrappedInterval[3];
- return result;
- }
- };
- return CzmlColor;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlDirection.js b/Source/DynamicScene/CzmlDirection.js
deleted file mode 100644
index bec55c7a3a0a..000000000000
--- a/Source/DynamicScene/CzmlDirection.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/*global define*/
-define([
- '../Core/Cartesian3',
- '../Core/defined',
- '../Core/Spherical',
- '../Core/Math',
- '../Core/Ellipsoid'
- ], function(
- Cartesian3,
- defined,
- Spherical,
- CesiumMath,
- Ellipsoid) {
- "use strict";
-
- var scratchCartesian = new Cartesian3();
- var scratchSpherical = new Spherical();
-
- /**
- * Provides methods for working with a direction defined in CZML.
- *
- * @exports CzmlDirection
- */
- var CzmlDirection = {
- type : Cartesian3,
-
- /**
- * Returns the packed Cartesian3 representation contained within the provided CZML interval
- * or undefined if the interval does not contain Cartesian3 data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- var unitCartesian = czmlInterval.unitCartesian;
- if (defined(unitCartesian)) {
- return unitCartesian;
- }
-
- var unitSpherical = czmlInterval.unitSpherical;
- if (defined(unitSpherical)) {
- var len = unitSpherical.length;
- if (len === 2) {
- scratchSpherical.clock = unitSpherical[0];
- scratchSpherical.cone = unitSpherical[1];
- Cartesian3.fromSpherical(scratchSpherical, scratchCartesian);
- unitCartesian = [scratchCartesian.x, scratchCartesian.y, scratchCartesian.z];
- } else {
- var sphericalIt = 0;
- unitCartesian = new Array((len / 3) * 4);
- for ( var i = 0; i < len; i += 4) {
- unitCartesian[i] = unitSpherical[sphericalIt++];
-
- scratchSpherical.clock = unitSpherical[sphericalIt++];
- scratchSpherical.cone = unitSpherical[sphericalIt++];
- Cartesian3.fromSpherical(scratchSpherical, scratchCartesian);
-
- unitCartesian[i + 1] = scratchCartesian.x;
- unitCartesian[i + 2] = scratchCartesian.y;
- unitCartesian[i + 3] = scratchCartesian.z;
- }
- }
- }
- return unitCartesian;
- },
-
- /**
- * Returns true if this interval represents data that should be interpolated by the client
- * or false if it's a single value.
- *
- * @param {Object} unwrappedInterval The result of CzmlDirection.unwrapInterval.
- */
- isSampled : function(unwrappedInterval) {
- return unwrappedInterval.length > 3;
- },
-
- /**
- * Given a non-sampled unwrapped interval, returns a Cartesian3 instance of the data.
- *
- * @param {Object} unwrappedInterval The result of CzmlDirection.unwrapInterval.
- * @param {Cartesian3} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Cartesian3 instance if result was not defined.
- */
- getValue : function(unwrappedInterval, result) {
- if (!defined(result)) {
- result = new Cartesian3();
- }
- result.x = unwrappedInterval[0];
- result.y = unwrappedInterval[1];
- result.z = unwrappedInterval[2];
- return result;
- }
- };
-
- return CzmlDirection;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlHorizontalOrigin.js b/Source/DynamicScene/CzmlHorizontalOrigin.js
deleted file mode 100644
index 3893089bce67..000000000000
--- a/Source/DynamicScene/CzmlHorizontalOrigin.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*global define*/
-define([
- '../Core/defaultValue',
- '../Scene/HorizontalOrigin'
- ], function(
- defaultValue,
- HorizontalOrigin) {
- "use strict";
-
- /**
- * Provides methods for working with a horizontal origin defined in CZML.
- *
- * @exports CzmlHorizontalOrigin
- */
- var CzmlHorizontalOrigin = {
- /**
- * Returns the packed enum representation contained within the provided CZML interval
- * or undefined if the interval does not contain enum data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- return defaultValue(czmlInterval.horizontalOrigin, czmlInterval);
- },
-
- /**
- * Since enums can not be sampled, this method always returns false.
- */
- isSampled : function() {
- return false;
- },
-
- /**
- * Returns the HorizontalOrigin contained within the unwrappedInterval.
- *
- * @param {Object} unwrappedInterval The result of CzmlHorizontalOrigin.unwrapInterval.
- * @returns The HorizontalOrigin value.
- */
- getValue : function(unwrappedInterval) {
- return HorizontalOrigin[unwrappedInterval];
- }
- };
-
- return CzmlHorizontalOrigin;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlImage.js b/Source/DynamicScene/CzmlImage.js
deleted file mode 100644
index 406c324105f4..000000000000
--- a/Source/DynamicScene/CzmlImage.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/*global define*/
-define([
- '../Core/defaultValue',
- '../Core/defined',
- '../ThirdParty/Uri'
- ], function(
- defaultValue,
- defined,
- Uri) {
- "use strict";
-
- /**
- * Provides methods for working with a image defined in CZML.
- *
- * @exports CzmlImage
- */
- var CzmlImage = {
- /**
- * Returns the packed image representation contained within the provided CZML interval
- * or undefined if the interval does not contain image data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval, sourceUri) {
- var result = defaultValue(czmlInterval.image, czmlInterval);
- if (defined(sourceUri)) {
- var baseUri = new Uri(document.location.href);
- sourceUri = new Uri(sourceUri);
- result = new Uri(result).resolve(sourceUri.resolve(baseUri)).toString();
- }
- return result;
- },
-
- /**
- * Since CZML images can not be sampled, this method always returns false.
- */
- isSampled : function() {
- return false;
- },
-
- /**
- * Returns the image value contained within the unwrappedInterval. For images
- * this is the unwrappedInterval itself.
- *
- * @param {Object} unwrappedInterval The result of CzmlImage.unwrapInterval.
- * @returns The image value.
- */
- getValue : function(unwrappedInterval) {
- return unwrappedInterval;
- }
- };
-
- return CzmlImage;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlLabelStyle.js b/Source/DynamicScene/CzmlLabelStyle.js
deleted file mode 100644
index 85dfa4643ab9..000000000000
--- a/Source/DynamicScene/CzmlLabelStyle.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*global define*/
-define([
- '../Core/defaultValue',
- '../Scene/LabelStyle'
- ], function(
- defaultValue,
- LabelStyle) {
- "use strict";
-
- /**
- * Provides methods for working with a label style defined in CZML.
- *
- * @exports CzmlLabelStyle
- */
- var CzmlLabelStyle = {
- /**
- * Returns the packed enum representation contained within the provided CZML interval
- * or undefined if the interval does not contain enum data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- return defaultValue(czmlInterval.labelStyle, czmlInterval);
- },
-
- /**
- * Since enums can not be sampled, this method always returns false.
- */
- isSampled : function() {
- return false;
- },
-
- /**
- * Returns the LabelStyle contained within the unwrappedInterval.
- *
- * @param {Object} unwrappedInterval The result of CzmlLabelStyle.unwrapInterval.
- * @returns The LabelStyle value.
- */
- getValue : function(unwrappedInterval) {
- return LabelStyle[unwrappedInterval];
- }
- };
-
- return CzmlLabelStyle;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlNumber.js b/Source/DynamicScene/CzmlNumber.js
deleted file mode 100644
index da0334bbd1e8..000000000000
--- a/Source/DynamicScene/CzmlNumber.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/*global define*/
-define([
- '../Core/defaultValue',
- '../Core/InterpolatableNumber'
- ], function(
- defaultValue,
- InterpolatableNumber) {
- "use strict";
-
- /**
- * Provides methods for working with a number defined in CZML.
- *
- * @exports CzmlNumber
- */
- var CzmlNumber = {
- type : InterpolatableNumber,
-
- /**
- * Returns the packed numerical representation contained within the provided CZML interval
- * or undefined if the interval does not contain numerical data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- return defaultValue(czmlInterval.number, czmlInterval);
- },
-
- /**
- * Returns true if this interval represents data that should be interpolated by the client
- * or false if it's a single value.
- *
- * @param {Object} unwrappedInterval The result of CzmlNumber.unwrapInterval.
- */
- isSampled : function(unwrappedInterval) {
- return Array.isArray(unwrappedInterval);
- },
-
- /**
- * Returns the numerical value contained within the unwrappedInterval. For numbers
- * this is the unwrappedInterval itself.
- *
- * @param {Object} unwrappedInterval The result of CzmlNumber.unwrapInterval.
- * @returns The boolean value.
- */
- getValue : function(unwrappedInterval) {
- return unwrappedInterval;
- }
- };
-
- return CzmlNumber;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlPosition.js b/Source/DynamicScene/CzmlPosition.js
deleted file mode 100644
index 46449be2b122..000000000000
--- a/Source/DynamicScene/CzmlPosition.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/*global define*/
-define([
- '../Core/Cartesian3',
- '../Core/Cartographic',
- '../Core/defined',
- '../Core/Math',
- '../Core/Ellipsoid'
- ], function(
- Cartesian3,
- Cartographic,
- defined,
- CesiumMath,
- Ellipsoid) {
- "use strict";
-
- var length = 3;
- var scratchCartesian = new Cartesian3();
- var scratchCartographic = new Cartographic();
-
- /**
- * Provides methods for working with a position defined in CZML.
- *
- * @exports CzmlPosition
- */
- var CzmlPosition = {
- type : Cartesian3,
-
- /**
- * Returns the packed Cartesian3 representation contained within the provided CZML interval
- * or undefined if the interval does not contain Cartesian3 data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- var cartesian = czmlInterval.cartesian;
- if (defined(cartesian)) {
- return cartesian;
- }
-
- var i;
- var len;
- var tmp = scratchCartesian;
- var cartographic = czmlInterval.cartographicRadians;
- if (defined(cartographic)) {
- if (!this.isSampled(cartographic)) {
- scratchCartographic.longitude = cartographic[0];
- scratchCartographic.latitude = cartographic[1];
- scratchCartographic.height = cartographic[2];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
- cartesian = [tmp.x, tmp.y, tmp.z];
- } else {
- len = cartographic.length;
- cartesian = new Array(len);
- for (i = 0; i < len; i += 4) {
- scratchCartographic.longitude = cartographic[i + 1];
- scratchCartographic.latitude = cartographic[i + 2];
- scratchCartographic.height = cartographic[i + 3];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
-
- cartesian[i] = cartographic[i];
- cartesian[i + 1] = tmp.x;
- cartesian[i + 2] = tmp.y;
- cartesian[i + 3] = tmp.z;
- }
- }
- } else {
- var cartographicDegrees = czmlInterval.cartographicDegrees;
- if (!defined(cartographicDegrees)) {
- return undefined;
- }
-
- if (!this.isSampled(cartographicDegrees)) {
- scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[0]);
- scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[1]);
- scratchCartographic.height = cartographicDegrees[2];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
- cartesian = [tmp.x, tmp.y, tmp.z];
- } else {
- len = cartographicDegrees.length;
- cartesian = new Array(len);
- for (i = 0; i < len; i += 4) {
- scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[i + 1]);
- scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[i + 2]);
- scratchCartographic.height = cartographicDegrees[i + 3];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
-
- cartesian[i] = cartographicDegrees[i];
- cartesian[i + 1] = tmp.x;
- cartesian[i + 2] = tmp.y;
- cartesian[i + 3] = tmp.z;
- }
- }
- }
- return cartesian;
- },
-
- /**
- * Returns true if this interval represents data that should be interpolated by the client
- * or false if it's a single value.
- *
- * @param {Object} unwrappedInterval The result of CzmlPosition.unwrapInterval.
- */
- isSampled : function(unwrappedInterval) {
- return unwrappedInterval.length > length;
- },
-
- /**
- * Given a non-sampled unwrapped interval, returns a Cartesian3 instance of the data.
- *
- * @param {Object} unwrappedInterval The result of CzmlPosition.unwrapInterval.
- * @param {Cartesian3} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Cartesian3 instance if result was not defined.
- */
- getValue : function(unwrappedInterval, result) {
- if (!defined(result)) {
- result = new Cartesian3();
- }
- result.x = unwrappedInterval[0];
- result.y = unwrappedInterval[1];
- result.z = unwrappedInterval[2];
- return result;
- }
- };
-
- return CzmlPosition;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlString.js b/Source/DynamicScene/CzmlString.js
deleted file mode 100644
index f723a3f35265..000000000000
--- a/Source/DynamicScene/CzmlString.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*global define*/
-define([
- '../Core/defaultValue'
- ], function(
- defaultValue) {
- "use strict";
-
- /**
- * Provides methods for working with a string defined in CZML.
- *
- * @exports CzmlString
- */
- var CzmlString = {
- /**
- * Returns the packed string representation contained within the provided CZML interval
- * or undefined if the interval does not contain string data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- return defaultValue(czmlInterval.string, czmlInterval);
- },
-
- /**
- * Since CZML strings can not be sampled, this method always returns false.
- */
- isSampled : function() {
- return false;
- },
-
- /**
- * Returns the string value contained within the unwrappedInterval. For strings
- * this is the unwrappedInterval itself.
- *
- * @param {Object} unwrappedInterval The result of CzmlString.unwrapInterval.
- * @returns The string value.
- */
- getValue : function(unwrappedInterval) {
- return unwrappedInterval;
- }
- };
-
- return CzmlString;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlUnitCartesian3.js b/Source/DynamicScene/CzmlUnitCartesian3.js
deleted file mode 100644
index eb2dd355dfee..000000000000
--- a/Source/DynamicScene/CzmlUnitCartesian3.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*global define*/
-define([
- '../Core/Cartesian3',
- '../Core/defined'
- ], function(
- Cartesian3,
- defined) {
- "use strict";
-
- var length = 3;
-
- /**
- * Provides methods for working with a unit Cartesian3 defined in CZML.
- *
- * @exports CzmlUnitCartesian3
- */
- var CzmlUnitCartesian3 = {
- type : Cartesian3,
-
- /**
- * Returns the packed Cartesian3 representation contained within the provided CZML interval
- * or undefined if the interval does not contain Cartesian3 data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- return czmlInterval.unitCartesian;
- },
-
- /**
- * Returns true if this interval represents data that should be interpolated by the client
- * or false if it's a single value.
- *
- * @param {Object} unwrappedInterval The result of CzmlUnitCartesian3.unwrapInterval.
- */
- isSampled : function(unwrappedInterval) {
- return unwrappedInterval.length > length;
- },
-
- /**
- * Given a non-sampled unwrapped interval, returns a Cartesian3 instance of the data.
- *
- * @param {Object} unwrappedInterval The result of CzmlUnitCartesian3.unwrapInterval.
- * @param {Cartesian3} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Cartesian3 instance if result was not defined.
- */
- getValue : function(unwrappedInterval, result) {
- if (!defined(result)) {
- result = new Cartesian3();
- }
- result.x = unwrappedInterval[0];
- result.y = unwrappedInterval[1];
- result.z = unwrappedInterval[2];
- return result.normalize(result);
- }
- };
-
- return CzmlUnitCartesian3;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlUnitQuaternion.js b/Source/DynamicScene/CzmlUnitQuaternion.js
deleted file mode 100644
index 8b47960ce874..000000000000
--- a/Source/DynamicScene/CzmlUnitQuaternion.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*global define*/
-define([
- '../Core/Quaternion',
- '../Core/defined'
- ], function(
- Quaternion,
- defined) {
- "use strict";
-
- var doublesPerQuaternion = 4;
-
- /**
- * Provides methods for working with a unit Quaternion defined in CZML.
- *
- * @exports CzmlUnitQuaternion
- */
- var CzmlUnitQuaternion = {
- type : Quaternion,
-
- /**
- * Returns the packed Quaternion representation contained within the provided CZML interval
- * or undefined if the interval does not contain Quaternion data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- return czmlInterval.unitQuaternion;
- },
-
- /**
- * Returns true if this interval represents data that should be interpolated by the client
- * or false if it's a single value.
- *
- * @param {Object} unwrappedInterval The result of CzmlUnitQuaternion.unwrapInterval.
- */
- isSampled : function(unwrappedInterval) {
- return unwrappedInterval.length > doublesPerQuaternion;
- },
-
- /**
- * Given a non-sampled unwrapped interval, returns a Quaternion instance of the data.
- *
- * @param {Object} unwrappedInterval The result of CzmlUnitQuaternion.unwrapInterval.
- * @param {Cartesian3} result The object to store the result in, if undefined a new instance will be created.
- * @returns The modified result parameter or a new Quaternion instance if result was not defined.
- */
- getValue : function(unwrappedInterval, result) {
- if (!defined(result)) {
- result = new Quaternion();
- }
- result.x = unwrappedInterval[0];
- result.y = unwrappedInterval[1];
- result.z = unwrappedInterval[2];
- result.w = unwrappedInterval[3];
- return result.normalize(result);
- }
- };
-
- return CzmlUnitQuaternion;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlVerticalOrigin.js b/Source/DynamicScene/CzmlVerticalOrigin.js
deleted file mode 100644
index 152665e4a7e0..000000000000
--- a/Source/DynamicScene/CzmlVerticalOrigin.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*global define*/
-define([
- '../Core/defaultValue',
- '../Scene/VerticalOrigin'
- ], function(
- defaultValue,
- VerticalOrigin) {
- "use strict";
-
- /**
- * Provides methods for working with a vertical origin defined in CZML.
- *
- * @exports CzmlVerticalOrigin
- */
- var CzmlVerticalOrigin = {
- /**
- * Returns the packed enum representation contained within the provided CZML interval
- * or undefined if the interval does not contain enum data.
- *
- * @param {Object} czmlInterval The CZML interval to unwrap.
- */
- unwrapInterval : function(czmlInterval) {
- return defaultValue(czmlInterval.verticalOrigin, czmlInterval);
- },
-
- /**
- * Since enums can not be sampled, this method always returns false.
- */
- isSampled : function() {
- return false;
- },
-
- /**
- * Returns the VerticalOrigin contained within the unwrappedInterval.
- *
- * @param {Object} unwrappedInterval The result of CzmlVerticalOrigin.unwrapInterval.
- * @returns The VerticalOrigin value.
- */
- getValue : function(unwrappedInterval) {
- return VerticalOrigin[unwrappedInterval];
- }
- };
-
- return CzmlVerticalOrigin;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/DynamicBillboard.js b/Source/DynamicScene/DynamicBillboard.js
index e10a802bce20..abc9f0da6091 100644
--- a/Source/DynamicScene/DynamicBillboard.js
+++ b/Source/DynamicScene/DynamicBillboard.js
@@ -3,27 +3,21 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- './CzmlBoolean',
- './CzmlCartesian2',
- './CzmlCartesian3',
- './CzmlNumber',
- './CzmlImage',
- './CzmlHorizontalOrigin',
- './CzmlVerticalOrigin',
- './CzmlColor',
+ '../Core/Cartesian2',
+ '../Core/Cartesian3',
+ '../Scene/HorizontalOrigin',
+ '../Scene/VerticalOrigin',
+ '../Core/Color',
'./processPacketData'
], function(
TimeInterval,
defaultValue,
defined,
- CzmlBoolean,
- CzmlCartesian2,
- CzmlCartesian3,
- CzmlNumber,
- CzmlImage,
- CzmlHorizontalOrigin,
- CzmlVerticalOrigin,
- CzmlColor,
+ Cartesian2,
+ Cartesian3,
+ HorizontalOrigin,
+ VerticalOrigin,
+ Color,
processPacketData) {
"use strict";
@@ -45,61 +39,61 @@ define([
*/
var DynamicBillboard = function() {
/**
- * A DynamicProperty of type CzmlImage which determines the billboard's texture.
+ * A DynamicProperty of type Image which determines the billboard's texture.
* @type {DynamicProperty}
* @default undefined
*/
this.image = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the billboard's scale.
+ * A DynamicProperty of type Number which determines the billboard's scale.
* @type {DynamicProperty}
* @default undefined
*/
this.scale = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the billboard's rotation.
+ * A DynamicProperty of type Number which determines the billboard's rotation.
* @type {DynamicProperty}
* @default undefined
*/
this.rotation = undefined;
/**
- * A DynamicProperty of type CzmlCartesian3 which determines the billboard's aligned axis.
+ * A DynamicProperty of type Cartesian3 which determines the billboard's aligned axis.
* @type {DynamicProperty}
* @default undefined
*/
this.alignedAxis = undefined;
/**
- * A DynamicProperty of type CzmlHorizontalOrigin which determines the billboard's horizontal origin.
+ * A DynamicProperty of type HorizontalOrigin which determines the billboard's horizontal origin.
* @type {DynamicProperty}
* @default undefined
*/
this.horizontalOrigin = undefined;
/**
- * A DynamicProperty of type CzmlVerticalHorigin which determines the billboard's vertical origin.
+ * A DynamicProperty of type VerticalOrigin which determines the billboard's vertical origin.
* @type {DynamicProperty}
* @default undefined
*/
this.verticalOrigin = undefined;
/**
- * A DynamicProperty of type CzmlColor which determines the billboard's color.
+ * A DynamicProperty of type Color which determines the billboard's color.
* @type {DynamicProperty}
* @default undefined
*/
this.color = undefined;
/**
- * A DynamicProperty of type CzmlCartesian3 which determines the billboard's eye offset.
+ * A DynamicProperty of type Cartesian3 which determines the billboard's eye offset.
* @type {DynamicProperty}
* @default undefined
*/
this.eyeOffset = undefined;
/**
- * A DynamicProperty of type CzmlCartesian2 which determines the billboard's pixel offset.
+ * A DynamicProperty of type Cartesian2 which determines the billboard's pixel offset.
* @type {DynamicProperty}
* @default undefined
*/
this.pixelOffset = undefined;
/**
- * A DynamicProperty of type CzmlBoolean which determines the billboard's visibility.
+ * A DynamicProperty of type Boolean which determines the billboard's visibility.
* @type {DynamicProperty}
* @default undefined
*/
@@ -141,16 +135,16 @@ define([
dynamicObject.billboard = billboard = new DynamicBillboard();
}
- billboardUpdated = processPacketData(CzmlColor, billboard, 'color', billboardData.color, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(CzmlCartesian3, billboard, 'eyeOffset', billboardData.eyeOffset, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(CzmlHorizontalOrigin, billboard, 'horizontalOrigin', billboardData.horizontalOrigin, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(CzmlImage, billboard, 'image', billboardData.image, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(CzmlCartesian2, billboard, 'pixelOffset', billboardData.pixelOffset, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(CzmlNumber, billboard, 'scale', billboardData.scale, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(CzmlNumber, billboard, 'rotation', billboardData.rotation, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(CzmlCartesian3, billboard, 'alignedAxis', billboardData.alignedAxis, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(CzmlBoolean, billboard, 'show', billboardData.show, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(CzmlVerticalOrigin, billboard, 'verticalOrigin', billboardData.verticalOrigin, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Color, billboard, 'color', billboardData.color, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Cartesian3, billboard, 'eyeOffset', billboardData.eyeOffset, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(HorizontalOrigin, billboard, 'horizontalOrigin', billboardData.horizontalOrigin, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Image, billboard, 'image', billboardData.image, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Cartesian2, billboard, 'pixelOffset', billboardData.pixelOffset, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Number, billboard, 'scale', billboardData.scale, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Number, billboard, 'rotation', billboardData.rotation, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Cartesian3, billboard, 'alignedAxis', billboardData.alignedAxis, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Boolean, billboard, 'show', billboardData.show, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(VerticalOrigin, billboard, 'verticalOrigin', billboardData.verticalOrigin, interval, sourceUri) || billboardUpdated;
return billboardUpdated;
};
diff --git a/Source/DynamicScene/DynamicColorMaterial.js b/Source/DynamicScene/DynamicColorMaterial.js
index 0fb496ce1d74..c59fd551b126 100644
--- a/Source/DynamicScene/DynamicColorMaterial.js
+++ b/Source/DynamicScene/DynamicColorMaterial.js
@@ -1,11 +1,11 @@
/*global define*/
define([
- './CzmlColor',
+ '../Core/Color',
'../Core/defined',
'./processPacketData',
'../Scene/Material'
], function(
- CzmlColor,
+ Color,
defined,
processPacketData,
Material) {
@@ -18,7 +18,7 @@ define([
*/
var DynamicColorMaterial = function() {
/**
- * A DynamicProperty of type CzmlColor which determines the material's color.
+ * A DynamicProperty of type Color which determines the material's color.
* @type {DynamicProperty}
* @default undefined
*/
@@ -51,7 +51,7 @@ define([
DynamicColorMaterial.prototype.processCzmlIntervals = function(czmlInterval) {
var materialData = czmlInterval.solidColor;
if (defined(materialData)) {
- processPacketData(CzmlColor, this, 'color', materialData.color);
+ processPacketData(Color, this, 'color', materialData.color);
}
};
diff --git a/Source/DynamicScene/DynamicCone.js b/Source/DynamicScene/DynamicCone.js
index 6465b6da319b..f529c1798e71 100644
--- a/Source/DynamicScene/DynamicCone.js
+++ b/Source/DynamicScene/DynamicCone.js
@@ -3,18 +3,14 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- './CzmlBoolean',
- './CzmlNumber',
- './CzmlColor',
+ '../Core/Color',
'./processPacketData',
'./DynamicMaterialProperty'
], function(
TimeInterval,
defaultValue,
defined,
- CzmlBoolean,
- CzmlNumber,
- CzmlColor,
+ Color,
processPacketData,
DynamicMaterialProperty) {
"use strict";
@@ -36,25 +32,25 @@ define([
*/
var DynamicCone = function() {
/**
- * A DynamicProperty of type CzmlNumber which determines the cone's minimum clock-angle.
+ * A DynamicProperty of type Number which determines the cone's minimum clock-angle.
* @type {DynamicProperty}
* @default undefined
*/
this.minimumClockAngle = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the cone's maximum clock-angle.
+ * A DynamicProperty of type Number which determines the cone's maximum clock-angle.
* @type {DynamicProperty}
* @default undefined
*/
this.maximumClockAngle = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the cone's inner half-angle.
+ * A DynamicProperty of type Number which determines the cone's inner half-angle.
* @type {DynamicProperty}
* @default undefined
*/
this.innerHalfAngle = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the cone's outer half-angle.
+ * A DynamicProperty of type Number which determines the cone's outer half-angle.
* @type {DynamicProperty}
* @default undefined
*/
@@ -84,31 +80,31 @@ define([
*/
this.silhouetteMaterial = undefined;
/**
- * A DynamicProperty of type CzmlColor which determines the color of the line formed by the intersection of the cone and other central bodies.
+ * A DynamicProperty of type Color which determines the color of the line formed by the intersection of the cone and other central bodies.
* @type {DynamicProperty}
* @default undefined
*/
this.intersectionColor = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the approximate pixel width of the line formed by the intersection of the cone and other central bodies.
+ * A DynamicProperty of type Number which determines the approximate pixel width of the line formed by the intersection of the cone and other central bodies.
* @type {DynamicProperty}
* @default undefined
*/
this.intersectionWidth = undefined;
/**
- * A DynamicProperty of type CzmlBoolean which determines the cone's intersection visibility
+ * A DynamicProperty of type Boolean which determines the cone's intersection visibility
* @type {DynamicProperty}
* @default undefined
*/
this.showIntersection = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the cone's radius.
+ * A DynamicProperty of type Number which determines the cone's radius.
* @type {DynamicProperty}
* @default undefined
*/
this.radius = undefined;
/**
- * A DynamicProperty of type CzmlBoolean which determines the cone's visibility
+ * A DynamicProperty of type Boolean which determines the cone's visibility
* @type {DynamicProperty}
* @default undefined
*/
@@ -147,15 +143,15 @@ define([
dynamicObject.cone = cone = new DynamicCone();
}
- coneUpdated = processPacketData(CzmlBoolean, cone, 'show', coneData.show, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(CzmlNumber, cone, 'radius', coneData.radius, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(CzmlBoolean, cone, 'showIntersection', coneData.showIntersection, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(CzmlColor, cone, 'intersectionColor', coneData.intersectionColor, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(CzmlNumber, cone, 'intersectionWidth', coneData.intersectionWidth, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(CzmlNumber, cone, 'innerHalfAngle', coneData.innerHalfAngle, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(CzmlNumber, cone, 'outerHalfAngle', coneData.outerHalfAngle, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(CzmlNumber, cone, 'minimumClockAngle', coneData.minimumClockAngle, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(CzmlNumber, cone, 'maximumClockAngle', coneData.maximumClockAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Boolean, cone, 'show', coneData.show, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'radius', coneData.radius, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Boolean, cone, 'showIntersection', coneData.showIntersection, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Color, cone, 'intersectionColor', coneData.intersectionColor, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'intersectionWidth', coneData.intersectionWidth, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'innerHalfAngle', coneData.innerHalfAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'outerHalfAngle', coneData.outerHalfAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'minimumClockAngle', coneData.minimumClockAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'maximumClockAngle', coneData.maximumClockAngle, interval, sourceUri) || coneUpdated;
if (defined(coneData.capMaterial)) {
var capMaterial = cone.capMaterial;
diff --git a/Source/DynamicScene/DynamicEllipse.js b/Source/DynamicScene/DynamicEllipse.js
index b6241847aded..34f1c7171932 100644
--- a/Source/DynamicScene/DynamicEllipse.js
+++ b/Source/DynamicScene/DynamicEllipse.js
@@ -6,7 +6,6 @@ define([
'../Core/Cartesian3',
'../Core/Ellipsoid',
'../Core/Shapes',
- './CzmlNumber',
'./processPacketData'
], function (
TimeInterval,
@@ -15,7 +14,6 @@ define([
Cartesian3,
Ellipsoid,
Shapes,
- CzmlNumber,
processPacketData) {
"use strict";
@@ -35,20 +33,20 @@ define([
*/
var DynamicEllipse = function() {
/**
- * A DynamicProperty of type CzmlNumber which determines the ellipse's semiMajorAxis.
+ * A DynamicProperty of type Number which determines the ellipse's semiMajorAxis.
* @type {DynamicProperty}
* @default undefined
*/
this.semiMajorAxis = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the ellipse's semiMinorAxis.
+ * A DynamicProperty of type Number which determines the ellipse's semiMinorAxis.
* @type {DynamicProperty}
* @default undefined
*/
this.semiMinorAxis = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the bearing of the ellipse.
+ * A DynamicProperty of type Number which determines the bearing of the ellipse.
* @type {DynamicProperty}
* @default undefined
*/
@@ -95,9 +93,9 @@ define([
dynamicObject.ellipse = ellipse = new DynamicEllipse();
}
- ellipseUpdated = processPacketData(CzmlNumber, ellipse, 'bearing', ellipseData.bearing, interval, sourceUri) || ellipseUpdated;
- ellipseUpdated = processPacketData(CzmlNumber, ellipse, 'semiMajorAxis', ellipseData.semiMajorAxis, interval, sourceUri) || ellipseUpdated;
- ellipseUpdated = processPacketData(CzmlNumber, ellipse, 'semiMinorAxis', ellipseData.semiMinorAxis, interval, sourceUri) || ellipseUpdated;
+ ellipseUpdated = processPacketData(Number, ellipse, 'bearing', ellipseData.bearing, interval, sourceUri) || ellipseUpdated;
+ ellipseUpdated = processPacketData(Number, ellipse, 'semiMajorAxis', ellipseData.semiMajorAxis, interval, sourceUri) || ellipseUpdated;
+ ellipseUpdated = processPacketData(Number, ellipse, 'semiMinorAxis', ellipseData.semiMinorAxis, interval, sourceUri) || ellipseUpdated;
return ellipseUpdated;
};
diff --git a/Source/DynamicScene/DynamicEllipsoid.js b/Source/DynamicScene/DynamicEllipsoid.js
index c6011bfb3595..aa11e41d8857 100644
--- a/Source/DynamicScene/DynamicEllipsoid.js
+++ b/Source/DynamicScene/DynamicEllipsoid.js
@@ -3,16 +3,14 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- './CzmlBoolean',
- './CzmlCartesian3',
+ '../Core/Cartesian3',
'./processPacketData',
'./DynamicMaterialProperty'
], function(
TimeInterval,
defaultValue,
defined,
- CzmlBoolean,
- CzmlCartesian3,
+ Cartesian3,
processPacketData,
DynamicMaterialProperty) {
"use strict";
@@ -34,13 +32,13 @@ define([
*/
var DynamicEllipsoid = function() {
/**
- * A DynamicProperty of type CzmlBoolean which determines the ellipsoid's visibility.
+ * A DynamicProperty of type Boolean which determines the ellipsoid's visibility.
* @type {DynamicProperty}
* @default undefined
*/
this.show = undefined;
/**
- * A DynamicProperty of type CzmlCartesian3 which determines the ellipsoid's radii.
+ * A DynamicProperty of type Cartesian3 which determines the ellipsoid's radii.
* @type {DynamicProperty}
* @default undefined
*/
@@ -87,8 +85,8 @@ define([
dynamicObject.ellipsoid = ellipsoid = new DynamicEllipsoid();
}
- ellipsoidUpdated = processPacketData(CzmlBoolean, ellipsoid, 'show', ellipsoidData.show, interval, sourceUri) || ellipsoidUpdated;
- ellipsoidUpdated = processPacketData(CzmlCartesian3, ellipsoid, 'radii', ellipsoidData.radii, interval, sourceUri) || ellipsoidUpdated;
+ ellipsoidUpdated = processPacketData(Boolean, ellipsoid, 'show', ellipsoidData.show, interval, sourceUri) || ellipsoidUpdated;
+ ellipsoidUpdated = processPacketData(Cartesian3, ellipsoid, 'radii', ellipsoidData.radii, interval, sourceUri) || ellipsoidUpdated;
if (defined(ellipsoidData.material)) {
var material = ellipsoid.material;
diff --git a/Source/DynamicScene/DynamicGridMaterial.js b/Source/DynamicScene/DynamicGridMaterial.js
index 32d23c94a5d8..8c7e533ce133 100644
--- a/Source/DynamicScene/DynamicGridMaterial.js
+++ b/Source/DynamicScene/DynamicGridMaterial.js
@@ -1,14 +1,12 @@
/*global define*/
define([
'./processPacketData',
- './CzmlColor',
- './CzmlNumber',
+ '../Core/Color',
'../Core/defined',
'../Scene/Material'
], function(
processPacketData,
- CzmlColor,
- CzmlNumber,
+ Color,
defined,
Material) {
"use strict";
@@ -20,42 +18,42 @@ define([
*/
var DynamicGridMaterial = function() {
/**
- * A DynamicProperty of type CzmlColor which determines the grid's color.
+ * A DynamicProperty of type Color which determines the grid's color.
* @type {DynamicProperty}
* @default undefined
*/
this.color = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the grid cells alpha value, when combined with the color alpha.
+ * A DynamicProperty of type Number which determines the grid cells alpha value, when combined with the color alpha.
* @type {DynamicProperty}
* @default undefined
*/
this.cellAlpha = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the number of horizontal rows.
+ * A DynamicProperty of type Number which determines the number of horizontal rows.
* @type {DynamicProperty}
* @default undefined
*/
this.rowCount = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the number of vertical columns.
+ * A DynamicProperty of type Number which determines the number of vertical columns.
* @type {DynamicProperty}
* @default undefined
*/
this.columnCount = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the width of each horizontal line, in pixels.
+ * A DynamicProperty of type Number which determines the width of each horizontal line, in pixels.
* @type {DynamicProperty}
* @default undefined
*/
this.rowThickness = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the width of each vertical line, in pixels.
+ * A DynamicProperty of type Number which determines the width of each vertical line, in pixels.
* @type {DynamicProperty}
* @default undefined
*/
@@ -92,12 +90,12 @@ define([
return;
}
- processPacketData(CzmlColor, this, 'color', materialData.color, undefined, sourceUri);
- processPacketData(CzmlNumber, this, 'cellAlpha', materialData.cellAlpha, undefined, sourceUri);
- processPacketData(CzmlNumber, this, 'rowCount', materialData.rowCount, undefined, sourceUri);
- processPacketData(CzmlNumber, this, 'columnCount', materialData.columnCount, undefined, sourceUri);
- processPacketData(CzmlNumber, this, 'rowThickness', materialData.rowThickness, undefined, sourceUri);
- processPacketData(CzmlNumber, this, 'columnThickness', materialData.columnThickness, undefined, sourceUri);
+ processPacketData(Color, this, 'color', materialData.color, undefined, sourceUri);
+ processPacketData(Number, this, 'cellAlpha', materialData.cellAlpha, undefined, sourceUri);
+ processPacketData(Number, this, 'rowCount', materialData.rowCount, undefined, sourceUri);
+ processPacketData(Number, this, 'columnCount', materialData.columnCount, undefined, sourceUri);
+ processPacketData(Number, this, 'rowThickness', materialData.rowThickness, undefined, sourceUri);
+ processPacketData(Number, this, 'columnThickness', materialData.columnThickness, undefined, sourceUri);
};
/**
diff --git a/Source/DynamicScene/DynamicImageMaterial.js b/Source/DynamicScene/DynamicImageMaterial.js
index e93841da15b2..34d5557f7648 100644
--- a/Source/DynamicScene/DynamicImageMaterial.js
+++ b/Source/DynamicScene/DynamicImageMaterial.js
@@ -1,14 +1,10 @@
/*global define*/
define([
'./processPacketData',
- './CzmlImage',
- './CzmlNumber',
'../Core/defined',
'../Scene/Material'
], function(
processPacketData,
- CzmlImage,
- CzmlNumber,
defined,
Material) {
"use strict";
@@ -20,19 +16,19 @@ define([
*/
var DynamicImageMaterial = function() {
/**
- * A DynamicProperty of type CzmlNumber which determines the material's image.
+ * A DynamicProperty of type Number which determines the material's image.
* @type {DynamicProperty}
* @default undefined
*/
this.image = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the material's vertical repeat.
+ * A DynamicProperty of type Number which determines the material's vertical repeat.
* @type {DynamicProperty}
* @default undefined
*/
this.verticalRepeat = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the material's horizontal repeat.
+ * A DynamicProperty of type Number which determines the material's horizontal repeat.
*
* @type {DynamicProperty}
* @default undefined
@@ -70,9 +66,9 @@ define([
return;
}
- processPacketData(CzmlImage, this, 'image', materialData.image, undefined, sourceUri);
- processPacketData(CzmlNumber, this, 'verticalRepeat', materialData.verticalRepeat, undefined, sourceUri);
- processPacketData(CzmlNumber, this, 'horizontalRepeat', materialData.horizontalRepeat, undefined, sourceUri);
+ processPacketData(Image, this, 'image', materialData.image, undefined, sourceUri);
+ processPacketData(Number, this, 'verticalRepeat', materialData.verticalRepeat, undefined, sourceUri);
+ processPacketData(Number, this, 'horizontalRepeat', materialData.horizontalRepeat, undefined, sourceUri);
};
/**
diff --git a/Source/DynamicScene/DynamicLabel.js b/Source/DynamicScene/DynamicLabel.js
index 1fe50bf6fc15..d90073ba278c 100644
--- a/Source/DynamicScene/DynamicLabel.js
+++ b/Source/DynamicScene/DynamicLabel.js
@@ -3,29 +3,23 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- './CzmlBoolean',
- './CzmlCartesian2',
- './CzmlCartesian3',
- './CzmlNumber',
- './CzmlString',
- './CzmlHorizontalOrigin',
- './CzmlVerticalOrigin',
- './CzmlLabelStyle',
- './CzmlColor',
+ '../Core/Cartesian2',
+ '../Core/Cartesian3',
+ '../Scene/HorizontalOrigin',
+ '../Scene/VerticalOrigin',
+ '../Scene/LabelStyle',
+ '../Core/Color',
'./processPacketData'
], function(
TimeInterval,
defaultValue,
defined,
- CzmlBoolean,
- CzmlCartesian2,
- CzmlCartesian3,
- CzmlNumber,
- CzmlString,
- CzmlHorizontalOrigin,
- CzmlVerticalOrigin,
- CzmlLabelStyle,
- CzmlColor,
+ Cartesian2,
+ Cartesian3,
+ HorizontalOrigin,
+ VerticalOrigin,
+ LabelStyle,
+ Color,
processPacketData) {
"use strict";
@@ -47,73 +41,73 @@ define([
*/
var DynamicLabel = function() {
/**
- * A DynamicProperty of type CzmlString which determines the label's text.
+ * A DynamicProperty of type String which determines the label's text.
* @type {DynamicProperty}
* @default undefined
*/
this.text = undefined;
/**
- * A DynamicProperty of type CzmlString which determines the label's font.
+ * A DynamicProperty of type String which determines the label's font.
* @type {DynamicProperty}
* @default undefined
*/
this.font = undefined;
/**
- * A DynamicProperty of type CzmlLabelStyle which determines the label's style.
+ * A DynamicProperty of type LabelStyle which determines the label's style.
* @type {DynamicProperty}
* @default undefined
*/
this.style = undefined;
/**
- * A DynamicProperty of type CzmlColor which determines the label's fill color.
+ * A DynamicProperty of type Color which determines the label's fill color.
* @type {DynamicProperty}
* @default undefined
*/
this.fillColor = undefined;
/**
- * A DynamicProperty of type CzmlColor which determines the label's outline color.
+ * A DynamicProperty of type Color which determines the label's outline color.
* @type {DynamicProperty}
* @default undefined
*/
this.outlineColor = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the label's outline width.
+ * A DynamicProperty of type Number which determines the label's outline width.
* @type {DynamicProperty}
* @default undefined
*/
this.outlineWidth = undefined;
/**
- * A DynamicProperty of type CzmlHorizontalOrigin which determines the label's horizontal origin.
+ * A DynamicProperty of type HorizontalOrigin which determines the label's horizontal origin.
* @type {DynamicProperty}
* @default undefined
*/
this.horizontalOrigin = undefined;
/**
- * A DynamicProperty of type CzmlVerticalOrigin which determines the label's vertical origin.
+ * A DynamicProperty of type VerticalOrigin which determines the label's vertical origin.
* @type {DynamicProperty}
* @default undefined
*/
this.verticalOrigin = undefined;
/**
- * A DynamicProperty of type CzmlCartesian3 which determines the label's eye offset.
+ * A DynamicProperty of type Cartesian3 which determines the label's eye offset.
* @type {DynamicProperty}
* @default undefined
*/
this.eyeOffset = undefined;
/**
- * A DynamicProperty of type CzmlCartesian2 which determines the label's pixel offset.
+ * A DynamicProperty of type Cartesian2 which determines the label's pixel offset.
* @type {DynamicProperty}
* @default undefined
*/
this.pixelOffset = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the label's scale.
+ * A DynamicProperty of type Number which determines the label's scale.
* @type {DynamicProperty}
* @default undefined
*/
this.scale = undefined;
/**
- * A DynamicProperty of type CzmlBoolean which determines the label's visibility.
+ * A DynamicProperty of type Boolean which determines the label's visibility.
* @type {DynamicProperty}
* @default undefined
*/
@@ -152,18 +146,18 @@ define([
dynamicObject.label = label = new DynamicLabel();
}
- labelUpdated = processPacketData(CzmlColor, label, 'fillColor', labelData.fillColor, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlColor, label, 'outlineColor', labelData.outlineColor, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlNumber, label, 'outlineWidth', labelData.outlineWidth, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlCartesian3, label, 'eyeOffset', labelData.eyeOffset, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlHorizontalOrigin, label, 'horizontalOrigin', labelData.horizontalOrigin, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlString, label, 'text', labelData.text, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlCartesian2, label, 'pixelOffset', labelData.pixelOffset, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlNumber, label, 'scale', labelData.scale, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlBoolean, label, 'show', labelData.show, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlVerticalOrigin, label, 'verticalOrigin', labelData.verticalOrigin, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlString, label, 'font', labelData.font, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(CzmlLabelStyle, label, 'style', labelData.style, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Color, label, 'fillColor', labelData.fillColor, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Color, label, 'outlineColor', labelData.outlineColor, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Number, label, 'outlineWidth', labelData.outlineWidth, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Cartesian3, label, 'eyeOffset', labelData.eyeOffset, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(HorizontalOrigin, label, 'horizontalOrigin', labelData.horizontalOrigin, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(String, label, 'text', labelData.text, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Cartesian2, label, 'pixelOffset', labelData.pixelOffset, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Number, label, 'scale', labelData.scale, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Boolean, label, 'show', labelData.show, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(VerticalOrigin, label, 'verticalOrigin', labelData.verticalOrigin, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(String, label, 'font', labelData.font, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(LabelStyle, label, 'style', labelData.style, interval, sourceUri) || labelUpdated;
return labelUpdated;
};
diff --git a/Source/DynamicScene/DynamicObject.js b/Source/DynamicScene/DynamicObject.js
index 383e2ef44744..9bfdc60f57df 100644
--- a/Source/DynamicScene/DynamicObject.js
+++ b/Source/DynamicScene/DynamicObject.js
@@ -5,22 +5,22 @@ define([
'../Core/defined',
'../Core/DeveloperError',
'../Core/JulianDate',
+ '../Core/Quaternion',
'../Core/TimeInterval',
'./processPacketData',
'./DynamicVertexPositionsProperty',
- './CzmlUnitQuaternion',
- './CzmlCartesian3'
+ '../Core/Cartesian3'
], function(
createGuid,
defaultValue,
defined,
DeveloperError,
JulianDate,
+ Quaternion,
TimeInterval,
processPacketData,
DynamicVertexPositionsProperty,
- CzmlUnitQuaternion,
- CzmlCartesian3) {
+ Cartesian3) {
"use strict";
/**
@@ -241,7 +241,7 @@ define([
if (!defined(positionData)) {
return false;
}
- return processPacketData(CzmlCartesian3, dynamicObject, 'position', positionData, undefined, sourceUri);
+ return processPacketData(Cartesian3, dynamicObject, 'position', positionData, undefined, sourceUri);
};
/**
@@ -262,7 +262,7 @@ define([
if (!defined(viewFromData)) {
return false;
}
- return processPacketData(CzmlCartesian3, dynamicObject, 'viewFrom', viewFromData, undefined, sourceUri);
+ return processPacketData(Cartesian3, dynamicObject, 'viewFrom', viewFromData, undefined, sourceUri);
};
/**
@@ -284,7 +284,7 @@ define([
return false;
}
- return processPacketData(CzmlUnitQuaternion, dynamicObject, 'orientation', orientationData, undefined, sourceUri);
+ return processPacketData(Quaternion, dynamicObject, 'orientation', orientationData, undefined, sourceUri);
};
/**
diff --git a/Source/DynamicScene/DynamicPath.js b/Source/DynamicScene/DynamicPath.js
index 749aaf7ea73d..2e9d7bad9b5b 100644
--- a/Source/DynamicScene/DynamicPath.js
+++ b/Source/DynamicScene/DynamicPath.js
@@ -3,17 +3,13 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- './CzmlBoolean',
- './CzmlNumber',
- './CzmlColor',
+ '../Core/Color',
'./processPacketData'],
function(
TimeInterval,
defaultValue,
defined,
- CzmlBoolean,
- CzmlNumber,
- CzmlColor,
+ Color,
processPacketData) {
"use strict";
@@ -34,49 +30,49 @@ function(
*/
var DynamicPath = function() {
/**
- * A DynamicProperty of type CzmlColor which determines the line's color.
+ * A DynamicProperty of type Color which determines the line's color.
* @type {DynamicProperty}
* @default undefined
*/
this.color = undefined;
/**
- * A DynamicProperty of type CzmlColor which determines the line's outline color.
+ * A DynamicProperty of type Color which determines the line's outline color.
* @type {DynamicProperty}
* @default undefined
*/
this.outlineColor = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the line's outline width.
+ * A DynamicProperty of type Number which determines the line's outline width.
* @type {DynamicProperty}
* @default undefined
*/
this.outlineWidth = undefined;
/**
- * A DynamicProperty of type CzmlBoolean which determines the lines's visibility.
+ * A DynamicProperty of type Boolean which determines the lines's visibility.
* @type {DynamicProperty}
* @default undefined
*/
this.show = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the line's width.
+ * A DynamicProperty of type Number which determines the line's width.
* @type {DynamicProperty}
* @default undefined
*/
this.width = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the maximum step size, in seconds, to take when sampling the position.
+ * A DynamicProperty of type Number which determines the maximum step size, in seconds, to take when sampling the position.
* @type {DynamicProperty}
* @default undefined
*/
this.resolution = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the number of seconds in front of the object to show.
+ * A DynamicProperty of type Number which determines the number of seconds in front of the object to show.
* @type {DynamicProperty}
* @default undefined
*/
this.leadTime = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the the number of seconds behind the object to show.
+ * A DynamicProperty of type Number which determines the the number of seconds behind the object to show.
* @type {DynamicProperty}
* @default undefined
*/
@@ -115,14 +111,14 @@ function(
dynamicObject.path = path = new DynamicPath();
}
- pathUpdated = processPacketData(CzmlColor, path, 'color', pathData.color, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(CzmlNumber, path, 'width', pathData.width, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(CzmlColor, path, 'outlineColor', pathData.outlineColor, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(CzmlNumber, path, 'outlineWidth', pathData.outlineWidth, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(CzmlBoolean, path, 'show', pathData.show, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(CzmlNumber, path, 'resolution', pathData.resolution, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(CzmlNumber, path, 'leadTime', pathData.leadTime, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(CzmlNumber, path, 'trailTime', pathData.trailTime, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Color, path, 'color', pathData.color, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Number, path, 'width', pathData.width, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Color, path, 'outlineColor', pathData.outlineColor, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Number, path, 'outlineWidth', pathData.outlineWidth, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Boolean, path, 'show', pathData.show, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Number, path, 'resolution', pathData.resolution, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Number, path, 'leadTime', pathData.leadTime, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Number, path, 'trailTime', pathData.trailTime, interval, sourceUri) || pathUpdated;
return pathUpdated;
};
diff --git a/Source/DynamicScene/DynamicPoint.js b/Source/DynamicScene/DynamicPoint.js
index d264247b2404..0c46ab6dd91c 100644
--- a/Source/DynamicScene/DynamicPoint.js
+++ b/Source/DynamicScene/DynamicPoint.js
@@ -3,17 +3,13 @@ define([
'../Core/defined',
'../Core/TimeInterval',
'../Core/defaultValue',
- './CzmlBoolean',
- './CzmlNumber',
- './CzmlColor',
+ '../Core/Color',
'./processPacketData'
], function(
defined,
TimeInterval,
defaultValue,
- CzmlBoolean,
- CzmlNumber,
- CzmlColor,
+ Color,
processPacketData) {
"use strict";
@@ -35,27 +31,27 @@ define([
*/
var DynamicPoint = function() {
/**
- * A DynamicProperty of type CzmlColor which determines the point's color.
+ * A DynamicProperty of type Color which determines the point's color.
* @type DynamicProperty
*/
this.color = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the point's pixel size.
+ * A DynamicProperty of type Number which determines the point's pixel size.
* @type DynamicProperty
*/
this.pixelSize = undefined;
/**
- * A DynamicProperty of type CzmlColor which determines the point's outline color.
+ * A DynamicProperty of type Color which determines the point's outline color.
* @type DynamicProperty
*/
this.outlineColor = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the point's outline width.
+ * A DynamicProperty of type Number which determines the point's outline width.
* @type DynamicProperty
*/
this.outlineWidth = undefined;
/**
- * A DynamicProperty of type CzmlBoolean which determines the point's visibility.
+ * A DynamicProperty of type Boolean which determines the point's visibility.
* @type DynamicProperty
*/
this.show = undefined;
@@ -93,11 +89,11 @@ define([
dynamicObject.point = point = new DynamicPoint();
}
- pointUpdated = processPacketData(CzmlColor, point, 'color', pointData.color, interval, sourceUri) || pointUpdated;
- pointUpdated = processPacketData(CzmlNumber, point, 'pixelSize', pointData.pixelSize, interval, sourceUri) || pointUpdated;
- pointUpdated = processPacketData(CzmlColor, point, 'outlineColor', pointData.outlineColor, interval, sourceUri) || pointUpdated;
- pointUpdated = processPacketData(CzmlNumber, point, 'outlineWidth', pointData.outlineWidth, interval, sourceUri) || pointUpdated;
- pointUpdated = processPacketData(CzmlBoolean, point, 'show', pointData.show, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(Color, point, 'color', pointData.color, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(Number, point, 'pixelSize', pointData.pixelSize, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(Color, point, 'outlineColor', pointData.outlineColor, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(Number, point, 'outlineWidth', pointData.outlineWidth, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(Boolean, point, 'show', pointData.show, interval, sourceUri) || pointUpdated;
return pointUpdated;
};
diff --git a/Source/DynamicScene/DynamicPolygon.js b/Source/DynamicScene/DynamicPolygon.js
index 5a64e0933a0d..95437d0c2eb5 100644
--- a/Source/DynamicScene/DynamicPolygon.js
+++ b/Source/DynamicScene/DynamicPolygon.js
@@ -3,14 +3,12 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- './CzmlBoolean',
'./processPacketData',
'./DynamicMaterialProperty'
], function(
TimeInterval,
defaultValue,
defined,
- CzmlBoolean,
processPacketData,
DynamicMaterialProperty) {
"use strict";
@@ -32,7 +30,7 @@ define([
*/
var DynamicPolygon = function() {
/**
- * A DynamicProperty of type CzmlBoolean which determines the polygon's visibility.
+ * A DynamicProperty of type Boolean which determines the polygon's visibility.
* @type {DynamicProperty}
* @default undefined
*/
@@ -79,7 +77,7 @@ define([
dynamicObject.polygon = polygon = new DynamicPolygon();
}
- polygonUpdated = processPacketData(CzmlBoolean, polygon, 'show', polygonData.show, interval, sourceUri) || polygonUpdated;
+ polygonUpdated = processPacketData(Boolean, polygon, 'show', polygonData.show, interval, sourceUri) || polygonUpdated;
if (defined(polygonData.material)) {
var material = polygon.material;
diff --git a/Source/DynamicScene/DynamicPolyline.js b/Source/DynamicScene/DynamicPolyline.js
index 80f47fd7fe09..d9469535e74d 100644
--- a/Source/DynamicScene/DynamicPolyline.js
+++ b/Source/DynamicScene/DynamicPolyline.js
@@ -3,17 +3,13 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- './CzmlBoolean',
- './CzmlNumber',
- './CzmlColor',
+ '../Core/Color',
'./processPacketData'],
function(
TimeInterval,
defaultValue,
defined,
- CzmlBoolean,
- CzmlNumber,
- CzmlColor,
+ Color,
processPacketData) {
"use strict";
@@ -34,31 +30,31 @@ function(
*/
var DynamicPolyline = function() {
/**
- * A DynamicProperty of type CzmlColor which determines the line's color.
+ * A DynamicProperty of type Color which determines the line's color.
* @type {DynamicProperty}
* @default undefined
*/
this.color = undefined;
/**
- * A DynamicProperty of type CzmlColor which determines the line's outline color.
+ * A DynamicProperty of type Color which determines the line's outline color.
* @type {DynamicProperty}
* @default undefined
*/
this.outlineColor = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the line's outline width.
+ * A DynamicProperty of type Number which determines the line's outline width.
* @type {DynamicProperty}
* @default undefined
*/
this.outlineWidth = undefined;
/**
- * A DynamicProperty of type CzmlBoolean which determines the lines's visibility.
+ * A DynamicProperty of type Boolean which determines the lines's visibility.
* @type {DynamicProperty}
* @default undefined
*/
this.show = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the line's width.
+ * A DynamicProperty of type Number which determines the line's width.
* @type {DynamicProperty}
* @default undefined
*/
@@ -97,11 +93,11 @@ function(
dynamicObject.polyline = polyline = new DynamicPolyline();
}
- polylineUpdated = processPacketData(CzmlColor, polyline, 'color', polylineData.color, interval, sourceUri) || polylineUpdated;
- polylineUpdated = processPacketData(CzmlNumber, polyline, 'width', polylineData.width, interval, sourceUri) || polylineUpdated;
- polylineUpdated = processPacketData(CzmlColor, polyline, 'outlineColor', polylineData.outlineColor, interval, sourceUri) || polylineUpdated;
- polylineUpdated = processPacketData(CzmlNumber, polyline, 'outlineWidth', polylineData.outlineWidth, interval, sourceUri) || polylineUpdated;
- polylineUpdated = processPacketData(CzmlBoolean, polyline, 'show', polylineData.show, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(Color, polyline, 'color', polylineData.color, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(Number, polyline, 'width', polylineData.width, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(Color, polyline, 'outlineColor', polylineData.outlineColor, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(Number, polyline, 'outlineWidth', polylineData.outlineWidth, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(Boolean, polyline, 'show', polylineData.show, interval, sourceUri) || polylineUpdated;
return polylineUpdated;
};
diff --git a/Source/DynamicScene/DynamicPyramid.js b/Source/DynamicScene/DynamicPyramid.js
index 2c5feecf980b..b5ae6ed3f98c 100644
--- a/Source/DynamicScene/DynamicPyramid.js
+++ b/Source/DynamicScene/DynamicPyramid.js
@@ -3,9 +3,7 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- './CzmlBoolean',
- './CzmlNumber',
- './CzmlColor',
+ '../Core/Color',
'./processPacketData',
'./DynamicDirectionsProperty',
'./DynamicMaterialProperty'
@@ -13,9 +11,7 @@ define([
TimeInterval,
defaultValue,
defined,
- CzmlBoolean,
- CzmlNumber,
- CzmlColor,
+ Color,
processPacketData,
DynamicDirectionsProperty,
DynamicMaterialProperty) {
@@ -38,7 +34,7 @@ define([
*/
var DynamicPyramid = function() {
/**
- * A DynamicProperty of type CzmlBoolean which determines the pyramid's visibility.
+ * A DynamicProperty of type Boolean which determines the pyramid's visibility.
* @type {DynamicProperty}
* @default undefined
*/
@@ -50,25 +46,25 @@ define([
*/
this.directions = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the pyramid's radius.
+ * A DynamicProperty of type Number which determines the pyramid's radius.
* @type {DynamicProperty}
* @default undefined
*/
this.radius = undefined;
/**
- * A DynamicProperty of type CzmlBoolean which determines the pyramid's intersection visibility.
+ * A DynamicProperty of type Boolean which determines the pyramid's intersection visibility.
* @type {DynamicProperty}
* @default undefined
*/
this.showIntersection = undefined;
/**
- * A DynamicProperty of type CzmlColor which determines the color of the line formed by the intersection of the pyramid and other central bodies.
+ * A DynamicProperty of type Color which determines the color of the line formed by the intersection of the pyramid and other central bodies.
* @type {DynamicProperty}
* @default undefined
*/
this.intersectionColor = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the approximate pixel width of the line formed by the intersection of the pyramid and other central bodies.
+ * A DynamicProperty of type Number which determines the approximate pixel width of the line formed by the intersection of the pyramid and other central bodies.
* @type {DynamicProperty}
* @default undefined
*/
@@ -115,11 +111,11 @@ define([
dynamicObject.pyramid = pyramid = new DynamicPyramid();
}
- pyramidUpdated = processPacketData(CzmlBoolean, pyramid, 'show', pyramidData.show, interval, sourceUri) || pyramidUpdated;
- pyramidUpdated = processPacketData(CzmlNumber, pyramid, 'radius', pyramidData.radius, interval, sourceUri) || pyramidUpdated;
- pyramidUpdated = processPacketData(CzmlBoolean, pyramid, 'showIntersection', pyramidData.showIntersection, interval, sourceUri) || pyramidUpdated;
- pyramidUpdated = processPacketData(CzmlColor, pyramid, 'intersectionColor', pyramidData.intersectionColor, interval, sourceUri) || pyramidUpdated;
- pyramidUpdated = processPacketData(CzmlNumber, pyramid, 'intersectionWidth', pyramidData.intersectionWidth, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(Boolean, pyramid, 'show', pyramidData.show, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(Number, pyramid, 'radius', pyramidData.radius, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(Boolean, pyramid, 'showIntersection', pyramidData.showIntersection, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(Color, pyramid, 'intersectionColor', pyramidData.intersectionColor, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(Number, pyramid, 'intersectionWidth', pyramidData.intersectionWidth, interval, sourceUri) || pyramidUpdated;
if (defined(pyramidData.material)) {
var material = pyramid.material;
diff --git a/Source/DynamicScene/DynamicVector.js b/Source/DynamicScene/DynamicVector.js
index 8406abb9e876..a70b4b4bd1a3 100644
--- a/Source/DynamicScene/DynamicVector.js
+++ b/Source/DynamicScene/DynamicVector.js
@@ -3,19 +3,15 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- './CzmlBoolean',
- './CzmlDirection',
- './CzmlNumber',
- './CzmlColor',
+ '../Core/Cartesian3',
+ '../Core/Color',
'./processPacketData'],
function(
TimeInterval,
defaultValue,
defined,
- CzmlBoolean,
- CzmlDirection,
- CzmlNumber,
- CzmlColor,
+ Cartesian3,
+ Color,
processPacketData) {
"use strict";
@@ -35,31 +31,31 @@ function(
*/
var DynamicVector = function() {
/**
- * A DynamicProperty of type CzmlColor which determines the vector's color.
+ * A DynamicProperty of type Color which determines the vector's color.
* @type {DynamicProperty}
* @default undefined
*/
this.color = undefined;
/**
- * A DynamicProperty of type CzmlBoolean which determines the vector's visibility.
+ * A DynamicProperty of type Boolean which determines the vector's visibility.
* @type {DynamicProperty}
* @default undefined
*/
this.show = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the vector's width.
+ * A DynamicProperty of type Number which determines the vector's width.
* @type {DynamicProperty}
* @default undefined
*/
this.width = undefined;
/**
- * A DynamicProperty of type CzmlDirection which determines the vector's direction.
+ * A DynamicProperty of type Cartesian3 which determines the vector's direction.
* @type {DynamicProperty}
* @default undefined
*/
this.direction = undefined;
/**
- * A DynamicProperty of type CzmlNumber which determines the vector's graphical length.
+ * A DynamicProperty of type Number which determines the vector's graphical length.
* @type {DynamicProperty}
* @default undefined
*/
@@ -98,11 +94,11 @@ function(
dynamicObject.vector = vector = new DynamicVector();
}
- vectorUpdated = processPacketData(CzmlColor, vector, 'color', vectorData.color, interval, sourceUri) || vectorUpdated;
- vectorUpdated = processPacketData(CzmlBoolean, vector, 'show', vectorData.show, interval, sourceUri) || vectorUpdated;
- vectorUpdated = processPacketData(CzmlNumber, vector, 'width', vectorData.width, interval, sourceUri) || vectorUpdated;
- vectorUpdated = processPacketData(CzmlDirection, vector, 'direction', vectorData.direction, interval, sourceUri) || vectorUpdated;
- vectorUpdated = processPacketData(CzmlNumber, vector, 'length', vectorData.length, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(Color, vector, 'color', vectorData.color, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(Boolean, vector, 'show', vectorData.show, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(Number, vector, 'width', vectorData.width, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(Cartesian3, vector, 'direction', vectorData.direction, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(Number, vector, 'length', vectorData.length, interval, sourceUri) || vectorUpdated;
return vectorUpdated;
};
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
index 9062e745af6b..b8f9b938097d 100644
--- a/Source/DynamicScene/processPacketData.js
+++ b/Source/DynamicScene/processPacketData.js
@@ -1,24 +1,215 @@
/*global define*/
define([
+ '../Core/Cartesian2',
+ '../Core/Cartesian3',
+ '../Core/Cartographic',
+ '../Core/Color',
+ '../Core/defaultValue',
'../Core/defined',
+ '../Core/DeveloperError',
+ '../Core/Ellipsoid',
+ '../Core/Math',
+ '../Core/Quaternion',
+ '../Core/Spherical',
+ '../Scene/HorizontalOrigin',
+ '../Scene/LabelStyle',
+ '../Scene/VerticalOrigin',
'../Core/TimeInterval',
'../Core/Iso8601',
'../Core/JulianDate',
'./CompositeProperty',
'./ConstantProperty',
'./SampledProperty',
- './TimeIntervalCollectionProperty'
+ './TimeIntervalCollectionProperty',
+ '../ThirdParty/Uri'
], function(
+ Cartesian2,
+ Cartesian3,
+ Cartographic,
+ Color,
+ defaultValue,
defined,
+ DeveloperError,
+ Ellipsoid,
+ CesiumMath,
+ Quaternion,
+ Spherical,
+ HorizontalOrigin,
+ LabelStyle,
+ VerticalOrigin,
TimeInterval,
Iso8601,
JulianDate,
CompositeProperty,
ConstantProperty,
SampledProperty,
- TimeIntervalCollectionProperty) {
+ TimeIntervalCollectionProperty,
+ Uri) {
"use strict";
+ var scratchCartesian = new Cartesian3();
+ var scratchSpherical = new Spherical();
+ var scratchCartographic = new Cartographic();
+
+ function unwrapColorInterval(czmlInterval) {
+ var rgbaf = czmlInterval.rgbaf;
+ if (defined(rgbaf)) {
+ return rgbaf;
+ }
+
+ var rgba = czmlInterval.rgba;
+ if (!defined(rgba)) {
+ return undefined;
+ }
+
+ if (rgba.length === Color.length) {
+ return [Color.byteToFloat(rgba[0]), Color.byteToFloat(rgba[1]), Color.byteToFloat(rgba[2]), Color.byteToFloat(rgba[3])];
+ }
+
+ var len = rgba.length;
+ rgbaf = new Array(len);
+ for ( var i = 0; i < len; i += 5) {
+ rgbaf[i] = rgba[i];
+ rgbaf[i + 1] = Color.byteToFloat(rgba[i + 1]);
+ rgbaf[i + 2] = Color.byteToFloat(rgba[i + 2]);
+ rgbaf[i + 3] = Color.byteToFloat(rgba[i + 3]);
+ rgbaf[i + 4] = Color.byteToFloat(rgba[i + 4]);
+ }
+ return rgbaf;
+ }
+
+ function unwrapImageInterval(czmlInterval, sourceUri) {
+ var result = defaultValue(czmlInterval.image, czmlInterval);
+ if (defined(sourceUri)) {
+ var baseUri = new Uri(document.location.href);
+ sourceUri = new Uri(sourceUri);
+ result = new Uri(result).resolve(sourceUri.resolve(baseUri)).toString();
+ }
+ return result;
+ }
+
+ function unwrapCartesianInterval(czmlInterval) {
+ if (defined(czmlInterval.cartesian)) {
+ return czmlInterval.cartesian;
+ }
+
+ if (defined(czmlInterval.unitCartesian)) {
+ return czmlInterval.unitCartesian;
+ }
+
+ var i;
+ var len;
+ var result;
+
+ var unitSpherical = czmlInterval.unitSpherical;
+ if (defined(unitSpherical)) {
+ len = unitSpherical.length;
+ if (len === 2) {
+ scratchSpherical.clock = unitSpherical[0];
+ scratchSpherical.cone = unitSpherical[1];
+ Cartesian3.fromSpherical(scratchSpherical, scratchCartesian);
+ result = [scratchCartesian.x, scratchCartesian.y, scratchCartesian.z];
+ } else {
+ var sphericalIt = 0;
+ result = new Array((len / 3) * 4);
+ for (i = 0; i < len; i += 4) {
+ result[i] = unitSpherical[sphericalIt++];
+
+ scratchSpherical.clock = unitSpherical[sphericalIt++];
+ scratchSpherical.cone = unitSpherical[sphericalIt++];
+ Cartesian3.fromSpherical(scratchSpherical, scratchCartesian);
+
+ result[i + 1] = scratchCartesian.x;
+ result[i + 2] = scratchCartesian.y;
+ result[i + 3] = scratchCartesian.z;
+ }
+ }
+ return result;
+ }
+
+ var tmp = scratchCartesian;
+ var cartographic = czmlInterval.cartographicRadians;
+ if (defined(cartographic)) {
+ if (cartographic.length > 3) {
+ scratchCartographic.longitude = cartographic[0];
+ scratchCartographic.latitude = cartographic[1];
+ scratchCartographic.height = cartographic[2];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+ result = [tmp.x, tmp.y, tmp.z];
+ } else {
+ len = cartographic.length;
+ result = new Array(len);
+ for (i = 0; i < len; i += 4) {
+ scratchCartographic.longitude = cartographic[i + 1];
+ scratchCartographic.latitude = cartographic[i + 2];
+ scratchCartographic.height = cartographic[i + 3];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+
+ result[i] = cartographic[i];
+ result[i + 1] = tmp.x;
+ result[i + 2] = tmp.y;
+ result[i + 3] = tmp.z;
+ }
+ }
+ } else {
+ var cartographicDegrees = czmlInterval.cartographicDegrees;
+ if (!defined(cartographicDegrees)) {
+ return undefined;
+ }
+
+ if (cartographicDegrees.length > 3) {
+ scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[0]);
+ scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[1]);
+ scratchCartographic.height = cartographicDegrees[2];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+ result = [tmp.x, tmp.y, tmp.z];
+ } else {
+ len = cartographicDegrees.length;
+ result = new Array(len);
+ for (i = 0; i < len; i += 4) {
+ scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[i + 1]);
+ scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[i + 2]);
+ scratchCartographic.height = cartographicDegrees[i + 3];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+
+ result[i] = cartographicDegrees[i];
+ result[i + 1] = tmp.x;
+ result[i + 2] = tmp.y;
+ result[i + 3] = tmp.z;
+ }
+ }
+ }
+ }
+
+ function unwrapInterval(type, czmlInterval, sourceUri) {
+ switch (type) {
+ case Boolean:
+ return defaultValue(czmlInterval.boolean, czmlInterval);
+ case Cartesian2:
+ return czmlInterval.cartesian2;
+ case Cartesian3:
+ return unwrapCartesianInterval(czmlInterval);
+ case Color:
+ return unwrapColorInterval(czmlInterval);
+ case HorizontalOrigin:
+ return HorizontalOrigin[defaultValue(czmlInterval.horizontalOrigin, czmlInterval)];
+ case Image:
+ return unwrapImageInterval(czmlInterval, sourceUri);
+ case LabelStyle:
+ return LabelStyle[defaultValue(czmlInterval.labelStyle, czmlInterval)];
+ case Number:
+ return defaultValue(czmlInterval.number, czmlInterval);
+ case String:
+ return defaultValue(czmlInterval.string, czmlInterval);
+ case Quaternion:
+ return czmlInterval.unitQuaternion;
+ case VerticalOrigin:
+ return VerticalOrigin[defaultValue(czmlInterval.verticalOrigin, czmlInterval)];
+ default:
+ throw new DeveloperError(type);
+ }
+ }
+
function processProperty(type, object, propertyName, packetData, constrainedInterval, sourceUri) {
var combinedInterval;
var packetInterval = packetData.interval;
@@ -31,12 +222,16 @@ define([
combinedInterval = constrainedInterval;
}
- var unwrappedInterval = type.unwrapInterval(packetData, sourceUri);
+ var unwrappedInterval = unwrapInterval(type, packetData, sourceUri);
var hasInterval = defined(combinedInterval) && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
- var isSampled = type.isSampled(unwrappedInterval);
+ var isSampled = typeof unwrappedInterval !== 'string' && defined(unwrappedInterval.length) && defined(type) && defined(type.length) && (unwrappedInterval.length > type.length);
if (!isSampled && !hasInterval) {
- object[propertyName] = new ConstantProperty(type.getValue(unwrappedInterval));
+ if (defined(type.unpack)) {
+ object[propertyName] = new ConstantProperty(type.unpack(unwrappedInterval, 0));
+ } else {
+ object[propertyName] = new ConstantProperty(unwrappedInterval);
+ }
return true;
}
@@ -44,7 +239,11 @@ define([
var property = object[propertyName];
if (!isSampled && hasInterval) {
combinedInterval = combinedInterval.clone();
- combinedInterval.data = type.getValue(unwrappedInterval);
+ if (defined(type.unpack)) {
+ combinedInterval.data = type.unpack(unwrappedInterval, 0);
+ } else {
+ combinedInterval.data = unwrappedInterval;
+ }
if (!defined(property)) {
property = new TimeIntervalCollectionProperty();
@@ -55,11 +254,11 @@ define([
if (property instanceof TimeIntervalCollectionProperty) {
property.getIntervals().addInterval(combinedInterval);
} else {
- //TODO
+ //TODO Morph to CompositeProperty
}
} else if (isSampled && !hasInterval) {
if (!(property instanceof SampledProperty)) {
- property = new SampledProperty(type.type);
+ property = new SampledProperty(type);
object[propertyName] = property;
propertyCreated = true;
}
@@ -78,17 +277,17 @@ define([
intervalData = interval.data;
} else {
interval = combinedInterval.clone();
- intervalData = new SampledProperty(type.type);
+ intervalData = new SampledProperty(type);
interval.data = intervalData;
intervals.addInterval(interval);
}
if (!(intervalData instanceof SampledProperty)) {
- intervalData = new SampledProperty(type.type);
+ intervalData = new SampledProperty(type);
interval.Data = intervalData;
}
intervalData.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
} else {
- //TODO
+ //TODO Morph to CompositeProperty
}
}
return propertyCreated;
diff --git a/Specs/DynamicScene/CzmlBooleanSpec.js b/Specs/DynamicScene/CzmlBooleanSpec.js
deleted file mode 100644
index 12b50f07315c..000000000000
--- a/Specs/DynamicScene/CzmlBooleanSpec.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlBoolean'
- ], function(
- CzmlBoolean) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var simpleBoolean = true;
-
- var constantBooleanInterval = {
- boolean : false
- };
-
- it('unwrapInterval', function() {
- expect(CzmlBoolean.unwrapInterval(simpleBoolean)).toEqual(simpleBoolean);
- expect(CzmlBoolean.unwrapInterval(constantBooleanInterval)).toEqual(constantBooleanInterval.boolean);
- });
-
- it('isSampled', function() {
- expect(CzmlBoolean.isSampled()).toEqual(false);
- });
-
- it('getValue', function() {
- expect(CzmlBoolean.getValue(simpleBoolean)).toEqual(simpleBoolean);
- expect(CzmlBoolean.getValue(constantBooleanInterval.boolean)).toEqual(constantBooleanInterval.boolean);
- });
-});
diff --git a/Specs/DynamicScene/CzmlCartesian2Spec.js b/Specs/DynamicScene/CzmlCartesian2Spec.js
deleted file mode 100644
index 1d4c28a5b414..000000000000
--- a/Specs/DynamicScene/CzmlCartesian2Spec.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlCartesian2',
- 'Core/Cartesian2'
- ], function(
- CzmlCartesian2,
- Cartesian2) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var cartesian1 = new Cartesian2(123.456, 789.101112);
- var cartesian2 = new Cartesian2(789.101112, 123.456);
-
- var constantCartesianInterval = {
- cartesian2 : [cartesian1.x, cartesian1.y]
- };
-
- var sampledCartesianInterval = {
- cartesian2 : [0, cartesian1.x, cartesian1.y, 1, cartesian2.x, cartesian2.y]
- };
-
- it('unwrapInterval', function() {
- expect(CzmlCartesian2.unwrapInterval(constantCartesianInterval)).toEqual(constantCartesianInterval.cartesian2);
- expect(CzmlCartesian2.unwrapInterval(sampledCartesianInterval)).toEqual(sampledCartesianInterval.cartesian2);
- });
-
- it('isSampled', function() {
- expect(CzmlCartesian2.isSampled(constantCartesianInterval.cartesian2)).toEqual(false);
- expect(CzmlCartesian2.isSampled(sampledCartesianInterval.cartesian2)).toEqual(true);
- });
-
- it('getValue', function() {
- expect(CzmlCartesian2.getValue(constantCartesianInterval.cartesian2)).toEqual(cartesian1);
- });
-});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CzmlCartesian3Spec.js b/Specs/DynamicScene/CzmlCartesian3Spec.js
deleted file mode 100644
index fec4f26bf7af..000000000000
--- a/Specs/DynamicScene/CzmlCartesian3Spec.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlCartesian3',
- 'Core/Cartesian3'
- ], function(
- CzmlCartesian3,
- Cartesian3) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var cartesian1 = new Cartesian3(123.456, 789.101112, 321.312);
- var cartesian2 = new Cartesian3(789.101112, 123.456, 521.312);
-
- var constantCartesianInterval = {
- cartesian : [cartesian1.x, cartesian1.y, cartesian1.z]
- };
-
- var sampledCartesianInterval = {
- cartesian : [0, cartesian1.x, cartesian1.y, cartesian1.z, 1, cartesian2.x, cartesian2.y, cartesian2.z]
- };
-
- it('unwrapInterval', function() {
- expect(CzmlCartesian3.unwrapInterval(constantCartesianInterval)).toEqual(constantCartesianInterval.cartesian);
- expect(CzmlCartesian3.unwrapInterval(sampledCartesianInterval)).toEqual(sampledCartesianInterval.cartesian);
- });
-
- it('isSampled', function() {
- expect(CzmlCartesian3.isSampled(constantCartesianInterval.cartesian)).toEqual(false);
- expect(CzmlCartesian3.isSampled(sampledCartesianInterval.cartesian)).toEqual(true);
- });
-
- it('getValue', function() {
- expect(CzmlCartesian3.getValue(constantCartesianInterval.cartesian)).toEqual(cartesian1);
- });
-});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CzmlColorSpec.js b/Specs/DynamicScene/CzmlColorSpec.js
deleted file mode 100644
index 5a490c2322dd..000000000000
--- a/Specs/DynamicScene/CzmlColorSpec.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlColor',
- 'Core/Color'
- ], function(
- CzmlColor,
- Color) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var constantRgbaInterval = {
- rgba : [1, 2, 3, 4]
- };
-
- var constantRgbafInterval = {
- rgbaf : [Color.byteToFloat(1), Color.byteToFloat(2), Color.byteToFloat(3), Color.byteToFloat(4)]
- };
-
- var sampledRgbaInterval = {
- rgba : [0, 1, 2, 3, 4, 1, 5, 6, 7, 8]
- };
-
- var sampledRgbafInterval = {
- rgbaf : [0, Color.byteToFloat(1), Color.byteToFloat(2), Color.byteToFloat(3), Color.byteToFloat(4), 1, Color.byteToFloat(5), Color.byteToFloat(6), Color.byteToFloat(7), Color.byteToFloat(8)]
- };
-
- var color1 = new Color(sampledRgbafInterval.rgbaf[1], sampledRgbafInterval.rgbaf[2], sampledRgbafInterval.rgbaf[3], sampledRgbafInterval.rgbaf[4]);
-
- it('unwrapInterval', function() {
- expect(CzmlColor.unwrapInterval(constantRgbaInterval)).toEqual(constantRgbafInterval.rgbaf);
- expect(CzmlColor.unwrapInterval(constantRgbafInterval)).toEqual(constantRgbafInterval.rgbaf);
- expect(CzmlColor.unwrapInterval(sampledRgbaInterval)).toEqual(sampledRgbafInterval.rgbaf);
- expect(CzmlColor.unwrapInterval(sampledRgbafInterval)).toEqual(sampledRgbafInterval.rgbaf);
- });
-
- it('isSampled', function() {
- expect(CzmlColor.isSampled(sampledRgbaInterval.rgba)).toEqual(true);
- expect(CzmlColor.isSampled(sampledRgbafInterval.rgbaf)).toEqual(true);
- });
-
- it('getValue', function() {
- expect(CzmlColor.getValue(constantRgbafInterval.rgbaf)).toEqual(color1);
- });
-});
diff --git a/Specs/DynamicScene/CzmlDataSourceSpec.js b/Specs/DynamicScene/CzmlDataSourceSpec.js
deleted file mode 100644
index c1db37619afe..000000000000
--- a/Specs/DynamicScene/CzmlDataSourceSpec.js
+++ /dev/null
@@ -1,404 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlDataSource',
- 'DynamicScene/DynamicBillboard',
- 'DynamicScene/DynamicObjectCollection',
- 'Core/ClockRange',
- 'Core/ClockStep',
- 'Core/defined',
- 'Core/Event',
- 'Core/loadJson',
- 'Core/JulianDate',
- 'Core/TimeInterval',
- 'ThirdParty/when'
- ], function(
- CzmlDataSource,
- DynamicBillboard,
- DynamicObjectCollection,
- ClockRange,
- ClockStep,
- defined,
- Event,
- loadJson,
- JulianDate,
- TimeInterval,
- when) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var staticCzml = {
- 'id' : 'test',
- 'billboard' : {
- 'show' : true
- }
- };
-
- var dynamicCzml = {
- id : 'test',
- availability : '2000-01-01/2001-01-01',
- billboard : {
- show : true
- }
- };
-
- var clockCzml = {
- id : 'document',
- clock : {
- interval : '2012-03-15T10:00:00Z/2012-03-16T10:00:00Z',
- currentTime : '2012-03-15T10:00:00Z',
- multiplier : 60.0,
- range : 'LOOP_STOP',
- step : 'SYSTEM_CLOCK_MULTIPLIER'
- }
- };
-
- var simple;
- var simpleUrl = 'Data/CZML/simple.czml';
- var vehicle;
- var vehicleUrl = 'Data/CZML/Vehicle.czml';
-
- beforeAll(function() {
- loadJson(simpleUrl).then(function(result) {
- simple = result;
- });
- loadJson(vehicleUrl).then(function(result) {
- vehicle = result;
- });
- });
-
- var parsedClock = {
- interval : TimeInterval.fromIso8601(clockCzml.clock.interval),
- currentTime : JulianDate.fromIso8601(clockCzml.clock.currentTime),
- multiplier : clockCzml.clock.multiplier,
- range : ClockRange[clockCzml.clock.range],
- step : ClockStep[clockCzml.clock.step]
- };
-
- it('default constructor has expected values', function() {
- var dataSource = new CzmlDataSource();
- expect(dataSource.getChangedEvent()).toBeInstanceOf(Event);
- expect(dataSource.getErrorEvent()).toBeInstanceOf(Event);
- expect(dataSource.getClock()).toBeUndefined();
- expect(dataSource.getDynamicObjectCollection()).toBeInstanceOf(DynamicObjectCollection);
- expect(dataSource.getDynamicObjectCollection().getObjects().length).toEqual(0);
- expect(dataSource.getIsTimeVarying()).toEqual(true);
- });
-
- it('getClock returns undefined for static CZML', function() {
- var dataSource = new CzmlDataSource();
- dataSource.load(staticCzml);
- expect(dataSource.getClock()).toBeUndefined();
- });
-
- it('getClock returns CZML defined clock', function() {
- var dataSource = new CzmlDataSource();
- dataSource.load(clockCzml);
- var clock = dataSource.getClock();
- expect(clock).toBeDefined();
- expect(clock.startTime).toEqual(parsedClock.interval.start);
- expect(clock.stopTime).toEqual(parsedClock.interval.stop);
- expect(clock.currentTime).toEqual(parsedClock.currentTime);
- expect(clock.clockRange).toEqual(parsedClock.range);
- expect(clock.clockStep).toEqual(parsedClock.step);
- expect(clock.multiplier).toEqual(parsedClock.multiplier);
- });
-
- it('getClock returns data interval if no clock defined', function() {
- var interval = TimeInterval.fromIso8601(dynamicCzml.availability);
-
- var dataSource = new CzmlDataSource();
- dataSource.load(dynamicCzml);
- var clock = dataSource.getClock();
- expect(clock).toBeDefined();
- expect(clock.startTime).toEqual(interval.start);
- expect(clock.stopTime).toEqual(interval.stop);
- expect(clock.currentTime).toEqual(interval.start);
- expect(clock.clockRange).toEqual(ClockRange.LOOP_STOP);
- expect(clock.clockStep).toEqual(ClockStep.SYSTEM_CLOCK_MULTIPLIER);
- expect(clock.multiplier).toEqual(interval.start.getSecondsDifference(interval.stop) / 120.0);
- });
-
- it('processUrl loads expected data', function() {
- var dataSource = new CzmlDataSource();
- dataSource.processUrl(simpleUrl);
- waitsFor(function() {
- return dataSource.getDynamicObjectCollection().getObjects().length === 12;
- });
- });
-
- it('processUrl loads data on top of existing', function() {
- var dataSource = new CzmlDataSource();
- dataSource.processUrl(simpleUrl);
- waitsFor(function() {
- return dataSource.getDynamicObjectCollection().getObjects().length === 12;
- });
-
- runs(function() {
- dataSource.processUrl(vehicleUrl);
- });
-
- waitsFor(function() {
- return dataSource.getDynamicObjectCollection().getObjects().length === 13;
- });
- });
-
- it('loadUrl replaces data', function() {
- var dataSource = new CzmlDataSource();
- dataSource.processUrl(simpleUrl);
- waitsFor(function() {
- return dataSource.getDynamicObjectCollection().getObjects().length === 12;
- });
-
- runs(function() {
- dataSource.loadUrl(vehicleUrl);
- });
-
- waitsFor(function() {
- return dataSource.getDynamicObjectCollection().getObjects().length === 1;
- });
- });
-
- it('process loads expected data', function() {
- waitsFor(function() {
- return defined(simple);
- });
-
- runs(function() {
- var dataSource = new CzmlDataSource();
- dataSource.process(simple, simpleUrl);
- expect(dataSource.getDynamicObjectCollection().getObjects().length).toEqual(12);
- });
- });
-
- it('process loads data on top of existing', function() {
- waitsFor(function() {
- return defined(simple) && defined(vehicle);
- });
-
- runs(function() {
- var dataSource = new CzmlDataSource();
- dataSource.process(simple, simpleUrl);
- expect(dataSource.getDynamicObjectCollection().getObjects().length === 12);
-
- dataSource.process(vehicle, vehicleUrl);
- expect(dataSource.getDynamicObjectCollection().getObjects().length === 13);
- });
- });
-
- it('load replaces data', function() {
- waitsFor(function() {
- return defined(simple) && defined(vehicle);
- });
-
- runs(function() {
- var dataSource = new CzmlDataSource();
- dataSource.process(simple, simpleUrl);
- expect(dataSource.getDynamicObjectCollection().getObjects().length).toEqual(12);
-
- dataSource.load(vehicle, vehicleUrl);
- expect(dataSource.getDynamicObjectCollection().getObjects().length).toEqual(1);
- });
- });
-
- it('process throws with undefined CZML', function() {
- var dataSource = new CzmlDataSource();
- expect(function() {
- dataSource.process(undefined);
- }).toThrow();
- });
-
- it('load throws with undefined CZML', function() {
- var dataSource = new CzmlDataSource();
- expect(function() {
- dataSource.load(undefined);
- }).toThrow();
- });
-
- it('processUrl throws with undefined Url', function() {
- var dataSource = new CzmlDataSource();
- expect(function() {
- dataSource.processUrl(undefined);
- }).toThrow();
- });
-
- it('loadUrl throws with undefined Url', function() {
- var dataSource = new CzmlDataSource();
- expect(function() {
- dataSource.loadUrl(undefined);
- }).toThrow();
- });
-
- it('raises error when an error occurs in loadUrl', function() {
- var dataSource = new CzmlDataSource();
-
- var spy = jasmine.createSpy('errorEvent');
- dataSource.getErrorEvent().addEventListener(spy);
-
- var promise = dataSource.loadUrl('Data/Images/Blue.png'); //not JSON
-
- var resolveSpy = jasmine.createSpy('resolve');
- var rejectSpy = jasmine.createSpy('reject');
- when(promise, resolveSpy, rejectSpy);
-
- waitsFor(function() {
- return rejectSpy.wasCalled;
- });
-
- runs(function() {
- expect(spy).toHaveBeenCalledWith(dataSource, jasmine.any(Error));
- expect(rejectSpy).toHaveBeenCalledWith(jasmine.any(Error));
- expect(resolveSpy).not.toHaveBeenCalled();
- });
- });
-
- it('raises error when an error occurs in processUrl', function() {
- var dataSource = new CzmlDataSource();
-
- var spy = jasmine.createSpy('errorEvent');
- dataSource.getErrorEvent().addEventListener(spy);
-
- var promise = dataSource.processUrl('Data/Images/Blue.png'); //not JSON
-
- var resolveSpy = jasmine.createSpy('resolve');
- var rejectSpy = jasmine.createSpy('reject');
- when(promise, resolveSpy, rejectSpy);
-
- waitsFor(function() {
- return rejectSpy.wasCalled;
- });
-
- runs(function() {
- expect(spy).toHaveBeenCalledWith(dataSource, jasmine.any(Error));
- expect(rejectSpy).toHaveBeenCalledWith(jasmine.any(Error));
- expect(resolveSpy).not.toHaveBeenCalled();
- });
- });
-
- var czml = {
- 'id' : 'test',
- 'billboard' : {
- 'show' : true
- },
- 'label' : {
- 'show' : false
- }
- };
-
- var czmlDelete = {
- 'id' : 'test',
- 'delete' : true
- };
-
- var czmlArray = [{
- 'id' : 'test',
- 'billboard' : {
- 'show' : true
- }
- }, {
- 'id' : 'test',
- 'label' : {
- 'show' : false
- }
- }];
-
- var czmlNoId = {
- 'billboard' : {
- 'show' : true
- }
- };
-
- it('processCzml throws if czml is undefined', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- expect(function() {
- CzmlDataSource.processCzml(undefined, dynamicObjectCollection);
- }).toThrow();
- });
-
- it('processCzml throws if dynamicObjectCollection is undefined', function() {
- expect(function() {
- CzmlDataSource.processCzml(czml, undefined);
- }).toThrow();
- });
-
- it('processCzml populates dynamicObjectCollection with expected data for an array of packets', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- CzmlDataSource.processCzml(czmlArray, dynamicObjectCollection);
-
- var testObject = dynamicObjectCollection.getObject('test');
- expect(testObject).toBeDefined();
- expect(testObject.billboard).toBeDefined();
- expect(testObject.billboard.show).toBeDefined();
- expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
- expect(testObject.label).toBeDefined();
- expect(testObject.label.show).toBeDefined();
- expect(testObject.label.show.getValue(new JulianDate())).toEqual(false);
- });
-
- it('processCzml deletes an existing object.', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- CzmlDataSource.processCzml(czml, dynamicObjectCollection);
-
- var objects = dynamicObjectCollection.getObjects();
- expect(objects.length).toEqual(1);
-
- CzmlDataSource.processCzml(czmlDelete, dynamicObjectCollection);
- expect(dynamicObjectCollection.getObjects().length).toEqual(0);
- expect(dynamicObjectCollection.getObject('test')).toBeUndefined();
- });
-
- it('processCzml populates dynamicObjectCollection with expected data for a single packet', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- CzmlDataSource.processCzml(czml, dynamicObjectCollection);
-
- var testObject = dynamicObjectCollection.getObject('test');
- expect(testObject).toBeDefined();
- expect(testObject.billboard).toBeDefined();
- expect(testObject.billboard.show).toBeDefined();
- expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
- expect(testObject.label).toBeDefined();
- expect(testObject.label.show).toBeDefined();
- expect(testObject.label.show.getValue(new JulianDate())).toEqual(false);
- });
-
- it('processCzml uses user-supplied updater functions', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- CzmlDataSource.processCzml(czml, dynamicObjectCollection, undefined, [DynamicBillboard.processCzmlPacket]);
-
- var testObject = dynamicObjectCollection.getObject('test');
- expect(testObject).toBeDefined();
- expect(testObject.billboard).toBeDefined();
- expect(testObject.billboard.show).toBeDefined();
- expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
- expect(testObject.label).toBeUndefined();
- });
-
- it('processCzml raises dynamicObjectCollection event', function() {
- var eventTriggered = false;
- var dynamicObjectCollection = new DynamicObjectCollection();
- dynamicObjectCollection.objectPropertiesChanged.addEventListener(function(dynamicObjectCollectionParam, updatedObjects) {
- expect(dynamicObjectCollectionParam).toEqual(dynamicObjectCollection);
- expect(updatedObjects.length).toEqual(1);
- expect(updatedObjects[0]).toEqual(dynamicObjectCollection.getObject('test'));
- expect(eventTriggered).toEqual(false);
- eventTriggered = true;
- });
- CzmlDataSource.processCzml(czml, dynamicObjectCollection);
- waitsFor(function() {
- return eventTriggered;
- });
- });
-
- it('processCzml creates a new object for packets with no id.', function() {
- var dynamicObjectCollection = new DynamicObjectCollection();
- CzmlDataSource.processCzml(czmlNoId, dynamicObjectCollection);
-
- var objects = dynamicObjectCollection.getObjects();
- expect(objects.length).toEqual(1);
- var testObject = objects[0];
- expect(testObject).toBeDefined();
- expect(testObject.id).toBeDefined();
- expect(testObject.billboard).toBeDefined();
- expect(testObject.billboard.show).toBeDefined();
- expect(testObject.billboard.show.getValue(new JulianDate())).toEqual(true);
- });
-});
diff --git a/Specs/DynamicScene/CzmlDirectionSpec.js b/Specs/DynamicScene/CzmlDirectionSpec.js
deleted file mode 100644
index 481efad3209e..000000000000
--- a/Specs/DynamicScene/CzmlDirectionSpec.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*global defineSuite*/
-defineSuite(['DynamicScene/CzmlDirection',
- 'Core/Cartesian3',
- 'Core/Spherical',
- 'Core/Math',
- 'Core/Ellipsoid'
- ], function(
- CzmlDirection,
- Cartesian3,
- Spherical,
- CesiumMath,
- Ellipsoid) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var spherical1 = new Spherical(0, 1.0);
- var spherical2 = new Spherical(1.0, 0.0);
- var cartesian1 = Cartesian3.fromSpherical(spherical1);
- var cartesian2 = Cartesian3.fromSpherical(spherical2);
-
- var constantCartesianInterval = {
- unitCartesian : [cartesian1.x, cartesian1.y, cartesian1.z]
- };
-
- var sampledCartesianInterval = {
- unitCartesian : [0, cartesian1.x, cartesian1.y, cartesian1.z, 1, cartesian2.x, cartesian2.y, cartesian2.z]
- };
-
- var constantSphericalInterval = {
- unitSpherical : [spherical1.clock, spherical1.cone]
- };
-
- var sampledSphericalInterval = {
- unitSpherical : [0, spherical1.clock, spherical1.cone, 1, spherical2.clock, spherical2.cone]
- };
-
- it('unwrapInterval', function() {
- expect(CzmlDirection.unwrapInterval(constantCartesianInterval)).toEqual(constantCartesianInterval.unitCartesian);
- expect(CzmlDirection.unwrapInterval(sampledCartesianInterval)).toEqual(sampledCartesianInterval.unitCartesian);
- });
-
- it('isSampled', function() {
- expect(CzmlDirection.isSampled(constantCartesianInterval.unitCartesian)).toEqual(false);
- expect(CzmlDirection.isSampled(sampledCartesianInterval.unitCartesian)).toEqual(true);
- });
-
- it('getValue', function() {
- expect(CzmlDirection.getValue(constantCartesianInterval.unitCartesian)).toEqual(cartesian1);
- });
-
- it('Spherical unwrapInterval', function() {
- expect(CzmlDirection.unwrapInterval(constantSphericalInterval)).toEqual(constantCartesianInterval.unitCartesian);
- expect(CzmlDirection.unwrapInterval(sampledSphericalInterval)).toEqual(sampledCartesianInterval.unitCartesian);
- });
-
- it('Spherical isSampled', function() {
- expect(CzmlDirection.isSampled(constantSphericalInterval.unitSpherical)).toEqual(false);
- expect(CzmlDirection.isSampled(sampledSphericalInterval.unitSpherical)).toEqual(true);
- });
-});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CzmlHorizontalOriginSpec.js b/Specs/DynamicScene/CzmlHorizontalOriginSpec.js
deleted file mode 100644
index a49c1e4d7ef2..000000000000
--- a/Specs/DynamicScene/CzmlHorizontalOriginSpec.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlHorizontalOrigin',
- 'Scene/HorizontalOrigin'
- ], function(
- CzmlHorizontalOrigin,
- HorizontalOrigin) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var simpleHorizontalOrigin = 'CENTER';
-
- var constantHorizontalOriginInterval = {
- horizontalOrigin : 'LEFT'
- };
-
- it('unwrapInterval', function() {
- expect(CzmlHorizontalOrigin.unwrapInterval(simpleHorizontalOrigin)).toEqual(simpleHorizontalOrigin);
- expect(CzmlHorizontalOrigin.unwrapInterval(constantHorizontalOriginInterval)).toEqual(constantHorizontalOriginInterval.horizontalOrigin);
- });
-
- it('isSampled', function() {
- expect(CzmlHorizontalOrigin.isSampled()).toEqual(false);
- });
-
- it('getValue', function() {
- expect(CzmlHorizontalOrigin.getValue(simpleHorizontalOrigin)).toEqual(HorizontalOrigin.CENTER);
- expect(CzmlHorizontalOrigin.getValue(constantHorizontalOriginInterval.horizontalOrigin)).toEqual(HorizontalOrigin.LEFT);
- });
-});
diff --git a/Specs/DynamicScene/CzmlImageSpec.js b/Specs/DynamicScene/CzmlImageSpec.js
deleted file mode 100644
index 2afb764f5791..000000000000
--- a/Specs/DynamicScene/CzmlImageSpec.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlImage'
- ], function(
- CzmlImage) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var simpleImage = 'foo.png';
-
- var constantImageInterval = {
- image : 'foo.png'
- };
-
- it('unwrapInterval works without a source uri', function() {
- expect(CzmlImage.unwrapInterval(simpleImage)).toEqual(simpleImage);
- expect(CzmlImage.unwrapInterval(constantImageInterval)).toEqual(constantImageInterval.image);
- });
-
- it('unwrapInterval resolves link with sourceUri', function() {
- expect(CzmlImage.unwrapInterval(simpleImage, "http://www.agi.com")).toEqual("http://www.agi.com/foo.png");
- expect(CzmlImage.unwrapInterval(simpleImage, "http://www.agi.com/data.czml")).toEqual("http://www.agi.com/foo.png");
- expect(CzmlImage.unwrapInterval(simpleImage, "http://www.agi.com/subdir/data.czml")).toEqual("http://www.agi.com/subdir/foo.png");
- expect(CzmlImage.unwrapInterval(constantImageInterval, "http://www.agi.com/someQuery?a=1&b=3")).toEqual("http://www.agi.com/foo.png");
- });
-
- it('unwrapInterval works with absolute urls', function() {
- var url = 'http://example.invalid/someDir/some.png';
- expect(CzmlImage.unwrapInterval(url, "http://www.agi.com")).toEqual(url);
- expect(CzmlImage.unwrapInterval(url, "http://www.agi.com/data.czml")).toEqual(url);
- expect(CzmlImage.unwrapInterval(url, "http://www.agi.com/subdir/data.czml")).toEqual(url);
-
- var interval = {
- image : url
- };
- expect(CzmlImage.unwrapInterval(interval, "http://www.agi.com/someQuery?a=1&b=3")).toEqual(url);
- });
-
- it('unwrapInterval works with data urls', function() {
- var dataUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIW2Nk+M/wHwAEBgIA5agATwAAAABJRU5ErkJggg==';
-
- expect(CzmlImage.unwrapInterval(dataUrl, "http://www.agi.com")).toEqual(dataUrl);
- expect(CzmlImage.unwrapInterval(dataUrl, "http://www.agi.com/data.czml")).toEqual(dataUrl);
- expect(CzmlImage.unwrapInterval(dataUrl, "http://www.agi.com/data.czml")).toEqual(dataUrl);
-
- var interval = {
- image : dataUrl
- };
- expect(CzmlImage.unwrapInterval(interval, "http://www.agi.com/someQuery?a=1&b=3")).toEqual(dataUrl);
- });
-
- it('isSampled always returns false', function() {
- expect(CzmlImage.isSampled()).toEqual(false);
- });
-
- it('getValue always returns the passed in parameter.', function() {
- expect(CzmlImage.getValue(simpleImage)).toBe(simpleImage);
- expect(CzmlImage.getValue(constantImageInterval.image)).toBe(constantImageInterval.image);
- });
-});
diff --git a/Specs/DynamicScene/CzmlLabelStyleSpec.js b/Specs/DynamicScene/CzmlLabelStyleSpec.js
deleted file mode 100644
index eb908cdad48f..000000000000
--- a/Specs/DynamicScene/CzmlLabelStyleSpec.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlLabelStyle',
- 'Scene/LabelStyle'
- ], function(
- CzmlLabelStyle,
- LabelStyle) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var simpleLabelStyle = 'FILL';
-
- var constantLabelStyleInterval = {
- labelStyle : 'OUTLINE'
- };
-
- it('unwrapInterval', function() {
- expect(CzmlLabelStyle.unwrapInterval(simpleLabelStyle)).toEqual(simpleLabelStyle);
- expect(CzmlLabelStyle.unwrapInterval(constantLabelStyleInterval)).toEqual(constantLabelStyleInterval.labelStyle);
- });
-
- it('isSampled', function() {
- expect(CzmlLabelStyle.isSampled()).toEqual(false);
- });
-
- it('getValue', function() {
- expect(CzmlLabelStyle.getValue(simpleLabelStyle)).toEqual(LabelStyle.FILL);
- expect(CzmlLabelStyle.getValue(constantLabelStyleInterval.labelStyle)).toEqual(LabelStyle.OUTLINE);
- });
-});
diff --git a/Specs/DynamicScene/CzmlNumberSpec.js b/Specs/DynamicScene/CzmlNumberSpec.js
deleted file mode 100644
index eb52aee5b60a..000000000000
--- a/Specs/DynamicScene/CzmlNumberSpec.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlNumber'
- ], function(
- CzmlNumber) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var simpleNumber = 0.5;
-
- var sampledNumberInterval = {
- number : [1, 2, 3, 4]
- };
-
- it('unwrapInterval', function() {
- expect(CzmlNumber.unwrapInterval(simpleNumber)).toEqual(simpleNumber);
- expect(CzmlNumber.unwrapInterval(sampledNumberInterval)).toEqual(sampledNumberInterval.number);
- });
-
- it('isSampled', function() {
- expect(CzmlNumber.isSampled(simpleNumber)).toEqual(false);
- expect(CzmlNumber.isSampled(sampledNumberInterval.number)).toEqual(true);
- });
-
- it('getValue', function() {
- expect(CzmlNumber.getValue(simpleNumber)).toEqual(simpleNumber);
- });
-});
diff --git a/Specs/DynamicScene/CzmlPositionSpec.js b/Specs/DynamicScene/CzmlPositionSpec.js
deleted file mode 100644
index 39460869a21d..000000000000
--- a/Specs/DynamicScene/CzmlPositionSpec.js
+++ /dev/null
@@ -1,71 +0,0 @@
-/*global defineSuite*/
-defineSuite(['DynamicScene/CzmlPosition',
- 'Core/Cartesian3',
- 'Core/Cartographic',
- 'Core/Math',
- 'Core/Ellipsoid'
- ], function(
- CzmlPosition,
- Cartesian3,
- Cartographic,
- CesiumMath,
- Ellipsoid) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var cartographic1 = new Cartographic(0, 1.0, 100);
- var cartographic2 = new Cartographic(1.0, 0.0, 1500);
- var cartesian1 = Ellipsoid.WGS84.cartographicToCartesian(cartographic1);
- var cartesian2 = Ellipsoid.WGS84.cartographicToCartesian(cartographic2);
-
- var constantCartesianInterval = {
- cartesian : [cartesian1.x, cartesian1.y, cartesian1.z]
- };
-
- var sampledCartesianInterval = {
- cartesian : [0, cartesian1.x, cartesian1.y, cartesian1.z, 1, cartesian2.x, cartesian2.y, cartesian2.z]
- };
-
- var constantCartographicInterval = {
- cartographicRadians : [cartographic1.longitude, cartographic1.latitude, cartographic1.height]
- };
-
- var constantCartographicDegreesInterval = {
- cartographicDegrees : [CesiumMath.toDegrees(cartographic1.longitude), CesiumMath.toDegrees(cartographic1.latitude), cartographic1.height]
- };
-
- var sampledCartographicInterval = {
- cartographicRadians : [0, cartographic1.longitude, cartographic1.latitude, cartographic1.height, 1, cartographic2.longitude, cartographic2.latitude, cartographic2.height]
- };
-
- var sampledCartographicDegreesInterval = {
- cartographicDegrees : [0, CesiumMath.toDegrees(cartographic1.longitude), CesiumMath.toDegrees(cartographic1.latitude), cartographic1.height, 1, CesiumMath.toDegrees(cartographic2.longitude),
- CesiumMath.toDegrees(cartographic2.latitude), cartographic2.height]
- };
-
- it('unwrapInterval', function() {
- expect(CzmlPosition.unwrapInterval(constantCartesianInterval)).toEqual(constantCartesianInterval.cartesian);
- expect(CzmlPosition.unwrapInterval(sampledCartesianInterval)).toEqual(sampledCartesianInterval.cartesian);
- });
-
- it('isSampled', function() {
- expect(CzmlPosition.isSampled(constantCartesianInterval.cartesian)).toEqual(false);
- expect(CzmlPosition.isSampled(sampledCartesianInterval.cartesian)).toEqual(true);
- });
-
- it('getValue', function() {
- expect(CzmlPosition.getValue(constantCartesianInterval.cartesian)).toEqual(cartesian1);
- });
-
- it('Cartographic unwrapInterval', function() {
- expect(CzmlPosition.unwrapInterval(constantCartographicInterval)).toEqual(constantCartesianInterval.cartesian);
- expect(CzmlPosition.unwrapInterval(constantCartographicDegreesInterval)).toEqual(constantCartesianInterval.cartesian);
- expect(CzmlPosition.unwrapInterval(sampledCartographicInterval)).toEqual(sampledCartesianInterval.cartesian);
- expect(CzmlPosition.unwrapInterval(sampledCartographicDegreesInterval)).toEqual(sampledCartesianInterval.cartesian);
- });
-
- it('Cartographic isSampled', function() {
- expect(CzmlPosition.isSampled(constantCartographicInterval.cartographicRadians)).toEqual(false);
- expect(CzmlPosition.isSampled(sampledCartographicInterval.cartographicRadians)).toEqual(true);
- });
-});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CzmlStringSpec.js b/Specs/DynamicScene/CzmlStringSpec.js
deleted file mode 100644
index 849ab726d130..000000000000
--- a/Specs/DynamicScene/CzmlStringSpec.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlString'
- ], function(
- CzmlString) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var simpleString = 'some Value';
-
- var constantStringInterval = {
- string : 'some other value'
- };
-
- it('unwrapInterval', function() {
- expect(CzmlString.unwrapInterval(simpleString)).toEqual(simpleString);
- expect(CzmlString.unwrapInterval(constantStringInterval)).toEqual(constantStringInterval.string);
- });
-
- it('isSampled', function() {
- expect(CzmlString.isSampled()).toEqual(false);
- });
-
- it('getValue', function() {
- expect(CzmlString.getValue(simpleString)).toEqual(simpleString);
- expect(CzmlString.getValue(constantStringInterval.string)).toEqual(constantStringInterval.string);
- });
-});
diff --git a/Specs/DynamicScene/CzmlUnitCartesian3Spec.js b/Specs/DynamicScene/CzmlUnitCartesian3Spec.js
deleted file mode 100644
index d26b0a2d2462..000000000000
--- a/Specs/DynamicScene/CzmlUnitCartesian3Spec.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlUnitCartesian3',
- 'Core/Cartesian3',
- 'Core/Math'
- ], function(
- CzmlUnitCartesian3,
- Cartesian3,
- CesiumMath) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var cartesian1 = new Cartesian3(1, 2, 3).normalize();
- var cartesian2 = new Cartesian3(4, 5, 6).normalize();
-
- var constantCartesianInterval = {
- unitCartesian : [cartesian1.x, cartesian1.y, cartesian1.z]
- };
-
- var sampledCartesianInterval = {
- unitCartesian : [0, cartesian1.x, cartesian1.y, cartesian1.z, 1, cartesian2.x, cartesian2.y, cartesian2.z]
- };
-
- it('unwrapInterval', function() {
- expect(CzmlUnitCartesian3.unwrapInterval(constantCartesianInterval)).toEqual(constantCartesianInterval.unitCartesian);
- expect(CzmlUnitCartesian3.unwrapInterval(sampledCartesianInterval)).toEqual(sampledCartesianInterval.unitCartesian);
- });
-
- it('isSampled', function() {
- expect(CzmlUnitCartesian3.isSampled(constantCartesianInterval.unitCartesian)).toEqual(false);
- expect(CzmlUnitCartesian3.isSampled(sampledCartesianInterval.unitCartesian)).toEqual(true);
- });
-
- it('getValue', function() {
- expect(CzmlUnitCartesian3.getValue(constantCartesianInterval.unitCartesian)).toEqual(cartesian1);
- });
-});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CzmlUnitQuaternionSpec.js b/Specs/DynamicScene/CzmlUnitQuaternionSpec.js
deleted file mode 100644
index 79faba761512..000000000000
--- a/Specs/DynamicScene/CzmlUnitQuaternionSpec.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlUnitQuaternion',
- 'Core/Quaternion',
- 'Core/Math'
- ], function(
- CzmlUnitQuaternion,
- Quaternion,
- CesiumMath) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var quaternion1 = new Quaternion(1, 2, 3, 4).normalize();
- var quaternion2 = new Quaternion(4, 5, 6, 7).normalize();
-
- var constantQuaternionInterval = {
- unitQuaternion : [quaternion1.x, quaternion1.y, quaternion1.z, quaternion1.w]
- };
-
- var sampledQuaternionInterval = {
- unitQuaternion : [0, quaternion1.x, quaternion1.y, quaternion1.z, quaternion1.w, 1, quaternion2.x, quaternion2.y, quaternion2.z, quaternion2.w]
- };
-
- it('unwrapInterval', function() {
- expect(CzmlUnitQuaternion.unwrapInterval(constantQuaternionInterval)).toEqual(constantQuaternionInterval.unitQuaternion);
- expect(CzmlUnitQuaternion.unwrapInterval(sampledQuaternionInterval)).toEqual(sampledQuaternionInterval.unitQuaternion);
- });
-
- it('isSampled', function() {
- expect(CzmlUnitQuaternion.isSampled(constantQuaternionInterval.unitQuaternion)).toEqual(false);
- expect(CzmlUnitQuaternion.isSampled(sampledQuaternionInterval.unitQuaternion)).toEqual(true);
- });
-
- it('getValue', function() {
- expect(CzmlUnitQuaternion.getValue(constantQuaternionInterval.unitQuaternion)).toEqualEpsilon(quaternion1, CesiumMath.EPSILON15);
- });
-});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CzmlVerticalOriginSpec.js b/Specs/DynamicScene/CzmlVerticalOriginSpec.js
deleted file mode 100644
index 2d151110651b..000000000000
--- a/Specs/DynamicScene/CzmlVerticalOriginSpec.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/CzmlVerticalOrigin',
- 'Scene/VerticalOrigin'
- ], function(
- CzmlVerticalOrigin,
- VerticalOrigin) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var simpleVerticalOrigin = 'CENTER';
-
- var constantVerticalOriginInterval = {
- verticalOrigin : 'LEFT'
- };
-
- it('unwrapInterval', function() {
- expect(CzmlVerticalOrigin.unwrapInterval(simpleVerticalOrigin)).toEqual(simpleVerticalOrigin);
- expect(CzmlVerticalOrigin.unwrapInterval(constantVerticalOriginInterval)).toEqual(constantVerticalOriginInterval.verticalOrigin);
- });
-
- it('isSampled', function() {
- expect(CzmlVerticalOrigin.isSampled()).toEqual(false);
- });
-
- it('getValue', function() {
- expect(CzmlVerticalOrigin.getValue(simpleVerticalOrigin)).toEqual(VerticalOrigin.CENTER);
- expect(CzmlVerticalOrigin.getValue(constantVerticalOriginInterval.verticalOrigin)).toEqual(VerticalOrigin.LEFT);
- });
-});
From baf7a021c02f2443306f316bcd1f11fe65d475c8 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 14 Aug 2013 17:01:31 -0400
Subject: [PATCH 17/65] Rename length to packedLength and other minor cleanup.
---
Source/Core/Cartesian2.js | 2 +-
Source/Core/Cartesian3.js | 2 +-
Source/Core/Color.js | 2 +-
Source/Core/InterpolatableNumber.js | 2 +-
Source/Core/Quaternion.js | 4 +--
Source/DynamicScene/SampledProperty.js | 38 ++++++++++++++---------
Source/DynamicScene/processPacketData.js | 6 ++--
Specs/DynamicScene/SampledPropertySpec.js | 14 ++++-----
8 files changed, 39 insertions(+), 31 deletions(-)
diff --git a/Source/Core/Cartesian2.js b/Source/Core/Cartesian2.js
index a9efdb75d0dc..e19236db5299 100644
--- a/Source/Core/Cartesian2.js
+++ b/Source/Core/Cartesian2.js
@@ -148,7 +148,7 @@ define([
*/
Cartesian2.fromCartesian4 = Cartesian2.clone;
- Cartesian2.length = 2;
+ Cartesian2.packedLength = 2;
Cartesian2.pack = function(array, startingIndex, value) {
array[startingIndex++] = value.x;
diff --git a/Source/Core/Cartesian3.js b/Source/Core/Cartesian3.js
index 963308e201d3..f62f151fb98c 100644
--- a/Source/Core/Cartesian3.js
+++ b/Source/Core/Cartesian3.js
@@ -173,7 +173,7 @@ define([
*/
Cartesian3.fromCartesian4 = Cartesian3.clone;
- Cartesian3.length = 3;
+ Cartesian3.packedLength = 3;
Cartesian3.pack = function(array, startingIndex, value) {
array[startingIndex++] = value.x;
diff --git a/Source/Core/Color.js b/Source/Core/Color.js
index c68fdf2ef0b3..b34f05bda19b 100644
--- a/Source/Core/Color.js
+++ b/Source/Core/Color.js
@@ -228,7 +228,7 @@ define([
return undefined;
};
- Color.length = 4;
+ Color.packedLength = 4;
Color.pack = function(array, startingIndex, value) {
array[startingIndex++] = value.red;
diff --git a/Source/Core/InterpolatableNumber.js b/Source/Core/InterpolatableNumber.js
index 8ac356ef7ee3..899b8333de47 100644
--- a/Source/Core/InterpolatableNumber.js
+++ b/Source/Core/InterpolatableNumber.js
@@ -4,7 +4,7 @@ define(['../Core/DeveloperError'], function(DeveloperError) {
var InterpolatableNumber = {};
- InterpolatableNumber.length = 1;
+ InterpolatableNumber.packedLength = 1;
InterpolatableNumber.pack = function(array, startingIndex, value) {
array[startingIndex++] = value;
diff --git a/Source/Core/Quaternion.js b/Source/Core/Quaternion.js
index 5eec66e8d386..99979736dd1b 100644
--- a/Source/Core/Quaternion.js
+++ b/Source/Core/Quaternion.js
@@ -180,9 +180,9 @@ define([
var sampledQuaternionQuaternion0 = new Quaternion();
var sampledQuaternionQuaternion0Conjugate = new Quaternion();
- Quaternion.length = 4;
+ Quaternion.packedLength = 4;
- Quaternion.interpolationLength = 3;
+ Quaternion.packedInterpolationLength = 3;
Quaternion.pack = function(array, startingIndex, value) {
array[startingIndex++] = value.x;
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 5481ce701586..dbb6791efe4a 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -4,6 +4,7 @@ define([
'../Core/defaultValue',
'../Core/defined',
'../Core/DeveloperError',
+ '../Core/InterpolatableNumber',
'../Core/JulianDate',
'../Core/LinearApproximation'
], function(
@@ -11,6 +12,7 @@ define([
defaultValue,
defined,
DeveloperError,
+ InterpolatableNumber,
JulianDate,
LinearApproximation) {
"use strict";
@@ -113,13 +115,19 @@ define([
}
this.type = type;
+
+ if (type === Number) {
+ type = InterpolatableNumber;
+ }
+
+ this._innerType = type;
this.interpolationAlgorithm = LinearApproximation;
this.interpolationDegree = 1;
this.numberOfPoints = LinearApproximation.getRequiredDataPoints(1);
this._times = [];
this._values = [];
this._xTable = new Array(this.numberOfPoints);
- this._yTable = new Array(this.numberOfPoints * defaultValue(type.interpolationLength, type.length), 1);
+ this._yTable = new Array(this.numberOfPoints * defaultValue(type.packedInterpolationLength, type.packedLength), 1);
};
/**
@@ -141,7 +149,7 @@ define([
* @exception {DeveloperError} time is required.
*/
SampledProperty.prototype.getValue = function(time, result) {
- var type = this.type;
+ var innerType = this._innerType;
var times = this._times;
var values = this._values;
var index = binarySearch(times, time, JulianDate.compare);
@@ -183,7 +191,7 @@ define([
var length = lastIndex - firstIndex + 1;
- var interpolationLength = defaultValue(type.length, type.interpolationLength);
+ var interpolationLength = defaultValue(innerType.packedLength, innerType.packedInterpolationLength);
var xTable = this._xTable;
var yTable = this._yTable;
@@ -196,7 +204,7 @@ define([
for ( var i = 0; i < length; ++i) {
xTable[i] = times[lastIndex].getSecondsDifference(times[firstIndex + i]);
}
- var specializedPackFunction = type.packForInterpolation;
+ var specializedPackFunction = innerType.packForInterpolation;
if (!defined(specializedPackFunction)) {
var destinationIndex = 0;
var sourceIndex = firstIndex * length;
@@ -215,34 +223,34 @@ define([
var x = times[lastIndex].getSecondsDifference(time);
interpolationScratch = this.interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, interpolationLength, interpolationScratch);
- if (!defined(type.unpackInterpolationResult)) {
- return type.unpack(interpolationScratch, 0, result);
+ if (!defined(innerType.unpackInterpolationResult)) {
+ return innerType.unpack(interpolationScratch, 0, result);
}
- return type.unpackInterpolationResult(interpolationScratch, result, values, firstIndex, lastIndex);
+ return innerType.unpackInterpolationResult(interpolationScratch, result, values, firstIndex, lastIndex);
}
- return type.unpack(this._values, index * type.length, result);
+ return innerType.unpack(this._values, index * innerType.packedLength, result);
};
SampledProperty.prototype.addSample = function(time, value) {
- var type = this.type;
+ var innerType = this._innerType;
var data = [time];
- type.pack(data, 1, value);
- _mergeNewSamples(undefined, this._times, this._values, data, type.length);
+ innerType.pack(data, 1, value);
+ _mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
};
SampledProperty.prototype.addSamples = function(times, values) {
- var type = this.type;
+ var innerType = this._innerType;
var length = times.length;
var data = [];
for ( var i = 0; i < length; i++) {
data.push(times[i]);
- type.pack(data, data.length, values[i]);
+ innerType.pack(data, data.length, values[i]);
}
- _mergeNewSamples(undefined, this._times, this._values, data, type.length);
+ _mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
};
SampledProperty.prototype.addSamplesFlatArray = function(data, epoch) {
- _mergeNewSamples(epoch, this._times, this._values, data, this.type.length);
+ _mergeNewSamples(epoch, this._times, this._values, data, this._innerType.packedLength);
};
//Exposed for testing.
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
index b8f9b938097d..06a9c0254f47 100644
--- a/Source/DynamicScene/processPacketData.js
+++ b/Source/DynamicScene/processPacketData.js
@@ -223,9 +223,11 @@ define([
}
var unwrappedInterval = unwrapInterval(type, packetData, sourceUri);
-
var hasInterval = defined(combinedInterval) && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
- var isSampled = typeof unwrappedInterval !== 'string' && defined(unwrappedInterval.length) && defined(type) && defined(type.length) && (unwrappedInterval.length > type.length);
+ var packedLength = defaultValue(type.packedLength, 1);
+ var unwrappedIntervalLength = defaultValue(unwrappedInterval.length, 1);
+ var isSampled = (typeof unwrappedInterval !== 'string') && unwrappedIntervalLength > packedLength;
+
if (!isSampled && !hasInterval) {
if (defined(type.unpack)) {
object[propertyName] = new ConstantProperty(type.unpack(unwrappedInterval, 0));
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index f8babdec0278..d1e94a1f9f72 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -1,12 +1,10 @@
/*global defineSuite*/
defineSuite([
'DynamicScene/SampledProperty',
- 'Core/JulianDate',
- 'Core/InterpolatableNumber'
+ 'Core/JulianDate'
], function(
SampledProperty,
- JulianDate,
- InterpolatableNumber) {
+ JulianDate) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -14,7 +12,7 @@ defineSuite([
var data = [0, 7, 1, 8, 2, 9];
var epoch = new JulianDate(0, 0);
- var property = new SampledProperty(InterpolatableNumber);
+ var property = new SampledProperty(Number);
property.addSamplesFlatArray(data, epoch);
expect(property.getIsTimeVarying()).toEqual(true);
expect(property.getValue(epoch)).toEqual(7);
@@ -25,7 +23,7 @@ defineSuite([
var values = [7, 8, 9];
var times = [new JulianDate(0, 0), new JulianDate(1, 0), new JulianDate(2, 0)];
- var property = new SampledProperty(InterpolatableNumber);
+ var property = new SampledProperty(Number);
property.addSample(times[0], values[0]);
property.addSample(times[1], values[1]);
property.addSample(times[2], values[2]);
@@ -40,7 +38,7 @@ defineSuite([
var values = [7, 8, 9];
var times = [new JulianDate(0, 0), new JulianDate(1, 0), new JulianDate(2, 0)];
- var property = new SampledProperty(InterpolatableNumber);
+ var property = new SampledProperty(Number);
property.addSamples(times, values);
expect(property.getValue(times[0])).toEqual(values[0]);
expect(property.getValue(times[1])).toEqual(values[1]);
@@ -52,7 +50,7 @@ defineSuite([
var value = 7;
var time = new JulianDate(0, 0);
- var property = new SampledProperty(InterpolatableNumber);
+ var property = new SampledProperty(Number);
property.addSample(time, value);
expect(property.getValue(time)).toEqual(value);
From a1ce45a3846fca0c314aa2f089acfd3b09fb4b20 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 14 Aug 2013 17:11:10 -0400
Subject: [PATCH 18/65] Fix and clarify `mergeNewSamples`.
---
Source/DynamicScene/SampledProperty.js | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index dbb6791efe4a..8c96cacdba9b 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -50,7 +50,7 @@ define([
return epoch.addSeconds(date);
}
- var _mergeNewSamples = function(epoch, times, values, newData, length) {
+ var _mergeNewSamples = function(epoch, times, values, newData, packedLength) {
var newDataIndex = 0;
var i;
var prevItem;
@@ -70,7 +70,7 @@ define([
timesInsertionPoint = ~timesInsertionPoint;
timesSpliceArgs = [];
- valuesInsertionPoint = timesInsertionPoint * length;
+ valuesInsertionPoint = timesInsertionPoint * packedLength;
valuesSpliceArgs = [];
prevItem = undefined;
nextTime = times[timesInsertionPoint];
@@ -81,7 +81,7 @@ define([
}
timesSpliceArgs.push(currentTime);
newDataIndex = newDataIndex + 1;
- for (i = 0; i < length; i++) {
+ for (i = 0; i < packedLength; i++) {
valuesSpliceArgs.push(newData[newDataIndex]);
newDataIndex = newDataIndex + 1;
}
@@ -92,9 +92,9 @@ define([
arrayInsert(times, timesInsertionPoint, timesSpliceArgs);
} else {
//Found an exact match
- for (i = 0; i < length; i++) {
+ for (i = 0; i < packedLength; i++) {
newDataIndex++;
- values[(timesInsertionPoint * length) + i] = newData[newDataIndex];
+ values[(timesInsertionPoint * packedLength) + i] = newData[newDataIndex];
}
newDataIndex++;
}
@@ -190,14 +190,14 @@ define([
}
var length = lastIndex - firstIndex + 1;
-
- var interpolationLength = defaultValue(innerType.packedLength, innerType.packedInterpolationLength);
+ var packedLength = innerType.packedLength;
+ var packedInterpolationLength = defaultValue(innerType.packedInterpolationLength, packedLength);
var xTable = this._xTable;
var yTable = this._yTable;
if (!defined(xTable)) {
xTable = this._xTable = new Array(this.numberOfPoints);
- yTable = this._yTable = new Array(this.numberOfPoints * interpolationLength);
+ yTable = this._yTable = new Array(this.numberOfPoints * packedInterpolationLength);
}
// Build the tables
@@ -207,8 +207,8 @@ define([
var specializedPackFunction = innerType.packForInterpolation;
if (!defined(specializedPackFunction)) {
var destinationIndex = 0;
- var sourceIndex = firstIndex * length;
- var stop = (lastIndex + 1) * length;
+ var sourceIndex = firstIndex * packedLength;
+ var stop = (lastIndex + 1) * packedLength;
while (sourceIndex < stop) {
yTable[destinationIndex] = values[sourceIndex];
@@ -221,7 +221,7 @@ define([
// Interpolate!
var x = times[lastIndex].getSecondsDifference(time);
- interpolationScratch = this.interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, interpolationLength, interpolationScratch);
+ interpolationScratch = this.interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, packedInterpolationLength, interpolationScratch);
if (!defined(innerType.unpackInterpolationResult)) {
return innerType.unpack(interpolationScratch, 0, result);
From 81df997ef489b1013cbec1b9942c84a0f6966512 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 14 Aug 2013 17:18:46 -0400
Subject: [PATCH 19/65] Start of settable interpolation algorithm for
SampledProperty.
---
Source/DynamicScene/SampledProperty.js | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 8c96cacdba9b..0a5d33b0a48f 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -121,13 +121,12 @@ define([
}
this._innerType = type;
- this.interpolationAlgorithm = LinearApproximation;
- this.interpolationDegree = 1;
- this.numberOfPoints = LinearApproximation.getRequiredDataPoints(1);
+ this._interpolationAlgorithm = LinearApproximation;
+ this._numberOfPoints = LinearApproximation.getRequiredDataPoints(1);
this._times = [];
this._values = [];
- this._xTable = new Array(this.numberOfPoints);
- this._yTable = new Array(this.numberOfPoints * defaultValue(type.packedInterpolationLength, type.packedLength), 1);
+ this._xTable = new Array(this._numberOfPoints);
+ this._yTable = new Array(this._numberOfPoints * defaultValue(type.packedInterpolationLength, type.packedLength), 1);
};
/**
@@ -154,7 +153,7 @@ define([
var values = this._values;
var index = binarySearch(times, time, JulianDate.compare);
if (index < 0) {
- if (times.length < this.numberOfPoints) {
+ if (times.length < this._numberOfPoints) {
return undefined;
}
index = ~index;
@@ -166,7 +165,7 @@ define([
var firstIndex = 0;
var lastIndex = times.length - 1;
- var degree = this.numberOfPoints - 1;
+ var degree = this._numberOfPoints - 1;
var pointsInCollection = lastIndex - firstIndex + 1;
if (pointsInCollection < degree + 1) {
@@ -195,11 +194,6 @@ define([
var xTable = this._xTable;
var yTable = this._yTable;
- if (!defined(xTable)) {
- xTable = this._xTable = new Array(this.numberOfPoints);
- yTable = this._yTable = new Array(this.numberOfPoints * packedInterpolationLength);
- }
-
// Build the tables
for ( var i = 0; i < length; ++i) {
xTable[i] = times[lastIndex].getSecondsDifference(times[firstIndex + i]);
@@ -221,7 +215,7 @@ define([
// Interpolate!
var x = times[lastIndex].getSecondsDifference(time);
- interpolationScratch = this.interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, packedInterpolationLength, interpolationScratch);
+ interpolationScratch = this._interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, packedInterpolationLength, interpolationScratch);
if (!defined(innerType.unpackInterpolationResult)) {
return innerType.unpack(interpolationScratch, 0, result);
From 178bbc980740f3f32064b0d2b5434b2da333549d Mon Sep 17 00:00:00 2001
From: mramato
Date: Wed, 14 Aug 2013 23:12:16 -0400
Subject: [PATCH 20/65] Add getter/setter for SampledProperty interpolation
algorithm
---
Source/DynamicScene/SampledProperty.js | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 0a5d33b0a48f..b40de0b3b979 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -126,7 +126,23 @@ define([
this._times = [];
this._values = [];
this._xTable = new Array(this._numberOfPoints);
- this._yTable = new Array(this._numberOfPoints * defaultValue(type.packedInterpolationLength, type.packedLength), 1);
+ this._yTable = new Array(this._numberOfPoints * defaultValue(type.packedInterpolationLength, type.packedLength));
+ };
+
+ SampledProperty.prototype.getInterpolationAlgorithm = function() {
+ return this._interpolationAlgorithm;
+ };
+
+ SampledProperty.prototype.setInterpolationAlgorithm = function(value) {
+ if (typeof value === 'undefined') {
+ throw new DeveloperError('value is required');
+ }
+
+ this._interpolationAlgorithm = value;
+ this._numberOfPoints = value.getRequiredDataPoints(1);
+ this._xTable.length = this._numberOfPoints;
+ var type = this._innerType;
+ this._yTable.length = this._numberOfPoints * defaultValue(type.packedInterpolationLength, type.packedLength);
};
/**
From b3ee3995f2bf0167cbf8f057b4f333e913b392cc Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 15 Aug 2013 13:22:29 -0400
Subject: [PATCH 21/65] Have Property implementaions use ES5 properties.
---
Source/DynamicScene/CompositeProperty.js | 41 +++++----
.../DynamicScene/ConstantPositionProperty.js | 41 +++++----
Source/DynamicScene/ConstantProperty.js | 24 ++++--
Source/DynamicScene/PositionProperty.js | 13 ++-
Source/DynamicScene/Property.js | 7 +-
Source/DynamicScene/ReferenceProperty.js | 26 +++---
Source/DynamicScene/SampledProperty.js | 83 ++++++++++++-------
.../TimeIntervalCollectionProperty.js | 43 ++++++----
Source/DynamicScene/processPacketData.js | 4 +-
Specs/DynamicScene/CompositePropertySpec.js | 12 +--
Specs/DynamicScene/ConstantPropertySpec.js | 8 +-
Specs/DynamicScene/SampledPropertySpec.js | 2 +-
.../TimeIntervalCollectionPropertySpec.js | 16 ++--
13 files changed, 185 insertions(+), 135 deletions(-)
diff --git a/Source/DynamicScene/CompositeProperty.js b/Source/DynamicScene/CompositeProperty.js
index f1cf5d853e22..0a60bb96a772 100644
--- a/Source/DynamicScene/CompositeProperty.js
+++ b/Source/DynamicScene/CompositeProperty.js
@@ -23,13 +23,30 @@ define([
this._intervals = new TimeIntervalCollection();
};
- /**
- * @memberof ConstantProperty
- * @returns {Boolean} Always returns true, since this property always varies with simulation time.
- */
- CompositeProperty.prototype.getIsTimeVarying = function() {
- return true;
- };
+ defineProperties(CompositeProperty.prototype, {
+ /**
+ * Always returns true, since this property always varies with simulation time.
+ * @memberof SampledProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return true;
+ }
+ },
+ /**
+ * Gets the interval collection.
+ * @memberof CompositeProperty.prototype
+ *
+ * @type {TimeIntervalCollection}
+ */
+ intervals : {
+ get : function() {
+ return this._intervals;
+ }
+ }
+ });
/**
* Returns the value of the property at the specified simulation time.
@@ -56,15 +73,5 @@ define([
return undefined;
};
- /**
- * Gets the interval collection.
- * @memberof CompositeProperty.prototype
- *
- * @type {TimeIntervalCollection}
- */
- CompositeProperty.prototype.getIntervals = function() {
- return this._intervals;
- };
-
return CompositeProperty;
});
\ No newline at end of file
diff --git a/Source/DynamicScene/ConstantPositionProperty.js b/Source/DynamicScene/ConstantPositionProperty.js
index 5a61a3409b4b..626bbc77c2db 100644
--- a/Source/DynamicScene/ConstantPositionProperty.js
+++ b/Source/DynamicScene/ConstantPositionProperty.js
@@ -4,6 +4,7 @@ define([
'./PositionProperty',
'../Core/Cartesian3',
'../Core/defaultValue',
+ '../Core/defineProperties',
'../Core/DeveloperError',
'../Core/ReferenceFrame'
], function(
@@ -11,6 +12,7 @@ define([
PositionProperty,
Cartesian3,
defaultValue,
+ defineProperties,
DeveloperError,
ReferenceFrame) {
"use strict";
@@ -28,23 +30,28 @@ define([
this._referenceFrame = defaultValue(referenceFrame, ReferenceFrame.FIXED);
};
- /**
- * @memberof ConstantPositionProperty
- * @returns {Boolean} Always returns false, since this property never varies with simulation time.
- */
- ConstantPositionProperty.prototype.getIsTimeVarying = function() {
- return this._property.getIsTimeVarying();
- };
-
- /**
- * Gets the reference frame that the position is defined in.
- *
- * @memberof PositionProperty
- * @returns {ReferenceFrame} The reference frame that the position is defined in.
- */
- ConstantPositionProperty.prototype.getReferenceFrame = function() {
- return this._referenceFrame;
- };
+ defineProperties(ConstantPositionProperty.prototype, {
+ /**
+ * Always returns true, since this property always varies with simulation time.
+ * @memberof SampledProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return false;
+ }
+ },
+ /**
+ * Gets the reference frame that the position is defined in.
+ * @Type {ReferenceFrame}
+ */
+ referenceFrame : {
+ get : function() {
+ return this._referenceFrame;
+ }
+ }
+ });
/**
* Returns the value of the property at the specified simulation time in the fixed frame.
diff --git a/Source/DynamicScene/ConstantProperty.js b/Source/DynamicScene/ConstantProperty.js
index e37c58aa5bc7..7483391880ea 100644
--- a/Source/DynamicScene/ConstantProperty.js
+++ b/Source/DynamicScene/ConstantProperty.js
@@ -2,11 +2,13 @@
define([
'../Core/defaultValue',
'../Core/defined',
+ '../Core/defineProperties',
'../Core/DeveloperError',
'../Core/Enumeration'
], function(
defaultValue,
defined,
+ defineProperties,
DeveloperError,
Enumeration) {
"use strict";
@@ -37,7 +39,7 @@ define([
throw new DeveloperError('value is required.');
}
- if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean' && !(value instanceof Enumeration) && !Array.isArray(value)) {
+ if (typeof value === 'object' && !Array.isArray(value) && !(value instanceof Enumeration)) {
if (typeof value.clone !== 'function' && typeof clone !== 'function') {
throw new DeveloperError('clone is a required function.');
}
@@ -49,13 +51,19 @@ define([
this._clone = defaultValue(clone, noClone);
};
- /**
- * @memberof ConstantProperty
- * @returns {Boolean} Always returns false, since this property never varies with simulation time.
- */
- ConstantProperty.prototype.getIsTimeVarying = function() {
- return false;
- };
+ defineProperties(ConstantProperty.prototype, {
+ /**
+ * Always returns false, since this property always varies with simulation time.
+ * @memberof ConstantProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return false;
+ }
+ }
+ });
/**
* Returns the value of the property at the specified simulation time.
diff --git a/Source/DynamicScene/PositionProperty.js b/Source/DynamicScene/PositionProperty.js
index abd02916a96f..055ccc83c499 100644
--- a/Source/DynamicScene/PositionProperty.js
+++ b/Source/DynamicScene/PositionProperty.js
@@ -35,21 +35,18 @@ define([
var PositionProperty = throwInstantiationError;
/**
- * If the property varies with simulation time, this function returns true. If the property
- * is constant or changes in ways not related to simulation time, this function returns false.
- *
+ * Gets a value indicating if the property varies with simulation time or is constant.
* @memberof PositionProperty
- * @returns {Boolean} True if the property varies with simulation time, false otherwise.
+ * @Type {Boolean}
*/
- PositionProperty.prototype.getIsTimeVarying = throwInstantiationError;
+ PositionProperty.prototype.isTimeVarying = undefined;
/**
* Gets the reference frame that the position is defined in.
- *
* @memberof PositionProperty
- * @returns {ReferenceFrame} The reference frame that the position is defined in.
+ * @Type {ReferenceFrame}
*/
- PositionProperty.prototype.getReferenceFrame = throwInstantiationError;
+ PositionProperty.prototype.referenceFrame = throwInstantiationError;
/**
* Returns the value of the property at the specified simulation time in the fixed frame.
diff --git a/Source/DynamicScene/Property.js b/Source/DynamicScene/Property.js
index 5910f00bf0ca..bda4f2b13ed8 100644
--- a/Source/DynamicScene/Property.js
+++ b/Source/DynamicScene/Property.js
@@ -26,13 +26,10 @@ define(['../Core/DeveloperError'
var Property = throwInstantiationError;
/**
- * If the property varies with simulation time, this function returns true. If the property
- * is constant or changes in ways not related to simulation time, this function returns false.
- *
+ * Gets a value indicating if the property varies with simulation time or is constant.
* @memberof Property
- * @returns {Boolean} True if the property varies with simulation time, false otherwise.
*/
- Property.prototype.getIsTimeVarying = throwInstantiationError;
+ Property.prototype.isTimeVarying = undefined;
/**
* Returns the value of the property at the specified simulation time.
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index 4c150a8144c7..63a12f9d158c 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -2,10 +2,12 @@
define([
'../Core/defaultValue',
'../Core/defined',
+ '../Core/defineProperties',
'../Core/DeveloperError'
], function(
defaultValue,
defined,
+ defineProperties,
DeveloperError) {
"use strict";
@@ -102,17 +104,19 @@ define([
return new ReferenceProperty(dynamicObjectCollection, parts[0], parts[1]);
};
- /**
- * If the property varies with simulation time, this function returns true. If the property
- * is constant or changes in ways not related to simulation time, this function returns false.
- *
- * @memberof Property
- * @returns {Boolean} True if the property varies with simulation time, false otherwise.
- */
- ReferenceProperty.prototype.getIsTimeVarying = function() {
- var targetProperty = resolve(this);
- return defined(targetProperty) ? targetProperty.getIsTimeVarying() : undefined;
- };
+ defineProperties(ReferenceProperty.prototype, {
+ /**
+ * True if the property varies with simulation time, false otherwise.
+ * @memberof ReferenceProperty
+ * Type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ var targetProperty = resolve(this);
+ return defined(targetProperty) ? targetProperty.isTimeVarying() : undefined;
+ }
+ }
+ });
/**
* Retrieves the value of the property at the specified time.
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index b40de0b3b979..e66f138b4e76 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -3,6 +3,7 @@ define([
'../Core/binarySearch',
'../Core/defaultValue',
'../Core/defined',
+ '../Core/defineProperties',
'../Core/DeveloperError',
'../Core/InterpolatableNumber',
'../Core/JulianDate',
@@ -11,6 +12,7 @@ define([
binarySearch,
defaultValue,
defined,
+ defineProperties,
DeveloperError,
InterpolatableNumber,
JulianDate,
@@ -101,6 +103,15 @@ define([
}
};
+ function updateTables(property) {
+ var numberOfPoints = Math.min(property._interpolationAlgorithm.getRequiredDataPoints(property._interpolationDegree), property._times.length);
+ if (numberOfPoints !== property._numberOfPoints) {
+ property._numberOfPoints = numberOfPoints;
+ property._xTable.length = numberOfPoints;
+ property._yTable.length = numberOfPoints * property._packedInterpolationLength;
+ }
+ }
+
/**
* A {@link Property} whose value never changes.
*
@@ -121,37 +132,47 @@ define([
}
this._innerType = type;
+ this._interpolationDegree = 1;
this._interpolationAlgorithm = LinearApproximation;
- this._numberOfPoints = LinearApproximation.getRequiredDataPoints(1);
this._times = [];
this._values = [];
- this._xTable = new Array(this._numberOfPoints);
- this._yTable = new Array(this._numberOfPoints * defaultValue(type.packedInterpolationLength, type.packedLength));
- };
-
- SampledProperty.prototype.getInterpolationAlgorithm = function() {
- return this._interpolationAlgorithm;
+ this._xTable = [];
+ this._yTable = [];
+ this._packedInterpolationLength = defaultValue(type.packedInterpolationLength, type.packedLength);
+ updateTables(this);
};
- SampledProperty.prototype.setInterpolationAlgorithm = function(value) {
- if (typeof value === 'undefined') {
- throw new DeveloperError('value is required');
+ defineProperties(SampledProperty.prototype, {
+ /**
+ * Always returns true, since this property always varies with simulation time.
+ * @memberof SampledProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return true;
+ }
+ },
+ interpolationDegree : {
+ get : function() {
+ return this._interpolationDegree;
+ },
+ set : function(value) {
+ this._interpolationDegree = value;
+ updateTables(this);
+ }
+ },
+ interpolationAlgorithm : {
+ get : function() {
+ return this._interpolationAlgorithm;
+ },
+ set : function(value) {
+ this._interpolationAlgorithm = value;
+ updateTables(this);
+ }
}
-
- this._interpolationAlgorithm = value;
- this._numberOfPoints = value.getRequiredDataPoints(1);
- this._xTable.length = this._numberOfPoints;
- var type = this._innerType;
- this._yTable.length = this._numberOfPoints * defaultValue(type.packedInterpolationLength, type.packedLength);
- };
-
- /**
- * @memberof SampledProperty
- * @returns {Boolean} Always returns true, since this property always varies with simulation time.
- */
- SampledProperty.prototype.getIsTimeVarying = function() {
- return true;
- };
+ });
/**
* Gets the value of the property, optionally cloning it.
@@ -169,7 +190,8 @@ define([
var values = this._values;
var index = binarySearch(times, time, JulianDate.compare);
if (index < 0) {
- if (times.length < this._numberOfPoints) {
+ var degree = this._numberOfPoints - 1;
+ if (degree < 1) {
return undefined;
}
index = ~index;
@@ -181,7 +203,6 @@ define([
var firstIndex = 0;
var lastIndex = times.length - 1;
- var degree = this._numberOfPoints - 1;
var pointsInCollection = lastIndex - firstIndex + 1;
if (pointsInCollection < degree + 1) {
@@ -205,8 +226,6 @@ define([
}
var length = lastIndex - firstIndex + 1;
- var packedLength = innerType.packedLength;
- var packedInterpolationLength = defaultValue(innerType.packedInterpolationLength, packedLength);
var xTable = this._xTable;
var yTable = this._yTable;
@@ -217,6 +236,7 @@ define([
var specializedPackFunction = innerType.packForInterpolation;
if (!defined(specializedPackFunction)) {
var destinationIndex = 0;
+ var packedLength = innerType.packedLength;
var sourceIndex = firstIndex * packedLength;
var stop = (lastIndex + 1) * packedLength;
@@ -231,7 +251,7 @@ define([
// Interpolate!
var x = times[lastIndex].getSecondsDifference(time);
- interpolationScratch = this._interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, packedInterpolationLength, interpolationScratch);
+ interpolationScratch = this._interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, this._packedInterpolationLength, interpolationScratch);
if (!defined(innerType.unpackInterpolationResult)) {
return innerType.unpack(interpolationScratch, 0, result);
@@ -246,6 +266,7 @@ define([
var data = [time];
innerType.pack(data, 1, value);
_mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
+ updateTables(this);
};
SampledProperty.prototype.addSamples = function(times, values) {
@@ -257,10 +278,12 @@ define([
innerType.pack(data, data.length, values[i]);
}
_mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
+ updateTables(this);
};
SampledProperty.prototype.addSamplesFlatArray = function(data, epoch) {
_mergeNewSamples(epoch, this._times, this._values, data, this._innerType.packedLength);
+ updateTables(this);
};
//Exposed for testing.
diff --git a/Source/DynamicScene/TimeIntervalCollectionProperty.js b/Source/DynamicScene/TimeIntervalCollectionProperty.js
index 32977963f90b..58fedfbebc77 100644
--- a/Source/DynamicScene/TimeIntervalCollectionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionProperty.js
@@ -29,13 +29,30 @@ define([
this._clone = clone;
};
- /**
- * @memberof TimeIntervalCollectionProperty
- * @returns {Boolean} Always returns true, since this property always varies with simulation time.
- */
- TimeIntervalCollectionProperty.prototype.getIsTimeVarying = function() {
- return true;
- };
+ defineProperties(TimeIntervalCollectionProperty.prototype, {
+ /**
+ * Always returns true, since this property always varies with simulation time.
+ * @memberof TimeIntervalCollectionProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return true;
+ }
+ },
+ /**
+ * Gets the interval collection.
+ * @memberof TimeIntervalCollectionProperty
+ *
+ * @type {TimeIntervalCollection}
+ */
+ intervals : {
+ get : function() {
+ return this._intervals;
+ }
+ }
+ });
/**
* Returns the value of the property at the specified simulation time.
@@ -55,7 +72,7 @@ define([
var interval = this._intervals.findIntervalContainingDate(time);
if (defined(interval)) {
var value = interval.data;
- if (defined(value) && typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean' && !(value instanceof Enumeration) && !Array.isArray(value)) {
+ if (defined(value) && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Enumeration)) {
if (typeof value.clone === 'function') {
return value.clone(result);
}
@@ -66,15 +83,5 @@ define([
return undefined;
};
- /**
- * Gets the interval collection.
- * @memberof TimeIntervalCollectionProperty
- *
- * @type {TimeIntervalCollection}
- */
- TimeIntervalCollectionProperty.prototype.getIntervals = function() {
- return this._intervals;
- };
-
return TimeIntervalCollectionProperty;
});
\ No newline at end of file
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
index 06a9c0254f47..3dfd172d649f 100644
--- a/Source/DynamicScene/processPacketData.js
+++ b/Source/DynamicScene/processPacketData.js
@@ -254,7 +254,7 @@ define([
}
if (property instanceof TimeIntervalCollectionProperty) {
- property.getIntervals().addInterval(combinedInterval);
+ property.intervals.addInterval(combinedInterval);
} else {
//TODO Morph to CompositeProperty
}
@@ -272,7 +272,7 @@ define([
propertyCreated = true;
}
if (property instanceof CompositeProperty) {
- var intervals = property.getIntervals();
+ var intervals = property.intervals;
var interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
var intervalData;
if (defined(interval)) {
diff --git a/Specs/DynamicScene/CompositePropertySpec.js b/Specs/DynamicScene/CompositePropertySpec.js
index b873d4d4f318..e5292fb2b281 100644
--- a/Specs/DynamicScene/CompositePropertySpec.js
+++ b/Specs/DynamicScene/CompositePropertySpec.js
@@ -18,8 +18,8 @@ defineSuite([
it('default constructor has expected values', function() {
var property = new CompositeProperty();
- expect(property.getIsTimeVarying()).toEqual(true);
- expect(property.getIntervals()).toBeInstanceOf(TimeIntervalCollection);
+ expect(property.isTimeVarying).toEqual(true);
+ expect(property.intervals).toBeInstanceOf(TimeIntervalCollection);
expect(property.getValue(new JulianDate())).toBeUndefined();
});
@@ -28,8 +28,8 @@ defineSuite([
var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantProperty(new Cartesian3(4, 5, 6)));
var property = new CompositeProperty();
- property.getIntervals().addInterval(interval1);
- property.getIntervals().addInterval(interval2);
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
var result1 = property.getValue(interval1.start);
expect(result1).not.toBe(interval1.data.getValue());
@@ -45,8 +45,8 @@ defineSuite([
var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantProperty(new Cartesian3(4, 5, 6)));
var property = new CompositeProperty();
- property.getIntervals().addInterval(interval1);
- property.getIntervals().addInterval(interval2);
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
var expected = new Cartesian3();
var result1 = property.getValue(interval1.start, expected);
diff --git a/Specs/DynamicScene/ConstantPropertySpec.js b/Specs/DynamicScene/ConstantPropertySpec.js
index 42f727592154..7df30d61e12a 100644
--- a/Specs/DynamicScene/ConstantPropertySpec.js
+++ b/Specs/DynamicScene/ConstantPropertySpec.js
@@ -11,7 +11,7 @@ defineSuite([
it('works with basic types', function() {
var expected = 5;
var property = new ConstantProperty(expected);
- expect(property.getIsTimeVarying()).toEqual(false);
+ expect(property.isTimeVarying).toEqual(false);
expect(property.getValue()).toBe(expected);
});
@@ -23,7 +23,7 @@ defineSuite([
return expected;
};
var property = new ConstantProperty(expected, cloneFunction);
- expect(property.getIsTimeVarying()).toEqual(false);
+ expect(property.isTimeVarying).toEqual(false);
expect(property.getValue()).toBe(expected);
expect(cloneCalled).toEqual(true);
});
@@ -31,7 +31,7 @@ defineSuite([
it('works with clonable objects', function() {
var value = new Cartesian3(1, 2, 3);
var property = new ConstantProperty(value);
- expect(property.getIsTimeVarying()).toEqual(false);
+ expect(property.isTimeVarying).toEqual(false);
var result = property.getValue();
expect(result).not.toBe(value);
@@ -41,7 +41,7 @@ defineSuite([
it('works with clonable objects with result parameter', function() {
var value = new Cartesian3(1, 2, 3);
var property = new ConstantProperty(value);
- expect(property.getIsTimeVarying()).toEqual(false);
+ expect(property.isTimeVarying).toEqual(false);
var expected = new Cartesian3();
var result = property.getValue(undefined, expected);
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index d1e94a1f9f72..3226020aab94 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -14,7 +14,7 @@ defineSuite([
var property = new SampledProperty(Number);
property.addSamplesFlatArray(data, epoch);
- expect(property.getIsTimeVarying()).toEqual(true);
+ expect(property.isTimeVarying).toEqual(true);
expect(property.getValue(epoch)).toEqual(7);
expect(property.getValue(new JulianDate(0, 0.5))).toEqual(7.5);
});
diff --git a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
index 9e16114e1976..df072d8c39c7 100644
--- a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
+++ b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
@@ -16,8 +16,8 @@ defineSuite([
it('default constructor has expected values', function() {
var property = new TimeIntervalCollectionProperty();
- expect(property.getIsTimeVarying()).toEqual(true);
- expect(property.getIntervals()).toBeInstanceOf(TimeIntervalCollection);
+ expect(property.isTimeVarying).toEqual(true);
+ expect(property.intervals).toBeInstanceOf(TimeIntervalCollection);
expect(property.getValue(new JulianDate())).toBeUndefined();
});
@@ -32,8 +32,8 @@ defineSuite([
}
var property = new TimeIntervalCollectionProperty(noClone);
- property.getIntervals().addInterval(interval1);
- property.getIntervals().addInterval(interval2);
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
expect(property.getValue(interval1.start)).toBe(interval1.data);
expect(timesCalled).toEqual(1);
@@ -46,8 +46,8 @@ defineSuite([
var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new Cartesian3(4, 5, 6));
var property = new TimeIntervalCollectionProperty();
- property.getIntervals().addInterval(interval1);
- property.getIntervals().addInterval(interval2);
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
var result1 = property.getValue(interval1.start);
expect(result1).not.toBe(interval1.data);
@@ -63,8 +63,8 @@ defineSuite([
var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new Cartesian3(4, 5, 6));
var property = new TimeIntervalCollectionProperty();
- property.getIntervals().addInterval(interval1);
- property.getIntervals().addInterval(interval2);
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
var expected = new Cartesian3();
var result1 = property.getValue(interval1.start, expected);
From 7711dcff64904fb50bfe810c5dfdd3fa2f68f275 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 15 Aug 2013 14:18:30 -0400
Subject: [PATCH 22/65] Add position properties.
---
.../DynamicScene/CompositePositionProperty.js | 110 ++++++++++++++++++
.../DynamicScene/ConstantPositionProperty.js | 6 +-
Source/DynamicScene/PositionProperty.js | 4 +-
.../DynamicScene/SampledPositionProperty.js | 95 +++++++++++++++
.../TimeIntervalCollectionPositionProperty.js | 108 +++++++++++++++++
5 files changed, 318 insertions(+), 5 deletions(-)
create mode 100644 Source/DynamicScene/CompositePositionProperty.js
create mode 100644 Source/DynamicScene/SampledPositionProperty.js
create mode 100644 Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
diff --git a/Source/DynamicScene/CompositePositionProperty.js b/Source/DynamicScene/CompositePositionProperty.js
new file mode 100644
index 000000000000..8c783b3704f2
--- /dev/null
+++ b/Source/DynamicScene/CompositePositionProperty.js
@@ -0,0 +1,110 @@
+/*global define*/
+define([
+ '../Core/defaultValue',
+ '../Core/defined',
+ '../Core/defineProperties',
+ '../Core/DeveloperError',
+ '../Core/TimeIntervalCollection',
+ '../Core/ReferenceFrame',
+ '../PositionProperty'
+ ], function(
+ defaultValue,
+ defined,
+ defineProperties,
+ DeveloperError,
+ TimeIntervalCollection,
+ ReferenceFrame,
+ PositionProperty) {
+ "use strict";
+
+ /**
+ * A {@link Property} which is defined by a TimeIntervalCollection, where the
+ * data property of the interval is another Property instance which is evaluated
+ * at the provided time.
+ *
+ * @alias CompositePositionProperty
+ * @constructor
+ */
+ var CompositePositionProperty = function(referenceFrame) {
+ this._intervals = new TimeIntervalCollection();
+ this._referenceFrame = defaultValue(referenceFrame, ReferenceFrame.FIXED);
+ };
+
+ defineProperties(CompositePositionProperty.prototype, {
+ /**
+ * Always returns true, since this property always varies with simulation time.
+ * @memberof SampledProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return true;
+ }
+ },
+ /**
+ * Gets the interval collection.
+ * @memberof CompositePositionProperty.prototype
+ *
+ * @type {TimeIntervalCollection}
+ */
+ intervals : {
+ get : function() {
+ return this._intervals;
+ }
+ },
+ /**
+ * Gets or sets the reference frame that the position is defined in.
+ * @Type {ReferenceFrame}
+ */
+ referenceFrame : {
+ get : function() {
+ return this._referenceFrame;
+ },
+ set : function(value) {
+ this._referenceFrame = value;
+ }
+ }
+ });
+
+ /**
+ * Returns the value of the property at the specified simulation time.
+ * @memberof Property
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ */
+ CompositePositionProperty.prototype.getValue = function(time, result) {
+ return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result);
+ };
+
+ /**
+ * Returns the value of the property at the specified simulation time in the specified reference frame.
+ * @memberof PositionProperty
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The desired referenceFrame of the result.
+ * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ CompositePositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
+ if (!defined(time)) {
+ throw new DeveloperError('time is required');
+ }
+
+ var interval = this._intervals.findIntervalContainingDate(time);
+ if (defined(interval)) {
+ var data = interval.data;
+ if (defined(data)) {
+ var value = data.getValue(time, result);
+ return PositionProperty.convertToReferenceFrame(time, value, data.referenceFrame, referenceFrame, value);
+ }
+ }
+ return undefined;
+ };
+
+ return CompositePositionProperty;
+});
\ No newline at end of file
diff --git a/Source/DynamicScene/ConstantPositionProperty.js b/Source/DynamicScene/ConstantPositionProperty.js
index 626bbc77c2db..cb220d1160c6 100644
--- a/Source/DynamicScene/ConstantPositionProperty.js
+++ b/Source/DynamicScene/ConstantPositionProperty.js
@@ -39,7 +39,7 @@ define([
*/
isTimeVarying : {
get : function() {
- return false;
+ return this._property.isTimeVarying;
}
},
/**
@@ -61,7 +61,7 @@ define([
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*/
- ConstantPositionProperty.prototype.getValue = function(time, result, referenceFrame) {
+ ConstantPositionProperty.prototype.getValue = function(time, result) {
return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result);
};
@@ -74,7 +74,7 @@ define([
* @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
*/
- ConstantPositionProperty.prototype.getValueInReferenceFrame = function(time, result, referenceFrame) {
+ ConstantPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
var value = this._property.getValue(time, result);
return PositionProperty.convertToReferenceFrame(time, value, this._referenceFrame, referenceFrame, value);
};
diff --git a/Source/DynamicScene/PositionProperty.js b/Source/DynamicScene/PositionProperty.js
index 055ccc83c499..701265c5b60d 100644
--- a/Source/DynamicScene/PositionProperty.js
+++ b/Source/DynamicScene/PositionProperty.js
@@ -53,8 +53,8 @@ define([
* @memberof PositionProperty
*
* @param {JulianDate} time The simulation time for which to retrieve the value.
- * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
- * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
*/
PositionProperty.prototype.getValue = throwInstantiationError;
diff --git a/Source/DynamicScene/SampledPositionProperty.js b/Source/DynamicScene/SampledPositionProperty.js
new file mode 100644
index 000000000000..d193b2280fcc
--- /dev/null
+++ b/Source/DynamicScene/SampledPositionProperty.js
@@ -0,0 +1,95 @@
+/*global define*/
+define([
+ '../Core/Cartesian3',
+ '../Core/defined',
+ '../Core/defineProperties',
+ '../Core/ReferenceFrame',
+ './PositionProperty',
+ './SampledProperty'
+ ], function(
+ Cartesian3,
+ defined,
+ defineProperties,
+ ReferenceFrame,
+ PositionProperty,
+ SampledProperty) {
+ "use strict";
+
+ /**
+ * A {@link Property} whose value never changes.
+ *
+ * @alias SampledPositionProperty
+ * @constructor
+ *
+ * @exception {DeveloperError} value is required.
+ */
+ var SampledPositionProperty = function() {
+ this._property = new SampledProperty(Cartesian3);
+ };
+
+ defineProperties(SampledPositionProperty.prototype, {
+ /**
+ * Always returns true, since this property always varies with simulation time.
+ * @memberof SampledPositionProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return this._property.isTimeVarying;
+ }
+ },
+ interpolationDegree : {
+ get : function() {
+ return this._property.interpolationDegree;
+ },
+ set : function(value) {
+ this._property.interpolationDegree = value;
+ }
+ },
+ interpolationAlgorithm : {
+ get : function() {
+ return this._property.interpolationAlgorithm;
+ },
+ set : function(value) {
+ this._property.interpolationAlgorithm = value;
+ }
+ }
+ });
+
+ /**
+ * Gets the value of the property, optionally cloning it.
+ * @memberof SampledPositionProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the value. This parameter is unused.
+ * @param {Object} [result] The object to store the value into if the value is clonable. If the result is omitted or the value does not implement clone, the actual value is returned.
+ * @returns The modified result parameter or the actual value instance if the value is not clonable.
+ *
+ * @exception {DeveloperError} time is required.
+ */
+ SampledPositionProperty.prototype.getValue = function(time, result) {
+ return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result);
+ };
+
+ SampledPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
+ result = this._property.getValue(time, result);
+ if (defined(result)) {
+ return PositionProperty.convertToReferenceFrame(time, result, this._referenceFrame, referenceFrame, result);
+ }
+ return result;
+ };
+
+ SampledPositionProperty.prototype.addSample = function(time, value) {
+ this._property.addSample(time, value);
+ };
+
+ SampledPositionProperty.prototype.addSamples = function(times, values) {
+ this._property.addSamples(times, values);
+ };
+
+ SampledPositionProperty.prototype.addSamplesFlatArray = function(data, epoch) {
+ this._property.addSamplesFlatArray(data, epoch);
+ };
+
+ return SampledPositionProperty;
+});
\ No newline at end of file
diff --git a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
new file mode 100644
index 000000000000..d0f9b111ce0e
--- /dev/null
+++ b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
@@ -0,0 +1,108 @@
+/*global define*/
+define([
+ '../Core/defaultValue',
+ '../Core/defined',
+ '../Core/defineProperties',
+ '../Core/DeveloperError',
+ '../Core/Enumeration',
+ '../Core/ReferenceFrame',
+ '../Core/TimeIntervalCollection',
+ './PositionProperty'
+ ], function(
+ defaultValue,
+ defined,
+ defineProperties,
+ DeveloperError,
+ Enumeration,
+ ReferenceFrame,
+ TimeIntervalCollection,
+ PositionProperty) {
+ "use strict";
+
+ /**
+ * A {@link Property} which is defined by an TimeIntervalCollection, where the
+ * data property of the interval represents the value at simulation time.
+ *
+ * @alias TimeIntervalCollectionPositionProperty
+ * @constructor
+ */
+ var TimeIntervalCollectionPositionProperty = function(referenceFrame) {
+ this._intervals = new TimeIntervalCollection();
+ this._referenceFrame = defaultValue(referenceFrame, ReferenceFrame.FIXED);
+ };
+
+ defineProperties(TimeIntervalCollectionPositionProperty.prototype, {
+ /**
+ * Always returns true, since this property always varies with simulation time.
+ * @memberof TimeIntervalCollectionPositionProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return true;
+ }
+ },
+ /**
+ * Gets the interval collection.
+ * @memberof TimeIntervalCollectionPositionProperty
+ *
+ * @type {TimeIntervalCollection}
+ */
+ intervals : {
+ get : function() {
+ return this._intervals;
+ }
+ },
+ /**
+ * Gets the reference frame that the position is defined in.
+ * @Type {ReferenceFrame}
+ */
+ referenceFrame : {
+ get : function() {
+ return this._referenceFrame;
+ }
+ }
+ });
+
+ /**
+ * Returns the value of the property at the specified simulation time.
+ * @memberof TimeIntervalCollectionPositionProperty
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ */
+ TimeIntervalCollectionPositionProperty.prototype.getValue = function(time, result) {
+ return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result);
+ };
+
+ /**
+ * Returns the value of the property at the specified simulation time in the specified reference frame.
+ * @memberof PositionProperty
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The desired referenceFrame of the result.
+ * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ TimeIntervalCollectionPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
+ if (!defined(time)) {
+ throw new DeveloperError('time is required');
+ }
+
+ var interval = this._intervals.findIntervalContainingDate(time);
+ if (defined(interval)) {
+ var value = interval.data;
+ if (defined(value) && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Enumeration)) {
+ return PositionProperty.convertToReferenceFrame(time, value, this._referenceFrame, referenceFrame, result);
+ }
+ return value;
+ }
+ return undefined;
+ };
+
+ return TimeIntervalCollectionPositionProperty;
+});
\ No newline at end of file
From 6f01113d80136bac68aea5193a13264eccad725f Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 15 Aug 2013 16:03:12 -0400
Subject: [PATCH 23/65] Start fleshing out position processing.
Messy but working-ish.
---
.../DynamicScene/CompositePositionProperty.js | 2 +-
Source/DynamicScene/DynamicObject.js | 2 +-
Source/DynamicScene/PositionProperty.js | 4 +-
.../DynamicScene/SampledPositionProperty.js | 10 +-
Source/DynamicScene/processPacketData.js | 128 ++++++++++++++++++
5 files changed, 141 insertions(+), 5 deletions(-)
diff --git a/Source/DynamicScene/CompositePositionProperty.js b/Source/DynamicScene/CompositePositionProperty.js
index 8c783b3704f2..a1a54f3cd246 100644
--- a/Source/DynamicScene/CompositePositionProperty.js
+++ b/Source/DynamicScene/CompositePositionProperty.js
@@ -6,7 +6,7 @@ define([
'../Core/DeveloperError',
'../Core/TimeIntervalCollection',
'../Core/ReferenceFrame',
- '../PositionProperty'
+ './PositionProperty'
], function(
defaultValue,
defined,
diff --git a/Source/DynamicScene/DynamicObject.js b/Source/DynamicScene/DynamicObject.js
index 9bfdc60f57df..123ff1226ce8 100644
--- a/Source/DynamicScene/DynamicObject.js
+++ b/Source/DynamicScene/DynamicObject.js
@@ -241,7 +241,7 @@ define([
if (!defined(positionData)) {
return false;
}
- return processPacketData(Cartesian3, dynamicObject, 'position', positionData, undefined, sourceUri);
+ return processPacketData.position(dynamicObject, 'position', positionData, undefined, sourceUri);
};
/**
diff --git a/Source/DynamicScene/PositionProperty.js b/Source/DynamicScene/PositionProperty.js
index 701265c5b60d..b8840de31937 100644
--- a/Source/DynamicScene/PositionProperty.js
+++ b/Source/DynamicScene/PositionProperty.js
@@ -80,11 +80,11 @@ define([
}
var icrfToFixed = Transforms.computeIcrfToFixedMatrix(time, scratchMatrix3);
- if (defined(icrfToFixed)) {
+ if (!defined(icrfToFixed)) {
icrfToFixed = Transforms.computeTemeToPseudoFixedMatrix(time, scratchMatrix3);
}
if (inputFrame === ReferenceFrame.INERTIAL) {
- return icrfToFixed(scratchMatrix3).multiplyByVector(value, result);
+ return icrfToFixed.multiplyByVector(value, result);
}
if (inputFrame === ReferenceFrame.FIXED) {
return icrfToFixed.transpose(scratchMatrix3).multiplyByVector(value, result);
diff --git a/Source/DynamicScene/SampledPositionProperty.js b/Source/DynamicScene/SampledPositionProperty.js
index d193b2280fcc..88c5568b336c 100644
--- a/Source/DynamicScene/SampledPositionProperty.js
+++ b/Source/DynamicScene/SampledPositionProperty.js
@@ -1,6 +1,7 @@
/*global define*/
define([
'../Core/Cartesian3',
+ '../Core/defaultValue',
'../Core/defined',
'../Core/defineProperties',
'../Core/ReferenceFrame',
@@ -8,6 +9,7 @@ define([
'./SampledProperty'
], function(
Cartesian3,
+ defaultValue,
defined,
defineProperties,
ReferenceFrame,
@@ -23,8 +25,9 @@ define([
*
* @exception {DeveloperError} value is required.
*/
- var SampledPositionProperty = function() {
+ var SampledPositionProperty = function(referenceFrame) {
this._property = new SampledProperty(Cartesian3);
+ this._referenceFrame = defaultValue(referenceFrame, ReferenceFrame.FIXED);
};
defineProperties(SampledPositionProperty.prototype, {
@@ -39,6 +42,11 @@ define([
return this._property.isTimeVarying;
}
},
+ referenceFrame : {
+ get : function() {
+ return this._referenceFrame;
+ }
+ },
interpolationDegree : {
get : function() {
return this._property.interpolationDegree;
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
index 3dfd172d649f..313a734ede20 100644
--- a/Source/DynamicScene/processPacketData.js
+++ b/Source/DynamicScene/processPacketData.js
@@ -10,7 +10,11 @@ define([
'../Core/Ellipsoid',
'../Core/Math',
'../Core/Quaternion',
+ '../Core/ReferenceFrame',
'../Core/Spherical',
+ '../Core/HermitePolynomialApproximation',
+ '../Core/LinearApproximation',
+ '../Core/LagrangePolynomialApproximation',
'../Scene/HorizontalOrigin',
'../Scene/LabelStyle',
'../Scene/VerticalOrigin',
@@ -21,6 +25,10 @@ define([
'./ConstantProperty',
'./SampledProperty',
'./TimeIntervalCollectionProperty',
+ './CompositePositionProperty',
+ './ConstantPositionProperty',
+ './SampledPositionProperty',
+ './TimeIntervalCollectionPositionProperty',
'../ThirdParty/Uri'
], function(
Cartesian2,
@@ -33,7 +41,11 @@ define([
Ellipsoid,
CesiumMath,
Quaternion,
+ ReferenceFrame,
Spherical,
+ HermitePolynomialApproximation,
+ LinearApproximation,
+ LagrangePolynomialApproximation,
HorizontalOrigin,
LabelStyle,
VerticalOrigin,
@@ -44,6 +56,10 @@ define([
ConstantProperty,
SampledProperty,
TimeIntervalCollectionProperty,
+ CompositePositionProperty,
+ ConstantPositionProperty,
+ SampledPositionProperty,
+ TimeIntervalCollectionPositionProperty,
Uri) {
"use strict";
@@ -311,5 +327,117 @@ define([
return updated;
}
+ var interpolators = {
+ HERMITE : HermitePolynomialApproximation,
+ LAGRANGE : LagrangePolynomialApproximation,
+ LINEAR : LinearApproximation
+ };
+
+ function updateInterpolationSettings(packetData, property) {
+ var interpolator = interpolators[packetData.interpolationAlgorithm];
+ if (defined(interpolator)) {
+ property.interpolationAlgorithm = interpolator;
+ }
+ if (defined(packetData.interpolationDegree)) {
+ property.interpolationDegree = packetData.interpolationDegree;
+ }
+
+ }
+
+ function processPositionProperty(object, propertyName, packetData, constrainedInterval, sourceUri) {
+ var combinedInterval;
+ var packetInterval = packetData.interval;
+ if (defined(packetInterval)) {
+ combinedInterval = TimeInterval.fromIso8601(packetInterval);
+ if (defined(constrainedInterval)) {
+ combinedInterval = combinedInterval.intersect(constrainedInterval);
+ }
+ } else if (defined(constrainedInterval)) {
+ combinedInterval = constrainedInterval;
+ }
+
+ var referenceFrame = ReferenceFrame[defaultValue(packetData.referenceFrame, "FIXED")];
+ var unwrappedInterval = unwrapCartesianInterval(packetData);
+ var hasInterval = defined(combinedInterval) && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
+ var isSampled = unwrappedInterval.length > Cartesian3.packedLength;
+
+ if (!isSampled && !hasInterval) {
+ object[propertyName] = new ConstantPositionProperty(Cartesian3.unpack(unwrappedInterval, 0), referenceFrame);
+ return true;
+ }
+
+ var propertyCreated = false;
+ var property = object[propertyName];
+ if (!isSampled && hasInterval) {
+ combinedInterval = combinedInterval.clone();
+ object[propertyName] = new ConstantPositionProperty(Cartesian3.unpack(unwrappedInterval, 0), referenceFrame);
+
+ if (!defined(property)) {
+ property = new TimeIntervalCollectionPositionProperty(referenceFrame);
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ if (property instanceof TimeIntervalCollectionPositionProperty) {
+ property.intervals.addInterval(combinedInterval);
+ updateInterpolationSettings(packetData, property);
+ } else {
+ //TODO Morph to CompositePositionProperty
+ }
+ } else if (isSampled && !hasInterval) {
+ if (!(property instanceof SampledPositionProperty)) {
+ property = new SampledPositionProperty(referenceFrame);
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ updateInterpolationSettings(packetData, property);
+ } else if (isSampled && hasInterval) {
+ if (!defined(property)) {
+ property = new CompositePositionProperty(referenceFrame);
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ if (property instanceof CompositePositionProperty) {
+ var intervals = property.intervals;
+ var interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
+ var intervalData;
+ if (defined(interval)) {
+ intervalData = interval.data;
+ } else {
+ interval = combinedInterval.clone();
+ intervalData = new SampledPositionProperty(referenceFrame);
+ interval.data = intervalData;
+ intervals.addInterval(interval);
+ }
+ if (!(intervalData instanceof SampledPositionProperty)) {
+ intervalData = new SampledPositionProperty(referenceFrame);
+ interval.Data = intervalData;
+ }
+ intervalData.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ updateInterpolationSettings(packetData, property);
+ } else {
+ //TODO Morph to CompositePositionProperty
+ }
+ }
+ return propertyCreated;
+ }
+
+ function processPositionPacketData(object, propertyName, packetData, interval, sourceUri) {
+ if (!defined(packetData)) {
+ return false;
+ }
+
+ var updated = false;
+ if (Array.isArray(packetData)) {
+ for ( var i = 0, len = packetData.length; i < len; i++) {
+ updated = processPositionProperty(object, propertyName, packetData[i], interval, sourceUri) || updated;
+ }
+ } else {
+ updated = processPositionProperty(object, propertyName, packetData, interval, sourceUri) || updated;
+ }
+ return updated;
+ }
+ processPacketData.position = processPositionPacketData;
+
return processPacketData;
});
From 7966abc7993b4a096cae7cb38c11e213d49fe6bb Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 15 Aug 2013 16:37:29 -0400
Subject: [PATCH 24/65] Fix Path visualization.
It's only for SampledProperty for now.
---
Source/DynamicScene/CzmlDefaults.js | 2 +-
Source/DynamicScene/DynamicPathVisualizer.js | 95 +++++++++++++++++++-
2 files changed, 93 insertions(+), 4 deletions(-)
diff --git a/Source/DynamicScene/CzmlDefaults.js b/Source/DynamicScene/CzmlDefaults.js
index 4745f109f1a6..8b84bab58e38 100644
--- a/Source/DynamicScene/CzmlDefaults.js
+++ b/Source/DynamicScene/CzmlDefaults.js
@@ -75,7 +75,7 @@ define([
DynamicEllipsoid.processCzmlPacket,
DynamicCone.processCzmlPacket,
DynamicLabel.processCzmlPacket,
- //DynamicPath.processCzmlPacket,
+ DynamicPath.processCzmlPacket,
DynamicPoint.processCzmlPacket,
DynamicPolygon.processCzmlPacket,
DynamicPolyline.processCzmlPacket,
diff --git a/Source/DynamicScene/DynamicPathVisualizer.js b/Source/DynamicScene/DynamicPathVisualizer.js
index 1970b608570d..b6ab77ccc200 100644
--- a/Source/DynamicScene/DynamicPathVisualizer.js
+++ b/Source/DynamicScene/DynamicPathVisualizer.js
@@ -9,6 +9,7 @@ define([
'../Core/Color',
'../Core/Transforms',
'../Core/ReferenceFrame',
+ './SampledPositionProperty',
'../Scene/Material',
'../Scene/SceneMode',
'../Scene/PolylineCollection'
@@ -22,11 +23,99 @@ define([
Color,
Transforms,
ReferenceFrame,
+ SampledPositionProperty,
Material,
SceneMode,
PolylineCollection) {
"use strict";
+ function getValueRangeInReferenceFrame(positionProperty, start, stop, currentTime, referenceFrame, maximumStep, result) {
+ var times = positionProperty._property._times;
+
+ if (!defined(start)) {
+ throw new DeveloperError('start is required');
+ }
+
+ if (!defined(stop)) {
+ throw new DeveloperError('stop is required');
+ }
+
+ if (!defined(result)) {
+ result = [];
+ }
+
+ var r = 0;
+ //Always step exactly on start (but only use it if it exists.)
+ var tmp;
+ tmp = positionProperty.getValueInReferenceFrame(start, referenceFrame, result[r]);
+ if (defined(tmp)) {
+ result[r++] = tmp;
+ }
+
+ var steppedOnNow = !defined(currentTime) || currentTime.lessThan(start) || currentTime.greaterThan(stop);
+
+ //Iterate over all interval times and add the ones that fall in our
+ //time range. Note that times can contain data outside of
+ //the intervals range. This is by design for use with interpolation.
+ var t = 0;
+ var len = times.length;
+ var current = times[t];
+ var loopStop = stop;
+ var sampling = false;
+ var sampleStepsToTake;
+ var sampleStepsTaken;
+ var sampleStepSize;
+
+ while (t < len) {
+ if (!steppedOnNow && current.greaterThanOrEquals(currentTime)) {
+ tmp = positionProperty.getValueInReferenceFrame(currentTime, referenceFrame, result[r]);
+ if (defined(tmp)) {
+ result[r++] = tmp;
+ }
+ steppedOnNow = true;
+ }
+ if (current.greaterThan(start) && current.lessThan(loopStop)) {
+ tmp = positionProperty.getValueInReferenceFrame(current, referenceFrame, result[r]);
+ if (defined(tmp)) {
+ result[r++] = tmp;
+ }
+ }
+
+ if (t < (len - 1)) {
+ if (!sampling) {
+ var next = times[t + 1];
+ var secondsUntilNext = current.getSecondsDifference(next);
+ sampling = secondsUntilNext > maximumStep;
+
+ if (sampling) {
+ sampleStepsToTake = Math.floor(secondsUntilNext / maximumStep);
+ sampleStepsTaken = 0;
+ sampleStepSize = secondsUntilNext / Math.max(sampleStepsToTake, 2);
+ sampleStepsToTake = Math.max(sampleStepsToTake - 2, 1);
+ }
+ }
+
+ if (sampling && sampleStepsTaken < sampleStepsToTake) {
+ current = current.addSeconds(sampleStepSize);
+ sampleStepsTaken++;
+ continue;
+ }
+ }
+ sampling = false;
+ t++;
+ current = times[t];
+ }
+
+ //Always step exactly on stop (but only use it if it exists.)
+ tmp = positionProperty.getValueInReferenceFrame(stop, referenceFrame, result[r]);
+ if (defined(tmp)) {
+ result[r++] = tmp;
+ }
+
+ result.length = r;
+ return result;
+ }
+
var toFixedScratch = new Matrix3();
var PolylineUpdater = function(scene, referenceFrame) {
this._unusedIndexes = [];
@@ -53,7 +142,7 @@ define([
}
var positionProperty = dynamicObject.position;
- if (!defined(positionProperty)) {
+ if (!(positionProperty instanceof SampledPositionProperty)) {
return;
}
@@ -160,7 +249,7 @@ define([
resolution = property.getValue(time);
}
- polyline.setPositions(positionProperty._getValueRangeInReferenceFrame(sampleStart, sampleStop, time, this._referenceFrame, resolution, polyline.getPositions()));
+ polyline.setPositions(getValueRangeInReferenceFrame(positionProperty, sampleStart, sampleStop, time, this._referenceFrame, resolution, polyline.getPositions()));
property = dynamicPath.color;
if (defined(property)) {
@@ -313,7 +402,7 @@ define([
var frameToVisualize = ReferenceFrame.FIXED;
if (this._scene.mode === SceneMode.SCENE3D) {
- frameToVisualize = positionProperty.getReferenceFrame();
+ frameToVisualize = positionProperty.referenceFrame;
}
var currentUpdater = this._updaters[frameToVisualize];
From 8b3df8ce7d83def335727b80914d23a96f22ff88 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 15 Aug 2013 17:08:14 -0400
Subject: [PATCH 25/65] Fix minor issue with path sampling and position
packets.
---
Source/DynamicScene/DynamicPathVisualizer.js | 2 +-
Source/DynamicScene/processPacketData.js | 2 +-
Specs/MockProperty.js | 7 -------
3 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/Source/DynamicScene/DynamicPathVisualizer.js b/Source/DynamicScene/DynamicPathVisualizer.js
index b6ab77ccc200..1e4a330e756b 100644
--- a/Source/DynamicScene/DynamicPathVisualizer.js
+++ b/Source/DynamicScene/DynamicPathVisualizer.js
@@ -74,7 +74,7 @@ define([
}
steppedOnNow = true;
}
- if (current.greaterThan(start) && current.lessThan(loopStop)) {
+ if (current.greaterThan(start) && current.lessThan(loopStop) && !current.equals(currentTime)) {
tmp = positionProperty.getValueInReferenceFrame(current, referenceFrame, result[r]);
if (defined(tmp)) {
result[r++] = tmp;
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
index 313a734ede20..1f05312df1eb 100644
--- a/Source/DynamicScene/processPacketData.js
+++ b/Source/DynamicScene/processPacketData.js
@@ -370,7 +370,7 @@ define([
var property = object[propertyName];
if (!isSampled && hasInterval) {
combinedInterval = combinedInterval.clone();
- object[propertyName] = new ConstantPositionProperty(Cartesian3.unpack(unwrappedInterval, 0), referenceFrame);
+ combinedInterval.data = Cartesian3.unpack(unwrappedInterval, 0);
if (!defined(property)) {
property = new TimeIntervalCollectionPositionProperty(referenceFrame);
diff --git a/Specs/MockProperty.js b/Specs/MockProperty.js
index 8cc6f867a12f..7caf4fb5b1e4 100644
--- a/Specs/MockProperty.js
+++ b/Specs/MockProperty.js
@@ -22,12 +22,5 @@ define([
return ReferenceFrame.FIXED;
};
- MockProperty.prototype._getValueRangeInReferenceFrame = function(start, stop, currentTime, result) {
- this.lastStart = start;
- this.lastStop = stop;
- this.lastCurrentTime = currentTime;
- return this.value;
- };
-
return MockProperty;
});
From 8d6ace7c9288b620aa6483ea5bd33091b7020898 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Fri, 16 Aug 2013 14:43:04 -0400
Subject: [PATCH 26/65] Flesh out property specs and fix some bugs found in
doing so.
---
Source/Core/InterpolatableValue.js | 4 +-
Source/DynamicScene/SampledProperty.js | 59 ++++----
Specs/DynamicScene/CompositePropertySpec.js | 15 ++
Specs/DynamicScene/SampledPropertySpec.js | 136 +++++++++++++++---
.../TimeIntervalCollectionPropertySpec.js | 12 ++
5 files changed, 173 insertions(+), 53 deletions(-)
diff --git a/Source/Core/InterpolatableValue.js b/Source/Core/InterpolatableValue.js
index 0370e732c455..5270f5538235 100644
--- a/Source/Core/InterpolatableValue.js
+++ b/Source/Core/InterpolatableValue.js
@@ -8,9 +8,9 @@ define(['../Core/DeveloperError'], function(DeveloperError) {
var InterpolatableValue = {};
- InterpolatableValue.length = 0;
+ InterpolatableValue.packedLength = undefined;
- InterpolatableValue.interpolationLength = 0;
+ InterpolatableValue.packedInterpolationLength = undefined;
InterpolatableValue.pack = throwInstantiationError;
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index e66f138b4e76..c50b5fe42d01 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -19,8 +19,6 @@ define([
LinearApproximation) {
"use strict";
- var interpolationScratch;
-
//We can't use splice for inserting new elements because function apply can't handle
//a huge number of arguments. See https://code.google.com/p/chromium/issues/detail?id=56588
function arrayInsert(array, startIndex, items) {
@@ -103,15 +101,6 @@ define([
}
};
- function updateTables(property) {
- var numberOfPoints = Math.min(property._interpolationAlgorithm.getRequiredDataPoints(property._interpolationDegree), property._times.length);
- if (numberOfPoints !== property._numberOfPoints) {
- property._numberOfPoints = numberOfPoints;
- property._xTable.length = numberOfPoints;
- property._yTable.length = numberOfPoints * property._packedInterpolationLength;
- }
- }
-
/**
* A {@link Property} whose value never changes.
*
@@ -131,15 +120,19 @@ define([
type = InterpolatableNumber;
}
+ var packedInterpolationLength = defaultValue(type.packedInterpolationLength, type.packedLength);
+
this._innerType = type;
this._interpolationDegree = 1;
this._interpolationAlgorithm = LinearApproximation;
+ this._numberOfPoints = 0;
this._times = [];
this._values = [];
this._xTable = [];
this._yTable = [];
- this._packedInterpolationLength = defaultValue(type.packedInterpolationLength, type.packedLength);
- updateTables(this);
+ this._packedInterpolationLength = packedInterpolationLength;
+ this._updateTables = true;
+ this._interpolationResult = new Array(packedInterpolationLength);
};
defineProperties(SampledProperty.prototype, {
@@ -160,7 +153,7 @@ define([
},
set : function(value) {
this._interpolationDegree = value;
- updateTables(this);
+ this._updateTables = true;
}
},
interpolationAlgorithm : {
@@ -169,7 +162,7 @@ define([
},
set : function(value) {
this._interpolationAlgorithm = value;
- updateTables(this);
+ this._updateTables = true;
}
}
});
@@ -190,6 +183,21 @@ define([
var values = this._values;
var index = binarySearch(times, time, JulianDate.compare);
if (index < 0) {
+ var xTable = this._xTable;
+ var yTable = this._yTable;
+ var interpolationAlgorithm = this._interpolationAlgorithm;
+ var packedInterpolationLength = this._packedInterpolationLength;
+
+ if (this._updateTables) {
+ this._updateTables = false;
+ var numberOfPoints = Math.min(interpolationAlgorithm.getRequiredDataPoints(this._interpolationDegree), times.length);
+ if (numberOfPoints !== this._numberOfPoints) {
+ this._numberOfPoints = numberOfPoints;
+ xTable.length = numberOfPoints;
+ yTable.length = numberOfPoints * packedInterpolationLength;
+ }
+ }
+
var degree = this._numberOfPoints - 1;
if (degree < 1) {
return undefined;
@@ -202,7 +210,6 @@ define([
var firstIndex = 0;
var lastIndex = times.length - 1;
-
var pointsInCollection = lastIndex - firstIndex + 1;
if (pointsInCollection < degree + 1) {
@@ -224,17 +231,13 @@ define([
firstIndex = computedFirstIndex;
lastIndex = computedLastIndex;
}
-
var length = lastIndex - firstIndex + 1;
- var xTable = this._xTable;
- var yTable = this._yTable;
// Build the tables
for ( var i = 0; i < length; ++i) {
xTable[i] = times[lastIndex].getSecondsDifference(times[firstIndex + i]);
}
- var specializedPackFunction = innerType.packForInterpolation;
- if (!defined(specializedPackFunction)) {
+ if (!defined(innerType.packForInterpolation)) {
var destinationIndex = 0;
var packedLength = innerType.packedLength;
var sourceIndex = firstIndex * packedLength;
@@ -246,17 +249,17 @@ define([
destinationIndex++;
}
} else {
- specializedPackFunction(values, yTable, firstIndex, lastIndex);
+ innerType.packForInterpolation(values, yTable, firstIndex, lastIndex);
}
// Interpolate!
var x = times[lastIndex].getSecondsDifference(time);
- interpolationScratch = this._interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, this._packedInterpolationLength, interpolationScratch);
+ var interpolationResult = interpolationAlgorithm.interpolateOrderZero(x, xTable, yTable, packedInterpolationLength, this._interpolationResult);
if (!defined(innerType.unpackInterpolationResult)) {
- return innerType.unpack(interpolationScratch, 0, result);
+ return innerType.unpack(interpolationResult, 0, result);
}
- return innerType.unpackInterpolationResult(interpolationScratch, result, values, firstIndex, lastIndex);
+ return innerType.unpackInterpolationResult(interpolationResult, result, values, firstIndex, lastIndex);
}
return innerType.unpack(this._values, index * innerType.packedLength, result);
};
@@ -266,7 +269,7 @@ define([
var data = [time];
innerType.pack(data, 1, value);
_mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
- updateTables(this);
+ this._updateTables = true;
};
SampledProperty.prototype.addSamples = function(times, values) {
@@ -278,12 +281,12 @@ define([
innerType.pack(data, data.length, values[i]);
}
_mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
- updateTables(this);
+ this._updateTables = true;
};
SampledProperty.prototype.addSamplesFlatArray = function(data, epoch) {
_mergeNewSamples(epoch, this._times, this._values, data, this._innerType.packedLength);
- updateTables(this);
+ this._updateTables = true;
};
//Exposed for testing.
diff --git a/Specs/DynamicScene/CompositePropertySpec.js b/Specs/DynamicScene/CompositePropertySpec.js
index e5292fb2b281..cca17aff7f51 100644
--- a/Specs/DynamicScene/CompositePropertySpec.js
+++ b/Specs/DynamicScene/CompositePropertySpec.js
@@ -58,6 +58,21 @@ defineSuite([
expect(result2).toEqual(interval2.data.getValue());
});
+ it('works without a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantProperty(new Cartesian3(1, 2, 3)));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantProperty(new Cartesian3(4, 5, 6)));
+
+ var property = new CompositeProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var result1 = property.getValue(interval1.start);
+ expect(result1).toEqual(interval1.data.getValue());
+
+ var result2 = property.getValue(interval2.stop);
+ expect(result2).toEqual(interval2.data.getValue());
+ });
+
it('throws with no time parameter', function() {
var property = new CompositeProperty();
expect(function() {
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index 3226020aab94..9e8c0db855bb 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -1,20 +1,30 @@
/*global defineSuite*/
defineSuite([
'DynamicScene/SampledProperty',
- 'Core/JulianDate'
+ 'Core/defined',
+ 'Core/JulianDate',
+ 'Core/LinearApproximation'
], function(
SampledProperty,
- JulianDate) {
+ defined,
+ JulianDate,
+ LinearApproximation) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+ it('constructor sets expected defaults', function() {
+ var property = new SampledProperty(Number);
+ expect(property.isTimeVarying).toEqual(true);
+ expect(property.interpolationDegree).toEqual(1);
+ expect(property.interpolationAlgorithm).toEqual(LinearApproximation);
+ });
+
it('addSamplesFlatArray works', function() {
var data = [0, 7, 1, 8, 2, 9];
var epoch = new JulianDate(0, 0);
var property = new SampledProperty(Number);
property.addSamplesFlatArray(data, epoch);
- expect(property.isTimeVarying).toEqual(true);
expect(property.getValue(epoch)).toEqual(7);
expect(property.getValue(new JulianDate(0, 0.5))).toEqual(7.5);
});
@@ -46,6 +56,98 @@ defineSuite([
expect(property.getValue(new JulianDate(0.5, 0))).toEqual(7.5);
});
+ it('works with specialized interpolation packing', function() {
+ var CustomType = function(value) {
+ this.x = value;
+ };
+
+ CustomType.packedLength = 1;
+
+ CustomType.packedInterpolationLength = 2;
+
+ CustomType.pack = function(array, startingIndex, value) {
+ array[startingIndex++] = value.x;
+ return startingIndex;
+ };
+
+ CustomType.unpack = function(array, startingIndex, result) {
+ return array[startingIndex];
+ };
+
+ CustomType.packForInterpolation = function(sourceArray, destinationArray, firstIndex, lastIndex) {
+ for ( var i = 0, len = lastIndex - firstIndex + 1; i < len; i++) {
+ var offset = i * 2;
+ destinationArray[offset] = sourceArray[i] * 0.5;
+ destinationArray[offset + 1] = sourceArray[i] * 0.5;
+ }
+ };
+
+ CustomType.unpackInterpolationResult = function(array, result, sourceArray, firstIndex, lastIndex) {
+ if (!defined(result)) {
+ result = new CustomType();
+ }
+ result.x = array[0] + array[1];
+ return result;
+ };
+
+ var values = [new CustomType(0), new CustomType(2), new CustomType(4)];
+ var times = [new JulianDate(0, 0), new JulianDate(1, 0), new JulianDate(2, 0)];
+
+ var property = new SampledProperty(CustomType);
+ property.addSample(times[0], values[0]);
+ property.addSample(times[1], values[1]);
+ property.addSample(times[2], values[2]);
+
+ expect(property.getValue(new JulianDate(0.5, 0)).x).toEqual(1);
+ });
+
+ it('can set interpolationAlgorithm and degree', function() {
+ var data = [0, 7, 2, 9, 4, 11];
+ var epoch = new JulianDate(0, 0);
+
+ var timesCalled = 0;
+ var MockInterpolation = {
+ type : 'Mock',
+ getRequiredDataPoints : function(degree) {
+ return 3;
+ },
+
+ interpolateOrderZero : function(x, xTable, yTable, yStride, result) {
+ expect(x).toEqual(-1);
+
+ expect(xTable.length).toEqual(3);
+ expect(xTable[0]).toBe(-4);
+ expect(xTable[1]).toBe(-2);
+ expect(xTable[2]).toBe(0);
+
+ expect(yTable.length).toEqual(3);
+ expect(yTable[0]).toBe(7);
+ expect(yTable[1]).toBe(9);
+ expect(yTable[2]).toBe(11);
+
+ expect(yStride).toEqual(1);
+
+ expect(result.length).toEqual(1);
+
+ result[0] = 2;
+ timesCalled++;
+ return result;
+ }
+ };
+
+ var property = new SampledProperty(Number);
+ property.addSamplesFlatArray(data, epoch);
+ expect(property.getValue(epoch)).toEqual(7);
+ expect(property.getValue(new JulianDate(0, 1))).toEqual(8);
+
+ property.interpolationDegree = 2;
+ property.interpolationAlgorithm = MockInterpolation;
+ expect(property.getValue(epoch)).toEqual(7);
+ expect(property.getValue(new JulianDate(0, 3))).toEqual(2);
+
+ expect(timesCalled).toEqual(1);
+ });
+
it('Returns undefined if trying to interpolate with less than enough samples.', function() {
var value = 7;
var time = new JulianDate(0, 0);
@@ -167,28 +269,10 @@ defineSuite([
var interwovenData = [{
epoch : JulianDate.fromIso8601("20130205T150405.704999999999927Z"),
- values : [0.0, 1,
- 120.0, 2,
- 240.0, 3,
- 360.0, 4,
- 480.0, 6,
- 600.0, 8,
- 720.0, 10,
- 840.0, 12,
- 960.0, 14,
- 1080.0, 16]
+ values : [0.0, 1, 120.0, 2, 240.0, 3, 360.0, 4, 480.0, 6, 600.0, 8, 720.0, 10, 840.0, 12, 960.0, 14, 1080.0, 16]
}, {
epoch : JulianDate.fromIso8601("20130205T151151.60499999999956Z"),
- values : [0.0, 5,
- 120.0, 7,
- 240.0, 9,
- 360.0, 11,
- 480.0, 13,
- 600.0, 15,
- 720.0, 17,
- 840.0, 18,
- 960.0, 19,
- 1080.0, 20]
+ values : [0.0, 5, 120.0, 7, 240.0, 9, 360.0, 11, 480.0, 13, 600.0, 15, 720.0, 17, 840.0, 18, 960.0, 19, 1080.0, 20]
}];
it('_mergeNewSamples works with interwoven data', function() {
@@ -200,4 +284,10 @@ defineSuite([
expect(values[i]).toBe(i + 1);
}
});
+
+ it('constructor throws without type parameter.', function() {
+ expect(function() {
+ return new SampledProperty(undefined);
+ }).toThrow();
+ });
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
index df072d8c39c7..5fee0b5c7946 100644
--- a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
+++ b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
@@ -21,6 +21,18 @@ defineSuite([
expect(property.getValue(new JulianDate())).toBeUndefined();
});
+ it('works with basic types', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, 5);
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, 6);
+
+ var property = new TimeIntervalCollectionProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ expect(property.getValue(interval1.start)).toBe(interval1.data);
+ expect(property.getValue(interval2.stop)).toBe(interval2.data);
+ });
+
it('works with non-clonable objects', function() {
var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, {});
var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, {});
From 89102679ce32fe0eeafac4e7d5c8127783fc1cf9 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Fri, 16 Aug 2013 15:06:21 -0400
Subject: [PATCH 27/65] Specs for ConstantPositionProperty.
---
.../ConstantPositionPropertySpec.js | 81 +++++++++++++++++++
1 file changed, 81 insertions(+)
create mode 100644 Specs/DynamicScene/ConstantPositionPropertySpec.js
diff --git a/Specs/DynamicScene/ConstantPositionPropertySpec.js b/Specs/DynamicScene/ConstantPositionPropertySpec.js
new file mode 100644
index 000000000000..ed0aba42e228
--- /dev/null
+++ b/Specs/DynamicScene/ConstantPositionPropertySpec.js
@@ -0,0 +1,81 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/ConstantPositionProperty',
+ 'DynamicScene/PositionProperty',
+ 'Core/Cartesian3',
+ 'Core/JulianDate',
+ 'Core/ReferenceFrame'
+ ], function(
+ ConstantPositionProperty,
+ PositionProperty,
+ Cartesian3,
+ JulianDate,
+ ReferenceFrame) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ var time = new JulianDate();
+
+ it('Constructor sets expected defaults', function() {
+ var property = new ConstantPositionProperty(new Cartesian3(1, 2, 3));
+ expect(property.isTimeVarying).toEqual(false);
+ expect(property.referenceFrame).toBe(ReferenceFrame.FIXED);
+
+ property = new ConstantPositionProperty(new Cartesian3(1, 2, 3), ReferenceFrame.INERTIAL);
+ expect(property.isTimeVarying).toEqual(false);
+ expect(property.referenceFrame).toBe(ReferenceFrame.INERTIAL);
+ });
+
+ it('getValue works without a result parameter', function() {
+ var value = new Cartesian3(1, 2, 3);
+ var property = new ConstantPositionProperty(value);
+
+ var result = property.getValue();
+ expect(result).not.toBe(value);
+ expect(result).toEqual(value);
+ });
+
+ it('getValue works with a result parameter', function() {
+ var value = new Cartesian3(1, 2, 3);
+ var property = new ConstantPositionProperty(value);
+
+ var expected = new Cartesian3();
+ var result = property.getValue(time, expected);
+ expect(result).toBe(expected);
+ expect(expected).toEqual(value);
+ });
+
+ it('getValue returns in fixed frame', function() {
+ var valueInertial = new Cartesian3(1, 2, 3);
+ var valueFixed = PositionProperty.convertToReferenceFrame(time, valueInertial, ReferenceFrame.INERTIAL, ReferenceFrame.FIXED);
+ var property = new ConstantPositionProperty(valueInertial, ReferenceFrame.INERTIAL);
+
+ var result = property.getValue(time);
+ expect(result).toEqual(valueFixed);
+ });
+
+ it('getValueInReferenceFrame works without a result parameter', function() {
+ var value = new Cartesian3(1, 2, 3);
+ var property = new ConstantPositionProperty(value);
+
+ var result = property.getValueInReferenceFrame(time, ReferenceFrame.INERTIAL);
+ expect(result).not.toBe(value);
+ expect(result).toEqual(PositionProperty.convertToReferenceFrame(time, value, ReferenceFrame.FIXED, ReferenceFrame.INERTIAL));
+ });
+
+ it('getValueInReferenceFrame works with a result parameter', function() {
+ var value = new Cartesian3(1, 2, 3);
+ var property = new ConstantPositionProperty(value, ReferenceFrame.INERTIAL);
+
+ var expected = new Cartesian3();
+ var result = property.getValueInReferenceFrame(time, ReferenceFrame.FIXED, expected);
+ expect(result).toBe(expected);
+ expect(expected).toEqual(PositionProperty.convertToReferenceFrame(time, value, ReferenceFrame.INERTIAL, ReferenceFrame.FIXED));
+ });
+
+ it('constructor throws with undefined value', function() {
+ expect(function() {
+ return new ConstantPositionProperty(undefined);
+ }).toThrow();
+ });
+});
\ No newline at end of file
From edaa098f60f2f2377060285a167eacb30068ca99 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 19 Aug 2013 15:18:58 -0400
Subject: [PATCH 28/65] Doc and cleanup.
Split InterpolatableValue interface into two separate interfaces, Packable and PackableForInterpolation.
---
Source/Core/Cartesian2.js | 44 ++++++++-
Source/Core/Cartesian3.js | 44 ++++++++-
Source/Core/Color.js | 43 ++++++++-
Source/Core/InterpolatableNumber.js | 19 ----
Source/Core/InterpolatableValue.js | 24 -----
Source/Core/Packable.js | 56 +++++++++++
Source/Core/PackableForInterpolation.js | 59 ++++++++++++
Source/Core/PackableNumber.js | 44 +++++++++
Source/Core/Quaternion.js | 111 ++++++++++++++++++----
Source/DynamicScene/SampledProperty.js | 17 ++--
Specs/DynamicScene/SampledPropertySpec.js | 14 +--
11 files changed, 393 insertions(+), 82 deletions(-)
delete mode 100644 Source/Core/InterpolatableNumber.js
delete mode 100644 Source/Core/InterpolatableValue.js
create mode 100644 Source/Core/Packable.js
create mode 100644 Source/Core/PackableForInterpolation.js
create mode 100644 Source/Core/PackableNumber.js
diff --git a/Source/Core/Cartesian2.js b/Source/Core/Cartesian2.js
index e19236db5299..43f2b405f49a 100644
--- a/Source/Core/Cartesian2.js
+++ b/Source/Core/Cartesian2.js
@@ -19,6 +19,7 @@ define([
* @param {Number} [x=0.0] The X component.
* @param {Number} [y=0.0] The Y component.
*
+ * @see Packable
* @see Cartesian3
* @see Cartesian4
*/
@@ -148,15 +149,56 @@ define([
*/
Cartesian2.fromCartesian4 = Cartesian2.clone;
+ /**
+ * The number of elements used to pack the object into an array.
+ * @Type {Number}
+ */
Cartesian2.packedLength = 2;
- Cartesian2.pack = function(array, startingIndex, value) {
+ /**
+ * Stores the provided instance into the provided array.
+ * @memberof Cartesian2
+ *
+ * @param {Cartesian2} value The value to pack.
+ * @param {Array} array The array to pack into.
+ * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
+ *
+ * @exception {DeveloperError} value is required.
+ * @exception {DeveloperError} array is required.
+ */
+ Cartesian2.pack = function(value, array, startingIndex) {
+ if (!defined(value)) {
+ throw new DeveloperError('value is required');
+ }
+
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+
array[startingIndex++] = value.x;
array[startingIndex++] = value.y;
return startingIndex;
};
+ /**
+ * Retrieves an instance from a packed array.
+ * @memberof Cartesian2
+ *
+ * @param {Array} array The packed array.
+ * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
+ * @param {Cartesian2} [result] The object into which to store the result.
+ *
+ * @exception {DeveloperError} array is required.
+ */
Cartesian2.unpack = function(array, startingIndex, result) {
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+
if (!defined(result)) {
result = new Cartesian2();
}
diff --git a/Source/Core/Cartesian3.js b/Source/Core/Cartesian3.js
index f62f151fb98c..b1e895740c04 100644
--- a/Source/Core/Cartesian3.js
+++ b/Source/Core/Cartesian3.js
@@ -22,6 +22,7 @@ define([
*
* @see Cartesian2
* @see Cartesian4
+ * @see Packable
*/
var Cartesian3 = function(x, y, z) {
/**
@@ -173,16 +174,57 @@ define([
*/
Cartesian3.fromCartesian4 = Cartesian3.clone;
+ /**
+ * The number of elements used to pack the object into an array.
+ * @Type {Number}
+ */
Cartesian3.packedLength = 3;
- Cartesian3.pack = function(array, startingIndex, value) {
+ /**
+ * Stores the provided instance into the provided array.
+ * @memberof Cartesian3
+ *
+ * @param {Cartesian3} value The value to pack.
+ * @param {Array} array The array to pack into.
+ * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
+ *
+ * @exception {DeveloperError} value is required.
+ * @exception {DeveloperError} array is required.
+ */
+ Cartesian3.pack = function(value, array, startingIndex) {
+ if (!defined(value)) {
+ throw new DeveloperError('value is required');
+ }
+
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+
array[startingIndex++] = value.x;
array[startingIndex++] = value.y;
array[startingIndex++] = value.z;
return startingIndex;
};
+ /**
+ * Retrieves an instance from a packed array.
+ * @memberof Cartesian3
+ *
+ * @param {Array} array The packed array.
+ * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
+ * @param {Cartesian3} [result] The object into which to store the result.
+ *
+ * @exception {DeveloperError} array is required.
+ */
Cartesian3.unpack = function(array, startingIndex, result) {
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+
if (!defined(result)) {
result = new Cartesian3();
}
diff --git a/Source/Core/Color.js b/Source/Core/Color.js
index b34f05bda19b..3e30a4f6bae2 100644
--- a/Source/Core/Color.js
+++ b/Source/Core/Color.js
@@ -228,9 +228,34 @@ define([
return undefined;
};
+ /**
+ * The number of elements used to pack the object into an array.
+ * @Type {Number}
+ */
Color.packedLength = 4;
- Color.pack = function(array, startingIndex, value) {
+ /**
+ * Stores the provided instance into the provided array.
+ * @memberof Color
+ *
+ * @param {Color} value The value to pack.
+ * @param {Array} array The array to pack into.
+ * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
+ *
+ * @exception {DeveloperError} value is required.
+ * @exception {DeveloperError} array is required.
+ */
+ Color.pack = function(value, array, startingIndex) {
+ if (!defined(value)) {
+ throw new DeveloperError('value is required');
+ }
+
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+
array[startingIndex++] = value.red;
array[startingIndex++] = value.green;
array[startingIndex++] = value.blue;
@@ -238,7 +263,23 @@ define([
return startingIndex;
};
+ /**
+ * Retrieves an instance from a packed array.
+ * @memberof Color
+ *
+ * @param {Array} array The packed array.
+ * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
+ * @param {Color} [result] The object into which to store the result.
+ *
+ * @exception {DeveloperError} array is required.
+ */
Color.unpack = function(array, startingIndex, result) {
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+
if (!defined(result)) {
result = new Color();
}
diff --git a/Source/Core/InterpolatableNumber.js b/Source/Core/InterpolatableNumber.js
deleted file mode 100644
index 899b8333de47..000000000000
--- a/Source/Core/InterpolatableNumber.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*global define*/
-define(['../Core/DeveloperError'], function(DeveloperError) {
- "use strict";
-
- var InterpolatableNumber = {};
-
- InterpolatableNumber.packedLength = 1;
-
- InterpolatableNumber.pack = function(array, startingIndex, value) {
- array[startingIndex++] = value;
- return startingIndex;
- };
-
- InterpolatableNumber.unpack = function(array, startingIndex, result) {
- return array[startingIndex];
- };
-
- return InterpolatableNumber;
-});
diff --git a/Source/Core/InterpolatableValue.js b/Source/Core/InterpolatableValue.js
deleted file mode 100644
index 5270f5538235..000000000000
--- a/Source/Core/InterpolatableValue.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/*global define*/
-define(['../Core/DeveloperError'], function(DeveloperError) {
- "use strict";
-
- function throwInstantiationError() {
- throw new DeveloperError('This type should not be instantiated directly.');
- }
-
- var InterpolatableValue = {};
-
- InterpolatableValue.packedLength = undefined;
-
- InterpolatableValue.packedInterpolationLength = undefined;
-
- InterpolatableValue.pack = throwInstantiationError;
-
- InterpolatableValue.unpack = throwInstantiationError;
-
- InterpolatableValue.packForInterpolation = throwInstantiationError;
-
- InterpolatableValue.unpackInterpolationResult = throwInstantiationError;
-
- return InterpolatableValue;
-});
diff --git a/Source/Core/Packable.js b/Source/Core/Packable.js
new file mode 100644
index 000000000000..cbc7e3ae2762
--- /dev/null
+++ b/Source/Core/Packable.js
@@ -0,0 +1,56 @@
+/*global define*/
+define(['../Core/DeveloperError'], function(DeveloperError) {
+ "use strict";
+
+ function throwInstantiationError() {
+ throw new DeveloperError('This type should not be instantiated directly.');
+ }
+
+ /**
+ * Base interface for objects which can store their values as packed
+ * elements in an array.
+ *
+ * @exports Packable
+ *
+ * @see {PackableForInterpolation}
+ */
+ var Packable = {
+
+ /**
+ * The number of elements used to pack the object into an array.
+ * @Type {Number}
+ */
+ packedLength : undefined,
+
+ /**
+ * Stores the provided instance into the provided array.
+ * @memberof Packable
+ *
+ * @param {Object} value The value to pack.
+ * @param {Array} array The array to pack into.
+ * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
+ *
+ * @exception {DeveloperError} value is required.
+ * @exception {DeveloperError} array is required.
+ */
+ pack : function(value, array, startingIndex) {
+ throwInstantiationError();
+ },
+
+ /**
+ * Retrieves an instance from a packed array.
+ * @memberof Packable
+ *
+ * @param {Array} array The packed array.
+ * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
+ * @param {Object} [result] The object into which to store the result.
+ *
+ * @exception {DeveloperError} array is required.
+ */
+ unpack : function(array, startingIndex, result) {
+ throwInstantiationError();
+ }
+ };
+
+ return Packable;
+});
diff --git a/Source/Core/PackableForInterpolation.js b/Source/Core/PackableForInterpolation.js
new file mode 100644
index 000000000000..f9e3a781ea2a
--- /dev/null
+++ b/Source/Core/PackableForInterpolation.js
@@ -0,0 +1,59 @@
+/*global define*/
+define(['../Core/DeveloperError'], function(DeveloperError) {
+ "use strict";
+
+ function throwInstantiationError() {
+ throw new DeveloperError('This type should not be instantiated directly.');
+ }
+
+ /**
+ * Interface for {@link Packable} objects which are interpolated in a
+ * different representation than their packed value.
+ *
+ * @exports PackableForInterpolation
+ *
+ * @see {Packable}
+ */
+ var PackableForInterpolation = {
+
+ /**
+ * The number of elements used to store the object into an array in its interpolatable form.
+ * @Type {Number}
+ */
+ packedInterpolationLength : undefined,
+
+ /**
+ * Converts a packed array into a form suitable for interpolation.
+ * @memberof PackableForInterpolation
+ *
+ * @param {Array} packedArray The packed array.
+ * @param {Number} [startingIndex=0] The index of the first element to be converted.
+ * @param {Number} [lastIndex=packedArray.length] The index of the last element to be converted.
+ * @param {Object} [result] The object into which to store the result.
+ *
+ * @exception {DeveloperError} packedArray is required.
+ */
+ convertPackedArrayForInterpolation : function(packedArray, startingIndex, lastIndex, result) {
+ throwInstantiationError();
+ },
+
+ /**
+ * Retrieves an instance from a packed array converted with {@link convertPackedArrayForInterpolation}.
+ * @memberof PackableForInterpolation
+ *
+ * @param {Array} array The original packed array.
+ * @param {Array} sourceArray The converted array.
+ * @param {Number} [startingIndex=0] The startingIndex used to convert the array.
+ * @param {Number} [lastIndex=packedArray.length] The lastIndex used to convert the array.
+ * @param {Object} [result] The object into which to store the result.
+ *
+ * @exception {DeveloperError} array is required.
+ * @exception {DeveloperError} sourceArray is required.
+ */
+ unpackInterpolationResult : function(array, sourceArray, startingIndex, lastIndex, result) {
+ throwInstantiationError();
+ }
+ };
+
+ return PackableForInterpolation;
+});
diff --git a/Source/Core/PackableNumber.js b/Source/Core/PackableNumber.js
new file mode 100644
index 000000000000..a989e83a3baa
--- /dev/null
+++ b/Source/Core/PackableNumber.js
@@ -0,0 +1,44 @@
+/*global define*/
+define([
+ '../Core/defaultValue',
+ '../Core/defined',
+ '../Core/DeveloperError'
+ ], function(
+ defaultValue,
+ defined,
+ DeveloperError) {
+ "use strict";
+
+ /**
+ * @private
+ */
+ var PackableNumber = {
+
+ packedLength : 1,
+
+ pack : function(value, array, startingIndex) {
+ if (!defined(value)) {
+ throw new DeveloperError('value is required');
+ }
+
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+
+ array[startingIndex++] = value;
+ return startingIndex;
+ },
+
+ unpack : function(array, startingIndex, result) {
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+ return array[startingIndex];
+ }
+ };
+ return PackableNumber;
+});
diff --git a/Source/Core/Quaternion.js b/Source/Core/Quaternion.js
index 99979736dd1b..5b7e266acd50 100644
--- a/Source/Core/Quaternion.js
+++ b/Source/Core/Quaternion.js
@@ -180,11 +180,34 @@ define([
var sampledQuaternionQuaternion0 = new Quaternion();
var sampledQuaternionQuaternion0Conjugate = new Quaternion();
+ /**
+ * The number of elements used to pack the object into an array.
+ * @Type {Number}
+ */
Quaternion.packedLength = 4;
- Quaternion.packedInterpolationLength = 3;
+ /**
+ * Stores the provided instance into the provided array.
+ * @memberof Quaternion
+ *
+ * @param {Quaternion} value The value to pack.
+ * @param {Array} array The array to pack into.
+ * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
+ *
+ * @exception {DeveloperError} value is required.
+ * @exception {DeveloperError} array is required.
+ */
+ Quaternion.pack = function(value, array, startingIndex) {
+ if (!defined(value)) {
+ throw new DeveloperError('value is required');
+ }
+
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
- Quaternion.pack = function(array, startingIndex, value) {
array[startingIndex++] = value.x;
array[startingIndex++] = value.y;
array[startingIndex++] = value.z;
@@ -192,13 +215,57 @@ define([
return startingIndex;
};
- Quaternion.packForInterpolation = function(sourceArray, destinationArray, firstIndex, lastIndex) {
- Quaternion.unpack(sourceArray, lastIndex * 4, sampledQuaternionQuaternion0Conjugate);
+ /**
+ * Retrieves an instance from a packed array.
+ * @memberof Quaternion
+ *
+ * @param {Array} array The packed array.
+ * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
+ * @param {Quaternion} [result] The object into which to store the result.
+ *
+ * @exception {DeveloperError} array is required.
+ */
+ Quaternion.unpack = function(array, startingIndex, result) {
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+
+ if (!defined(result)) {
+ result = new Quaternion();
+ }
+ result.x = array[startingIndex];
+ result.y = array[startingIndex + 1];
+ result.z = array[startingIndex + 2];
+ result.w = array[startingIndex + 3];
+ return result;
+ };
+
+ /**
+ * The number of elements used to store the object into an array in its interpolatable form.
+ * @Type {Number}
+ */
+ Quaternion.packedInterpolationLength = 3;
+
+ /**
+ * Converts a packed array into a form suitable for interpolation.
+ * @memberof Quaternion
+ *
+ * @param {Array} packedArray The packed array.
+ * @param {Number} [startingIndex=0] The index of the first element to be converted.
+ * @param {Number} [lastIndex=packedArray.length] The index of the last element to be converted.
+ * @param {Quaternion} [result] The object into which to store the result.
+ *
+ * @exception {DeveloperError} packedArray is required.
+ */
+ Quaternion.convertPackedArrayForInterpolation = function(packedArray, startingIndex, lastIndex, result) {
+ Quaternion.unpack(packedArray, lastIndex * 4, sampledQuaternionQuaternion0Conjugate);
sampledQuaternionQuaternion0Conjugate.conjugate(sampledQuaternionQuaternion0Conjugate);
- for ( var i = 0, len = lastIndex - firstIndex + 1; i < len; i++) {
+ for ( var i = 0, len = lastIndex - startingIndex + 1; i < len; i++) {
var offset = i * 3;
- Quaternion.unpack(sourceArray, (firstIndex + i) * 4, sampledQuaternionTempQuaternion);
+ Quaternion.unpack(packedArray, (startingIndex + i) * 4, sampledQuaternionTempQuaternion);
sampledQuaternionTempQuaternion.multiply(sampledQuaternionQuaternion0Conjugate, sampledQuaternionTempQuaternion);
@@ -208,24 +275,26 @@ define([
sampledQuaternionTempQuaternion.getAxis(sampledQuaternionAxis);
var angle = sampledQuaternionTempQuaternion.getAngle();
- destinationArray[offset] = sampledQuaternionAxis.x * angle;
- destinationArray[offset + 1] = sampledQuaternionAxis.y * angle;
- destinationArray[offset + 2] = sampledQuaternionAxis.z * angle;
- }
- };
-
- Quaternion.unpack = function(array, startingIndex, result) {
- if (!defined(result)) {
- result = new Quaternion();
+ result[offset] = sampledQuaternionAxis.x * angle;
+ result[offset + 1] = sampledQuaternionAxis.y * angle;
+ result[offset + 2] = sampledQuaternionAxis.z * angle;
}
- result.x = array[startingIndex];
- result.y = array[startingIndex + 1];
- result.z = array[startingIndex + 2];
- result.w = array[startingIndex + 3];
- return result;
};
- Quaternion.unpackInterpolationResult = function(array, result, sourceArray, firstIndex, lastIndex) {
+ /**
+ * Retrieves an instance from a packed array converted with {@link convertPackedArrayForInterpolation}.
+ * @memberof Quaternion
+ *
+ * @param {Array} array The original packed array.
+ * @param {Array} sourceArray The converted array.
+ * @param {Number} [startingIndex=0] The startingIndex used to convert the array.
+ * @param {Number} [lastIndex=packedArray.length] The lastIndex used to convert the array.
+ * @param {Quaternion} [result] The object into which to store the result.
+ *
+ * @exception {DeveloperError} array is required.
+ * @exception {DeveloperError} sourceArray is required.
+ */
+ Quaternion.unpackInterpolationResult = function(array, sourceArray, firstIndex, lastIndex, result) {
if (!defined(result)) {
result = new Quaternion();
}
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index c50b5fe42d01..926b8758250c 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -5,7 +5,7 @@ define([
'../Core/defined',
'../Core/defineProperties',
'../Core/DeveloperError',
- '../Core/InterpolatableNumber',
+ '../Core/PackableNumber',
'../Core/JulianDate',
'../Core/LinearApproximation'
], function(
@@ -14,7 +14,7 @@ define([
defined,
defineProperties,
DeveloperError,
- InterpolatableNumber,
+ PackableNumber,
JulianDate,
LinearApproximation) {
"use strict";
@@ -117,7 +117,7 @@ define([
this.type = type;
if (type === Number) {
- type = InterpolatableNumber;
+ type = PackableNumber;
}
var packedInterpolationLength = defaultValue(type.packedInterpolationLength, type.packedLength);
@@ -237,7 +237,8 @@ define([
for ( var i = 0; i < length; ++i) {
xTable[i] = times[lastIndex].getSecondsDifference(times[firstIndex + i]);
}
- if (!defined(innerType.packForInterpolation)) {
+
+ if (!defined(innerType.convertPackedArrayForInterpolation)) {
var destinationIndex = 0;
var packedLength = innerType.packedLength;
var sourceIndex = firstIndex * packedLength;
@@ -249,7 +250,7 @@ define([
destinationIndex++;
}
} else {
- innerType.packForInterpolation(values, yTable, firstIndex, lastIndex);
+ innerType.convertPackedArrayForInterpolation(values, firstIndex, lastIndex, yTable);
}
// Interpolate!
@@ -259,7 +260,7 @@ define([
if (!defined(innerType.unpackInterpolationResult)) {
return innerType.unpack(interpolationResult, 0, result);
}
- return innerType.unpackInterpolationResult(interpolationResult, result, values, firstIndex, lastIndex);
+ return innerType.unpackInterpolationResult(interpolationResult, values, firstIndex, lastIndex, result);
}
return innerType.unpack(this._values, index * innerType.packedLength, result);
};
@@ -267,7 +268,7 @@ define([
SampledProperty.prototype.addSample = function(time, value) {
var innerType = this._innerType;
var data = [time];
- innerType.pack(data, 1, value);
+ innerType.pack(value, data, 1);
_mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
this._updateTables = true;
};
@@ -278,7 +279,7 @@ define([
var data = [];
for ( var i = 0; i < length; i++) {
data.push(times[i]);
- innerType.pack(data, data.length, values[i]);
+ innerType.pack(values[i], data, data.length);
}
_mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
this._updateTables = true;
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index 9e8c0db855bb..c63240293f6c 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -56,7 +56,7 @@ defineSuite([
expect(property.getValue(new JulianDate(0.5, 0))).toEqual(7.5);
});
- it('works with specialized interpolation packing', function() {
+ it('works with PackableForInterpolation', function() {
var CustomType = function(value) {
this.x = value;
};
@@ -65,7 +65,7 @@ defineSuite([
CustomType.packedInterpolationLength = 2;
- CustomType.pack = function(array, startingIndex, value) {
+ CustomType.pack = function(value, array, startingIndex) {
array[startingIndex++] = value.x;
return startingIndex;
};
@@ -74,15 +74,15 @@ defineSuite([
return array[startingIndex];
};
- CustomType.packForInterpolation = function(sourceArray, destinationArray, firstIndex, lastIndex) {
- for ( var i = 0, len = lastIndex - firstIndex + 1; i < len; i++) {
+ CustomType.convertPackedArrayForInterpolation = function(packedArray, startingIndex, lastIndex, result) {
+ for ( var i = 0, len = lastIndex - startingIndex + 1; i < len; i++) {
var offset = i * 2;
- destinationArray[offset] = sourceArray[i] * 0.5;
- destinationArray[offset + 1] = sourceArray[i] * 0.5;
+ result[offset] = packedArray[i] * 0.5;
+ result[offset + 1] = packedArray[i] * 0.5;
}
};
- CustomType.unpackInterpolationResult = function(array, result, sourceArray, firstIndex, lastIndex) {
+ CustomType.unpackInterpolationResult = function(array, sourceArray, firstIndex, lastIndex, result) {
if (!defined(result)) {
result = new CustomType();
}
From fd4db232788b1ca914ed449a0608d8583a472cf3 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 19 Aug 2013 15:59:46 -0400
Subject: [PATCH 29/65] Specs for Packable implementations
---
Source/Core/Cartesian2.js | 3 +-
Source/Core/Cartesian3.js | 3 +-
Source/Core/Cartesian4.js | 63 +++++++++++++++++++++++
Source/Core/Color.js | 5 +-
Source/Core/PackableNumber.js | 3 +-
Source/Core/Quaternion.js | 5 +-
Specs/Core/Cartesian2Spec.js | 8 ++-
Specs/Core/Cartesian3Spec.js | 10 ++--
Specs/Core/Cartesian4Spec.js | 8 ++-
Specs/Core/ColorSpec.js | 8 ++-
Specs/Core/QuaternionSpec.js | 9 ++--
Specs/DynamicScene/SampledPropertySpec.js | 3 +-
Specs/createPackableSpecs.js | 53 +++++++++++++++++++
13 files changed, 157 insertions(+), 24 deletions(-)
create mode 100644 Specs/createPackableSpecs.js
diff --git a/Source/Core/Cartesian2.js b/Source/Core/Cartesian2.js
index 43f2b405f49a..94c1ed0e92a9 100644
--- a/Source/Core/Cartesian2.js
+++ b/Source/Core/Cartesian2.js
@@ -178,8 +178,7 @@ define([
startingIndex = defaultValue(startingIndex, 0);
array[startingIndex++] = value.x;
- array[startingIndex++] = value.y;
- return startingIndex;
+ array[startingIndex] = value.y;
};
/**
diff --git a/Source/Core/Cartesian3.js b/Source/Core/Cartesian3.js
index b1e895740c04..275ee5daffe1 100644
--- a/Source/Core/Cartesian3.js
+++ b/Source/Core/Cartesian3.js
@@ -204,8 +204,7 @@ define([
array[startingIndex++] = value.x;
array[startingIndex++] = value.y;
- array[startingIndex++] = value.z;
- return startingIndex;
+ array[startingIndex] = value.z;
};
/**
diff --git a/Source/Core/Cartesian4.js b/Source/Core/Cartesian4.js
index 95d3b81fdbbb..8169681d53b5 100644
--- a/Source/Core/Cartesian4.js
+++ b/Source/Core/Cartesian4.js
@@ -23,6 +23,7 @@ define([
*
* @see Cartesian2
* @see Cartesian3
+ * @see Packable
*/
var Cartesian4 = function(x, y, z, w) {
/**
@@ -145,6 +146,68 @@ define([
return result;
};
+
+ /**
+ * The number of elements used to pack the object into an array.
+ * @Type {Number}
+ */
+ Cartesian4.packedLength = 4;
+
+ /**
+ * Stores the provided instance into the provided array.
+ * @memberof Cartesian4
+ *
+ * @param {Cartesian4} value The value to pack.
+ * @param {Array} array The array to pack into.
+ * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
+ *
+ * @exception {DeveloperError} value is required.
+ * @exception {DeveloperError} array is required.
+ */
+ Cartesian4.pack = function(value, array, startingIndex) {
+ if (!defined(value)) {
+ throw new DeveloperError('value is required');
+ }
+
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+
+ array[startingIndex++] = value.x;
+ array[startingIndex++] = value.y;
+ array[startingIndex++] = value.z;
+ array[startingIndex] = value.w;
+ };
+
+ /**
+ * Retrieves an instance from a packed array.
+ * @memberof Cartesian4
+ *
+ * @param {Array} array The packed array.
+ * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
+ * @param {Cartesian4} [result] The object into which to store the result.
+ *
+ * @exception {DeveloperError} array is required.
+ */
+ Cartesian4.unpack = function(array, startingIndex, result) {
+ if (!defined(array)) {
+ throw new DeveloperError('array is required');
+ }
+
+ startingIndex = defaultValue(startingIndex, 0);
+
+ if (!defined(result)) {
+ result = new Cartesian4();
+ }
+ result.x = array[startingIndex++];
+ result.y = array[startingIndex++];
+ result.z = array[startingIndex++];
+ result.w = array[startingIndex];
+ return result;
+ };
+
/**
* Computes the value of the maximum component for the supplied Cartesian.
* @memberof Cartesian4
diff --git a/Source/Core/Color.js b/Source/Core/Color.js
index 3e30a4f6bae2..bbc85d9ddb99 100644
--- a/Source/Core/Color.js
+++ b/Source/Core/Color.js
@@ -42,6 +42,8 @@ define([
*
* @constructor
* @alias Color
+ *
+ * @see Packable
*/
var Color = function(red, green, blue, alpha) {
/**
@@ -259,8 +261,7 @@ define([
array[startingIndex++] = value.red;
array[startingIndex++] = value.green;
array[startingIndex++] = value.blue;
- array[startingIndex++] = value.alpha;
- return startingIndex;
+ array[startingIndex] = value.alpha;
};
/**
diff --git a/Source/Core/PackableNumber.js b/Source/Core/PackableNumber.js
index a989e83a3baa..0bc3f4a62843 100644
--- a/Source/Core/PackableNumber.js
+++ b/Source/Core/PackableNumber.js
@@ -27,8 +27,7 @@ define([
startingIndex = defaultValue(startingIndex, 0);
- array[startingIndex++] = value;
- return startingIndex;
+ array[startingIndex] = value;
},
unpack : function(array, startingIndex, result) {
diff --git a/Source/Core/Quaternion.js b/Source/Core/Quaternion.js
index 5b7e266acd50..b4d76ed66a6d 100644
--- a/Source/Core/Quaternion.js
+++ b/Source/Core/Quaternion.js
@@ -26,6 +26,8 @@ define([
* @param {Number} [y=0.0] The Y component.
* @param {Number} [z=0.0] The Z component.
* @param {Number} [w=0.0] The W component.
+ *
+ * @see PackableForInterpolation
*/
var Quaternion = function(x, y, z, w) {
/**
@@ -211,8 +213,7 @@ define([
array[startingIndex++] = value.x;
array[startingIndex++] = value.y;
array[startingIndex++] = value.z;
- array[startingIndex++] = value.w;
- return startingIndex;
+ array[startingIndex] = value.w;
};
/**
diff --git a/Specs/Core/Cartesian2Spec.js b/Specs/Core/Cartesian2Spec.js
index 302c57e27474..019b144580e7 100644
--- a/Specs/Core/Cartesian2Spec.js
+++ b/Specs/Core/Cartesian2Spec.js
@@ -1,10 +1,12 @@
/*global defineSuite*/
defineSuite([
'Core/Cartesian2',
- 'Core/Math'
+ 'Core/Math',
+ 'Specs/createPackableSpecs'
], function(
Cartesian2,
- CesiumMath) {
+ CesiumMath,
+ createPackableSpecs) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -629,4 +631,6 @@ defineSuite([
var expectedResult = new Cartesian2(2, 2);
expect(cartesian2).toEqual(expectedResult);
});
+
+ createPackableSpecs(Cartesian2, new Cartesian2(1, 2), [1, 2]);
});
diff --git a/Specs/Core/Cartesian3Spec.js b/Specs/Core/Cartesian3Spec.js
index baf5b3c74cd9..eeb83d7e3f7e 100644
--- a/Specs/Core/Cartesian3Spec.js
+++ b/Specs/Core/Cartesian3Spec.js
@@ -1,10 +1,12 @@
/*global defineSuite*/
defineSuite([
'Core/Cartesian3',
- 'Core/Math'
+ 'Core/Math',
+ 'Specs/createPackableSpecs'
], function(
- Cartesian3,
- CesiumMath) {
+ Cartesian3,
+ CesiumMath,
+ createPackableSpecs) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -713,4 +715,6 @@ defineSuite([
var expectedResult = new Cartesian3(2, 2, 4);
expect(cartesian3).toEqual(expectedResult);
});
+
+ createPackableSpecs(Cartesian3, new Cartesian3(1, 2, 3), [1, 2, 3]);
});
diff --git a/Specs/Core/Cartesian4Spec.js b/Specs/Core/Cartesian4Spec.js
index cabdfc2aa101..2cd4cde011f0 100644
--- a/Specs/Core/Cartesian4Spec.js
+++ b/Specs/Core/Cartesian4Spec.js
@@ -1,8 +1,10 @@
/*global defineSuite*/
defineSuite([
- 'Core/Cartesian4'
+ 'Core/Cartesian4',
+ 'Specs/createPackableSpecs'
], function(
- Cartesian4) {
+ Cartesian4,
+ createPackableSpecs) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -633,4 +635,6 @@ defineSuite([
var expectedResult = new Cartesian4(2, 2, 4, 7);
expect(cartesian4).toEqual(expectedResult);
});
+
+ createPackableSpecs(Cartesian4, new Cartesian4(1, 2, 3, 4), [1, 2, 3, 4]);
});
diff --git a/Specs/Core/ColorSpec.js b/Specs/Core/ColorSpec.js
index eba3e0d814b6..4010b7eefa0a 100644
--- a/Specs/Core/ColorSpec.js
+++ b/Specs/Core/ColorSpec.js
@@ -1,9 +1,11 @@
/*global defineSuite*/
defineSuite(['Core/Color',
- 'Core/Math'
+ 'Core/Math',
+ 'Specs/createPackableSpecs'
], function(
Color,
- CesiumMath) {
+ CesiumMath,
+ createPackableSpecs) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -242,4 +244,6 @@ defineSuite(['Core/Color',
var newRgba = newColor.toRgba();
expect(rgba).toEqual(newRgba);
});
+
+ createPackableSpecs(Color, new Color(0.1, 0.2, 0.3, 0.4), [0.1, 0.2, 0.3, 0.4]);
});
diff --git a/Specs/Core/QuaternionSpec.js b/Specs/Core/QuaternionSpec.js
index fe45b3dc45ff..829ae9cfd13d 100644
--- a/Specs/Core/QuaternionSpec.js
+++ b/Specs/Core/QuaternionSpec.js
@@ -3,12 +3,14 @@ defineSuite([
'Core/Quaternion',
'Core/Cartesian3',
'Core/Math',
- 'Core/Matrix3'
+ 'Core/Matrix3',
+ 'Specs/createPackableSpecs'
], function(
Quaternion,
Cartesian3,
CesiumMath,
- Matrix3) {
+ Matrix3,
+ createPackableSpecs) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -758,5 +760,6 @@ defineSuite([
Quaternion.equalsEpsilon(new Quaternion(), new Quaternion(), undefined);
}).toThrow();
});
-});
+ createPackableSpecs(Quaternion, new Quaternion(1, 2, 3, 4), [1, 2, 3, 4]);
+});
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index c63240293f6c..473b1db90b52 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -66,8 +66,7 @@ defineSuite([
CustomType.packedInterpolationLength = 2;
CustomType.pack = function(value, array, startingIndex) {
- array[startingIndex++] = value.x;
- return startingIndex;
+ array[startingIndex] = value.x;
};
CustomType.unpack = function(array, startingIndex, result) {
diff --git a/Specs/createPackableSpecs.js b/Specs/createPackableSpecs.js
new file mode 100644
index 000000000000..9d45d1134aaa
--- /dev/null
+++ b/Specs/createPackableSpecs.js
@@ -0,0 +1,53 @@
+/*global define*/
+define(function() {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ function createPackableSpecs(packable, instance, packedInstance) {
+ it('can pack', function() {
+ var packedArray = [];
+ packable.pack(instance, packedArray);
+ expect(packedArray.length).toEqual(packable.packedLength);
+ expect(packedArray).toEqual(packedInstance);
+ });
+
+ it('can unpack', function() {
+ var result = packable.unpack(packedInstance);
+ expect(result).toEqual(instance);
+ });
+
+ it('can pack with startingIndex', function() {
+ var packedArray = [0];
+ var expected = packedArray.concat(packedInstance);
+ packable.pack(instance, packedArray, 1);
+ expect(packedArray).toEqual(expected);
+ });
+
+ it('can unpack with startingIndex', function() {
+ var packedArray = [0].concat(packedInstance);
+ var result = packable.unpack(packedArray, 1);
+ expect(instance).toEqual(result);
+ });
+
+ it('pack throws with undefined value', function() {
+ var array = [];
+ expect(function() {
+ packable.pack(undefined, array);
+ }).toThrow();
+ });
+
+ it('pack throws with undefined array', function() {
+ expect(function() {
+ packable.pack(instance, undefined);
+ }).toThrow();
+ });
+
+ it('unpack throws with undefined array', function() {
+ expect(function() {
+ packable.unpack(undefined);
+ }).toThrow();
+ });
+ }
+
+ return createPackableSpecs;
+});
From 9332eead2197c732cdf881da2d31315fbcdb7a13 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 19 Aug 2013 17:44:09 -0400
Subject: [PATCH 30/65] Start refactoring DynamicScene material handling
Lots of brokeness, but have a new architecture in place.
---
Source/DynamicScene/DynamicColorMaterial.js | 40 +----
Source/DynamicScene/DynamicCone.js | 47 +-----
.../DynamicConeVisualizerUsingCustomSensor.js | 8 +-
Source/DynamicScene/DynamicEllipsoid.js | 17 +--
.../DynamicEllipsoidVisualizer.js | 8 +-
Source/DynamicScene/DynamicGridMaterial.js | 65 ---------
Source/DynamicScene/DynamicImageMaterial.js | 42 ------
.../DynamicScene/DynamicMaterialProperty.js | 2 +-
Source/DynamicScene/DynamicPolygon.js | 17 +--
.../DynamicScene/DynamicPolygonVisualizer.js | 8 +-
Source/DynamicScene/DynamicPyramid.js | 16 +-
.../DynamicScene/DynamicPyramidVisualizer.js | 8 +-
Source/DynamicScene/GeoJsonDataSource.js | 19 +--
Source/DynamicScene/processMaterial.js | 138 ++++++++++++++++++
Source/DynamicScene/processPacketData.js | 73 +++++++++
15 files changed, 257 insertions(+), 251 deletions(-)
create mode 100644 Source/DynamicScene/processMaterial.js
diff --git a/Source/DynamicScene/DynamicColorMaterial.js b/Source/DynamicScene/DynamicColorMaterial.js
index c59fd551b126..abb1f36cba30 100644
--- a/Source/DynamicScene/DynamicColorMaterial.js
+++ b/Source/DynamicScene/DynamicColorMaterial.js
@@ -1,14 +1,8 @@
/*global define*/
define([
- '../Core/Color',
- '../Core/defined',
- './processPacketData',
- '../Scene/Material'
+ '../Core/defined'
], function(
- Color,
- defined,
- processPacketData,
- Material) {
+ defined) {
"use strict";
/**
@@ -41,35 +35,5 @@ define([
*/
DynamicColorMaterial.prototype.isMaterial = DynamicColorMaterial.isMaterial;
- /**
- * Provided a CZML interval containing color material data, processes the
- * interval into a new or existing instance of this class.
- *
- * @param {Object} czmlInterval The interval to process.
- * @param {DynamicColorMaterial} [existingMaterial] The DynamicColorMaterial to modify.
- */
- DynamicColorMaterial.prototype.processCzmlIntervals = function(czmlInterval) {
- var materialData = czmlInterval.solidColor;
- if (defined(materialData)) {
- processPacketData(Color, this, 'color', materialData.color);
- }
- };
-
- /**
- * Gets a Color Material that represents this dynamic material at the provided time.
- *
- * @param {JulianDate} time The desired time.
- * @param {Context} context The context in which this material exists.
- * @param {Material} [existingMaterial] An existing material to be modified. If the material is undefined or not a Color Material, a new instance is created.
- * @returns The modified existingMaterial parameter or a new Color Material instance if existingMaterial was undefined or not a Color Material.
- */
- DynamicColorMaterial.prototype.getValue = function(time, context, existingMaterial) {
- if (!defined(existingMaterial) || (existingMaterial.type !== Material.ColorType)) {
- existingMaterial = Material.fromType(context, Material.ColorType);
- }
- existingMaterial.uniforms.color = this.color.getValue(time, existingMaterial.uniforms.color);
- return existingMaterial;
- };
-
return DynamicColorMaterial;
});
diff --git a/Source/DynamicScene/DynamicCone.js b/Source/DynamicScene/DynamicCone.js
index f529c1798e71..79b640e1b04d 100644
--- a/Source/DynamicScene/DynamicCone.js
+++ b/Source/DynamicScene/DynamicCone.js
@@ -4,15 +4,13 @@ define([
'../Core/defaultValue',
'../Core/defined',
'../Core/Color',
- './processPacketData',
- './DynamicMaterialProperty'
+ './processPacketData'
], function(
TimeInterval,
defaultValue,
defined,
Color,
- processPacketData,
- DynamicMaterialProperty) {
+ processPacketData) {
"use strict";
/**
@@ -152,43 +150,10 @@ define([
coneUpdated = processPacketData(Number, cone, 'outerHalfAngle', coneData.outerHalfAngle, interval, sourceUri) || coneUpdated;
coneUpdated = processPacketData(Number, cone, 'minimumClockAngle', coneData.minimumClockAngle, interval, sourceUri) || coneUpdated;
coneUpdated = processPacketData(Number, cone, 'maximumClockAngle', coneData.maximumClockAngle, interval, sourceUri) || coneUpdated;
-
- if (defined(coneData.capMaterial)) {
- var capMaterial = cone.capMaterial;
- if (!defined(capMaterial)) {
- cone.capMaterial = capMaterial = new DynamicMaterialProperty();
- coneUpdated = true;
- }
- capMaterial.processCzmlIntervals(coneData.capMaterial, interval);
- }
-
- if (defined(coneData.innerMaterial)) {
- var innerMaterial = cone.innerMaterial;
- if (!defined(innerMaterial)) {
- cone.innerMaterial = innerMaterial = new DynamicMaterialProperty();
- coneUpdated = true;
- }
- innerMaterial.processCzmlIntervals(coneData.innerMaterial, interval);
- }
-
- if (defined(coneData.outerMaterial)) {
- var outerMaterial = cone.outerMaterial;
- if (!defined(outerMaterial)) {
- cone.outerMaterial = outerMaterial = new DynamicMaterialProperty();
- coneUpdated = true;
- }
- outerMaterial.processCzmlIntervals(coneData.outerMaterial, interval);
- }
-
- if (defined(coneData.silhouetteMaterial)) {
- var silhouetteMaterial = cone.silhouetteMaterial;
- if (!defined(silhouetteMaterial)) {
- cone.silhouetteMaterial = silhouetteMaterial = new DynamicMaterialProperty();
- coneUpdated = true;
- }
- silhouetteMaterial.processCzmlIntervals(coneData.silhouetteMaterial, interval);
- }
-
+ coneUpdated = processPacketData.material(cone, 'capMaterial', coneData.capMaterial, interval, sourceUri);
+ coneUpdated = processPacketData.material(cone, 'innerMaterial', coneData.innerMaterial, interval, sourceUri);
+ coneUpdated = processPacketData.material(cone, 'outerMaterial', coneData.outerMaterial, interval, sourceUri);
+ coneUpdated = processPacketData.material(cone, 'silhouetteMaterial', coneData.silhouetteMaterial, interval, sourceUri);
return coneUpdated;
};
diff --git a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
index 80591ac1d8ab..1d253e598690 100644
--- a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
+++ b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
@@ -12,7 +12,8 @@ define([
'../Core/Matrix4',
'../Core/Spherical',
'../Scene/CustomSensorVolume',
- '../Scene/Material'
+ '../Scene/Material',
+ './processMaterial'
], function(
Cartesian3,
Color,
@@ -26,7 +27,8 @@ define([
Matrix4,
Spherical,
CustomSensorVolume,
- Material) {
+ Material,
+ processMaterial) {
"use strict";
//CZML_TODO DynamicConeVisualizerUsingCustomSensor is a temporary workaround
@@ -364,7 +366,7 @@ define([
var material = dynamicCone.outerMaterial;
if (defined(material)) {
- cone.material = material.getValue(time, context, cone.material);
+ cone.material = processMaterial(time, material, context, cone.material);
}
property = dynamicCone.intersectionColor;
diff --git a/Source/DynamicScene/DynamicEllipsoid.js b/Source/DynamicScene/DynamicEllipsoid.js
index aa11e41d8857..70cea814bf1e 100644
--- a/Source/DynamicScene/DynamicEllipsoid.js
+++ b/Source/DynamicScene/DynamicEllipsoid.js
@@ -4,15 +4,13 @@ define([
'../Core/defaultValue',
'../Core/defined',
'../Core/Cartesian3',
- './processPacketData',
- './DynamicMaterialProperty'
+ './processPacketData'
], function(
TimeInterval,
defaultValue,
defined,
Cartesian3,
- processPacketData,
- DynamicMaterialProperty) {
+ processPacketData) {
"use strict";
/**
@@ -87,16 +85,7 @@ define([
ellipsoidUpdated = processPacketData(Boolean, ellipsoid, 'show', ellipsoidData.show, interval, sourceUri) || ellipsoidUpdated;
ellipsoidUpdated = processPacketData(Cartesian3, ellipsoid, 'radii', ellipsoidData.radii, interval, sourceUri) || ellipsoidUpdated;
-
- if (defined(ellipsoidData.material)) {
- var material = ellipsoid.material;
- if (!defined(material)) {
- ellipsoid.material = material = new DynamicMaterialProperty();
- ellipsoidUpdated = true;
- }
- material.processCzmlIntervals(ellipsoidData.material, interval);
- }
-
+ ellipsoidUpdated = processPacketData.material(ellipsoid, 'material', ellipsoidData.material, interval, sourceUri);
return ellipsoidUpdated;
};
diff --git a/Source/DynamicScene/DynamicEllipsoidVisualizer.js b/Source/DynamicScene/DynamicEllipsoidVisualizer.js
index 773d03fc3045..204dcebf6ef4 100644
--- a/Source/DynamicScene/DynamicEllipsoidVisualizer.js
+++ b/Source/DynamicScene/DynamicEllipsoidVisualizer.js
@@ -7,7 +7,8 @@ define([
'../Core/Matrix3',
'../Core/Matrix4',
'../Scene/EllipsoidPrimitive',
- '../Scene/Material'
+ '../Scene/Material',
+ './processMaterial'
], function(
defaultValue,
defined,
@@ -16,7 +17,8 @@ define([
Matrix3,
Matrix4,
EllipsoidPrimitive,
- Material) {
+ Material,
+ processMaterial) {
"use strict";
var matrix3Scratch = new Matrix3();
@@ -254,7 +256,7 @@ define([
var material = dynamicEllipsoid.material;
if (defined(material)) {
- ellipsoid.material = material.getValue(time, context, ellipsoid.material);
+ ellipsoid.material = processMaterial(time, material, context, ellipsoid.material);
}
}
diff --git a/Source/DynamicScene/DynamicGridMaterial.js b/Source/DynamicScene/DynamicGridMaterial.js
index 8c7e533ce133..929cf8d7e40b 100644
--- a/Source/DynamicScene/DynamicGridMaterial.js
+++ b/Source/DynamicScene/DynamicGridMaterial.js
@@ -98,70 +98,5 @@ define([
processPacketData(Number, this, 'columnThickness', materialData.columnThickness, undefined, sourceUri);
};
- /**
- * Gets an Grid Material that represents this dynamic material at the provided time.
- *
- * @param {JulianDate} time The desired time.
- * @param {Context} context The context in which this material exists.
- * @param {Material} [existingMaterial] An existing material to be modified. If the material is undefined or not an Grid Material, a new instance is created.
- * @returns The modified existingMaterial parameter or a new Grid Material instance if existingMaterial was undefined or not a Grid Material.
- */
- DynamicGridMaterial.prototype.getValue = function(time, context, existingMaterial) {
- if (!defined(existingMaterial) || (existingMaterial.type !== Material.GridType)) {
- existingMaterial = Material.fromType(context, Material.GridType);
- }
-
- var property = this.color;
- if (defined(property)) {
- property.getValue(time, existingMaterial.uniforms.color);
- }
-
- property = this.cellAlpha;
- if (defined(property)) {
- var cellAlpha = property.getValue(time);
- if (defined(cellAlpha)) {
- existingMaterial.uniforms.cellAlpha = cellAlpha;
- }
- }
-
- var lineCount = existingMaterial.uniforms.lineCount;
-
- property = this.rowCount;
- if (defined(property)) {
- var rowCount = property.getValue(time);
- if (defined(rowCount)) {
- lineCount.x = rowCount;
- }
- }
-
- property = this.columnCount;
- if (defined(property)) {
- var columnCount = property.getValue(time);
- if (defined(columnCount)) {
- lineCount.y = columnCount;
- }
- }
-
- var lineThickness = existingMaterial.uniforms.lineThickness;
-
- property = this.rowThickness;
- if (defined(property)) {
- var rowThickness = property.getValue(time);
- if (defined(rowThickness)) {
- lineThickness.x = rowThickness;
- }
- }
-
- property = this.columnThickness;
- if (defined(property)) {
- var columnThickness = property.getValue(time);
- if (defined(columnThickness)) {
- lineThickness.y = columnThickness;
- }
- }
-
- return existingMaterial;
- };
-
return DynamicGridMaterial;
});
diff --git a/Source/DynamicScene/DynamicImageMaterial.js b/Source/DynamicScene/DynamicImageMaterial.js
index 34d5557f7648..41bdf2d52d7c 100644
--- a/Source/DynamicScene/DynamicImageMaterial.js
+++ b/Source/DynamicScene/DynamicImageMaterial.js
@@ -71,47 +71,5 @@ define([
processPacketData(Number, this, 'horizontalRepeat', materialData.horizontalRepeat, undefined, sourceUri);
};
- /**
- * Gets an Image Material that represents this dynamic material at the provided time.
- *
- * @param {JulianDate} time The desired time.
- * @param {Context} context The context in which this material exists.
- * @param {Material} [existingMaterial] An existing material to be modified. If the material is undefined or not an Image Material, a new instance is created.
- * @returns The modified existingMaterial parameter or a new Image Material instance if existingMaterial was undefined or not a Image Material.
- */
- DynamicImageMaterial.prototype.getValue = function(time, context, existingMaterial) {
- if (!defined(existingMaterial) || (existingMaterial.type !== Material.ImageType)) {
- existingMaterial = Material.fromType(context, Material.ImageType);
- }
-
- var xRepeat;
- var property = this.verticalRepeat;
- if (defined(property)) {
- xRepeat = property.getValue(time);
- if (defined(xRepeat)) {
- existingMaterial.uniforms.repeat.x = xRepeat;
- }
- }
-
- var yRepeat;
- property = this.horizontalRepeat;
- if (defined(property)) {
- yRepeat = property.getValue(time);
- if (defined(yRepeat)) {
- existingMaterial.uniforms.repeat.y = yRepeat;
- }
- }
-
- property = this.image;
- if (defined(property)) {
- var url = this.image.getValue(time);
- if (defined(url) && existingMaterial.currentUrl !== url) {
- existingMaterial.currentUrl = url;
- existingMaterial.uniforms.image = url;
- }
- }
- return existingMaterial;
- };
-
return DynamicImageMaterial;
});
diff --git a/Source/DynamicScene/DynamicMaterialProperty.js b/Source/DynamicScene/DynamicMaterialProperty.js
index 64127fc3d856..f0f4ccec2cd3 100644
--- a/Source/DynamicScene/DynamicMaterialProperty.js
+++ b/Source/DynamicScene/DynamicMaterialProperty.js
@@ -70,7 +70,7 @@ define([
var value = this._intervals.findIntervalContainingDate(time);
var material = defined(value) ? value.data : undefined;
if (defined(material)) {
- return material.getValue(time, context, existingMaterial);
+ return material;
}
return existingMaterial;
};
diff --git a/Source/DynamicScene/DynamicPolygon.js b/Source/DynamicScene/DynamicPolygon.js
index 95437d0c2eb5..511f536e03ba 100644
--- a/Source/DynamicScene/DynamicPolygon.js
+++ b/Source/DynamicScene/DynamicPolygon.js
@@ -3,14 +3,12 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- './processPacketData',
- './DynamicMaterialProperty'
+ './processPacketData'
], function(
TimeInterval,
defaultValue,
defined,
- processPacketData,
- DynamicMaterialProperty) {
+ processPacketData) {
"use strict";
/**
@@ -78,16 +76,7 @@ define([
}
polygonUpdated = processPacketData(Boolean, polygon, 'show', polygonData.show, interval, sourceUri) || polygonUpdated;
-
- if (defined(polygonData.material)) {
- var material = polygon.material;
- if (!defined(material)) {
- polygon.material = material = new DynamicMaterialProperty();
- polygonUpdated = true;
- }
- material.processCzmlIntervals(polygonData.material, interval, sourceUri);
- }
-
+ polygonUpdated = processPacketData.material(polygon, 'material', polygonData.material, interval, sourceUri);
return polygonUpdated;
};
diff --git a/Source/DynamicScene/DynamicPolygonVisualizer.js b/Source/DynamicScene/DynamicPolygonVisualizer.js
index 390131eb2c10..68f16e86e1db 100644
--- a/Source/DynamicScene/DynamicPolygonVisualizer.js
+++ b/Source/DynamicScene/DynamicPolygonVisualizer.js
@@ -5,14 +5,16 @@ define([
'../Core/DeveloperError',
'../Core/destroyObject',
'../Scene/Polygon',
- '../Scene/Material'
+ '../Scene/Material',
+ './processMaterial'
], function(
Cartesian3,
defined,
DeveloperError,
destroyObject,
Polygon,
- Material) {
+ Material,
+ processMaterial) {
"use strict";
/**
@@ -238,7 +240,7 @@ define([
var material = dynamicPolygon.material;
if (defined(material)) {
- polygon.material = material.getValue(time, context, polygon.material);
+ polygon.material = processMaterial(time, material, context, polygon.material);
}
}
diff --git a/Source/DynamicScene/DynamicPyramid.js b/Source/DynamicScene/DynamicPyramid.js
index b5ae6ed3f98c..5bb003c28b7c 100644
--- a/Source/DynamicScene/DynamicPyramid.js
+++ b/Source/DynamicScene/DynamicPyramid.js
@@ -5,16 +5,14 @@ define([
'../Core/defined',
'../Core/Color',
'./processPacketData',
- './DynamicDirectionsProperty',
- './DynamicMaterialProperty'
+ './DynamicDirectionsProperty'
], function(
TimeInterval,
defaultValue,
defined,
Color,
processPacketData,
- DynamicDirectionsProperty,
- DynamicMaterialProperty) {
+ DynamicDirectionsProperty) {
"use strict";
/**
@@ -116,15 +114,7 @@ define([
pyramidUpdated = processPacketData(Boolean, pyramid, 'showIntersection', pyramidData.showIntersection, interval, sourceUri) || pyramidUpdated;
pyramidUpdated = processPacketData(Color, pyramid, 'intersectionColor', pyramidData.intersectionColor, interval, sourceUri) || pyramidUpdated;
pyramidUpdated = processPacketData(Number, pyramid, 'intersectionWidth', pyramidData.intersectionWidth, interval, sourceUri) || pyramidUpdated;
-
- if (defined(pyramidData.material)) {
- var material = pyramid.material;
- if (!defined(material)) {
- pyramid.material = material = new DynamicMaterialProperty();
- pyramidUpdated = true;
- }
- material.processCzmlIntervals(pyramidData.material, interval);
- }
+ pyramidUpdated = processPacketData.material(pyramid, 'material', pyramidData.material, interval, sourceUri);
if (defined(pyramidData.directions)) {
var directions = pyramid.directions;
diff --git a/Source/DynamicScene/DynamicPyramidVisualizer.js b/Source/DynamicScene/DynamicPyramidVisualizer.js
index a8f6e806e8ac..1797c8ff2d64 100644
--- a/Source/DynamicScene/DynamicPyramidVisualizer.js
+++ b/Source/DynamicScene/DynamicPyramidVisualizer.js
@@ -8,7 +8,8 @@ define([
'../Core/Matrix3',
'../Core/Matrix4',
'../Scene/CustomSensorVolume',
- '../Scene/Material'
+ '../Scene/Material',
+ './processMaterial'
], function(
defaultValue,
defined,
@@ -18,7 +19,8 @@ define([
Matrix3,
Matrix4,
CustomSensorVolume,
- Material) {
+ Material,
+ processMaterial) {
"use strict";
var matrix3Scratch = new Matrix3();
@@ -266,7 +268,7 @@ define([
var material = dynamicPyramid.material;
if (defined(material)) {
- pyramid.material = material.getValue(time, context, pyramid.material);
+ pyramid.material = processMaterial(time, material, context, pyramid.material);
}
var property = dynamicPyramid.intersectionColor;
diff --git a/Source/DynamicScene/GeoJsonDataSource.js b/Source/DynamicScene/GeoJsonDataSource.js
index e5b1b6c82e87..87e67889ba94 100644
--- a/Source/DynamicScene/GeoJsonDataSource.js
+++ b/Source/DynamicScene/GeoJsonDataSource.js
@@ -15,7 +15,7 @@ define([
'./DynamicPoint',
'./DynamicPolyline',
'./DynamicPolygon',
- './DynamicMaterialProperty',
+ './DynamicColorMaterial',
'./DynamicObjectCollection',
'../ThirdParty/when',
'../ThirdParty/topojson'
@@ -35,7 +35,7 @@ define([
DynamicPoint,
DynamicPolyline,
DynamicPolygon,
- DynamicMaterialProperty,
+ DynamicColorMaterial,
DynamicObjectCollection,
when,
topojson) {
@@ -232,24 +232,21 @@ define([
//default polygon
var defaultPolygon = new DynamicObject('GeoJsonDataSource.defaultPolygon');
- var polygonMaterial = new DynamicMaterialProperty();
+
polyline = new DynamicPolyline();
polyline.color = new ConstantProperty(Color.YELLOW);
polyline.width = new ConstantProperty(1);
polyline.outlineColor = new ConstantProperty(Color.BLACK);
polyline.outlineWidth = new ConstantProperty(0);
defaultPolygon.polyline = polyline;
+
var polygon = new DynamicPolygon();
- polygon.material = polygonMaterial;
- polygonMaterial.processCzmlIntervals({
- solidColor : {
- color : {
- rgba : [255, 255, 0, 25]
- }
- }
- }, undefined, undefined);
defaultPolygon.polygon = polygon;
+ var material = new DynamicColorMaterial();
+ material.color = new ConstantProperty(new Color(1.0, 1.0, 0.0, 0.1));
+ polygon.material = material;
+
this._changed = new Event();
this._error = new Event();
this._dynamicObjectCollection = new DynamicObjectCollection();
diff --git a/Source/DynamicScene/processMaterial.js b/Source/DynamicScene/processMaterial.js
new file mode 100644
index 000000000000..db1aba0dc1ba
--- /dev/null
+++ b/Source/DynamicScene/processMaterial.js
@@ -0,0 +1,138 @@
+/*global define*/
+define([
+ '../Core/defined',
+ '../Core/RuntimeError',
+ '../Scene/Material',
+ './DynamicColorMaterial',
+ './DynamicImageMaterial',
+ './DynamicGridMaterial'
+ ], function(
+ defined,
+ RuntimeError,
+ Material,
+ DynamicColorMaterial,
+ DynamicImageMaterial,
+ DynamicGridMaterial) {
+ "use strict";
+
+ function processColorMaterial(time, context, dynamicMaterial, result) {
+ if (!defined(result) || (result.type !== Material.ColorType)) {
+ result = Material.fromType(context, Material.ColorType);
+ }
+ result.uniforms.color = dynamicMaterial.color.getValue(time, result.uniforms.color);
+ return result;
+ }
+
+ function processImageMaterial(time, context, dynamicMaterial, result) {
+ if (!defined(result) || (result.type !== Material.ImageType)) {
+ result = Material.fromType(context, Material.ImageType);
+ }
+
+ var xRepeat;
+ var property = dynamicMaterial.verticalRepeat;
+ if (defined(property)) {
+ xRepeat = property.getValue(time);
+ if (defined(xRepeat)) {
+ result.uniforms.repeat.x = xRepeat;
+ }
+ }
+
+ var yRepeat;
+ property = dynamicMaterial.horizontalRepeat;
+ if (defined(property)) {
+ yRepeat = property.getValue(time);
+ if (defined(yRepeat)) {
+ result.uniforms.repeat.y = yRepeat;
+ }
+ }
+
+ property = dynamicMaterial.image;
+ if (defined(property)) {
+ var url = dynamicMaterial.image.getValue(time);
+ if (defined(url) && result.currentUrl !== url) {
+ result.currentUrl = url;
+ result.uniforms.image = url;
+ }
+ }
+ return result;
+ }
+
+ function processGridMaterial(time, context, dynamicMaterial, result) {
+ if (!defined(result) || (result.type !== Material.GridType)) {
+ result = Material.fromType(context, Material.GridType);
+ }
+
+ var property = dynamicMaterial.color;
+ if (defined(property)) {
+ property.getValue(time, result.uniforms.color);
+ }
+
+ property = dynamicMaterial.cellAlpha;
+ if (defined(property)) {
+ var cellAlpha = property.getValue(time);
+ if (defined(cellAlpha)) {
+ result.uniforms.cellAlpha = cellAlpha;
+ }
+ }
+
+ var lineCount = result.uniforms.lineCount;
+
+ property = dynamicMaterial.rowCount;
+ if (defined(property)) {
+ var rowCount = property.getValue(time);
+ if (defined(rowCount)) {
+ lineCount.x = rowCount;
+ }
+ }
+
+ property = dynamicMaterial.columnCount;
+ if (defined(property)) {
+ var columnCount = property.getValue(time);
+ if (defined(columnCount)) {
+ lineCount.y = columnCount;
+ }
+ }
+
+ var lineThickness = result.uniforms.lineThickness;
+
+ property = dynamicMaterial.rowThickness;
+ if (defined(property)) {
+ var rowThickness = property.getValue(time);
+ if (defined(rowThickness)) {
+ lineThickness.x = rowThickness;
+ }
+ }
+
+ property = dynamicMaterial.columnThickness;
+ if (defined(property)) {
+ var columnThickness = property.getValue(time);
+ if (defined(columnThickness)) {
+ lineThickness.y = columnThickness;
+ }
+ }
+
+ return result;
+ }
+
+ var processMaterial = function(time, property, context, result) {
+ var dynamicMaterial = property;
+ if (defined(property.getValue)) {
+ dynamicMaterial = property.getValue(time);
+ }
+
+ if (defined(dynamicMaterial)) {
+ if (dynamicMaterial instanceof DynamicColorMaterial) {
+ return processColorMaterial(time, context, dynamicMaterial, result);
+ } else if (dynamicMaterial instanceof DynamicImageMaterial) {
+ return processImageMaterial(time, context, dynamicMaterial, result);
+ } else if (dynamicMaterial instanceof DynamicGridMaterial) {
+ return processGridMaterial(time, context, dynamicMaterial, result);
+ }
+ throw new RuntimeError('unknown material');
+ }
+
+ return result;
+ };
+
+ return processMaterial;
+});
\ No newline at end of file
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
index 1f05312df1eb..57f7c6fbd650 100644
--- a/Source/DynamicScene/processPacketData.js
+++ b/Source/DynamicScene/processPacketData.js
@@ -29,6 +29,9 @@ define([
'./ConstantPositionProperty',
'./SampledPositionProperty',
'./TimeIntervalCollectionPositionProperty',
+ './DynamicColorMaterial',
+ './DynamicImageMaterial',
+ './DynamicGridMaterial',
'../ThirdParty/Uri'
], function(
Cartesian2,
@@ -60,6 +63,9 @@ define([
ConstantPositionProperty,
SampledPositionProperty,
TimeIntervalCollectionPositionProperty,
+ DynamicColorMaterial,
+ DynamicImageMaterial,
+ DynamicGridMaterial,
Uri) {
"use strict";
@@ -439,5 +445,72 @@ define([
}
processPacketData.position = processPositionPacketData;
+ function processMaterialProperty(object, propertyName, packetData, constrainedInterval, sourceUri) {
+ var combinedInterval;
+ var packetInterval = packetData.interval;
+ if (defined(packetInterval)) {
+ combinedInterval = TimeInterval.fromIso8601(packetInterval);
+ if (defined(constrainedInterval)) {
+ combinedInterval = combinedInterval.intersect(constrainedInterval);
+ }
+ } else if (defined(constrainedInterval)) {
+ combinedInterval = constrainedInterval;
+ }
+
+ combinedInterval = defaultValue(combinedInterval, Iso8601.MAXIMUM_INTERVAL);
+
+ var propertyCreated = false;
+ var property = object[propertyName];
+ if (!defined(property)) {
+ property = new TimeIntervalCollectionProperty(function(value) {
+ return value;
+ });
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+
+ //See if we already have data at that interval.
+ var thisIntervals = property.intervals;
+ var existingInterval = thisIntervals.findInterval(combinedInterval.start, combinedInterval.stop);
+ var existingMaterial;
+
+ if (defined(existingInterval)) {
+ //We have an interval, but we need to make sure the
+ //new data is the same type of material as the old data.
+ existingMaterial = existingInterval.data;
+ } else {
+ //If not, create it.
+ existingInterval = combinedInterval.clone();
+ thisIntervals.addInterval(existingInterval);
+ }
+
+ if (!defined(existingMaterial) || !existingMaterial.isMaterial(packetData)) {
+ if (defined(packetData.solidColor)) {
+ existingMaterial = new DynamicColorMaterial();
+ propertyCreated = processPacketData(Color, existingMaterial, 'color', packetData.solidColor.color);
+ existingInterval.data = existingMaterial;
+ }
+ }
+
+ return propertyCreated;
+ }
+
+ function processMaterialPacketData(object, propertyName, packetData, interval, sourceUri){
+ if (!defined(packetData)) {
+ return false;
+ }
+
+ var updated = false;
+ if (Array.isArray(packetData)) {
+ for ( var i = 0, len = packetData.length; i < len; i++) {
+ updated = processMaterialProperty(object, propertyName, packetData[i], interval, sourceUri) || updated;
+ }
+ } else {
+ updated = processMaterialProperty(object, propertyName, packetData, interval, sourceUri) || updated;
+ }
+ return updated;
+ }
+ processPacketData.material = processMaterialPacketData;
+
return processPacketData;
});
From cfc4a2066e78dc76f22cb0dde4b1221c8f30a188 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 20 Aug 2013 10:42:26 -0400
Subject: [PATCH 31/65] Ongoing material refactor.
---
Source/DynamicScene/DynamicColorMaterial.js | 21 +--
Source/DynamicScene/DynamicGridMaterial.js | 49 +------
Source/DynamicScene/DynamicImageMaterial.js | 44 +------
Source/DynamicScene/processPacketData.js | 53 +++++++-
Specs/DynamicScene/DynamicConeSpec.js | 16 +--
Specs/DynamicScene/DynamicGridMaterialSpec.js | 78 -----------
.../DynamicMaterialPropertySpec.js | 121 ------------------
7 files changed, 57 insertions(+), 325 deletions(-)
delete mode 100644 Specs/DynamicScene/DynamicGridMaterialSpec.js
delete mode 100644 Specs/DynamicScene/DynamicMaterialPropertySpec.js
diff --git a/Source/DynamicScene/DynamicColorMaterial.js b/Source/DynamicScene/DynamicColorMaterial.js
index abb1f36cba30..6b5db6f1c83c 100644
--- a/Source/DynamicScene/DynamicColorMaterial.js
+++ b/Source/DynamicScene/DynamicColorMaterial.js
@@ -1,8 +1,5 @@
/*global define*/
-define([
- '../Core/defined'
- ], function(
- defined) {
+define(function() {
"use strict";
/**
@@ -19,21 +16,5 @@ define([
this.color = undefined;
};
- /**
- * Returns true if the provided CZML interval contains color material data.
- * @param czmlInterval The CZML interval to check.
- * @returns {Boolean} true if the interval contains CZML color material data, false otherwise.
- */
- DynamicColorMaterial.isMaterial = function(czmlInterval) {
- return defined(czmlInterval) && defined(czmlInterval.solidColor);
- };
-
- /**
- * Returns true if the provided CZML interval contains color material data.
- * @param czmlInterval The CZML interval to check.
- * @returns {Boolean} true if the interval contains CZML color material data, false otherwise.
- */
- DynamicColorMaterial.prototype.isMaterial = DynamicColorMaterial.isMaterial;
-
return DynamicColorMaterial;
});
diff --git a/Source/DynamicScene/DynamicGridMaterial.js b/Source/DynamicScene/DynamicGridMaterial.js
index 929cf8d7e40b..ac08b5c29bf2 100644
--- a/Source/DynamicScene/DynamicGridMaterial.js
+++ b/Source/DynamicScene/DynamicGridMaterial.js
@@ -1,14 +1,5 @@
/*global define*/
-define([
- './processPacketData',
- '../Core/Color',
- '../Core/defined',
- '../Scene/Material'
- ], function(
- processPacketData,
- Color,
- defined,
- Material) {
+define(function() {
"use strict";
/**
@@ -60,43 +51,5 @@ define([
this.columnThickness = undefined;
};
- /**
- * Returns true if the provided CZML interval contains grid material data.
- * @param czmlInterval The CZML interval to check.
- * @returns {Boolean} true if the interval contains CZML grid material data, false otherwise.
- */
- DynamicGridMaterial.isMaterial = function(czmlInterval) {
- return defined(czmlInterval.grid);
- };
-
- /**
- * Returns true if the provided CZML interval contains grid material data.
- * @param czmlInterval The CZML interval to check.
- * @returns {Boolean} true if the interval contains CZML grid material data, false otherwise.
- */
- DynamicGridMaterial.prototype.isMaterial = DynamicGridMaterial.isMaterial;
-
- /**
- * Provided a CZML interval containing grid material data, processes the
- * interval into a new or existing instance of this class.
- *
- * @param {Object} czmlInterval The interval to process.
- * @param {String} [sourceUri] The originating url of the CZML being processed.
- * @returns The modified existingMaterial parameter or a new DynamicGridMaterial instance if existingMaterial was undefined or not a DynamicGridMaterial.
- */
- DynamicGridMaterial.prototype.processCzmlIntervals = function(czmlInterval, sourceUri) {
- var materialData = czmlInterval.grid;
- if (!defined(materialData)) {
- return;
- }
-
- processPacketData(Color, this, 'color', materialData.color, undefined, sourceUri);
- processPacketData(Number, this, 'cellAlpha', materialData.cellAlpha, undefined, sourceUri);
- processPacketData(Number, this, 'rowCount', materialData.rowCount, undefined, sourceUri);
- processPacketData(Number, this, 'columnCount', materialData.columnCount, undefined, sourceUri);
- processPacketData(Number, this, 'rowThickness', materialData.rowThickness, undefined, sourceUri);
- processPacketData(Number, this, 'columnThickness', materialData.columnThickness, undefined, sourceUri);
- };
-
return DynamicGridMaterial;
});
diff --git a/Source/DynamicScene/DynamicImageMaterial.js b/Source/DynamicScene/DynamicImageMaterial.js
index 41bdf2d52d7c..f0d74204c153 100644
--- a/Source/DynamicScene/DynamicImageMaterial.js
+++ b/Source/DynamicScene/DynamicImageMaterial.js
@@ -1,12 +1,5 @@
/*global define*/
-define([
- './processPacketData',
- '../Core/defined',
- '../Scene/Material'
- ], function(
- processPacketData,
- defined,
- Material) {
+define(function() {
"use strict";
/**
@@ -36,40 +29,5 @@ define([
this.horizontalRepeat = undefined;
};
- /**
- * Returns true if the provided CZML interval contains image material data.
- * @param czmlInterval The CZML interval to check.
- * @returns {Boolean} true if the interval contains CZML image material data, false otherwise.
- */
- DynamicImageMaterial.isMaterial = function(czmlInterval) {
- return defined(czmlInterval.image);
- };
-
- /**
- * Returns true if the provided CZML interval contains image material data.
- * @param czmlInterval The CZML interval to check.
- * @returns {Boolean} true if the interval contains CZML image material data, false otherwise.
- */
- DynamicImageMaterial.prototype.isMaterial = DynamicImageMaterial.isMaterial;
-
- /**
- * Provided a CZML interval containing image material data, processes the
- * interval into a new or existing instance of this class.
- *
- * @param {Object} czmlInterval The interval to process.
- * @param {String} [sourceUri] The originating url of the CZML being processed.
- * @returns The modified existingMaterial parameter or a new DynamicImageMaterial instance if existingMaterial was undefined or not a DynamicImageMaterial.
- */
- DynamicImageMaterial.prototype.processCzmlIntervals = function(czmlInterval, sourceUri) {
- var materialData = czmlInterval.image;
- if (!defined(materialData)) {
- return;
- }
-
- processPacketData(Image, this, 'image', materialData.image, undefined, sourceUri);
- processPacketData(Number, this, 'verticalRepeat', materialData.verticalRepeat, undefined, sourceUri);
- processPacketData(Number, this, 'horizontalRepeat', materialData.horizontalRepeat, undefined, sourceUri);
- };
-
return DynamicImageMaterial;
});
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
index 57f7c6fbd650..4d7c21b80cbf 100644
--- a/Source/DynamicScene/processPacketData.js
+++ b/Source/DynamicScene/processPacketData.js
@@ -445,6 +445,26 @@ define([
}
processPacketData.position = processPositionPacketData;
+ function cloneIntoUniforms(material, uniforms) {
+ if (!defined(uniforms)) {
+ uniforms = {};
+ }
+ if (material instanceof DynamicColorMaterial) {
+ //uniforms.color = material.color.getValue(time, uniforms.color);
+ }
+
+ if (material instanceof DynamicGridMaterial) {
+ }
+
+ if (material instanceof DynamicImageMaterial) {
+ return material;
+ }
+
+ //TODO
+ return material;
+ //throw new RuntimeError('unknown material');
+ }
+
function processMaterialProperty(object, propertyName, packetData, constrainedInterval, sourceUri) {
var combinedInterval;
var packetInterval = packetData.interval;
@@ -462,9 +482,7 @@ define([
var propertyCreated = false;
var property = object[propertyName];
if (!defined(property)) {
- property = new TimeIntervalCollectionProperty(function(value) {
- return value;
- });
+ property = new TimeIntervalCollectionProperty(cloneIntoUniforms);
object[propertyName] = property;
propertyCreated = true;
}
@@ -484,13 +502,34 @@ define([
thisIntervals.addInterval(existingInterval);
}
- if (!defined(existingMaterial) || !existingMaterial.isMaterial(packetData)) {
- if (defined(packetData.solidColor)) {
+ var materialData;
+ if (defined(packetData.solidColor)) {
+ if (!(existingMaterial instanceof DynamicColorMaterial)) {
existingMaterial = new DynamicColorMaterial();
- propertyCreated = processPacketData(Color, existingMaterial, 'color', packetData.solidColor.color);
- existingInterval.data = existingMaterial;
}
+ materialData = packetData.solidColor;
+ processPacketData(Color, existingMaterial, 'color', materialData.color);
+ } else if (defined(packetData.grid)) {
+ if (!(existingMaterial instanceof DynamicGridMaterial)) {
+ existingMaterial = new DynamicGridMaterial();
+ }
+ materialData = packetData.grid;
+ processPacketData(Color, existingMaterial, 'color', materialData.color, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'cellAlpha', materialData.cellAlpha, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'rowCount', materialData.rowCount, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'columnCount', materialData.columnCount, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'rowThickness', materialData.rowThickness, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'columnThickness', materialData.columnThickness, undefined, sourceUri);
+ } else if (defined(packetData.image)) {
+ if (!(existingMaterial instanceof DynamicImageMaterial)) {
+ existingMaterial = new DynamicImageMaterial();
+ }
+ materialData = packetData.image;
+ processPacketData(Image, existingMaterial, 'image', materialData.image, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'verticalRepeat', materialData.verticalRepeat, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'horizontalRepeat', materialData.horizontalRepeat, undefined, sourceUri);
}
+ existingInterval.data = existingMaterial;
return propertyCreated;
}
diff --git a/Specs/DynamicScene/DynamicConeSpec.js b/Specs/DynamicScene/DynamicConeSpec.js
index be18003734ea..8a1c7a1ea80c 100644
--- a/Specs/DynamicScene/DynamicConeSpec.js
+++ b/Specs/DynamicScene/DynamicConeSpec.js
@@ -70,10 +70,10 @@ defineSuite([
expect(dynamicObject.cone.radius.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.radius);
expect(dynamicObject.cone.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.show);
expect(dynamicObject.cone.showIntersection.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.showIntersection);
- expect(dynamicObject.cone.capMaterial.getValue(Iso8601.MINIMUM_VALUE).uniforms.color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.cone.innerMaterial.getValue(Iso8601.MINIMUM_VALUE).uniforms.color).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.cone.outerMaterial.getValue(Iso8601.MINIMUM_VALUE).uniforms.color).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
- expect(dynamicObject.cone.silhouetteMaterial.getValue(Iso8601.MINIMUM_VALUE).uniforms.color).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
+ expect(dynamicObject.cone.capMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.cone.innerMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.cone.outerMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
+ expect(dynamicObject.cone.silhouetteMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
expect(dynamicObject.cone.intersectionColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
expect(dynamicObject.cone.intersectionWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.intersectionWidth);
});
@@ -138,10 +138,10 @@ defineSuite([
expect(dynamicObject.cone.radius.getValue(validTime)).toEqual(conePacket.cone.radius);
expect(dynamicObject.cone.show.getValue(validTime)).toEqual(conePacket.cone.show);
expect(dynamicObject.cone.showIntersection.getValue(validTime)).toEqual(conePacket.cone.showIntersection);
- expect(dynamicObject.cone.capMaterial.getValue(validTime).uniforms.color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.cone.innerMaterial.getValue(validTime).uniforms.color).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.cone.outerMaterial.getValue(validTime).uniforms.color).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
- expect(dynamicObject.cone.silhouetteMaterial.getValue(validTime).uniforms.color).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
+ expect(dynamicObject.cone.capMaterial.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.cone.innerMaterial.getValue(validTime).color).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.cone.outerMaterial.getValue(validTime).color).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
+ expect(dynamicObject.cone.silhouetteMaterial.getValue(validTime).color).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
expect(dynamicObject.cone.intersectionColor.getValue(validTime)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
expect(dynamicObject.cone.intersectionWidth.getValue(validTime)).toEqual(conePacket.cone.intersectionWidth);
diff --git a/Specs/DynamicScene/DynamicGridMaterialSpec.js b/Specs/DynamicScene/DynamicGridMaterialSpec.js
deleted file mode 100644
index ed1f19f8cde8..000000000000
--- a/Specs/DynamicScene/DynamicGridMaterialSpec.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/DynamicGridMaterial',
- 'Core/Color',
- 'Core/JulianDate',
- 'Scene/Material',
- 'Specs/createContext',
- 'Specs/destroyContext'
- ], function(
- DynamicGridMaterial,
- Color,
- JulianDate,
- Material,
- createContext,
- destroyContext) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var context;
- beforeAll(function() {
- context = createContext();
- });
-
- afterAll(function() {
- destroyContext(context);
- });
-
- var color = new Color(0.25, 0.5, 0.75, 1);
-
- var gridCzml = {
- grid : {
- color : {
- rgbaf : [color.red, color.green, color.blue, color.alpha]
- },
- cellAlpha : 0.5,
- rowCount : 20,
- columnCount : 10,
- rowThickness : 2,
- columnThickness : 5
- }
- };
-
- it('isMaterial works.', function() {
- var grid = new DynamicGridMaterial();
- expect(grid.isMaterial(gridCzml)).toBe(true);
- expect(grid.isMaterial({})).toBe(false);
- });
-
- it('assigns properties from CZML.', function() {
- var grid = new DynamicGridMaterial();
- grid.processCzmlIntervals(gridCzml);
-
- var material = grid.getValue(new JulianDate(), context);
- expect(material.uniforms.color).toEqual(color);
- expect(material.uniforms.cellAlpha).toEqual(gridCzml.grid.cellAlpha);
- expect(material.uniforms.lineCount.x).toEqual(gridCzml.grid.rowCount);
- expect(material.uniforms.lineCount.y).toEqual(gridCzml.grid.columnCount);
- expect(material.uniforms.lineThickness.x).toEqual(gridCzml.grid.rowThickness);
- expect(material.uniforms.lineThickness.y).toEqual(gridCzml.grid.columnThickness);
- });
-
- it('assigns properties from CZML with result parameter.', function() {
- var grid = new DynamicGridMaterial();
- grid.processCzmlIntervals(gridCzml);
-
- var existingMaterial = Material.fromType(context, Material.GridType);
-
- var material = grid.getValue(new JulianDate(), context, existingMaterial);
- expect(material).toBe(existingMaterial);
- expect(material.uniforms.color).toEqual(color);
- expect(material.uniforms.cellAlpha).toEqual(gridCzml.grid.cellAlpha);
- expect(material.uniforms.lineCount.x).toEqual(gridCzml.grid.rowCount);
- expect(material.uniforms.lineCount.y).toEqual(gridCzml.grid.columnCount);
- expect(material.uniforms.lineThickness.x).toEqual(gridCzml.grid.rowThickness);
- expect(material.uniforms.lineThickness.y).toEqual(gridCzml.grid.columnThickness);
- });
-
-}, 'WebGL');
diff --git a/Specs/DynamicScene/DynamicMaterialPropertySpec.js b/Specs/DynamicScene/DynamicMaterialPropertySpec.js
deleted file mode 100644
index 9486eb6713b6..000000000000
--- a/Specs/DynamicScene/DynamicMaterialPropertySpec.js
+++ /dev/null
@@ -1,121 +0,0 @@
-/*global defineSuite*/
-defineSuite([
- 'DynamicScene/DynamicMaterialProperty',
- 'Core/Color',
- 'Core/JulianDate',
- 'Core/TimeInterval',
- 'Scene/Material',
- 'Specs/createContext',
- 'Specs/destroyContext'
- ], function(
- DynamicMaterialProperty,
- Color,
- JulianDate,
- TimeInterval,
- Material,
- createContext,
- destroyContext) {
- "use strict";
- /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
-
- var context;
- beforeAll(function() {
- context = createContext();
- });
-
- afterAll(function() {
- destroyContext(context);
- });
-
- var solidColor = Color.fromBytes(255, 0, 0, 77);
-
- var staticColorCzml = {
- solidColor : {
- color : {
- rgba : [255, 0, 0, 77]
- }
- }
- };
-
- var staticImageCzml = {
- image : {
- image : 'someImage'
- }
- };
-
- var constrainedImageCzml = [{
- interval : '2012-03-15/2012-03-16',
- image : {
- image : 'someImage'
- }
- }];
-
- it('Supports color materials.', function() {
- var property = new DynamicMaterialProperty();
- property.processCzmlIntervals(staticColorCzml, undefined, undefined);
- var material = property.getValue(new JulianDate(), context);
- expect(material.type).toEqual(Material.ColorType);
- expect(material.uniforms.color).toEqual(solidColor);
- });
-
- it('Supports image materials.', function() {
- var property = new DynamicMaterialProperty();
- property.processCzmlIntervals(staticImageCzml, undefined, undefined);
- var material = property.getValue(new JulianDate(), context);
- expect(material.type).toEqual(Material.ImageType);
- expect(material.uniforms.image).toEqual(staticImageCzml.image.image);
- });
-
- it('Constrains data to CZML defined Interval', function() {
- var property = new DynamicMaterialProperty();
- property.processCzmlIntervals(constrainedImageCzml, undefined, undefined);
-
- var interval = TimeInterval.fromIso8601(constrainedImageCzml[0].interval);
-
- var material = property.getValue(interval.stop.addSeconds(1), context);
- expect(material).toBeUndefined();
-
- material = property.getValue(interval.start, context);
- expect(material.type).toEqual(Material.ImageType);
- expect(material.uniforms.image).toEqual(constrainedImageCzml[0].image.image);
-
- material = property.getValue(interval.start.addSeconds(-1), context);
- expect(material).toBeUndefined();
-
- material = property.getValue(interval.stop, context);
- expect(material.type).toEqual(Material.ImageType);
- expect(material.uniforms.image).toEqual(constrainedImageCzml[0].image.image);
- });
-
- it('Works with different materials over time.', function() {
- var property = new DynamicMaterialProperty();
- property.processCzmlIntervals(staticColorCzml, TimeInterval.fromIso8601('2012-03-15/2012-03-16'), undefined);
- property.processCzmlIntervals(staticImageCzml, TimeInterval.fromIso8601('2012-03-16/2012-03-17'), undefined);
-
- var material = property.getValue(JulianDate.fromIso8601('2012-03-16'), context);
- expect(material.type).toEqual(Material.ImageType);
- expect(material.uniforms.image).toEqual(staticImageCzml.image.image);
-
- material = property.getValue(JulianDate.fromIso8601('2012-03-15'), context, material);
- expect(material.type).toEqual(Material.ColorType);
- expect(material.uniforms.color).toEqual(solidColor);
-
- material = property.getValue(JulianDate.fromIso8601('2012-03-18'), context);
- expect(material).toBeUndefined();
- });
-
- it('Incrementally processing CZML can replace existing material intervals.', function() {
- var property = new DynamicMaterialProperty();
- var date = new JulianDate();
-
- property.processCzmlIntervals(staticColorCzml, undefined, undefined);
- var material = property.getValue(date, context, material);
- expect(material.type).toEqual(Material.ColorType);
- expect(material.uniforms.color).toEqual(solidColor);
-
- property.processCzmlIntervals(staticImageCzml, undefined, undefined);
- material = property.getValue(date, context);
- expect(material.type).toEqual(Material.ImageType);
- expect(material.uniforms.image).toEqual(staticImageCzml.image.image);
- });
-}, 'WebGL');
From 7d1a22ab3ea4be86bc13c4bbba8960e3543b00c5 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 20 Aug 2013 10:55:28 -0400
Subject: [PATCH 32/65] Delete DynamicMaterialProperty.js
---
.../DynamicScene/DynamicMaterialProperty.js | 126 ------------------
1 file changed, 126 deletions(-)
delete mode 100644 Source/DynamicScene/DynamicMaterialProperty.js
diff --git a/Source/DynamicScene/DynamicMaterialProperty.js b/Source/DynamicScene/DynamicMaterialProperty.js
deleted file mode 100644
index f0f4ccec2cd3..000000000000
--- a/Source/DynamicScene/DynamicMaterialProperty.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/*global define*/
-define([
- '../Core/defined',
- '../Core/TimeInterval',
- '../Core/TimeIntervalCollection',
- '../Core/Iso8601',
- './DynamicColorMaterial',
- './DynamicImageMaterial',
- './DynamicGridMaterial'
- ], function(
- defined,
- TimeInterval,
- TimeIntervalCollection,
- Iso8601,
- DynamicColorMaterial,
- DynamicImageMaterial,
- DynamicGridMaterial) {
- "use strict";
-
- var potentialMaterials = [DynamicColorMaterial, DynamicImageMaterial, DynamicGridMaterial];
-
- /**
- * A dynamic property which stores data for multiple types of materials
- * associated with the same property over time. Rather than creating instances
- * of this object directly, it's typically created and managed via loading CZML
- * data into a DynamicObjectCollection.
- *
- * @alias DynamicMaterialProperty
- * @internalconstructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see ReferenceProperty
- * @see DynamicDirectionsProperty
- * @see DynamicVertexPositionsProperty
- */
- var DynamicMaterialProperty = function() {
- this._intervals = new TimeIntervalCollection();
- };
-
-
- /**
- * Processes the provided CZML interval or intervals into this property.
- * @memberof DynamicMaterialProperty
- *
- * @param {Object} czmlIntervals The CZML data to process.
- * @param {TimeInterval} [constrainedInterval] Constrains the processing so that any times outside of this interval are ignored.
- * @param {String} [sourceUri] The originating url of the CZML being processed.
- */
- DynamicMaterialProperty.prototype.processCzmlIntervals = function(czmlIntervals, constrainedInterval, sourceUri) {
- if (Array.isArray(czmlIntervals)) {
- for ( var i = 0, len = czmlIntervals.length; i < len; i++) {
- addCzmlInterval(this, czmlIntervals[i], constrainedInterval, sourceUri);
- }
- } else {
- addCzmlInterval(this, czmlIntervals, constrainedInterval, sourceUri);
- }
- };
-
- /**
- * Returns the value of the property at the specified time.
- * @memberof DynamicMaterialProperty
- *
- * @param {JulianDate} time The time for which to retrieve the value.
- * @param {Context} [context] The context in which the material exists.
- * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
- * @returns The modified result parameter or a new instance if the result parameter was not supplied.
- */
- DynamicMaterialProperty.prototype.getValue = function(time, context, existingMaterial) {
- var value = this._intervals.findIntervalContainingDate(time);
- var material = defined(value) ? value.data : undefined;
- if (defined(material)) {
- return material;
- }
- return existingMaterial;
- };
-
- function addCzmlInterval(dynamicMaterialProperty, czmlInterval, constrainedInterval, sourceUri) {
- var iso8601Interval = czmlInterval.interval;
- if (!defined(iso8601Interval)) {
- iso8601Interval = Iso8601.MAXIMUM_INTERVAL.clone();
- } else {
- iso8601Interval = TimeInterval.fromIso8601(iso8601Interval);
- }
-
- if (defined(constrainedInterval)) {
- iso8601Interval = iso8601Interval.intersect(constrainedInterval);
- }
-
- //See if we already have data at that interval.
- var thisIntervals = dynamicMaterialProperty._intervals;
- var existingInterval = thisIntervals.findInterval(iso8601Interval.start, iso8601Interval.stop);
- var foundMaterial = false;
- var existingMaterial;
-
- if (defined(existingInterval)) {
- //We have an interval, but we need to make sure the
- //new data is the same type of material as the old data.
- existingMaterial = existingInterval.data;
- foundMaterial = existingMaterial.isMaterial(czmlInterval);
- } else {
- //If not, create it.
- existingInterval = iso8601Interval;
- thisIntervals.addInterval(existingInterval);
- }
-
- //If the new data was a different type, look for a handler for this type.
- if (foundMaterial === false) {
- for ( var i = 0, len = potentialMaterials.length; i < len; i++) {
- var PotentialMaterial = potentialMaterials[i];
- foundMaterial = PotentialMaterial.isMaterial(czmlInterval);
- if (foundMaterial) {
- existingInterval.data = existingMaterial = new PotentialMaterial();
- break;
- }
- }
- }
-
- //We could handle the data, prcess it.
- if (foundMaterial) {
- existingMaterial.processCzmlIntervals(czmlInterval, sourceUri);
- }
- }
-
- return DynamicMaterialProperty;
-});
\ No newline at end of file
From 68353a26f61001e67cdd4cd0f827e021fd0c6af3 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 20 Aug 2013 11:29:29 -0400
Subject: [PATCH 33/65] Consolidate most (all?) CZML processing into
CzmlDataSource.
---
Source/DynamicScene/CzmlDataSource.js | 986 ++++++++++++++++++++++-
Source/DynamicScene/CzmlDefaults.js | 25 -
Source/DynamicScene/DynamicBillboard.js | 55 +-
Source/DynamicScene/DynamicClock.js | 52 --
Source/DynamicScene/DynamicCone.js | 54 +-
Source/DynamicScene/DynamicEllipse.js | 47 +-
Source/DynamicScene/DynamicEllipsoid.js | 46 +-
Source/DynamicScene/DynamicLabel.js | 54 +-
Source/DynamicScene/DynamicObject.js | 121 ---
Source/DynamicScene/DynamicPath.js | 49 +-
Source/DynamicScene/DynamicPoint.js | 47 +-
Source/DynamicScene/DynamicPolygon.js | 45 +-
Source/DynamicScene/DynamicPolyline.js | 46 +-
Source/DynamicScene/DynamicPyramid.js | 55 --
Source/DynamicScene/DynamicVector.js | 47 +-
Source/DynamicScene/processPacketData.js | 555 -------------
16 files changed, 1005 insertions(+), 1279 deletions(-)
delete mode 100644 Source/DynamicScene/processPacketData.js
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index 0f2ad43a0319..9850650a29e9 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -1,32 +1,1016 @@
/*global define*/
define([
+ '../Core/Cartesian2',
+ '../Core/Cartesian3',
+ '../Core/Cartographic',
+ '../Core/Color',
'../Core/ClockRange',
'../Core/ClockStep',
'../Core/createGuid',
+ '../Core/defaultValue',
'../Core/defined',
'../Core/DeveloperError',
+ '../Core/Ellipsoid',
'../Core/Event',
+ '../Core/HermitePolynomialApproximation',
'../Core/Iso8601',
+ '../Core/JulianDate',
+ '../Core/LagrangePolynomialApproximation',
+ '../Core/LinearApproximation',
'../Core/loadJson',
+ '../Core/Math',
+ '../Core/Quaternion',
+ '../Core/ReferenceFrame',
+ '../Core/Spherical',
+ '../Core/TimeInterval',
+ '../Scene/HorizontalOrigin',
+ '../Scene/LabelStyle',
+ '../Scene/VerticalOrigin',
+ './CompositePositionProperty',
+ './CompositeProperty',
+ './ConstantPositionProperty',
+ './ConstantProperty',
'./CzmlDefaults',
+ './DynamicBillboard',
'./DynamicClock',
+ './DynamicColorMaterial',
+ './DynamicCone',
+ './DynamicLabel',
+ './DynamicDirectionsProperty',
+ './DynamicEllipse',
+ './DynamicEllipsoid',
+ './DynamicGridMaterial',
+ './DynamicImageMaterial',
'./DynamicObjectCollection',
+ './DynamicPath',
+ './DynamicPoint',
+ './DynamicPolyline',
+ './DynamicPolygon',
+ './DynamicPyramid',
+ './DynamicVector',
+ './DynamicVertexPositionsProperty',
+ './SampledPositionProperty',
+ './SampledProperty',
+ './TimeIntervalCollectionPositionProperty',
+ './TimeIntervalCollectionProperty',
+ '../ThirdParty/Uri',
'../ThirdParty/when'
], function(
+ Cartesian2,
+ Cartesian3,
+ Cartographic,
+ Color,
ClockRange,
ClockStep,
createGuid,
+ defaultValue,
defined,
DeveloperError,
+ Ellipsoid,
Event,
+ HermitePolynomialApproximation,
Iso8601,
+ JulianDate,
+ LagrangePolynomialApproximation,
+ LinearApproximation,
loadJson,
+ CesiumMath,
+ Quaternion,
+ ReferenceFrame,
+ Spherical,
+ TimeInterval,
+ HorizontalOrigin,
+ LabelStyle,
+ VerticalOrigin,
+ CompositePositionProperty,
+ CompositeProperty,
+ ConstantPositionProperty,
+ ConstantProperty,
CzmlDefaults,
+ DynamicBillboard,
DynamicClock,
+ DynamicColorMaterial,
+ DynamicCone,
+ DynamicLabel,
+ DynamicDirectionsProperty,
+ DynamicEllipse,
+ DynamicEllipsoid,
+ DynamicGridMaterial,
+ DynamicImageMaterial,
DynamicObjectCollection,
+ DynamicPath,
+ DynamicPoint,
+ DynamicPolyline,
+ DynamicPolygon,
+ DynamicPyramid,
+ DynamicVector,
+ DynamicVertexPositionsProperty,
+ SampledPositionProperty,
+ SampledProperty,
+ TimeIntervalCollectionPositionProperty,
+ TimeIntervalCollectionProperty,
+ Uri,
when) {
"use strict";
+ var scratchCartesian = new Cartesian3();
+ var scratchSpherical = new Spherical();
+ var scratchCartographic = new Cartographic();
+
+ function unwrapColorInterval(czmlInterval) {
+ var rgbaf = czmlInterval.rgbaf;
+ if (defined(rgbaf)) {
+ return rgbaf;
+ }
+
+ var rgba = czmlInterval.rgba;
+ if (!defined(rgba)) {
+ return undefined;
+ }
+
+ if (rgba.length === Color.length) {
+ return [Color.byteToFloat(rgba[0]), Color.byteToFloat(rgba[1]), Color.byteToFloat(rgba[2]), Color.byteToFloat(rgba[3])];
+ }
+
+ var len = rgba.length;
+ rgbaf = new Array(len);
+ for ( var i = 0; i < len; i += 5) {
+ rgbaf[i] = rgba[i];
+ rgbaf[i + 1] = Color.byteToFloat(rgba[i + 1]);
+ rgbaf[i + 2] = Color.byteToFloat(rgba[i + 2]);
+ rgbaf[i + 3] = Color.byteToFloat(rgba[i + 3]);
+ rgbaf[i + 4] = Color.byteToFloat(rgba[i + 4]);
+ }
+ return rgbaf;
+ }
+
+ function unwrapImageInterval(czmlInterval, sourceUri) {
+ var result = defaultValue(czmlInterval.image, czmlInterval);
+ if (defined(sourceUri)) {
+ var baseUri = new Uri(document.location.href);
+ sourceUri = new Uri(sourceUri);
+ result = new Uri(result).resolve(sourceUri.resolve(baseUri)).toString();
+ }
+ return result;
+ }
+
+ function unwrapCartesianInterval(czmlInterval) {
+ if (defined(czmlInterval.cartesian)) {
+ return czmlInterval.cartesian;
+ }
+
+ if (defined(czmlInterval.unitCartesian)) {
+ return czmlInterval.unitCartesian;
+ }
+
+ var i;
+ var len;
+ var result;
+
+ var unitSpherical = czmlInterval.unitSpherical;
+ if (defined(unitSpherical)) {
+ len = unitSpherical.length;
+ if (len === 2) {
+ scratchSpherical.clock = unitSpherical[0];
+ scratchSpherical.cone = unitSpherical[1];
+ Cartesian3.fromSpherical(scratchSpherical, scratchCartesian);
+ result = [scratchCartesian.x, scratchCartesian.y, scratchCartesian.z];
+ } else {
+ var sphericalIt = 0;
+ result = new Array((len / 3) * 4);
+ for (i = 0; i < len; i += 4) {
+ result[i] = unitSpherical[sphericalIt++];
+
+ scratchSpherical.clock = unitSpherical[sphericalIt++];
+ scratchSpherical.cone = unitSpherical[sphericalIt++];
+ Cartesian3.fromSpherical(scratchSpherical, scratchCartesian);
+
+ result[i + 1] = scratchCartesian.x;
+ result[i + 2] = scratchCartesian.y;
+ result[i + 3] = scratchCartesian.z;
+ }
+ }
+ return result;
+ }
+
+ var tmp = scratchCartesian;
+ var cartographic = czmlInterval.cartographicRadians;
+ if (defined(cartographic)) {
+ if (cartographic.length > 3) {
+ scratchCartographic.longitude = cartographic[0];
+ scratchCartographic.latitude = cartographic[1];
+ scratchCartographic.height = cartographic[2];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+ result = [tmp.x, tmp.y, tmp.z];
+ } else {
+ len = cartographic.length;
+ result = new Array(len);
+ for (i = 0; i < len; i += 4) {
+ scratchCartographic.longitude = cartographic[i + 1];
+ scratchCartographic.latitude = cartographic[i + 2];
+ scratchCartographic.height = cartographic[i + 3];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+
+ result[i] = cartographic[i];
+ result[i + 1] = tmp.x;
+ result[i + 2] = tmp.y;
+ result[i + 3] = tmp.z;
+ }
+ }
+ } else {
+ var cartographicDegrees = czmlInterval.cartographicDegrees;
+ if (!defined(cartographicDegrees)) {
+ return undefined;
+ }
+
+ if (cartographicDegrees.length > 3) {
+ scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[0]);
+ scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[1]);
+ scratchCartographic.height = cartographicDegrees[2];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+ result = [tmp.x, tmp.y, tmp.z];
+ } else {
+ len = cartographicDegrees.length;
+ result = new Array(len);
+ for (i = 0; i < len; i += 4) {
+ scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[i + 1]);
+ scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[i + 2]);
+ scratchCartographic.height = cartographicDegrees[i + 3];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+
+ result[i] = cartographicDegrees[i];
+ result[i + 1] = tmp.x;
+ result[i + 2] = tmp.y;
+ result[i + 3] = tmp.z;
+ }
+ }
+ }
+ }
+
+ function unwrapInterval(type, czmlInterval, sourceUri) {
+ switch (type) {
+ case Boolean:
+ return defaultValue(czmlInterval.boolean, czmlInterval);
+ case Cartesian2:
+ return czmlInterval.cartesian2;
+ case Cartesian3:
+ return unwrapCartesianInterval(czmlInterval);
+ case Color:
+ return unwrapColorInterval(czmlInterval);
+ case HorizontalOrigin:
+ return HorizontalOrigin[defaultValue(czmlInterval.horizontalOrigin, czmlInterval)];
+ case Image:
+ return unwrapImageInterval(czmlInterval, sourceUri);
+ case LabelStyle:
+ return LabelStyle[defaultValue(czmlInterval.labelStyle, czmlInterval)];
+ case Number:
+ return defaultValue(czmlInterval.number, czmlInterval);
+ case String:
+ return defaultValue(czmlInterval.string, czmlInterval);
+ case Quaternion:
+ return czmlInterval.unitQuaternion;
+ case VerticalOrigin:
+ return VerticalOrigin[defaultValue(czmlInterval.verticalOrigin, czmlInterval)];
+ default:
+ throw new DeveloperError(type);
+ }
+ }
+
+ function processProperty(type, object, propertyName, packetData, constrainedInterval, sourceUri) {
+ var combinedInterval;
+ var packetInterval = packetData.interval;
+ if (defined(packetInterval)) {
+ combinedInterval = TimeInterval.fromIso8601(packetInterval);
+ if (defined(constrainedInterval)) {
+ combinedInterval = combinedInterval.intersect(constrainedInterval);
+ }
+ } else if (defined(constrainedInterval)) {
+ combinedInterval = constrainedInterval;
+ }
+
+ var unwrappedInterval = unwrapInterval(type, packetData, sourceUri);
+ var hasInterval = defined(combinedInterval) && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
+ var packedLength = defaultValue(type.packedLength, 1);
+ var unwrappedIntervalLength = defaultValue(unwrappedInterval.length, 1);
+ var isSampled = (typeof unwrappedInterval !== 'string') && unwrappedIntervalLength > packedLength;
+
+ if (!isSampled && !hasInterval) {
+ if (defined(type.unpack)) {
+ object[propertyName] = new ConstantProperty(type.unpack(unwrappedInterval, 0));
+ } else {
+ object[propertyName] = new ConstantProperty(unwrappedInterval);
+ }
+ return true;
+ }
+
+ var propertyCreated = false;
+ var property = object[propertyName];
+ if (!isSampled && hasInterval) {
+ combinedInterval = combinedInterval.clone();
+ if (defined(type.unpack)) {
+ combinedInterval.data = type.unpack(unwrappedInterval, 0);
+ } else {
+ combinedInterval.data = unwrappedInterval;
+ }
+
+ if (!defined(property)) {
+ property = new TimeIntervalCollectionProperty();
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+
+ if (property instanceof TimeIntervalCollectionProperty) {
+ property.intervals.addInterval(combinedInterval);
+ } else {
+ //TODO Morph to CompositeProperty
+ }
+ } else if (isSampled && !hasInterval) {
+ if (!(property instanceof SampledProperty)) {
+ property = new SampledProperty(type);
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ } else if (isSampled && hasInterval) {
+ if (!defined(property)) {
+ property = new CompositeProperty();
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ if (property instanceof CompositeProperty) {
+ var intervals = property.intervals;
+ var interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
+ var intervalData;
+ if (defined(interval)) {
+ intervalData = interval.data;
+ } else {
+ interval = combinedInterval.clone();
+ intervalData = new SampledProperty(type);
+ interval.data = intervalData;
+ intervals.addInterval(interval);
+ }
+ if (!(intervalData instanceof SampledProperty)) {
+ intervalData = new SampledProperty(type);
+ interval.Data = intervalData;
+ }
+ intervalData.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ } else {
+ //TODO Morph to CompositeProperty
+ }
+ }
+ return propertyCreated;
+ }
+
+ function processPacketData(type, object, propertyName, packetData, interval, sourceUri) {
+ if (!defined(packetData)) {
+ return false;
+ }
+
+ var updated = false;
+ if (Array.isArray(packetData)) {
+ for ( var i = 0, len = packetData.length; i < len; i++) {
+ updated = processProperty(type, object, propertyName, packetData[i], interval, sourceUri) || updated;
+ }
+ } else {
+ updated = processProperty(type, object, propertyName, packetData, interval, sourceUri) || updated;
+ }
+ return updated;
+ }
+
+ var interpolators = {
+ HERMITE : HermitePolynomialApproximation,
+ LAGRANGE : LagrangePolynomialApproximation,
+ LINEAR : LinearApproximation
+ };
+
+ function updateInterpolationSettings(packetData, property) {
+ var interpolator = interpolators[packetData.interpolationAlgorithm];
+ if (defined(interpolator)) {
+ property.interpolationAlgorithm = interpolator;
+ }
+ if (defined(packetData.interpolationDegree)) {
+ property.interpolationDegree = packetData.interpolationDegree;
+ }
+
+ }
+
+ function processPositionProperty(object, propertyName, packetData, constrainedInterval, sourceUri) {
+ var combinedInterval;
+ var packetInterval = packetData.interval;
+ if (defined(packetInterval)) {
+ combinedInterval = TimeInterval.fromIso8601(packetInterval);
+ if (defined(constrainedInterval)) {
+ combinedInterval = combinedInterval.intersect(constrainedInterval);
+ }
+ } else if (defined(constrainedInterval)) {
+ combinedInterval = constrainedInterval;
+ }
+
+ var referenceFrame = ReferenceFrame[defaultValue(packetData.referenceFrame, "FIXED")];
+ var unwrappedInterval = unwrapCartesianInterval(packetData);
+ var hasInterval = defined(combinedInterval) && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
+ var isSampled = unwrappedInterval.length > Cartesian3.packedLength;
+
+ if (!isSampled && !hasInterval) {
+ object[propertyName] = new ConstantPositionProperty(Cartesian3.unpack(unwrappedInterval, 0), referenceFrame);
+ return true;
+ }
+
+ var propertyCreated = false;
+ var property = object[propertyName];
+ if (!isSampled && hasInterval) {
+ combinedInterval = combinedInterval.clone();
+ combinedInterval.data = Cartesian3.unpack(unwrappedInterval, 0);
+
+ if (!defined(property)) {
+ property = new TimeIntervalCollectionPositionProperty(referenceFrame);
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ if (property instanceof TimeIntervalCollectionPositionProperty) {
+ property.intervals.addInterval(combinedInterval);
+ updateInterpolationSettings(packetData, property);
+ } else {
+ //TODO Morph to CompositePositionProperty
+ }
+ } else if (isSampled && !hasInterval) {
+ if (!(property instanceof SampledPositionProperty)) {
+ property = new SampledPositionProperty(referenceFrame);
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ updateInterpolationSettings(packetData, property);
+ } else if (isSampled && hasInterval) {
+ if (!defined(property)) {
+ property = new CompositePositionProperty(referenceFrame);
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ if (property instanceof CompositePositionProperty) {
+ var intervals = property.intervals;
+ var interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
+ var intervalData;
+ if (defined(interval)) {
+ intervalData = interval.data;
+ } else {
+ interval = combinedInterval.clone();
+ intervalData = new SampledPositionProperty(referenceFrame);
+ interval.data = intervalData;
+ intervals.addInterval(interval);
+ }
+ if (!(intervalData instanceof SampledPositionProperty)) {
+ intervalData = new SampledPositionProperty(referenceFrame);
+ interval.Data = intervalData;
+ }
+ intervalData.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ updateInterpolationSettings(packetData, property);
+ } else {
+ //TODO Morph to CompositePositionProperty
+ }
+ }
+ return propertyCreated;
+ }
+
+ function processPositionPacketData(object, propertyName, packetData, interval, sourceUri) {
+ if (!defined(packetData)) {
+ return false;
+ }
+
+ var updated = false;
+ if (Array.isArray(packetData)) {
+ for ( var i = 0, len = packetData.length; i < len; i++) {
+ updated = processPositionProperty(object, propertyName, packetData[i], interval, sourceUri) || updated;
+ }
+ } else {
+ updated = processPositionProperty(object, propertyName, packetData, interval, sourceUri) || updated;
+ }
+ return updated;
+ }
+ processPacketData.position = processPositionPacketData;
+
+ function cloneIntoUniforms(material, uniforms) {
+ if (!defined(uniforms)) {
+ uniforms = {};
+ }
+ if (material instanceof DynamicColorMaterial) {
+ //uniforms.color = material.color.getValue(time, uniforms.color);
+ }
+
+ if (material instanceof DynamicGridMaterial) {
+ }
+
+ if (material instanceof DynamicImageMaterial) {
+ return material;
+ }
+
+ //TODO
+ return material;
+ //throw new RuntimeError('unknown material');
+ }
+
+ function processMaterialProperty(object, propertyName, packetData, constrainedInterval, sourceUri) {
+ var combinedInterval;
+ var packetInterval = packetData.interval;
+ if (defined(packetInterval)) {
+ combinedInterval = TimeInterval.fromIso8601(packetInterval);
+ if (defined(constrainedInterval)) {
+ combinedInterval = combinedInterval.intersect(constrainedInterval);
+ }
+ } else if (defined(constrainedInterval)) {
+ combinedInterval = constrainedInterval;
+ }
+
+ combinedInterval = defaultValue(combinedInterval, Iso8601.MAXIMUM_INTERVAL);
+
+ var propertyCreated = false;
+ var property = object[propertyName];
+ if (!defined(property)) {
+ property = new TimeIntervalCollectionProperty(cloneIntoUniforms);
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+
+ //See if we already have data at that interval.
+ var thisIntervals = property.intervals;
+ var existingInterval = thisIntervals.findInterval(combinedInterval.start, combinedInterval.stop);
+ var existingMaterial;
+
+ if (defined(existingInterval)) {
+ //We have an interval, but we need to make sure the
+ //new data is the same type of material as the old data.
+ existingMaterial = existingInterval.data;
+ } else {
+ //If not, create it.
+ existingInterval = combinedInterval.clone();
+ thisIntervals.addInterval(existingInterval);
+ }
+
+ var materialData;
+ if (defined(packetData.solidColor)) {
+ if (!(existingMaterial instanceof DynamicColorMaterial)) {
+ existingMaterial = new DynamicColorMaterial();
+ }
+ materialData = packetData.solidColor;
+ processPacketData(Color, existingMaterial, 'color', materialData.color);
+ } else if (defined(packetData.grid)) {
+ if (!(existingMaterial instanceof DynamicGridMaterial)) {
+ existingMaterial = new DynamicGridMaterial();
+ }
+ materialData = packetData.grid;
+ processPacketData(Color, existingMaterial, 'color', materialData.color, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'cellAlpha', materialData.cellAlpha, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'rowCount', materialData.rowCount, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'columnCount', materialData.columnCount, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'rowThickness', materialData.rowThickness, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'columnThickness', materialData.columnThickness, undefined, sourceUri);
+ } else if (defined(packetData.image)) {
+ if (!(existingMaterial instanceof DynamicImageMaterial)) {
+ existingMaterial = new DynamicImageMaterial();
+ }
+ materialData = packetData.image;
+ processPacketData(Image, existingMaterial, 'image', materialData.image, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'verticalRepeat', materialData.verticalRepeat, undefined, sourceUri);
+ processPacketData(Number, existingMaterial, 'horizontalRepeat', materialData.horizontalRepeat, undefined, sourceUri);
+ }
+ existingInterval.data = existingMaterial;
+
+ return propertyCreated;
+ }
+
+ function processMaterialPacketData(object, propertyName, packetData, interval, sourceUri){
+ if (!defined(packetData)) {
+ return false;
+ }
+
+ var updated = false;
+ if (Array.isArray(packetData)) {
+ for ( var i = 0, len = packetData.length; i < len; i++) {
+ updated = processMaterialProperty(object, propertyName, packetData[i], interval, sourceUri) || updated;
+ }
+ } else {
+ updated = processMaterialProperty(object, propertyName, packetData, interval, sourceUri) || updated;
+ }
+ return updated;
+ }
+ processPacketData.material = processMaterialPacketData;
+
+ function DynamicObjectprocessCzmlPacketPosition(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var positionData = packet.position;
+ if (!defined(positionData)) {
+ return false;
+ }
+ return processPacketData.position(dynamicObject, 'position', positionData, undefined, sourceUri);
+ }
+
+ function DynamicObjectprocessCzmlPacketViewFrom(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var viewFromData = packet.viewFrom;
+ if (!defined(viewFromData)) {
+ return false;
+ }
+ return processPacketData(Cartesian3, dynamicObject, 'viewFrom', viewFromData, undefined, sourceUri);
+ }
+
+ function DynamicObjectprocessCzmlPacketOrientation(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var orientationData = packet.orientation;
+ if (!defined(orientationData)) {
+ return false;
+ }
+
+ return processPacketData(Quaternion, dynamicObject, 'orientation', orientationData, undefined, sourceUri);
+ }
+
+ function DynamicObjectprocessCzmlPacketVertexPositions(dynamicObject, packet, dynamicObjectCollection) {
+ var vertexPositionsData = packet.vertexPositions;
+ if (!defined(vertexPositionsData)) {
+ return false;
+ }
+
+ var vertexPositions = dynamicObject.vertexPositions;
+ var propertyCreated = !defined(dynamicObject.vertexPositions);
+ if (propertyCreated) {
+ dynamicObject.vertexPositions = vertexPositions = new DynamicVertexPositionsProperty();
+ }
+ vertexPositions.processCzmlIntervals(vertexPositionsData, undefined, dynamicObjectCollection);
+ return propertyCreated;
+ }
+
+ function DynamicObjectprocessCzmlPacketAvailability(dynamicObject, packet) {
+ var availability = packet.availability;
+ if (!defined(availability)) {
+ return false;
+ }
+
+ var propertyChanged = false;
+ var interval = TimeInterval.fromIso8601(availability);
+ if (defined(interval)) {
+ propertyChanged = dynamicObject._setAvailability(interval);
+ }
+ return propertyChanged;
+ }
+
+ function DynamicBillboardprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var billboardData = packet.billboard;
+ if (!defined(billboardData)) {
+ return false;
+ }
+
+ var interval = billboardData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var billboard = dynamicObject.billboard;
+ var billboardUpdated = !defined(billboard);
+ if (billboardUpdated) {
+ dynamicObject.billboard = billboard = new DynamicBillboard();
+ }
+
+ billboardUpdated = processPacketData(Color, billboard, 'color', billboardData.color, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Cartesian3, billboard, 'eyeOffset', billboardData.eyeOffset, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(HorizontalOrigin, billboard, 'horizontalOrigin', billboardData.horizontalOrigin, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Image, billboard, 'image', billboardData.image, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Cartesian2, billboard, 'pixelOffset', billboardData.pixelOffset, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Number, billboard, 'scale', billboardData.scale, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Number, billboard, 'rotation', billboardData.rotation, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Cartesian3, billboard, 'alignedAxis', billboardData.alignedAxis, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(Boolean, billboard, 'show', billboardData.show, interval, sourceUri) || billboardUpdated;
+ billboardUpdated = processPacketData(VerticalOrigin, billboard, 'verticalOrigin', billboardData.verticalOrigin, interval, sourceUri) || billboardUpdated;
+
+ return billboardUpdated;
+ }
+
+ function DynamicClockprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var clockUpdated = false;
+ var clockPacket = packet.clock;
+ if (defined(clockPacket)) {
+ if (dynamicObject.id === 'document') {
+ var clock = dynamicObject.clock;
+ if (!defined(clock)) {
+ clock = new DynamicClock();
+ dynamicObject.clock = clock;
+ clockUpdated = true;
+ }
+
+ if (defined(clockPacket.interval)) {
+ var interval = TimeInterval.fromIso8601(clockPacket.interval);
+ if (defined(interval)) {
+ clock.startTime = interval.start;
+ clock.stopTime = interval.stop;
+ }
+ }
+ if (defined(clockPacket.currentTime)) {
+ clock.currentTime = JulianDate.fromIso8601(clockPacket.currentTime);
+ }
+ if (defined(clockPacket.range)) {
+ clock.clockRange = ClockRange[clockPacket.range];
+ }
+ if (defined(clockPacket.step)) {
+ clock.clockStep = ClockStep[clockPacket.step];
+ }
+ if (defined(clockPacket.multiplier)) {
+ clock.multiplier = clockPacket.multiplier;
+ }
+ }
+ }
+
+ return clockUpdated;
+ }
+
+ function DynamicConeprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var coneData = packet.cone;
+ if (!defined(coneData)) {
+ return false;
+ }
+
+ var interval = coneData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var cone = dynamicObject.cone;
+ var coneUpdated = !defined(cone);
+ if (coneUpdated) {
+ dynamicObject.cone = cone = new DynamicCone();
+ }
+
+ coneUpdated = processPacketData(Boolean, cone, 'show', coneData.show, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'radius', coneData.radius, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Boolean, cone, 'showIntersection', coneData.showIntersection, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Color, cone, 'intersectionColor', coneData.intersectionColor, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'intersectionWidth', coneData.intersectionWidth, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'innerHalfAngle', coneData.innerHalfAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'outerHalfAngle', coneData.outerHalfAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'minimumClockAngle', coneData.minimumClockAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData(Number, cone, 'maximumClockAngle', coneData.maximumClockAngle, interval, sourceUri) || coneUpdated;
+ coneUpdated = processPacketData.material(cone, 'capMaterial', coneData.capMaterial, interval, sourceUri);
+ coneUpdated = processPacketData.material(cone, 'innerMaterial', coneData.innerMaterial, interval, sourceUri);
+ coneUpdated = processPacketData.material(cone, 'outerMaterial', coneData.outerMaterial, interval, sourceUri);
+ coneUpdated = processPacketData.material(cone, 'silhouetteMaterial', coneData.silhouetteMaterial, interval, sourceUri);
+ return coneUpdated;
+ }
+
+ function DynamicEllipseprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var ellipseData = packet.ellipse;
+ if (!defined(ellipseData)) {
+ return false;
+ }
+
+ var interval = ellipseData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var ellipse = dynamicObject.ellipse;
+ var ellipseUpdated = !defined(ellipse);
+ if (ellipseUpdated) {
+ dynamicObject.ellipse = ellipse = new DynamicEllipse();
+ }
+
+ ellipseUpdated = processPacketData(Number, ellipse, 'bearing', ellipseData.bearing, interval, sourceUri) || ellipseUpdated;
+ ellipseUpdated = processPacketData(Number, ellipse, 'semiMajorAxis', ellipseData.semiMajorAxis, interval, sourceUri) || ellipseUpdated;
+ ellipseUpdated = processPacketData(Number, ellipse, 'semiMinorAxis', ellipseData.semiMinorAxis, interval, sourceUri) || ellipseUpdated;
+
+ return ellipseUpdated;
+ }
+
+ function DynamicEllipsoidprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var ellipsoidData = packet.ellipsoid;
+ if (!defined(ellipsoidData)) {
+ return false;
+ }
+
+ var interval = ellipsoidData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var ellipsoid = dynamicObject.ellipsoid;
+ var ellipsoidUpdated = !defined(ellipsoid);
+ if (ellipsoidUpdated) {
+ dynamicObject.ellipsoid = ellipsoid = new DynamicEllipsoid();
+ }
+
+ ellipsoidUpdated = processPacketData(Boolean, ellipsoid, 'show', ellipsoidData.show, interval, sourceUri) || ellipsoidUpdated;
+ ellipsoidUpdated = processPacketData(Cartesian3, ellipsoid, 'radii', ellipsoidData.radii, interval, sourceUri) || ellipsoidUpdated;
+ ellipsoidUpdated = processPacketData.material(ellipsoid, 'material', ellipsoidData.material, interval, sourceUri);
+ return ellipsoidUpdated;
+ }
+
+ function DynamicLabelprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var labelData = packet.label;
+ if (!defined(labelData)) {
+ return false;
+ }
+
+ var interval = labelData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var label = dynamicObject.label;
+ var labelUpdated = !defined(label);
+ if (labelUpdated) {
+ dynamicObject.label = label = new DynamicLabel();
+ }
+
+ labelUpdated = processPacketData(Color, label, 'fillColor', labelData.fillColor, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Color, label, 'outlineColor', labelData.outlineColor, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Number, label, 'outlineWidth', labelData.outlineWidth, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Cartesian3, label, 'eyeOffset', labelData.eyeOffset, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(HorizontalOrigin, label, 'horizontalOrigin', labelData.horizontalOrigin, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(String, label, 'text', labelData.text, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Cartesian2, label, 'pixelOffset', labelData.pixelOffset, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Number, label, 'scale', labelData.scale, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(Boolean, label, 'show', labelData.show, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(VerticalOrigin, label, 'verticalOrigin', labelData.verticalOrigin, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(String, label, 'font', labelData.font, interval, sourceUri) || labelUpdated;
+ labelUpdated = processPacketData(LabelStyle, label, 'style', labelData.style, interval, sourceUri) || labelUpdated;
+
+ return labelUpdated;
+ }
+
+ function DynamicPathprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var pathData = packet.path;
+ if (!defined(pathData)) {
+ return false;
+ }
+
+ var interval = pathData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var path = dynamicObject.path;
+ var pathUpdated = !defined(path);
+ if (pathUpdated) {
+ dynamicObject.path = path = new DynamicPath();
+ }
+
+ pathUpdated = processPacketData(Color, path, 'color', pathData.color, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Number, path, 'width', pathData.width, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Color, path, 'outlineColor', pathData.outlineColor, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Number, path, 'outlineWidth', pathData.outlineWidth, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Boolean, path, 'show', pathData.show, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Number, path, 'resolution', pathData.resolution, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Number, path, 'leadTime', pathData.leadTime, interval, sourceUri) || pathUpdated;
+ pathUpdated = processPacketData(Number, path, 'trailTime', pathData.trailTime, interval, sourceUri) || pathUpdated;
+ return pathUpdated;
+ }
+
+ function DynamicPointprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var pointData = packet.point;
+ if (!defined(pointData)) {
+ return false;
+ }
+
+ var interval = pointData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var point = dynamicObject.point;
+ var pointUpdated = !defined(point);
+ if (pointUpdated) {
+ dynamicObject.point = point = new DynamicPoint();
+ }
+
+ pointUpdated = processPacketData(Color, point, 'color', pointData.color, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(Number, point, 'pixelSize', pointData.pixelSize, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(Color, point, 'outlineColor', pointData.outlineColor, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(Number, point, 'outlineWidth', pointData.outlineWidth, interval, sourceUri) || pointUpdated;
+ pointUpdated = processPacketData(Boolean, point, 'show', pointData.show, interval, sourceUri) || pointUpdated;
+
+ return pointUpdated;
+ }
+
+ function DynamicPolygonprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var polygonData = packet.polygon;
+ if (!defined(polygonData)) {
+ return false;
+ }
+
+ var interval = polygonData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var polygon = dynamicObject.polygon;
+ var polygonUpdated = !defined(polygon);
+ if (polygonUpdated) {
+ dynamicObject.polygon = polygon = new DynamicPolygon();
+ }
+
+ polygonUpdated = processPacketData(Boolean, polygon, 'show', polygonData.show, interval, sourceUri) || polygonUpdated;
+ polygonUpdated = processPacketData.material(polygon, 'material', polygonData.material, interval, sourceUri);
+ return polygonUpdated;
+ }
+
+ function DynamicPolylineprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var polylineData = packet.polyline;
+ if (!defined(polylineData)) {
+ return false;
+ }
+
+ var interval = polylineData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var polyline = dynamicObject.polyline;
+ var polylineUpdated = !defined(polyline);
+ if (polylineUpdated) {
+ dynamicObject.polyline = polyline = new DynamicPolyline();
+ }
+
+ polylineUpdated = processPacketData(Color, polyline, 'color', polylineData.color, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(Number, polyline, 'width', polylineData.width, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(Color, polyline, 'outlineColor', polylineData.outlineColor, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(Number, polyline, 'outlineWidth', polylineData.outlineWidth, interval, sourceUri) || polylineUpdated;
+ polylineUpdated = processPacketData(Boolean, polyline, 'show', polylineData.show, interval, sourceUri) || polylineUpdated;
+ return polylineUpdated;
+ }
+
+ function DynamicPyramidprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var pyramidData = packet.pyramid;
+ if (!defined(pyramidData)) {
+ return false;
+ }
+
+ var interval = pyramidData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var pyramid = dynamicObject.pyramid;
+ var pyramidUpdated = !defined(pyramid);
+ if (pyramidUpdated) {
+ dynamicObject.pyramid = pyramid = new DynamicPyramid();
+ }
+
+ pyramidUpdated = processPacketData(Boolean, pyramid, 'show', pyramidData.show, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(Number, pyramid, 'radius', pyramidData.radius, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(Boolean, pyramid, 'showIntersection', pyramidData.showIntersection, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(Color, pyramid, 'intersectionColor', pyramidData.intersectionColor, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData(Number, pyramid, 'intersectionWidth', pyramidData.intersectionWidth, interval, sourceUri) || pyramidUpdated;
+ pyramidUpdated = processPacketData.material(pyramid, 'material', pyramidData.material, interval, sourceUri);
+
+ if (defined(pyramidData.directions)) {
+ var directions = pyramid.directions;
+ if (!defined(directions)) {
+ pyramid.directions = directions = new DynamicDirectionsProperty();
+ pyramidUpdated = true;
+ }
+ directions.processCzmlIntervals(pyramidData.directions, interval);
+ }
+
+ return pyramidUpdated;
+ }
+
+ function DynamicVectorprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ var vectorData = packet.vector;
+ if (!defined(vectorData)) {
+ return false;
+ }
+
+ var interval = vectorData.interval;
+ if (defined(interval)) {
+ interval = TimeInterval.fromIso8601(interval);
+ }
+
+ var vector = dynamicObject.vector;
+ var vectorUpdated = !defined(vector);
+ if (vectorUpdated) {
+ dynamicObject.vector = vector = new DynamicVector();
+ }
+
+ vectorUpdated = processPacketData(Color, vector, 'color', vectorData.color, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(Boolean, vector, 'show', vectorData.show, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(Number, vector, 'width', vectorData.width, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(Cartesian3, vector, 'direction', vectorData.direction, interval, sourceUri) || vectorUpdated;
+ vectorUpdated = processPacketData(Number, vector, 'length', vectorData.length, interval, sourceUri) || vectorUpdated;
+
+ return vectorUpdated;
+ }
+
+ var updaters = [DynamicClockprocessCzmlPacket,
+ DynamicBillboardprocessCzmlPacket,
+ DynamicEllipseprocessCzmlPacket,
+ DynamicEllipsoidprocessCzmlPacket,
+ DynamicConeprocessCzmlPacket,
+ DynamicLabelprocessCzmlPacket,
+ DynamicPathprocessCzmlPacket,
+ DynamicPointprocessCzmlPacket,
+ DynamicPolygonprocessCzmlPacket,
+ DynamicPolylineprocessCzmlPacket,
+ DynamicPyramidprocessCzmlPacket,
+ DynamicVectorprocessCzmlPacket,
+ DynamicObjectprocessCzmlPacketPosition,
+ DynamicObjectprocessCzmlPacketViewFrom,
+ DynamicObjectprocessCzmlPacketOrientation,
+ DynamicObjectprocessCzmlPacketVertexPositions,
+ DynamicObjectprocessCzmlPacketAvailability];
+
function processCzmlPacket(packet, dynamicObjectCollection, updatedObjects, updatedObjectsHash, updaterFunctions, sourceUri) {
var objectId = packet.id;
if (!defined(objectId)) {
@@ -253,7 +1237,7 @@ define([
var updatedObjects = [];
var updatedObjectsHash = {};
- updaterFunctions = defined(updaterFunctions) ? updaterFunctions : CzmlDefaults.updaters;
+ updaterFunctions = defined(updaterFunctions) ? updaterFunctions : updaters;
if (Array.isArray(czml)) {
for ( var i = 0, len = czml.length; i < len; i++) {
diff --git a/Source/DynamicScene/CzmlDefaults.js b/Source/DynamicScene/CzmlDefaults.js
index 8b84bab58e38..6f23b972dc2a 100644
--- a/Source/DynamicScene/CzmlDefaults.js
+++ b/Source/DynamicScene/CzmlDefaults.js
@@ -62,31 +62,6 @@ define([
* @see VisualizerCollection#createCzmlDefaultsCollection
*/
var CzmlDefaults = {
- //Any change to updaters needs to be reflected in the DynamicObject constructor,
- //which has the superset of all properties created by the various updaters.
- /**
- * The standard set of updaters for processing CZML. This array is the default
- * set of updater methods used by DynamicObjectCollection.
- * @see DynamicObjectCollection
- */
- updaters : [DynamicClock.processCzmlPacket,
- DynamicBillboard.processCzmlPacket,
- DynamicEllipse.processCzmlPacket,
- DynamicEllipsoid.processCzmlPacket,
- DynamicCone.processCzmlPacket,
- DynamicLabel.processCzmlPacket,
- DynamicPath.processCzmlPacket,
- DynamicPoint.processCzmlPacket,
- DynamicPolygon.processCzmlPacket,
- DynamicPolyline.processCzmlPacket,
- DynamicPyramid.processCzmlPacket,
- DynamicVector.processCzmlPacket,
- DynamicObject.processCzmlPacketPosition,
- DynamicObject.processCzmlPacketViewFrom,
- DynamicObject.processCzmlPacketOrientation,
- DynamicObject.processCzmlPacketVertexPositions,
- DynamicObject.processCzmlPacketAvailability],
-
/**
* The standard set of mergers for processing CZML. This array is the default
* set of updater methods used by CompositeDynamicObjectCollection.
diff --git a/Source/DynamicScene/DynamicBillboard.js b/Source/DynamicScene/DynamicBillboard.js
index abc9f0da6091..aa3d09c3f70c 100644
--- a/Source/DynamicScene/DynamicBillboard.js
+++ b/Source/DynamicScene/DynamicBillboard.js
@@ -7,8 +7,7 @@ define([
'../Core/Cartesian3',
'../Scene/HorizontalOrigin',
'../Scene/VerticalOrigin',
- '../Core/Color',
- './processPacketData'
+ '../Core/Color'
], function(
TimeInterval,
defaultValue,
@@ -17,8 +16,7 @@ define([
Cartesian3,
HorizontalOrigin,
VerticalOrigin,
- Color,
- processPacketData) {
+ Color) {
"use strict";
/**
@@ -100,55 +98,6 @@ define([
this.show = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's billboard.
- * If the DynamicObject does not have a billboard, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- * @memberof DynamicBillboard
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the billboard data.
- * @param {Object} packet The CZML packet to process.
- * @param {DynamicObjectCollection} [dynamicObjectCollection] The collection into which objects are being loaded.
- * @param {String} [sourceUri] The originating url of the CZML being processed.
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicBillboard.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var billboardData = packet.billboard;
- if (!defined(billboardData)) {
- return false;
- }
-
- var interval = billboardData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var billboard = dynamicObject.billboard;
- var billboardUpdated = !defined(billboard);
- if (billboardUpdated) {
- dynamicObject.billboard = billboard = new DynamicBillboard();
- }
-
- billboardUpdated = processPacketData(Color, billboard, 'color', billboardData.color, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(Cartesian3, billboard, 'eyeOffset', billboardData.eyeOffset, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(HorizontalOrigin, billboard, 'horizontalOrigin', billboardData.horizontalOrigin, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(Image, billboard, 'image', billboardData.image, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(Cartesian2, billboard, 'pixelOffset', billboardData.pixelOffset, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(Number, billboard, 'scale', billboardData.scale, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(Number, billboard, 'rotation', billboardData.rotation, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(Cartesian3, billboard, 'alignedAxis', billboardData.alignedAxis, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(Boolean, billboard, 'show', billboardData.show, interval, sourceUri) || billboardUpdated;
- billboardUpdated = processPacketData(VerticalOrigin, billboard, 'verticalOrigin', billboardData.verticalOrigin, interval, sourceUri) || billboardUpdated;
-
- return billboardUpdated;
- };
-
/**
* Given two DynamicObjects, takes the billboard properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/DynamicClock.js b/Source/DynamicScene/DynamicClock.js
index f394bdeb5bfe..c2b996862b3e 100644
--- a/Source/DynamicScene/DynamicClock.js
+++ b/Source/DynamicScene/DynamicClock.js
@@ -88,58 +88,6 @@ define([
return result;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's clock.
- * @memberof DynamicClock
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the clock data.
- * @param {Object} packet The CZML packet to process.
- * @param {DynamicObjectCollection} [dynamicObjectCollection] The collection into which objects are being loaded.
- * @param {String} [sourceUri] The originating url of the CZML being processed.
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicClock.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var clockUpdated = false;
- var clockPacket = packet.clock;
- if (defined(clockPacket)) {
- if (dynamicObject.id === 'document') {
- var clock = dynamicObject.clock;
- if (!defined(clock)) {
- clock = new DynamicClock();
- dynamicObject.clock = clock;
- clockUpdated = true;
- }
-
- if (defined(clockPacket.interval)) {
- var interval = TimeInterval.fromIso8601(clockPacket.interval);
- if (defined(interval)) {
- clock.startTime = interval.start;
- clock.stopTime = interval.stop;
- }
- }
- if (defined(clockPacket.currentTime)) {
- clock.currentTime = JulianDate.fromIso8601(clockPacket.currentTime);
- }
- if (defined(clockPacket.range)) {
- clock.clockRange = ClockRange[clockPacket.range];
- }
- if (defined(clockPacket.step)) {
- clock.clockStep = ClockStep[clockPacket.step];
- }
- if (defined(clockPacket.multiplier)) {
- clock.multiplier = clockPacket.multiplier;
- }
- }
- }
-
- return clockUpdated;
- };
-
/**
* Given two DynamicObjects, takes the clock properties from the second
* and assigns them to the first.
diff --git a/Source/DynamicScene/DynamicCone.js b/Source/DynamicScene/DynamicCone.js
index 79b640e1b04d..a138e860a34b 100644
--- a/Source/DynamicScene/DynamicCone.js
+++ b/Source/DynamicScene/DynamicCone.js
@@ -3,14 +3,12 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- '../Core/Color',
- './processPacketData'
+ '../Core/Color'
], function(
TimeInterval,
defaultValue,
defined,
- Color,
- processPacketData) {
+ Color) {
"use strict";
/**
@@ -109,54 +107,6 @@ define([
this.show = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's cone.
- * If the DynamicObject does not have a cone, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the cone data.
- * @param {Object} packet The CZML packet to process.
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicCone.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var coneData = packet.cone;
- if (!defined(coneData)) {
- return false;
- }
-
- var interval = coneData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var cone = dynamicObject.cone;
- var coneUpdated = !defined(cone);
- if (coneUpdated) {
- dynamicObject.cone = cone = new DynamicCone();
- }
-
- coneUpdated = processPacketData(Boolean, cone, 'show', coneData.show, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(Number, cone, 'radius', coneData.radius, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(Boolean, cone, 'showIntersection', coneData.showIntersection, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(Color, cone, 'intersectionColor', coneData.intersectionColor, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(Number, cone, 'intersectionWidth', coneData.intersectionWidth, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(Number, cone, 'innerHalfAngle', coneData.innerHalfAngle, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(Number, cone, 'outerHalfAngle', coneData.outerHalfAngle, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(Number, cone, 'minimumClockAngle', coneData.minimumClockAngle, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData(Number, cone, 'maximumClockAngle', coneData.maximumClockAngle, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData.material(cone, 'capMaterial', coneData.capMaterial, interval, sourceUri);
- coneUpdated = processPacketData.material(cone, 'innerMaterial', coneData.innerMaterial, interval, sourceUri);
- coneUpdated = processPacketData.material(cone, 'outerMaterial', coneData.outerMaterial, interval, sourceUri);
- coneUpdated = processPacketData.material(cone, 'silhouetteMaterial', coneData.silhouetteMaterial, interval, sourceUri);
- return coneUpdated;
- };
-
/**
* Given two DynamicObjects, takes the cone properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/DynamicEllipse.js b/Source/DynamicScene/DynamicEllipse.js
index 34f1c7171932..2dcf5904bbb6 100644
--- a/Source/DynamicScene/DynamicEllipse.js
+++ b/Source/DynamicScene/DynamicEllipse.js
@@ -5,16 +5,14 @@ define([
'../Core/defined',
'../Core/Cartesian3',
'../Core/Ellipsoid',
- '../Core/Shapes',
- './processPacketData'
+ '../Core/Shapes'
], function (
TimeInterval,
defaultValue,
defined,
Cartesian3,
Ellipsoid,
- Shapes,
- processPacketData) {
+ Shapes) {
"use strict";
/**
@@ -59,47 +57,6 @@ define([
this._cachedVertexPositions = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's ellipse.
- * If the DynamicObject does not have a ellipse, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the ellipse data.
- * @param {Object} packet The CZML packet to process.
- * @param {DynamicObject} dynamicObjectCollection The DynamicObjectCollection to which the DynamicObject belongs.
- *
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicEllipse.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var ellipseData = packet.ellipse;
- if (!defined(ellipseData)) {
- return false;
- }
-
- var interval = ellipseData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var ellipse = dynamicObject.ellipse;
- var ellipseUpdated = !defined(ellipse);
- if (ellipseUpdated) {
- dynamicObject.ellipse = ellipse = new DynamicEllipse();
- }
-
- ellipseUpdated = processPacketData(Number, ellipse, 'bearing', ellipseData.bearing, interval, sourceUri) || ellipseUpdated;
- ellipseUpdated = processPacketData(Number, ellipse, 'semiMajorAxis', ellipseData.semiMajorAxis, interval, sourceUri) || ellipseUpdated;
- ellipseUpdated = processPacketData(Number, ellipse, 'semiMinorAxis', ellipseData.semiMinorAxis, interval, sourceUri) || ellipseUpdated;
-
- return ellipseUpdated;
- };
-
/**
* Given two DynamicObjects, takes the ellipse properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/DynamicEllipsoid.js b/Source/DynamicScene/DynamicEllipsoid.js
index 70cea814bf1e..109271ba4c0e 100644
--- a/Source/DynamicScene/DynamicEllipsoid.js
+++ b/Source/DynamicScene/DynamicEllipsoid.js
@@ -3,14 +3,12 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- '../Core/Cartesian3',
- './processPacketData'
+ '../Core/Cartesian3'
], function(
TimeInterval,
defaultValue,
defined,
- Cartesian3,
- processPacketData) {
+ Cartesian3) {
"use strict";
/**
@@ -49,46 +47,6 @@ define([
this.material = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's ellipsoid.
- * If the DynamicObject does not have a ellipsoid, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the ellipsoid data.
- * @param {Object} packet The CZML packet to process.
- * @param {DynamicObject} dynamicObjectCollection The DynamicObjectCollection to which the DynamicObject belongs.
- *
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicEllipsoid.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var ellipsoidData = packet.ellipsoid;
- if (!defined(ellipsoidData)) {
- return false;
- }
-
- var interval = ellipsoidData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var ellipsoid = dynamicObject.ellipsoid;
- var ellipsoidUpdated = !defined(ellipsoid);
- if (ellipsoidUpdated) {
- dynamicObject.ellipsoid = ellipsoid = new DynamicEllipsoid();
- }
-
- ellipsoidUpdated = processPacketData(Boolean, ellipsoid, 'show', ellipsoidData.show, interval, sourceUri) || ellipsoidUpdated;
- ellipsoidUpdated = processPacketData(Cartesian3, ellipsoid, 'radii', ellipsoidData.radii, interval, sourceUri) || ellipsoidUpdated;
- ellipsoidUpdated = processPacketData.material(ellipsoid, 'material', ellipsoidData.material, interval, sourceUri);
- return ellipsoidUpdated;
- };
-
/**
* Given two DynamicObjects, takes the ellipsoid properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/DynamicLabel.js b/Source/DynamicScene/DynamicLabel.js
index d90073ba278c..27274d876f85 100644
--- a/Source/DynamicScene/DynamicLabel.js
+++ b/Source/DynamicScene/DynamicLabel.js
@@ -8,8 +8,7 @@ define([
'../Scene/HorizontalOrigin',
'../Scene/VerticalOrigin',
'../Scene/LabelStyle',
- '../Core/Color',
- './processPacketData'
+ '../Core/Color'
], function(
TimeInterval,
defaultValue,
@@ -19,8 +18,7 @@ define([
HorizontalOrigin,
VerticalOrigin,
LabelStyle,
- Color,
- processPacketData) {
+ Color) {
"use strict";
/**
@@ -114,54 +112,6 @@ define([
this.show = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's label.
- * If the DynamicObject does not have a label, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the label data.
- * @param {Object} packet The CZML packet to process.
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicLabel.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var labelData = packet.label;
- if (!defined(labelData)) {
- return false;
- }
-
- var interval = labelData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var label = dynamicObject.label;
- var labelUpdated = !defined(label);
- if (labelUpdated) {
- dynamicObject.label = label = new DynamicLabel();
- }
-
- labelUpdated = processPacketData(Color, label, 'fillColor', labelData.fillColor, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(Color, label, 'outlineColor', labelData.outlineColor, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(Number, label, 'outlineWidth', labelData.outlineWidth, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(Cartesian3, label, 'eyeOffset', labelData.eyeOffset, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(HorizontalOrigin, label, 'horizontalOrigin', labelData.horizontalOrigin, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(String, label, 'text', labelData.text, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(Cartesian2, label, 'pixelOffset', labelData.pixelOffset, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(Number, label, 'scale', labelData.scale, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(Boolean, label, 'show', labelData.show, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(VerticalOrigin, label, 'verticalOrigin', labelData.verticalOrigin, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(String, label, 'font', labelData.font, interval, sourceUri) || labelUpdated;
- labelUpdated = processPacketData(LabelStyle, label, 'style', labelData.style, interval, sourceUri) || labelUpdated;
-
- return labelUpdated;
- };
-
/**
* Given two DynamicObjects, takes the label properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/DynamicObject.js b/Source/DynamicScene/DynamicObject.js
index 123ff1226ce8..c5b6808b5f73 100644
--- a/Source/DynamicScene/DynamicObject.js
+++ b/Source/DynamicScene/DynamicObject.js
@@ -7,7 +7,6 @@ define([
'../Core/JulianDate',
'../Core/Quaternion',
'../Core/TimeInterval',
- './processPacketData',
'./DynamicVertexPositionsProperty',
'../Core/Cartesian3'
], function(
@@ -18,7 +17,6 @@ define([
JulianDate,
Quaternion,
TimeInterval,
- processPacketData,
DynamicVertexPositionsProperty,
Cartesian3) {
"use strict";
@@ -224,125 +222,6 @@ define([
}
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's position
- * property. This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the position data.
- * @param {Object} packet The CZML packet to process.
- * @returns {Boolean} true if the property was newly created while processing the packet, false otherwise.
- *
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicObject.processCzmlPacketPosition = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var positionData = packet.position;
- if (!defined(positionData)) {
- return false;
- }
- return processPacketData.position(dynamicObject, 'position', positionData, undefined, sourceUri);
- };
-
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's viewFrom
- * property. This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the viewFrom data.
- * @param {Object} packet The CZML packet to process.
- * @returns {Boolean} true if the property was newly created while processing the packet, false otherwise.
- *
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicObject.processCzmlPacketViewFrom = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var viewFromData = packet.viewFrom;
- if (!defined(viewFromData)) {
- return false;
- }
- return processPacketData(Cartesian3, dynamicObject, 'viewFrom', viewFromData, undefined, sourceUri);
- };
-
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's orientation
- * property. This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the orientation data.
- * @param {Object} packet The CZML packet to process.
- * @returns {Boolean} true if the property was newly created while processing the packet, false otherwise.
- *
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicObject.processCzmlPacketOrientation = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var orientationData = packet.orientation;
- if (!defined(orientationData)) {
- return false;
- }
-
- return processPacketData(Quaternion, dynamicObject, 'orientation', orientationData, undefined, sourceUri);
- };
-
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's vertexPositions
- * property. This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the vertexPositions data.
- * @param {Object} packet The CZML packet to process.
- * @param {DynamicObjectCollection} dynamicObjectCollection The collection to use to resolve any CZML properly links.
- * @returns {Boolean} true if the property was newly created while processing the packet, false otherwise.
- *
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicObject.processCzmlPacketVertexPositions = function(dynamicObject, packet, dynamicObjectCollection) {
- var vertexPositionsData = packet.vertexPositions;
- if (!defined(vertexPositionsData)) {
- return false;
- }
-
- var vertexPositions = dynamicObject.vertexPositions;
- var propertyCreated = !defined(dynamicObject.vertexPositions);
- if (propertyCreated) {
- dynamicObject.vertexPositions = vertexPositions = new DynamicVertexPositionsProperty();
- }
- vertexPositions.processCzmlIntervals(vertexPositionsData, undefined, dynamicObjectCollection);
- return propertyCreated;
- };
-
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's availability
- * property. This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the availability data.
- * @param {Object} packet The CZML packet to process.
- * @returns {Boolean} true if the property was newly created while processing the packet, false otherwise.
- *
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicObject.processCzmlPacketAvailability = function(dynamicObject, packet) {
- var availability = packet.availability;
- if (!defined(availability)) {
- return false;
- }
-
- var propertyChanged = false;
- var interval = TimeInterval.fromIso8601(availability);
- if (defined(interval)) {
- propertyChanged = dynamicObject._setAvailability(interval);
- }
- return propertyChanged;
- };
-
/**
* Given two DynamicObjects, takes the position, orientation, vertexPositions and availability
* properties from the second and assigns them to the first, assuming such properties did not
diff --git a/Source/DynamicScene/DynamicPath.js b/Source/DynamicScene/DynamicPath.js
index 2e9d7bad9b5b..b1da805de943 100644
--- a/Source/DynamicScene/DynamicPath.js
+++ b/Source/DynamicScene/DynamicPath.js
@@ -3,14 +3,12 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- '../Core/Color',
- './processPacketData'],
+ '../Core/Color'],
function(
TimeInterval,
defaultValue,
defined,
- Color,
- processPacketData) {
+ Color) {
"use strict";
/**
@@ -79,49 +77,6 @@ function(
this.trailTime = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's path.
- * If the DynamicObject does not have a path, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the path data.
- * @param {Object} packet The CZML packet to process.
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicPath.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var pathData = packet.path;
- if (!defined(pathData)) {
- return false;
- }
-
- var interval = pathData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var path = dynamicObject.path;
- var pathUpdated = !defined(path);
- if (pathUpdated) {
- dynamicObject.path = path = new DynamicPath();
- }
-
- pathUpdated = processPacketData(Color, path, 'color', pathData.color, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(Number, path, 'width', pathData.width, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(Color, path, 'outlineColor', pathData.outlineColor, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(Number, path, 'outlineWidth', pathData.outlineWidth, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(Boolean, path, 'show', pathData.show, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(Number, path, 'resolution', pathData.resolution, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(Number, path, 'leadTime', pathData.leadTime, interval, sourceUri) || pathUpdated;
- pathUpdated = processPacketData(Number, path, 'trailTime', pathData.trailTime, interval, sourceUri) || pathUpdated;
- return pathUpdated;
- };
-
/**
* Given two DynamicObjects, takes the path properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/DynamicPoint.js b/Source/DynamicScene/DynamicPoint.js
index 0c46ab6dd91c..0535ab7dd6f2 100644
--- a/Source/DynamicScene/DynamicPoint.js
+++ b/Source/DynamicScene/DynamicPoint.js
@@ -3,14 +3,12 @@ define([
'../Core/defined',
'../Core/TimeInterval',
'../Core/defaultValue',
- '../Core/Color',
- './processPacketData'
+ '../Core/Color'
], function(
defined,
TimeInterval,
defaultValue,
- Color,
- processPacketData) {
+ Color) {
"use strict";
/**
@@ -57,47 +55,6 @@ define([
this.show = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's point.
- * If the DynamicObject does not have a point, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the point data.
- * @param {Object} packet The CZML packet to process.
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicPoint.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var pointData = packet.point;
- if (!defined(pointData)) {
- return false;
- }
-
- var interval = pointData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var point = dynamicObject.point;
- var pointUpdated = !defined(point);
- if (pointUpdated) {
- dynamicObject.point = point = new DynamicPoint();
- }
-
- pointUpdated = processPacketData(Color, point, 'color', pointData.color, interval, sourceUri) || pointUpdated;
- pointUpdated = processPacketData(Number, point, 'pixelSize', pointData.pixelSize, interval, sourceUri) || pointUpdated;
- pointUpdated = processPacketData(Color, point, 'outlineColor', pointData.outlineColor, interval, sourceUri) || pointUpdated;
- pointUpdated = processPacketData(Number, point, 'outlineWidth', pointData.outlineWidth, interval, sourceUri) || pointUpdated;
- pointUpdated = processPacketData(Boolean, point, 'show', pointData.show, interval, sourceUri) || pointUpdated;
-
- return pointUpdated;
- };
-
/**
* Given two DynamicObjects, takes the point properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/DynamicPolygon.js b/Source/DynamicScene/DynamicPolygon.js
index 511f536e03ba..25693999ffb1 100644
--- a/Source/DynamicScene/DynamicPolygon.js
+++ b/Source/DynamicScene/DynamicPolygon.js
@@ -2,13 +2,11 @@
define([
'../Core/TimeInterval',
'../Core/defaultValue',
- '../Core/defined',
- './processPacketData'
+ '../Core/defined'
], function(
TimeInterval,
defaultValue,
- defined,
- processPacketData) {
+ defined) {
"use strict";
/**
@@ -41,45 +39,6 @@ define([
this.material = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's polygon.
- * If the DynamicObject does not have a polygon, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the polygon data.
- * @param {Object} packet The CZML packet to process.
- * @param {DynamicObjectCollection} [dynamicObjectCollection] The collection into which objects are being loaded.
- * @param {String} [sourceUri] The originating url of the CZML being processed.
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicPolygon.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var polygonData = packet.polygon;
- if (!defined(polygonData)) {
- return false;
- }
-
- var interval = polygonData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var polygon = dynamicObject.polygon;
- var polygonUpdated = !defined(polygon);
- if (polygonUpdated) {
- dynamicObject.polygon = polygon = new DynamicPolygon();
- }
-
- polygonUpdated = processPacketData(Boolean, polygon, 'show', polygonData.show, interval, sourceUri) || polygonUpdated;
- polygonUpdated = processPacketData.material(polygon, 'material', polygonData.material, interval, sourceUri);
- return polygonUpdated;
- };
-
/**
* Given two DynamicObjects, takes the polygon properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/DynamicPolyline.js b/Source/DynamicScene/DynamicPolyline.js
index d9469535e74d..e94b6b923c60 100644
--- a/Source/DynamicScene/DynamicPolyline.js
+++ b/Source/DynamicScene/DynamicPolyline.js
@@ -3,14 +3,12 @@ define([
'../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
- '../Core/Color',
- './processPacketData'],
+ '../Core/Color'],
function(
TimeInterval,
defaultValue,
defined,
- Color,
- processPacketData) {
+ Color) {
"use strict";
/**
@@ -61,46 +59,6 @@ function(
this.width = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's polyline.
- * If the DynamicObject does not have a polyline, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the polyline data.
- * @param {Object} packet The CZML packet to process.
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicPolyline.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var polylineData = packet.polyline;
- if (!defined(polylineData)) {
- return false;
- }
-
- var interval = polylineData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var polyline = dynamicObject.polyline;
- var polylineUpdated = !defined(polyline);
- if (polylineUpdated) {
- dynamicObject.polyline = polyline = new DynamicPolyline();
- }
-
- polylineUpdated = processPacketData(Color, polyline, 'color', polylineData.color, interval, sourceUri) || polylineUpdated;
- polylineUpdated = processPacketData(Number, polyline, 'width', polylineData.width, interval, sourceUri) || polylineUpdated;
- polylineUpdated = processPacketData(Color, polyline, 'outlineColor', polylineData.outlineColor, interval, sourceUri) || polylineUpdated;
- polylineUpdated = processPacketData(Number, polyline, 'outlineWidth', polylineData.outlineWidth, interval, sourceUri) || polylineUpdated;
- polylineUpdated = processPacketData(Boolean, polyline, 'show', polylineData.show, interval, sourceUri) || polylineUpdated;
- return polylineUpdated;
- };
-
/**
* Given two DynamicObjects, takes the polyline properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/DynamicPyramid.js b/Source/DynamicScene/DynamicPyramid.js
index 5bb003c28b7c..5b6f8570bdaa 100644
--- a/Source/DynamicScene/DynamicPyramid.js
+++ b/Source/DynamicScene/DynamicPyramid.js
@@ -4,14 +4,12 @@ define([
'../Core/defaultValue',
'../Core/defined',
'../Core/Color',
- './processPacketData',
'./DynamicDirectionsProperty'
], function(
TimeInterval,
defaultValue,
defined,
Color,
- processPacketData,
DynamicDirectionsProperty) {
"use strict";
@@ -75,59 +73,6 @@ define([
this.material = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's pyramid.
- * If the DynamicObject does not have a pyramid, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the pyramid data.
- * @param {Object} packet The CZML packet to process.
- * @param {DynamicObject} dynamicObjectCollection The DynamicObjectCollection to which the DynamicObject belongs.
- *
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicPyramid.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var pyramidData = packet.pyramid;
- if (!defined(pyramidData)) {
- return false;
- }
-
- var interval = pyramidData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var pyramid = dynamicObject.pyramid;
- var pyramidUpdated = !defined(pyramid);
- if (pyramidUpdated) {
- dynamicObject.pyramid = pyramid = new DynamicPyramid();
- }
-
- pyramidUpdated = processPacketData(Boolean, pyramid, 'show', pyramidData.show, interval, sourceUri) || pyramidUpdated;
- pyramidUpdated = processPacketData(Number, pyramid, 'radius', pyramidData.radius, interval, sourceUri) || pyramidUpdated;
- pyramidUpdated = processPacketData(Boolean, pyramid, 'showIntersection', pyramidData.showIntersection, interval, sourceUri) || pyramidUpdated;
- pyramidUpdated = processPacketData(Color, pyramid, 'intersectionColor', pyramidData.intersectionColor, interval, sourceUri) || pyramidUpdated;
- pyramidUpdated = processPacketData(Number, pyramid, 'intersectionWidth', pyramidData.intersectionWidth, interval, sourceUri) || pyramidUpdated;
- pyramidUpdated = processPacketData.material(pyramid, 'material', pyramidData.material, interval, sourceUri);
-
- if (defined(pyramidData.directions)) {
- var directions = pyramid.directions;
- if (!defined(directions)) {
- pyramid.directions = directions = new DynamicDirectionsProperty();
- pyramidUpdated = true;
- }
- directions.processCzmlIntervals(pyramidData.directions, interval);
- }
-
- return pyramidUpdated;
- };
-
/**
* Given two DynamicObjects, takes the pyramid properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/DynamicVector.js b/Source/DynamicScene/DynamicVector.js
index a70b4b4bd1a3..211bdc8897fd 100644
--- a/Source/DynamicScene/DynamicVector.js
+++ b/Source/DynamicScene/DynamicVector.js
@@ -4,15 +4,13 @@ define([
'../Core/defaultValue',
'../Core/defined',
'../Core/Cartesian3',
- '../Core/Color',
- './processPacketData'],
+ '../Core/Color'],
function(
TimeInterval,
defaultValue,
defined,
Cartesian3,
- Color,
- processPacketData) {
+ Color) {
"use strict";
/**
@@ -62,47 +60,6 @@ function(
this.length = undefined;
};
- /**
- * Processes a single CZML packet and merges its data into the provided DynamicObject's vector.
- * If the DynamicObject does not have a vector, one is created. This method is not
- * normally called directly, but is part of the array of CZML processing functions that is
- * passed into the DynamicObjectCollection constructor.
- *
- * @param {DynamicObject} dynamicObject The DynamicObject which will contain the vector data.
- * @param {Object} packet The CZML packet to process.
- * @returns {Boolean} true if any new properties were created while processing the packet, false otherwise.
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see CzmlDefaults#updaters
- */
- DynamicVector.processCzmlPacket = function(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
- var vectorData = packet.vector;
- if (!defined(vectorData)) {
- return false;
- }
-
- var interval = vectorData.interval;
- if (defined(interval)) {
- interval = TimeInterval.fromIso8601(interval);
- }
-
- var vector = dynamicObject.vector;
- var vectorUpdated = !defined(vector);
- if (vectorUpdated) {
- dynamicObject.vector = vector = new DynamicVector();
- }
-
- vectorUpdated = processPacketData(Color, vector, 'color', vectorData.color, interval, sourceUri) || vectorUpdated;
- vectorUpdated = processPacketData(Boolean, vector, 'show', vectorData.show, interval, sourceUri) || vectorUpdated;
- vectorUpdated = processPacketData(Number, vector, 'width', vectorData.width, interval, sourceUri) || vectorUpdated;
- vectorUpdated = processPacketData(Cartesian3, vector, 'direction', vectorData.direction, interval, sourceUri) || vectorUpdated;
- vectorUpdated = processPacketData(Number, vector, 'length', vectorData.length, interval, sourceUri) || vectorUpdated;
-
- return vectorUpdated;
- };
-
/**
* Given two DynamicObjects, takes the vector properties from the second
* and assigns them to the first, assuming such a property did not already exist.
diff --git a/Source/DynamicScene/processPacketData.js b/Source/DynamicScene/processPacketData.js
deleted file mode 100644
index 4d7c21b80cbf..000000000000
--- a/Source/DynamicScene/processPacketData.js
+++ /dev/null
@@ -1,555 +0,0 @@
-/*global define*/
-define([
- '../Core/Cartesian2',
- '../Core/Cartesian3',
- '../Core/Cartographic',
- '../Core/Color',
- '../Core/defaultValue',
- '../Core/defined',
- '../Core/DeveloperError',
- '../Core/Ellipsoid',
- '../Core/Math',
- '../Core/Quaternion',
- '../Core/ReferenceFrame',
- '../Core/Spherical',
- '../Core/HermitePolynomialApproximation',
- '../Core/LinearApproximation',
- '../Core/LagrangePolynomialApproximation',
- '../Scene/HorizontalOrigin',
- '../Scene/LabelStyle',
- '../Scene/VerticalOrigin',
- '../Core/TimeInterval',
- '../Core/Iso8601',
- '../Core/JulianDate',
- './CompositeProperty',
- './ConstantProperty',
- './SampledProperty',
- './TimeIntervalCollectionProperty',
- './CompositePositionProperty',
- './ConstantPositionProperty',
- './SampledPositionProperty',
- './TimeIntervalCollectionPositionProperty',
- './DynamicColorMaterial',
- './DynamicImageMaterial',
- './DynamicGridMaterial',
- '../ThirdParty/Uri'
- ], function(
- Cartesian2,
- Cartesian3,
- Cartographic,
- Color,
- defaultValue,
- defined,
- DeveloperError,
- Ellipsoid,
- CesiumMath,
- Quaternion,
- ReferenceFrame,
- Spherical,
- HermitePolynomialApproximation,
- LinearApproximation,
- LagrangePolynomialApproximation,
- HorizontalOrigin,
- LabelStyle,
- VerticalOrigin,
- TimeInterval,
- Iso8601,
- JulianDate,
- CompositeProperty,
- ConstantProperty,
- SampledProperty,
- TimeIntervalCollectionProperty,
- CompositePositionProperty,
- ConstantPositionProperty,
- SampledPositionProperty,
- TimeIntervalCollectionPositionProperty,
- DynamicColorMaterial,
- DynamicImageMaterial,
- DynamicGridMaterial,
- Uri) {
- "use strict";
-
- var scratchCartesian = new Cartesian3();
- var scratchSpherical = new Spherical();
- var scratchCartographic = new Cartographic();
-
- function unwrapColorInterval(czmlInterval) {
- var rgbaf = czmlInterval.rgbaf;
- if (defined(rgbaf)) {
- return rgbaf;
- }
-
- var rgba = czmlInterval.rgba;
- if (!defined(rgba)) {
- return undefined;
- }
-
- if (rgba.length === Color.length) {
- return [Color.byteToFloat(rgba[0]), Color.byteToFloat(rgba[1]), Color.byteToFloat(rgba[2]), Color.byteToFloat(rgba[3])];
- }
-
- var len = rgba.length;
- rgbaf = new Array(len);
- for ( var i = 0; i < len; i += 5) {
- rgbaf[i] = rgba[i];
- rgbaf[i + 1] = Color.byteToFloat(rgba[i + 1]);
- rgbaf[i + 2] = Color.byteToFloat(rgba[i + 2]);
- rgbaf[i + 3] = Color.byteToFloat(rgba[i + 3]);
- rgbaf[i + 4] = Color.byteToFloat(rgba[i + 4]);
- }
- return rgbaf;
- }
-
- function unwrapImageInterval(czmlInterval, sourceUri) {
- var result = defaultValue(czmlInterval.image, czmlInterval);
- if (defined(sourceUri)) {
- var baseUri = new Uri(document.location.href);
- sourceUri = new Uri(sourceUri);
- result = new Uri(result).resolve(sourceUri.resolve(baseUri)).toString();
- }
- return result;
- }
-
- function unwrapCartesianInterval(czmlInterval) {
- if (defined(czmlInterval.cartesian)) {
- return czmlInterval.cartesian;
- }
-
- if (defined(czmlInterval.unitCartesian)) {
- return czmlInterval.unitCartesian;
- }
-
- var i;
- var len;
- var result;
-
- var unitSpherical = czmlInterval.unitSpherical;
- if (defined(unitSpherical)) {
- len = unitSpherical.length;
- if (len === 2) {
- scratchSpherical.clock = unitSpherical[0];
- scratchSpherical.cone = unitSpherical[1];
- Cartesian3.fromSpherical(scratchSpherical, scratchCartesian);
- result = [scratchCartesian.x, scratchCartesian.y, scratchCartesian.z];
- } else {
- var sphericalIt = 0;
- result = new Array((len / 3) * 4);
- for (i = 0; i < len; i += 4) {
- result[i] = unitSpherical[sphericalIt++];
-
- scratchSpherical.clock = unitSpherical[sphericalIt++];
- scratchSpherical.cone = unitSpherical[sphericalIt++];
- Cartesian3.fromSpherical(scratchSpherical, scratchCartesian);
-
- result[i + 1] = scratchCartesian.x;
- result[i + 2] = scratchCartesian.y;
- result[i + 3] = scratchCartesian.z;
- }
- }
- return result;
- }
-
- var tmp = scratchCartesian;
- var cartographic = czmlInterval.cartographicRadians;
- if (defined(cartographic)) {
- if (cartographic.length > 3) {
- scratchCartographic.longitude = cartographic[0];
- scratchCartographic.latitude = cartographic[1];
- scratchCartographic.height = cartographic[2];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
- result = [tmp.x, tmp.y, tmp.z];
- } else {
- len = cartographic.length;
- result = new Array(len);
- for (i = 0; i < len; i += 4) {
- scratchCartographic.longitude = cartographic[i + 1];
- scratchCartographic.latitude = cartographic[i + 2];
- scratchCartographic.height = cartographic[i + 3];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
-
- result[i] = cartographic[i];
- result[i + 1] = tmp.x;
- result[i + 2] = tmp.y;
- result[i + 3] = tmp.z;
- }
- }
- } else {
- var cartographicDegrees = czmlInterval.cartographicDegrees;
- if (!defined(cartographicDegrees)) {
- return undefined;
- }
-
- if (cartographicDegrees.length > 3) {
- scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[0]);
- scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[1]);
- scratchCartographic.height = cartographicDegrees[2];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
- result = [tmp.x, tmp.y, tmp.z];
- } else {
- len = cartographicDegrees.length;
- result = new Array(len);
- for (i = 0; i < len; i += 4) {
- scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[i + 1]);
- scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[i + 2]);
- scratchCartographic.height = cartographicDegrees[i + 3];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
-
- result[i] = cartographicDegrees[i];
- result[i + 1] = tmp.x;
- result[i + 2] = tmp.y;
- result[i + 3] = tmp.z;
- }
- }
- }
- }
-
- function unwrapInterval(type, czmlInterval, sourceUri) {
- switch (type) {
- case Boolean:
- return defaultValue(czmlInterval.boolean, czmlInterval);
- case Cartesian2:
- return czmlInterval.cartesian2;
- case Cartesian3:
- return unwrapCartesianInterval(czmlInterval);
- case Color:
- return unwrapColorInterval(czmlInterval);
- case HorizontalOrigin:
- return HorizontalOrigin[defaultValue(czmlInterval.horizontalOrigin, czmlInterval)];
- case Image:
- return unwrapImageInterval(czmlInterval, sourceUri);
- case LabelStyle:
- return LabelStyle[defaultValue(czmlInterval.labelStyle, czmlInterval)];
- case Number:
- return defaultValue(czmlInterval.number, czmlInterval);
- case String:
- return defaultValue(czmlInterval.string, czmlInterval);
- case Quaternion:
- return czmlInterval.unitQuaternion;
- case VerticalOrigin:
- return VerticalOrigin[defaultValue(czmlInterval.verticalOrigin, czmlInterval)];
- default:
- throw new DeveloperError(type);
- }
- }
-
- function processProperty(type, object, propertyName, packetData, constrainedInterval, sourceUri) {
- var combinedInterval;
- var packetInterval = packetData.interval;
- if (defined(packetInterval)) {
- combinedInterval = TimeInterval.fromIso8601(packetInterval);
- if (defined(constrainedInterval)) {
- combinedInterval = combinedInterval.intersect(constrainedInterval);
- }
- } else if (defined(constrainedInterval)) {
- combinedInterval = constrainedInterval;
- }
-
- var unwrappedInterval = unwrapInterval(type, packetData, sourceUri);
- var hasInterval = defined(combinedInterval) && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
- var packedLength = defaultValue(type.packedLength, 1);
- var unwrappedIntervalLength = defaultValue(unwrappedInterval.length, 1);
- var isSampled = (typeof unwrappedInterval !== 'string') && unwrappedIntervalLength > packedLength;
-
- if (!isSampled && !hasInterval) {
- if (defined(type.unpack)) {
- object[propertyName] = new ConstantProperty(type.unpack(unwrappedInterval, 0));
- } else {
- object[propertyName] = new ConstantProperty(unwrappedInterval);
- }
- return true;
- }
-
- var propertyCreated = false;
- var property = object[propertyName];
- if (!isSampled && hasInterval) {
- combinedInterval = combinedInterval.clone();
- if (defined(type.unpack)) {
- combinedInterval.data = type.unpack(unwrappedInterval, 0);
- } else {
- combinedInterval.data = unwrappedInterval;
- }
-
- if (!defined(property)) {
- property = new TimeIntervalCollectionProperty();
- object[propertyName] = property;
- propertyCreated = true;
- }
-
- if (property instanceof TimeIntervalCollectionProperty) {
- property.intervals.addInterval(combinedInterval);
- } else {
- //TODO Morph to CompositeProperty
- }
- } else if (isSampled && !hasInterval) {
- if (!(property instanceof SampledProperty)) {
- property = new SampledProperty(type);
- object[propertyName] = property;
- propertyCreated = true;
- }
- property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
- } else if (isSampled && hasInterval) {
- if (!defined(property)) {
- property = new CompositeProperty();
- object[propertyName] = property;
- propertyCreated = true;
- }
- if (property instanceof CompositeProperty) {
- var intervals = property.intervals;
- var interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
- var intervalData;
- if (defined(interval)) {
- intervalData = interval.data;
- } else {
- interval = combinedInterval.clone();
- intervalData = new SampledProperty(type);
- interval.data = intervalData;
- intervals.addInterval(interval);
- }
- if (!(intervalData instanceof SampledProperty)) {
- intervalData = new SampledProperty(type);
- interval.Data = intervalData;
- }
- intervalData.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
- } else {
- //TODO Morph to CompositeProperty
- }
- }
- return propertyCreated;
- }
-
- function processPacketData(type, object, propertyName, packetData, interval, sourceUri) {
- if (!defined(packetData)) {
- return false;
- }
-
- var updated = false;
- if (Array.isArray(packetData)) {
- for ( var i = 0, len = packetData.length; i < len; i++) {
- updated = processProperty(type, object, propertyName, packetData[i], interval, sourceUri) || updated;
- }
- } else {
- updated = processProperty(type, object, propertyName, packetData, interval, sourceUri) || updated;
- }
- return updated;
- }
-
- var interpolators = {
- HERMITE : HermitePolynomialApproximation,
- LAGRANGE : LagrangePolynomialApproximation,
- LINEAR : LinearApproximation
- };
-
- function updateInterpolationSettings(packetData, property) {
- var interpolator = interpolators[packetData.interpolationAlgorithm];
- if (defined(interpolator)) {
- property.interpolationAlgorithm = interpolator;
- }
- if (defined(packetData.interpolationDegree)) {
- property.interpolationDegree = packetData.interpolationDegree;
- }
-
- }
-
- function processPositionProperty(object, propertyName, packetData, constrainedInterval, sourceUri) {
- var combinedInterval;
- var packetInterval = packetData.interval;
- if (defined(packetInterval)) {
- combinedInterval = TimeInterval.fromIso8601(packetInterval);
- if (defined(constrainedInterval)) {
- combinedInterval = combinedInterval.intersect(constrainedInterval);
- }
- } else if (defined(constrainedInterval)) {
- combinedInterval = constrainedInterval;
- }
-
- var referenceFrame = ReferenceFrame[defaultValue(packetData.referenceFrame, "FIXED")];
- var unwrappedInterval = unwrapCartesianInterval(packetData);
- var hasInterval = defined(combinedInterval) && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
- var isSampled = unwrappedInterval.length > Cartesian3.packedLength;
-
- if (!isSampled && !hasInterval) {
- object[propertyName] = new ConstantPositionProperty(Cartesian3.unpack(unwrappedInterval, 0), referenceFrame);
- return true;
- }
-
- var propertyCreated = false;
- var property = object[propertyName];
- if (!isSampled && hasInterval) {
- combinedInterval = combinedInterval.clone();
- combinedInterval.data = Cartesian3.unpack(unwrappedInterval, 0);
-
- if (!defined(property)) {
- property = new TimeIntervalCollectionPositionProperty(referenceFrame);
- object[propertyName] = property;
- propertyCreated = true;
- }
- if (property instanceof TimeIntervalCollectionPositionProperty) {
- property.intervals.addInterval(combinedInterval);
- updateInterpolationSettings(packetData, property);
- } else {
- //TODO Morph to CompositePositionProperty
- }
- } else if (isSampled && !hasInterval) {
- if (!(property instanceof SampledPositionProperty)) {
- property = new SampledPositionProperty(referenceFrame);
- object[propertyName] = property;
- propertyCreated = true;
- }
- property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
- updateInterpolationSettings(packetData, property);
- } else if (isSampled && hasInterval) {
- if (!defined(property)) {
- property = new CompositePositionProperty(referenceFrame);
- object[propertyName] = property;
- propertyCreated = true;
- }
- if (property instanceof CompositePositionProperty) {
- var intervals = property.intervals;
- var interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
- var intervalData;
- if (defined(interval)) {
- intervalData = interval.data;
- } else {
- interval = combinedInterval.clone();
- intervalData = new SampledPositionProperty(referenceFrame);
- interval.data = intervalData;
- intervals.addInterval(interval);
- }
- if (!(intervalData instanceof SampledPositionProperty)) {
- intervalData = new SampledPositionProperty(referenceFrame);
- interval.Data = intervalData;
- }
- intervalData.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
- updateInterpolationSettings(packetData, property);
- } else {
- //TODO Morph to CompositePositionProperty
- }
- }
- return propertyCreated;
- }
-
- function processPositionPacketData(object, propertyName, packetData, interval, sourceUri) {
- if (!defined(packetData)) {
- return false;
- }
-
- var updated = false;
- if (Array.isArray(packetData)) {
- for ( var i = 0, len = packetData.length; i < len; i++) {
- updated = processPositionProperty(object, propertyName, packetData[i], interval, sourceUri) || updated;
- }
- } else {
- updated = processPositionProperty(object, propertyName, packetData, interval, sourceUri) || updated;
- }
- return updated;
- }
- processPacketData.position = processPositionPacketData;
-
- function cloneIntoUniforms(material, uniforms) {
- if (!defined(uniforms)) {
- uniforms = {};
- }
- if (material instanceof DynamicColorMaterial) {
- //uniforms.color = material.color.getValue(time, uniforms.color);
- }
-
- if (material instanceof DynamicGridMaterial) {
- }
-
- if (material instanceof DynamicImageMaterial) {
- return material;
- }
-
- //TODO
- return material;
- //throw new RuntimeError('unknown material');
- }
-
- function processMaterialProperty(object, propertyName, packetData, constrainedInterval, sourceUri) {
- var combinedInterval;
- var packetInterval = packetData.interval;
- if (defined(packetInterval)) {
- combinedInterval = TimeInterval.fromIso8601(packetInterval);
- if (defined(constrainedInterval)) {
- combinedInterval = combinedInterval.intersect(constrainedInterval);
- }
- } else if (defined(constrainedInterval)) {
- combinedInterval = constrainedInterval;
- }
-
- combinedInterval = defaultValue(combinedInterval, Iso8601.MAXIMUM_INTERVAL);
-
- var propertyCreated = false;
- var property = object[propertyName];
- if (!defined(property)) {
- property = new TimeIntervalCollectionProperty(cloneIntoUniforms);
- object[propertyName] = property;
- propertyCreated = true;
- }
-
- //See if we already have data at that interval.
- var thisIntervals = property.intervals;
- var existingInterval = thisIntervals.findInterval(combinedInterval.start, combinedInterval.stop);
- var existingMaterial;
-
- if (defined(existingInterval)) {
- //We have an interval, but we need to make sure the
- //new data is the same type of material as the old data.
- existingMaterial = existingInterval.data;
- } else {
- //If not, create it.
- existingInterval = combinedInterval.clone();
- thisIntervals.addInterval(existingInterval);
- }
-
- var materialData;
- if (defined(packetData.solidColor)) {
- if (!(existingMaterial instanceof DynamicColorMaterial)) {
- existingMaterial = new DynamicColorMaterial();
- }
- materialData = packetData.solidColor;
- processPacketData(Color, existingMaterial, 'color', materialData.color);
- } else if (defined(packetData.grid)) {
- if (!(existingMaterial instanceof DynamicGridMaterial)) {
- existingMaterial = new DynamicGridMaterial();
- }
- materialData = packetData.grid;
- processPacketData(Color, existingMaterial, 'color', materialData.color, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'cellAlpha', materialData.cellAlpha, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'rowCount', materialData.rowCount, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'columnCount', materialData.columnCount, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'rowThickness', materialData.rowThickness, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'columnThickness', materialData.columnThickness, undefined, sourceUri);
- } else if (defined(packetData.image)) {
- if (!(existingMaterial instanceof DynamicImageMaterial)) {
- existingMaterial = new DynamicImageMaterial();
- }
- materialData = packetData.image;
- processPacketData(Image, existingMaterial, 'image', materialData.image, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'verticalRepeat', materialData.verticalRepeat, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'horizontalRepeat', materialData.horizontalRepeat, undefined, sourceUri);
- }
- existingInterval.data = existingMaterial;
-
- return propertyCreated;
- }
-
- function processMaterialPacketData(object, propertyName, packetData, interval, sourceUri){
- if (!defined(packetData)) {
- return false;
- }
-
- var updated = false;
- if (Array.isArray(packetData)) {
- for ( var i = 0, len = packetData.length; i < len; i++) {
- updated = processMaterialProperty(object, propertyName, packetData[i], interval, sourceUri) || updated;
- }
- } else {
- updated = processMaterialProperty(object, propertyName, packetData, interval, sourceUri) || updated;
- }
- return updated;
- }
- processPacketData.material = processMaterialPacketData;
-
- return processPacketData;
-});
From 39727d331eb85bdb01aa0d2e93b3daa83e0b8673 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 20 Aug 2013 12:04:25 -0400
Subject: [PATCH 34/65] Put back file I accidentally deleted.
---
Source/DynamicScene/CzmlDataSource.js | 18 +-
Specs/DynamicScene/CzmlDataSourceSpec.js | 274 +++++++++++++++++++++++
2 files changed, 282 insertions(+), 10 deletions(-)
create mode 100644 Specs/DynamicScene/CzmlDataSourceSpec.js
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index 9850650a29e9..a6721bdbcdf9 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -487,7 +487,6 @@ define([
}
return updated;
}
- processPacketData.position = processPositionPacketData;
function cloneIntoUniforms(material, uniforms) {
if (!defined(uniforms)) {
@@ -593,14 +592,13 @@ define([
}
return updated;
}
- processPacketData.material = processMaterialPacketData;
function DynamicObjectprocessCzmlPacketPosition(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var positionData = packet.position;
if (!defined(positionData)) {
return false;
}
- return processPacketData.position(dynamicObject, 'position', positionData, undefined, sourceUri);
+ return processPositionPacketData(dynamicObject, 'position', positionData, undefined, sourceUri);
}
function DynamicObjectprocessCzmlPacketViewFrom(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
@@ -743,10 +741,10 @@ define([
coneUpdated = processPacketData(Number, cone, 'outerHalfAngle', coneData.outerHalfAngle, interval, sourceUri) || coneUpdated;
coneUpdated = processPacketData(Number, cone, 'minimumClockAngle', coneData.minimumClockAngle, interval, sourceUri) || coneUpdated;
coneUpdated = processPacketData(Number, cone, 'maximumClockAngle', coneData.maximumClockAngle, interval, sourceUri) || coneUpdated;
- coneUpdated = processPacketData.material(cone, 'capMaterial', coneData.capMaterial, interval, sourceUri);
- coneUpdated = processPacketData.material(cone, 'innerMaterial', coneData.innerMaterial, interval, sourceUri);
- coneUpdated = processPacketData.material(cone, 'outerMaterial', coneData.outerMaterial, interval, sourceUri);
- coneUpdated = processPacketData.material(cone, 'silhouetteMaterial', coneData.silhouetteMaterial, interval, sourceUri);
+ coneUpdated = processMaterialPacketData(cone, 'capMaterial', coneData.capMaterial, interval, sourceUri);
+ coneUpdated = processMaterialPacketData(cone, 'innerMaterial', coneData.innerMaterial, interval, sourceUri);
+ coneUpdated = processMaterialPacketData(cone, 'outerMaterial', coneData.outerMaterial, interval, sourceUri);
+ coneUpdated = processMaterialPacketData(cone, 'silhouetteMaterial', coneData.silhouetteMaterial, interval, sourceUri);
return coneUpdated;
}
@@ -793,7 +791,7 @@ define([
ellipsoidUpdated = processPacketData(Boolean, ellipsoid, 'show', ellipsoidData.show, interval, sourceUri) || ellipsoidUpdated;
ellipsoidUpdated = processPacketData(Cartesian3, ellipsoid, 'radii', ellipsoidData.radii, interval, sourceUri) || ellipsoidUpdated;
- ellipsoidUpdated = processPacketData.material(ellipsoid, 'material', ellipsoidData.material, interval, sourceUri);
+ ellipsoidUpdated = processMaterialPacketData(ellipsoid, 'material', ellipsoidData.material, interval, sourceUri);
return ellipsoidUpdated;
}
@@ -902,7 +900,7 @@ define([
}
polygonUpdated = processPacketData(Boolean, polygon, 'show', polygonData.show, interval, sourceUri) || polygonUpdated;
- polygonUpdated = processPacketData.material(polygon, 'material', polygonData.material, interval, sourceUri);
+ polygonUpdated = processMaterialPacketData(polygon, 'material', polygonData.material, interval, sourceUri);
return polygonUpdated;
}
@@ -953,7 +951,7 @@ define([
pyramidUpdated = processPacketData(Boolean, pyramid, 'showIntersection', pyramidData.showIntersection, interval, sourceUri) || pyramidUpdated;
pyramidUpdated = processPacketData(Color, pyramid, 'intersectionColor', pyramidData.intersectionColor, interval, sourceUri) || pyramidUpdated;
pyramidUpdated = processPacketData(Number, pyramid, 'intersectionWidth', pyramidData.intersectionWidth, interval, sourceUri) || pyramidUpdated;
- pyramidUpdated = processPacketData.material(pyramid, 'material', pyramidData.material, interval, sourceUri);
+ pyramidUpdated = processMaterialPacketData(pyramid, 'material', pyramidData.material, interval, sourceUri);
if (defined(pyramidData.directions)) {
var directions = pyramid.directions;
diff --git a/Specs/DynamicScene/CzmlDataSourceSpec.js b/Specs/DynamicScene/CzmlDataSourceSpec.js
new file mode 100644
index 000000000000..6198ec74c637
--- /dev/null
+++ b/Specs/DynamicScene/CzmlDataSourceSpec.js
@@ -0,0 +1,274 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/CzmlDataSource',
+ 'DynamicScene/DynamicObjectCollection',
+ 'Core/ClockRange',
+ 'Core/ClockStep',
+ 'Core/defined',
+ 'Core/Event',
+ 'Core/loadJson',
+ 'Core/JulianDate',
+ 'Core/TimeInterval',
+ 'ThirdParty/when'
+ ], function(
+ CzmlDataSource,
+ DynamicObjectCollection,
+ ClockRange,
+ ClockStep,
+ defined,
+ Event,
+ loadJson,
+ JulianDate,
+ TimeInterval,
+ when) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ var staticCzml = {
+ 'id' : 'test',
+ 'billboard' : {
+ 'show' : true
+ }
+ };
+
+ var dynamicCzml = {
+ id : 'test',
+ availability : '2000-01-01/2001-01-01',
+ billboard : {
+ show : true
+ }
+ };
+
+ var clockCzml = {
+ id : 'document',
+ clock : {
+ interval : '2012-03-15T10:00:00Z/2012-03-16T10:00:00Z',
+ currentTime : '2012-03-15T10:00:00Z',
+ multiplier : 60.0,
+ range : 'LOOP_STOP',
+ step : 'SYSTEM_CLOCK_MULTIPLIER'
+ }
+ };
+
+ var simple;
+ var simpleUrl = 'Data/CZML/simple.czml';
+ var vehicle;
+ var vehicleUrl = 'Data/CZML/Vehicle.czml';
+
+ beforeAll(function() {
+ loadJson(simpleUrl).then(function(result) {
+ simple = result;
+ });
+ loadJson(vehicleUrl).then(function(result) {
+ vehicle = result;
+ });
+ });
+
+ var parsedClock = {
+ interval : TimeInterval.fromIso8601(clockCzml.clock.interval),
+ currentTime : JulianDate.fromIso8601(clockCzml.clock.currentTime),
+ multiplier : clockCzml.clock.multiplier,
+ range : ClockRange[clockCzml.clock.range],
+ step : ClockStep[clockCzml.clock.step]
+ };
+
+ it('default constructor has expected values', function() {
+ var dataSource = new CzmlDataSource();
+ expect(dataSource.getChangedEvent()).toBeInstanceOf(Event);
+ expect(dataSource.getErrorEvent()).toBeInstanceOf(Event);
+ expect(dataSource.getClock()).toBeUndefined();
+ expect(dataSource.getDynamicObjectCollection()).toBeInstanceOf(DynamicObjectCollection);
+ expect(dataSource.getDynamicObjectCollection().getObjects().length).toEqual(0);
+ expect(dataSource.getIsTimeVarying()).toEqual(true);
+ });
+
+ it('getClock returns undefined for static CZML', function() {
+ var dataSource = new CzmlDataSource();
+ dataSource.load(staticCzml);
+ expect(dataSource.getClock()).toBeUndefined();
+ });
+
+ it('getClock returns CZML defined clock', function() {
+ var dataSource = new CzmlDataSource();
+ dataSource.load(clockCzml);
+ var clock = dataSource.getClock();
+ expect(clock).toBeDefined();
+ expect(clock.startTime).toEqual(parsedClock.interval.start);
+ expect(clock.stopTime).toEqual(parsedClock.interval.stop);
+ expect(clock.currentTime).toEqual(parsedClock.currentTime);
+ expect(clock.clockRange).toEqual(parsedClock.range);
+ expect(clock.clockStep).toEqual(parsedClock.step);
+ expect(clock.multiplier).toEqual(parsedClock.multiplier);
+ });
+
+ it('getClock returns data interval if no clock defined', function() {
+ var interval = TimeInterval.fromIso8601(dynamicCzml.availability);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(dynamicCzml);
+ var clock = dataSource.getClock();
+ expect(clock).toBeDefined();
+ expect(clock.startTime).toEqual(interval.start);
+ expect(clock.stopTime).toEqual(interval.stop);
+ expect(clock.currentTime).toEqual(interval.start);
+ expect(clock.clockRange).toEqual(ClockRange.LOOP_STOP);
+ expect(clock.clockStep).toEqual(ClockStep.SYSTEM_CLOCK_MULTIPLIER);
+ expect(clock.multiplier).toEqual(interval.start.getSecondsDifference(interval.stop) / 120.0);
+ });
+
+ it('processUrl loads expected data', function() {
+ var dataSource = new CzmlDataSource();
+ dataSource.processUrl(simpleUrl);
+ waitsFor(function() {
+ return dataSource.getDynamicObjectCollection().getObjects().length === 12;
+ });
+ });
+
+ it('processUrl loads data on top of existing', function() {
+ var dataSource = new CzmlDataSource();
+ dataSource.processUrl(simpleUrl);
+ waitsFor(function() {
+ return dataSource.getDynamicObjectCollection().getObjects().length === 12;
+ });
+
+ runs(function() {
+ dataSource.processUrl(vehicleUrl);
+ });
+
+ waitsFor(function() {
+ return dataSource.getDynamicObjectCollection().getObjects().length === 13;
+ });
+ });
+
+ it('loadUrl replaces data', function() {
+ var dataSource = new CzmlDataSource();
+ dataSource.processUrl(simpleUrl);
+ waitsFor(function() {
+ return dataSource.getDynamicObjectCollection().getObjects().length === 12;
+ });
+
+ runs(function() {
+ dataSource.loadUrl(vehicleUrl);
+ });
+
+ waitsFor(function() {
+ return dataSource.getDynamicObjectCollection().getObjects().length === 1;
+ });
+ });
+
+ it('process loads expected data', function() {
+ waitsFor(function() {
+ return defined(simple);
+ });
+
+ runs(function() {
+ var dataSource = new CzmlDataSource();
+ dataSource.process(simple, simpleUrl);
+ expect(dataSource.getDynamicObjectCollection().getObjects().length).toEqual(12);
+ });
+ });
+
+ it('process loads data on top of existing', function() {
+ waitsFor(function() {
+ return defined(simple) && defined(vehicle);
+ });
+
+ runs(function() {
+ var dataSource = new CzmlDataSource();
+ dataSource.process(simple, simpleUrl);
+ expect(dataSource.getDynamicObjectCollection().getObjects().length === 12);
+
+ dataSource.process(vehicle, vehicleUrl);
+ expect(dataSource.getDynamicObjectCollection().getObjects().length === 13);
+ });
+ });
+
+ it('load replaces data', function() {
+ waitsFor(function() {
+ return defined(simple) && defined(vehicle);
+ });
+
+ runs(function() {
+ var dataSource = new CzmlDataSource();
+ dataSource.process(simple, simpleUrl);
+ expect(dataSource.getDynamicObjectCollection().getObjects().length).toEqual(12);
+
+ dataSource.load(vehicle, vehicleUrl);
+ expect(dataSource.getDynamicObjectCollection().getObjects().length).toEqual(1);
+ });
+ });
+
+ it('process throws with undefined CZML', function() {
+ var dataSource = new CzmlDataSource();
+ expect(function() {
+ dataSource.process(undefined);
+ }).toThrow();
+ });
+
+ it('load throws with undefined CZML', function() {
+ var dataSource = new CzmlDataSource();
+ expect(function() {
+ dataSource.load(undefined);
+ }).toThrow();
+ });
+
+ it('processUrl throws with undefined Url', function() {
+ var dataSource = new CzmlDataSource();
+ expect(function() {
+ dataSource.processUrl(undefined);
+ }).toThrow();
+ });
+
+ it('loadUrl throws with undefined Url', function() {
+ var dataSource = new CzmlDataSource();
+ expect(function() {
+ dataSource.loadUrl(undefined);
+ }).toThrow();
+ });
+
+ it('raises error when an error occurs in loadUrl', function() {
+ var dataSource = new CzmlDataSource();
+
+ var spy = jasmine.createSpy('errorEvent');
+ dataSource.getErrorEvent().addEventListener(spy);
+
+ var promise = dataSource.loadUrl('Data/Images/Blue.png'); //not JSON
+
+ var resolveSpy = jasmine.createSpy('resolve');
+ var rejectSpy = jasmine.createSpy('reject');
+ when(promise, resolveSpy, rejectSpy);
+
+ waitsFor(function() {
+ return rejectSpy.wasCalled;
+ });
+
+ runs(function() {
+ expect(spy).toHaveBeenCalledWith(dataSource, jasmine.any(Error));
+ expect(rejectSpy).toHaveBeenCalledWith(jasmine.any(Error));
+ expect(resolveSpy).not.toHaveBeenCalled();
+ });
+ });
+
+ it('raises error when an error occurs in processUrl', function() {
+ var dataSource = new CzmlDataSource();
+
+ var spy = jasmine.createSpy('errorEvent');
+ dataSource.getErrorEvent().addEventListener(spy);
+
+ var promise = dataSource.processUrl('Data/Images/Blue.png'); //not JSON
+
+ var resolveSpy = jasmine.createSpy('resolve');
+ var rejectSpy = jasmine.createSpy('reject');
+ when(promise, resolveSpy, rejectSpy);
+
+ waitsFor(function() {
+ return rejectSpy.wasCalled;
+ });
+
+ runs(function() {
+ expect(spy).toHaveBeenCalledWith(dataSource, jasmine.any(Error));
+ expect(rejectSpy).toHaveBeenCalledWith(jasmine.any(Error));
+ expect(resolveSpy).not.toHaveBeenCalled();
+ });
+ });
+});
From 301977bb584880e8ed75c621c38e74e528bab92d Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 20 Aug 2013 15:07:58 -0400
Subject: [PATCH 35/65] Move all CZML specs into CzmlDataSourceSpec.js
---
Specs/DynamicScene/CzmlDataSourceSpec.js | 1005 ++++++++++++++++++++
Specs/DynamicScene/DynamicBillboardSpec.js | 90 --
Specs/DynamicScene/DynamicClockSpec.js | 148 +--
Specs/DynamicScene/DynamicConeSpec.js | 153 ---
Specs/DynamicScene/DynamicEllipseSpec.js | 50 -
Specs/DynamicScene/DynamicEllipsoidSpec.js | 69 --
Specs/DynamicScene/DynamicLabelSpec.js | 110 ---
Specs/DynamicScene/DynamicObjectSpec.js | 120 +--
Specs/DynamicScene/DynamicPathSpec.js | 83 --
Specs/DynamicScene/DynamicPointSpec.js | 69 --
Specs/DynamicScene/DynamicPolygonSpec.js | 58 --
Specs/DynamicScene/DynamicPolylineSpec.js | 69 --
Specs/DynamicScene/DynamicPyramidSpec.js | 95 --
Specs/DynamicScene/DynamicVectorSpec.js | 71 --
14 files changed, 1049 insertions(+), 1141 deletions(-)
diff --git a/Specs/DynamicScene/CzmlDataSourceSpec.js b/Specs/DynamicScene/CzmlDataSourceSpec.js
index 6198ec74c637..6228b1b2e97c 100644
--- a/Specs/DynamicScene/CzmlDataSourceSpec.js
+++ b/Specs/DynamicScene/CzmlDataSourceSpec.js
@@ -2,9 +2,20 @@
defineSuite([
'DynamicScene/CzmlDataSource',
'DynamicScene/DynamicObjectCollection',
+ 'Core/Cartesian2',
+ 'Core/Cartesian3',
'Core/ClockRange',
'Core/ClockStep',
+ 'Core/Color',
'Core/defined',
+ 'Core/Quaternion',
+ 'Core/Spherical',
+ 'DynamicScene/DynamicBillboard',
+ 'DynamicScene/DynamicObject',
+ 'Scene/HorizontalOrigin',
+ 'Core/Iso8601',
+ 'Scene/LabelStyle',
+ 'Scene/VerticalOrigin',
'Core/Event',
'Core/loadJson',
'Core/JulianDate',
@@ -13,9 +24,20 @@ defineSuite([
], function(
CzmlDataSource,
DynamicObjectCollection,
+ Cartesian2,
+ Cartesian3,
ClockRange,
ClockStep,
+ Color,
defined,
+ Quaternion,
+ Spherical,
+ DynamicBillboard,
+ DynamicObject,
+ HorizontalOrigin,
+ Iso8601,
+ LabelStyle,
+ VerticalOrigin,
Event,
loadJson,
JulianDate,
@@ -271,4 +293,987 @@ defineSuite([
expect(resolveSpy).not.toHaveBeenCalled();
});
});
+
+ it('CZML adds data for infinite billboard.', function() {
+ var sourceUri = 'http://someImage.invalid/';
+ var billboardPacket = {
+ billboard : {
+ image : 'image.png',
+ scale : 1.0,
+ horizontalOrigin : 'CENTER',
+ verticalOrigin : 'CENTER',
+ color : {
+ rgbaf : [1.0, 1.0, 1.0, 1.0]
+ },
+ eyeOffset : {
+ cartesian : [3.0, 4.0, 5.0]
+ },
+ pixelOffset : {
+ cartesian2 : [1.0, 2.0]
+ },
+ show : true
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(billboardPacket, sourceUri);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.billboard).toBeDefined();
+ expect(dynamicObject.billboard.image.getValue(Iso8601.MINIMUM_VALUE)).toEqual(sourceUri + 'image.png');
+ expect(dynamicObject.billboard.scale.getValue(Iso8601.MINIMUM_VALUE)).toEqual(billboardPacket.billboard.scale);
+ expect(dynamicObject.billboard.horizontalOrigin.getValue(Iso8601.MINIMUM_VALUE)).toEqual(HorizontalOrigin.CENTER);
+ expect(dynamicObject.billboard.verticalOrigin.getValue(Iso8601.MINIMUM_VALUE)).toEqual(VerticalOrigin.CENTER);
+ expect(dynamicObject.billboard.color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(1.0, 1.0, 1.0, 1.0));
+ expect(dynamicObject.billboard.eyeOffset.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian3(3.0, 4.0, 5.0));
+ expect(dynamicObject.billboard.pixelOffset.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian2(1.0, 2.0));
+ expect(dynamicObject.billboard.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
+ });
+
+ it('CZML adds data for constrained billboard.', function() {
+ var billboardPacket = {
+ billboard : {
+ interval : '2000-01-01/2001-01-01',
+ image : 'http://someImage.invalid/image',
+ scale : 1.0,
+ horizontalOrigin : 'CENTER',
+ verticalOrigin : 'CENTER',
+ color : {
+ rgbaf : [1.0, 1.0, 1.0, 1.0]
+ },
+ eyeOffset : {
+ cartesian : [3.0, 4.0, 5.0]
+ },
+ pixelOffset : {
+ cartesian2 : [1.0, 2.0]
+ },
+ show : true
+ }
+ };
+
+ var validTime = TimeInterval.fromIso8601(billboardPacket.billboard.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(billboardPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.billboard).toBeDefined();
+ expect(dynamicObject.billboard.image.getValue(validTime)).toEqual(billboardPacket.billboard.image);
+ expect(dynamicObject.billboard.scale.getValue(validTime)).toEqual(billboardPacket.billboard.scale);
+ expect(dynamicObject.billboard.horizontalOrigin.getValue(validTime)).toEqual(HorizontalOrigin.CENTER);
+ expect(dynamicObject.billboard.verticalOrigin.getValue(validTime)).toEqual(VerticalOrigin.CENTER);
+ expect(dynamicObject.billboard.color.getValue(validTime)).toEqual(new Color(1.0, 1.0, 1.0, 1.0));
+ expect(dynamicObject.billboard.eyeOffset.getValue(validTime)).toEqual(new Cartesian3(3.0, 4.0, 5.0));
+ expect(dynamicObject.billboard.pixelOffset.getValue(validTime)).toEqual(new Cartesian2(1.0, 2.0));
+ expect(dynamicObject.billboard.show.getValue(validTime)).toEqual(true);
+
+ expect(dynamicObject.billboard).toBeDefined();
+ expect(dynamicObject.billboard.image.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.billboard.scale.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.billboard.horizontalOrigin.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.billboard.verticalOrigin.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.billboard.color.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.billboard.eyeOffset.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.billboard.pixelOffset.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.billboard.show.getValue(invalidTime)).toBeUndefined();
+ });
+
+ it('CZML adds clock data.', function() {
+ var clockPacket = {
+ id : 'document',
+ clock : {
+ interval : '2012-03-15T10:00:00Z/2012-03-16T10:00:00Z',
+ currentTime : '2012-03-15T10:00:00Z',
+ multiplier : 60.0,
+ range : 'LOOP_STOP',
+ step : 'SYSTEM_CLOCK_MULTIPLIER'
+ }
+ };
+
+ var interval = TimeInterval.fromIso8601(clockPacket.clock.interval);
+ var currentTime = JulianDate.fromIso8601(clockPacket.clock.currentTime);
+ var multiplier = clockPacket.clock.multiplier;
+ var range = ClockRange[clockPacket.clock.range];
+ var step = ClockStep[clockPacket.clock.step];
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(clockPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.clock).toBeDefined();
+ expect(dynamicObject.clock.startTime).toEqual(interval.start);
+ expect(dynamicObject.clock.stopTime).toEqual(interval.stop);
+ expect(dynamicObject.clock.currentTime).toEqual(currentTime);
+ expect(dynamicObject.clock.clockRange).toEqual(range);
+ expect(dynamicObject.clock.clockStep).toEqual(step);
+ expect(dynamicObject.clock.multiplier).toEqual(multiplier);
+ });
+
+ it('CZML only adds clock data on the document object.', function() {
+ var clockPacket = {
+ id : 'notTheDocument',
+ clock : {
+ interval : "2012-03-15T10:00:00Z/2012-03-16T10:00:00Z",
+ currentTime : "2012-03-15T10:00:00Z",
+ multiplier : 60.0,
+ range : "LOOP_STOP",
+ step : "SYSTEM_CLOCK_MULTIPLIER"
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(clockPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+ expect(dynamicObject.clock).toBeUndefined();
+ });
+
+
+ it('CZML adds data for infinite cone.', function() {
+ var conePacket = {
+ cone : {
+ innerHalfAngle : 1.0,
+ outerHalfAngle : 1.1,
+ minimumClockAngle : 1.2,
+ maximumClockAngle : 1.3,
+ radius : 2.0,
+ show : true,
+ showIntersection : false,
+ intersectionWidth : 6.0,
+ capMaterial : {
+ solidColor : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ }
+ }
+ },
+ innerMaterial : {
+ solidColor : {
+ color : {
+ rgbaf : [0.2, 0.2, 0.2, 0.2]
+ }
+ }
+ },
+ outerMaterial : {
+ solidColor : {
+ color : {
+ rgbaf : [0.3, 0.3, 0.3, 0.3]
+ }
+ }
+ },
+ silhouetteMaterial : {
+ solidColor : {
+ color : {
+ rgbaf : [0.4, 0.4, 0.4, 0.4]
+ }
+ }
+ },
+ intersectionColor : {
+ rgbaf : [0.5, 0.5, 0.5, 0.5]
+ }
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(conePacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.cone).toBeDefined();
+ expect(dynamicObject.cone.innerHalfAngle.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.innerHalfAngle);
+ expect(dynamicObject.cone.outerHalfAngle.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.outerHalfAngle);
+ expect(dynamicObject.cone.minimumClockAngle.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.minimumClockAngle);
+ expect(dynamicObject.cone.maximumClockAngle.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.maximumClockAngle);
+ expect(dynamicObject.cone.radius.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.radius);
+ expect(dynamicObject.cone.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.show);
+ expect(dynamicObject.cone.showIntersection.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.showIntersection);
+ expect(dynamicObject.cone.capMaterial.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.cone.innerMaterial.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.cone.outerMaterial.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
+ expect(dynamicObject.cone.silhouetteMaterial.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
+ expect(dynamicObject.cone.intersectionColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
+ expect(dynamicObject.cone.intersectionWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.intersectionWidth);
+ });
+
+ it('CZML adds data for constrained cone.', function() {
+ var conePacket = {
+ cone : {
+ interval : '2000-01-01/2001-01-01',
+ innerHalfAngle : 1.0,
+ outerHalfAngle : 1.1,
+ minimumClockAngle : 1.2,
+ maximumClockAngle : 1.3,
+ radius : 2.0,
+ show : true,
+ showIntersection : false,
+ intersectionWidth : 4.0,
+ capMaterial : {
+ solidColor : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ }
+ }
+ },
+ innerMaterial : {
+ solidColor : {
+ color : {
+ rgbaf : [0.2, 0.2, 0.2, 0.2]
+ }
+ }
+ },
+ outerMaterial : {
+ solidColor : {
+ color : {
+ rgbaf : [0.3, 0.3, 0.3, 0.3]
+ }
+ }
+ },
+ silhouetteMaterial : {
+ solidColor : {
+ color : {
+ rgbaf : [0.4, 0.4, 0.4, 0.4]
+ }
+ }
+ },
+ intersectionColor : {
+ rgbaf : [0.5, 0.5, 0.5, 0.5]
+ }
+ }
+ };
+
+ var validTime = TimeInterval.fromIso8601(conePacket.cone.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(conePacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.cone).toBeDefined();
+ expect(dynamicObject.cone.innerHalfAngle.getValue(validTime)).toEqual(conePacket.cone.innerHalfAngle);
+ expect(dynamicObject.cone.outerHalfAngle.getValue(validTime)).toEqual(conePacket.cone.outerHalfAngle);
+ expect(dynamicObject.cone.minimumClockAngle.getValue(validTime)).toEqual(conePacket.cone.minimumClockAngle);
+ expect(dynamicObject.cone.maximumClockAngle.getValue(validTime)).toEqual(conePacket.cone.maximumClockAngle);
+ expect(dynamicObject.cone.radius.getValue(validTime)).toEqual(conePacket.cone.radius);
+ expect(dynamicObject.cone.show.getValue(validTime)).toEqual(conePacket.cone.show);
+ expect(dynamicObject.cone.showIntersection.getValue(validTime)).toEqual(conePacket.cone.showIntersection);
+ expect(dynamicObject.cone.capMaterial.getValue(validTime).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.cone.innerMaterial.getValue(validTime).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.cone.outerMaterial.getValue(validTime).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
+ expect(dynamicObject.cone.silhouetteMaterial.getValue(validTime).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
+ expect(dynamicObject.cone.intersectionColor.getValue(validTime)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
+ expect(dynamicObject.cone.intersectionWidth.getValue(validTime)).toEqual(conePacket.cone.intersectionWidth);
+
+ expect(dynamicObject.cone.innerHalfAngle.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.outerHalfAngle.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.minimumClockAngle.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.maximumClockAngle.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.radius.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.show.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.showIntersection.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.capMaterial.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.innerMaterial.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.outerMaterial.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.silhouetteMaterial.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.intersectionColor.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.cone.intersectionWidth.getValue(invalidTime)).toBeUndefined();
+ });
+
+ it('CZML adds data for infinite ellipse.', function() {
+ var ellipsePacket = {
+ ellipse : {
+ semiMajorAxis : 10,
+ semiMinorAxis : 20,
+ bearing : 1.0
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(ellipsePacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.ellipse).toBeDefined();
+ expect(dynamicObject.ellipse.semiMajorAxis.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ellipsePacket.ellipse.semiMajorAxis);
+ expect(dynamicObject.ellipse.semiMinorAxis.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ellipsePacket.ellipse.semiMinorAxis);
+ expect(dynamicObject.ellipse.bearing.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ellipsePacket.ellipse.bearing);
+ });
+
+ it('CZML adds data for constrained ellipse.', function() {
+ var ellipsePacketInterval = {
+ ellipse : {
+ interval : '2000-01-01/2001-01-01',
+ semiMajorAxis : 10,
+ semiMinorAxis : 20,
+ bearing : 1.0
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(ellipsePacketInterval);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ var validTime = TimeInterval.fromIso8601(ellipsePacketInterval.ellipse.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ expect(dynamicObject.ellipse).toBeDefined();
+ expect(dynamicObject.ellipse.semiMajorAxis.getValue(validTime)).toEqual(ellipsePacketInterval.ellipse.semiMajorAxis);
+ expect(dynamicObject.ellipse.semiMinorAxis.getValue(validTime)).toEqual(ellipsePacketInterval.ellipse.semiMinorAxis);
+ expect(dynamicObject.ellipse.bearing.getValue(validTime)).toEqual(ellipsePacketInterval.ellipse.bearing);
+
+ expect(dynamicObject.ellipse.semiMajorAxis.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.ellipse.semiMinorAxis.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.ellipse.bearing.getValue(invalidTime)).toBeUndefined();
+ });
+
+ it('CZML adds data for infinite ellipsoid.', function() {
+ var expectedRadii = new Cartesian3(1.0, 2.0, 3.0);
+
+ var ellipsoidPacket = {
+ ellipsoid : {
+ radii : {
+ cartesian : [1.0, 2.0, 3.0]
+ },
+ show : true,
+ material : {
+ solidColor : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ }
+ }
+ }
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(ellipsoidPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.ellipsoid).toBeDefined();
+ expect(dynamicObject.ellipsoid.radii.getValue(Iso8601.MINIMUM_VALUE)).toEqual(expectedRadii);
+ expect(dynamicObject.ellipsoid.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ellipsoidPacket.ellipsoid.show);
+ expect(dynamicObject.ellipsoid.material.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ });
+
+ it('CZML adds data for constrained ellipsoid.', function() {
+ var expectedRadii = new Cartesian3(1.0, 2.0, 3.0);
+
+ var ellipsoidPacketInterval = {
+ ellipsoid : {
+ interval : '2000-01-01/2001-01-01',
+ radii : {
+ cartesian : [1.0, 2.0, 3.0]
+ },
+ show : true,
+ material : {
+ solidColor : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ }
+ }
+ }
+ }
+ };
+
+ var validTime = TimeInterval.fromIso8601(ellipsoidPacketInterval.ellipsoid.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(ellipsoidPacketInterval);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.ellipsoid).toBeDefined();
+ expect(dynamicObject.ellipsoid.radii.getValue(validTime)).toEqual(expectedRadii);
+ expect(dynamicObject.ellipsoid.show.getValue(validTime)).toEqual(ellipsoidPacketInterval.ellipsoid.show);
+ expect(dynamicObject.ellipsoid.material.getValue(validTime).color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+
+ expect(dynamicObject.ellipsoid.radii.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.ellipsoid.show.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.ellipsoid.material.getValue(invalidTime)).toBeUndefined();
+ });
+
+ it('CZML adds data for infinite label.', function() {
+ var labelPacket = {
+ label : {
+ text : 'TestFacility',
+ font : '10pt "Open Sans"',
+ style : 'FILL',
+ fillColor : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ },
+ outlineColor : {
+ rgbaf : [0.2, 0.2, 0.2, 0.2]
+ },
+ outlineWidth : 3.14,
+ horizontalOrigin : 'LEFT',
+ verticalOrigin : 'CENTER',
+ eyeOffset : {
+ cartesian : [1.0, 2.0, 3.0]
+ },
+ pixelOffset : {
+ cartesian2 : [4.0, 5.0]
+ },
+ scale : 1.0,
+ show : true
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(labelPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.label).toBeDefined();
+ expect(dynamicObject.label.text.getValue(Iso8601.MINIMUM_VALUE)).toEqual(labelPacket.label.text);
+ expect(dynamicObject.label.font.getValue(Iso8601.MINIMUM_VALUE)).toEqual(labelPacket.label.font);
+ expect(dynamicObject.label.style.getValue(Iso8601.MINIMUM_VALUE)).toEqual(LabelStyle.FILL);
+ expect(dynamicObject.label.fillColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.label.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.label.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(labelPacket.label.outlineWidth);
+ expect(dynamicObject.label.horizontalOrigin.getValue(Iso8601.MINIMUM_VALUE)).toEqual(HorizontalOrigin.LEFT);
+ expect(dynamicObject.label.verticalOrigin.getValue(Iso8601.MINIMUM_VALUE)).toEqual(VerticalOrigin.CENTER);
+ expect(dynamicObject.label.eyeOffset.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian3(1.0, 2.0, 3.0));
+ expect(dynamicObject.label.pixelOffset.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian2(4.0, 5.0));
+ expect(dynamicObject.label.scale.getValue(Iso8601.MINIMUM_VALUE)).toEqual(labelPacket.label.scale);
+ expect(dynamicObject.label.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(labelPacket.label.show);
+ });
+
+ it('CZML adds data for constrained label.', function() {
+ var labelPacket = {
+ label : {
+ interval : '2000-01-01/2001-01-01',
+ text : 'TestFacility',
+ font : '10pt "Open Sans"',
+ style : 'FILL',
+ fillColor : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ },
+ outlineColor : {
+ rgbaf : [0.2, 0.2, 0.2, 0.2]
+ },
+ outlineWidth : 2.78,
+ horizontalOrigin : 'LEFT',
+ verticalOrigin : 'CENTER',
+ eyeOffset : {
+ cartesian : [1.0, 2.0, 3.0]
+ },
+ pixelOffset : {
+ cartesian2 : [4.0, 5.0]
+ },
+ scale : 1.0,
+ show : true
+ }
+ };
+
+ var validTime = TimeInterval.fromIso8601(labelPacket.label.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(labelPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.label).toBeDefined();
+ expect(dynamicObject.label.text.getValue(validTime)).toEqual(labelPacket.label.text);
+ expect(dynamicObject.label.font.getValue(validTime)).toEqual(labelPacket.label.font);
+ expect(dynamicObject.label.style.getValue(validTime)).toEqual(LabelStyle.FILL);
+ expect(dynamicObject.label.fillColor.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.label.outlineColor.getValue(validTime)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.label.outlineWidth.getValue(validTime)).toEqual(labelPacket.label.outlineWidth);
+ expect(dynamicObject.label.horizontalOrigin.getValue(validTime)).toEqual(HorizontalOrigin.LEFT);
+ expect(dynamicObject.label.verticalOrigin.getValue(validTime)).toEqual(VerticalOrigin.CENTER);
+ expect(dynamicObject.label.eyeOffset.getValue(validTime)).toEqual(new Cartesian3(1.0, 2.0, 3.0));
+ expect(dynamicObject.label.pixelOffset.getValue(validTime)).toEqual(new Cartesian2(4.0, 5.0));
+ expect(dynamicObject.label.scale.getValue(validTime)).toEqual(labelPacket.label.scale);
+ expect(dynamicObject.label.show.getValue(validTime)).toEqual(labelPacket.label.show);
+
+ expect(dynamicObject.label.text.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.font.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.style.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.fillColor.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.outlineColor.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.outlineWidth.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.horizontalOrigin.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.verticalOrigin.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.eyeOffset.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.pixelOffset.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.scale.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.label.show.getValue(invalidTime)).toBeUndefined();
+ });
+
+
+ it('CZML Position works.', function() {
+ var packet = {
+ position : {
+ cartesian : [1.0, 2.0, 3.0]
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(packet);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+ expect(dynamicObject.position.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian3(1.0, 2.0, 3.0));
+ });
+
+ it('CZML Orientation works.', function() {
+ var packet = {
+ orientation : {
+ unitQuaternion : [0.0, 0.0, 0.0, 1.0]
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(packet);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+ expect(dynamicObject.orientation.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Quaternion(0.0, 0.0, 0.0, 1.0));
+ });
+
+ it('CZML VertexPositions works.', function() {
+ var packet = {
+ vertexPositions : {
+ cartesian : [1.0, 2.0, 3.0, 5.0, 6.0, 7.0]
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(packet);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+ expect(dynamicObject.vertexPositions.getValue(Iso8601.MINIMUM_VALUE)).toEqual([new Cartesian3(1.0, 2.0, 3.0), new Cartesian3(5.0, 6.0, 7.0)]);
+ });
+
+ it('CZML ViewFrom works.', function() {
+ var packet = {
+ viewFrom : {
+ cartesian : [1.0, 2.0, 3.0]
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(packet);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+ expect(dynamicObject.viewFrom.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian3(1.0, 2.0, 3.0));
+ });
+
+ it('CZML Availability works.', function() {
+ var packet = {
+ availability : '2000-01-01/2001-01-01'
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(packet);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ var interval = TimeInterval.fromIso8601(packet.availability);
+ expect(dynamicObject.availability).toEqual(interval);
+ });
+
+ it('CZML adds data for infinite path.', function() {
+ var pathPacket = {
+ path : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ },
+ width : 1.0,
+ resolution : 23.0,
+ outlineColor : {
+ rgbaf : [0.2, 0.2, 0.2, 0.2]
+ },
+ outlineWidth : 1.0,
+ leadTime : 2.0,
+ trailTime : 3.0,
+ show : true
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(pathPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.path).toBeDefined();
+ expect(dynamicObject.path.color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.path.width.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pathPacket.path.width);
+ expect(dynamicObject.path.resolution.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pathPacket.path.resolution);
+ expect(dynamicObject.path.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.path.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pathPacket.path.outlineWidth);
+ expect(dynamicObject.path.leadTime.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pathPacket.path.leadTime);
+ expect(dynamicObject.path.trailTime.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pathPacket.path.trailTime);
+ expect(dynamicObject.path.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
+ });
+
+ it('CZML adds data for constrained path.', function() {
+ var pathPacket = {
+ path : {
+ interval : '2000-01-01/2001-01-01',
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ },
+ width : 1.0,
+ resolution : 23.0,
+ outlineColor : {
+ rgbaf : [0.2, 0.2, 0.2, 0.2]
+ },
+ outlineWidth : 1.0,
+ leadTime : 2.0,
+ trailTime : 3.0,
+ show : true
+ }
+ };
+
+ var validTime = TimeInterval.fromIso8601(pathPacket.path.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(pathPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.path).toBeDefined();
+ expect(dynamicObject.path.color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.path.width.getValue(validTime)).toEqual(pathPacket.path.width);
+ expect(dynamicObject.path.resolution.getValue(validTime)).toEqual(pathPacket.path.resolution);
+ expect(dynamicObject.path.outlineColor.getValue(validTime)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.path.outlineWidth.getValue(validTime)).toEqual(pathPacket.path.outlineWidth);
+ expect(dynamicObject.path.leadTime.getValue(validTime)).toEqual(pathPacket.path.leadTime);
+ expect(dynamicObject.path.trailTime.getValue(validTime)).toEqual(pathPacket.path.trailTime);
+ expect(dynamicObject.path.show.getValue(validTime)).toEqual(true);
+
+ expect(dynamicObject.path.color.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.path.width.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.path.outlineColor.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.path.outlineWidth.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.path.leadTime.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.path.trailTime.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.path.show.getValue(invalidTime)).toBeUndefined();
+ });
+
+ it('CZML adds data for infinite point.', function() {
+ var pointPacket = {
+ point : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ },
+ pixelSize : 1.0,
+ outlineColor : {
+ rgbaf : [0.2, 0.2, 0.2, 0.2]
+ },
+ outlineWidth : 1.0,
+ show : true
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(pointPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.point).toBeDefined();
+ expect(dynamicObject.point.color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.point.pixelSize.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pointPacket.point.pixelSize);
+ expect(dynamicObject.point.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.point.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pointPacket.point.outlineWidth);
+ expect(dynamicObject.point.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
+ });
+
+ it('CZML adds data for constrained point.', function() {
+ var pointPacket = {
+ point : {
+ interval : '2000-01-01/2001-01-01',
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ },
+ pixelSize : 1.0,
+ outlineColor : {
+ rgbaf : [0.2, 0.2, 0.2, 0.2]
+ },
+ outlineWidth : 1.0,
+ show : true
+ }
+ };
+
+ var validTime = TimeInterval.fromIso8601(pointPacket.point.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(pointPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.point).toBeDefined();
+ expect(dynamicObject.point.color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.point.pixelSize.getValue(validTime)).toEqual(pointPacket.point.pixelSize);
+ expect(dynamicObject.point.outlineColor.getValue(validTime)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.point.outlineWidth.getValue(validTime)).toEqual(pointPacket.point.outlineWidth);
+ expect(dynamicObject.point.show.getValue(validTime)).toEqual(true);
+
+ expect(dynamicObject.point.color.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.point.pixelSize.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.point.outlineColor.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.point.outlineWidth.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.point.show.getValue(invalidTime)).toBeUndefined();
+ });
+
+ it('CZML adds data for infinite polygon.', function() {
+ var polygonPacket = {
+ polygon : {
+ material : {
+ solidColor : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ }
+ }
+ },
+ show : true
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(polygonPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.polygon).toBeDefined();
+ expect(dynamicObject.polygon.material.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.polygon.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
+ });
+
+ it('CZML adds data for constrained polygon.', function() {
+ var polygonPacket = {
+ polygon : {
+ interval : '2000-01-01/2001-01-01',
+ material : {
+ solidColor : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ }
+ }
+ },
+ show : true
+ }
+ };
+
+ var validTime = TimeInterval.fromIso8601(polygonPacket.polygon.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(polygonPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.polygon).toBeDefined();
+ expect(dynamicObject.polygon.material.getValue(validTime).color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.polygon.show.getValue(validTime)).toEqual(true);
+
+ expect(dynamicObject.polygon.material.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.polygon.show.getValue(invalidTime)).toBeUndefined();
+ });
+
+ it('CZML adds data for infinite polyline.', function() {
+ var polylinePacket = {
+ polyline : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ },
+ width : 1.0,
+ outlineColor : {
+ rgbaf : [0.2, 0.2, 0.2, 0.2]
+ },
+ outlineWidth : 1.0,
+ show : true
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(polylinePacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.polyline).toBeDefined();
+ expect(dynamicObject.polyline.color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.polyline.width.getValue(Iso8601.MINIMUM_VALUE)).toEqual(polylinePacket.polyline.width);
+ expect(dynamicObject.polyline.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.polyline.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(polylinePacket.polyline.outlineWidth);
+ expect(dynamicObject.polyline.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
+ });
+
+ it('CZML adds data for constrained polyline.', function() {
+ var polylinePacket = {
+ polyline : {
+ interval : '2000-01-01/2001-01-01',
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ },
+ width : 1.0,
+ outlineColor : {
+ rgbaf : [0.2, 0.2, 0.2, 0.2]
+ },
+ outlineWidth : 1.0,
+ show : true
+ }
+ };
+
+ var validTime = TimeInterval.fromIso8601(polylinePacket.polyline.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(polylinePacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.polyline).toBeDefined();
+ expect(dynamicObject.polyline.color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.polyline.width.getValue(validTime)).toEqual(polylinePacket.polyline.width);
+ expect(dynamicObject.polyline.outlineColor.getValue(validTime)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.polyline.outlineWidth.getValue(validTime)).toEqual(polylinePacket.polyline.outlineWidth);
+ expect(dynamicObject.polyline.show.getValue(validTime)).toEqual(true);
+
+ expect(dynamicObject.polyline.color.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.polyline.width.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.polyline.outlineColor.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.polyline.outlineWidth.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.polyline.show.getValue(invalidTime)).toBeUndefined();
+ });
+
+ it('CZML adds data for infinite pyramid.', function() {
+ var pyramidPacket = {
+ pyramid : {
+ directions : {
+ unitSpherical : [1.0, 2.0, 3.0, 4.0]
+ },
+ radius : 2.0,
+ show : true,
+ showIntersection : false,
+ intersectionWidth : 7.0,
+ material : {
+ solidColor : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ }
+ }
+ },
+ intersectionColor : {
+ rgbaf : [0.5, 0.5, 0.5, 0.5]
+ }
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(pyramidPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.pyramid).toBeDefined();
+ expect(dynamicObject.pyramid.directions.getValue(Iso8601.MINIMUM_VALUE)).toEqual(
+ [new Spherical(pyramidPacket.pyramid.directions.unitSpherical[0], pyramidPacket.pyramid.directions.unitSpherical[1]),
+ new Spherical(pyramidPacket.pyramid.directions.unitSpherical[2], pyramidPacket.pyramid.directions.unitSpherical[3])]);
+ expect(dynamicObject.pyramid.radius.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.radius);
+ expect(dynamicObject.pyramid.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.show);
+ expect(dynamicObject.pyramid.showIntersection.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.showIntersection);
+ expect(dynamicObject.pyramid.material.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.pyramid.intersectionColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
+ expect(dynamicObject.pyramid.intersectionWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(7.0);
+ });
+
+ it('CZML adds data for constrained pyramid.', function() {
+ var pyramidPacket = {
+ pyramid : {
+ interval : '2000-01-01/2001-01-01',
+ directions : {
+ unitSpherical : [1.0, 2.0, 3.0, 4.0]
+ },
+ radius : 2.0,
+ show : true,
+ showIntersection : false,
+ intersectionWidth : 8.0,
+ material : {
+ solidColor : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ }
+ }
+ },
+ intersectionColor : {
+ rgbaf : [0.5, 0.5, 0.5, 0.5]
+ }
+ }
+ };
+
+ var validTime = TimeInterval.fromIso8601(pyramidPacket.pyramid.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(pyramidPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.pyramid).toBeDefined();
+ expect(dynamicObject.pyramid.directions.getValue(validTime)).toEqual(
+ [new Spherical(pyramidPacket.pyramid.directions.unitSpherical[0], pyramidPacket.pyramid.directions.unitSpherical[1]),
+ new Spherical(pyramidPacket.pyramid.directions.unitSpherical[2], pyramidPacket.pyramid.directions.unitSpherical[3])]);
+ expect(dynamicObject.pyramid.radius.getValue(validTime)).toEqual(pyramidPacket.pyramid.radius);
+ expect(dynamicObject.pyramid.show.getValue(validTime)).toEqual(pyramidPacket.pyramid.show);
+ expect(dynamicObject.pyramid.showIntersection.getValue(validTime)).toEqual(pyramidPacket.pyramid.showIntersection);
+ expect(dynamicObject.pyramid.material.getValue(validTime).color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.pyramid.intersectionColor.getValue(validTime)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
+ expect(dynamicObject.pyramid.intersectionWidth.getValue(validTime)).toEqual(8.0);
+
+ expect(dynamicObject.pyramid.directions.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.pyramid.radius.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.pyramid.show.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.pyramid.showIntersection.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.pyramid.material.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.pyramid.intersectionColor.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.pyramid.intersectionWidth.getValue(invalidTime)).toBeUndefined();
+ });
+
+ it('CZML adds data for infinite vector.', function() {
+ var direction = new Cartesian3(1, 2, 3).normalize();
+ var vectorPacket = {
+ vector : {
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ },
+ width : 1.0,
+ length : 10.0,
+ direction : {
+ unitCartesian : [direction.x, direction.y, direction.z]
+ },
+ show : true
+ }
+ };
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(vectorPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.vector).toBeDefined();
+ expect(dynamicObject.vector.color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.vector.width.getValue(Iso8601.MINIMUM_VALUE)).toEqual(vectorPacket.vector.width);
+ expect(dynamicObject.vector.direction.getValue(Iso8601.MINIMUM_VALUE)).toEqual(direction);
+ expect(dynamicObject.vector.length.getValue(Iso8601.MINIMUM_VALUE)).toEqual(vectorPacket.vector.length);
+ expect(dynamicObject.vector.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
+ });
+
+ it('CZML adds data for constrained vector.', function() {
+ var direction = new Cartesian3(1, 2, 3).normalize();
+ var vectorPacket = {
+ vector : {
+ interval : '2000-01-01/2001-01-01',
+ color : {
+ rgbaf : [0.1, 0.1, 0.1, 0.1]
+ },
+ width : 1.0,
+ length : 10.0,
+ direction : {
+ unitCartesian : [direction.x, direction.y, direction.z]
+ },
+ show : true
+ }
+ };
+
+ var validTime = TimeInterval.fromIso8601(vectorPacket.vector.interval).start;
+ var invalidTime = validTime.addSeconds(-1);
+
+ var dataSource = new CzmlDataSource();
+ dataSource.load(vectorPacket);
+ var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
+
+ expect(dynamicObject.vector).toBeDefined();
+ expect(dynamicObject.vector.color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.vector.width.getValue(validTime)).toEqual(vectorPacket.vector.width);
+ expect(dynamicObject.vector.direction.getValue(validTime)).toEqual(direction);
+ expect(dynamicObject.vector.length.getValue(validTime)).toEqual(vectorPacket.vector.length);
+ expect(dynamicObject.vector.show.getValue(validTime)).toEqual(true);
+
+ expect(dynamicObject.vector.color.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.vector.width.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.vector.direction.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.vector.length.getValue(invalidTime)).toBeUndefined();
+ expect(dynamicObject.vector.show.getValue(invalidTime)).toBeUndefined();
+ });
});
diff --git a/Specs/DynamicScene/DynamicBillboardSpec.js b/Specs/DynamicScene/DynamicBillboardSpec.js
index b98837750c22..2d7c03ca0156 100644
--- a/Specs/DynamicScene/DynamicBillboardSpec.js
+++ b/Specs/DynamicScene/DynamicBillboardSpec.js
@@ -22,96 +22,6 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('processCzmlPacket adds data for infinite billboard.', function() {
- var sourceUri = 'http://someImage.invalid/';
- var billboardPacket = {
- billboard : {
- image : 'image.png',
- scale : 1.0,
- horizontalOrigin : 'CENTER',
- verticalOrigin : 'CENTER',
- color : {
- rgbaf : [1.0, 1.0, 1.0, 1.0]
- },
- eyeOffset : {
- cartesian : [3.0, 4.0, 5.0]
- },
- pixelOffset : {
- cartesian2 : [1.0, 2.0]
- },
- show : true
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicBillboard.processCzmlPacket(dynamicObject, billboardPacket, undefined, sourceUri)).toEqual(true);
-
- expect(dynamicObject.billboard).toBeDefined();
- expect(dynamicObject.billboard.image.getValue(Iso8601.MINIMUM_VALUE)).toEqual(sourceUri + 'image.png');
- expect(dynamicObject.billboard.scale.getValue(Iso8601.MINIMUM_VALUE)).toEqual(billboardPacket.billboard.scale);
- expect(dynamicObject.billboard.horizontalOrigin.getValue(Iso8601.MINIMUM_VALUE)).toEqual(HorizontalOrigin.CENTER);
- expect(dynamicObject.billboard.verticalOrigin.getValue(Iso8601.MINIMUM_VALUE)).toEqual(VerticalOrigin.CENTER);
- expect(dynamicObject.billboard.color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(1.0, 1.0, 1.0, 1.0));
- expect(dynamicObject.billboard.eyeOffset.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian3(3.0, 4.0, 5.0));
- expect(dynamicObject.billboard.pixelOffset.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian2(1.0, 2.0));
- expect(dynamicObject.billboard.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
- });
-
- it('processCzmlPacket adds data for constrained billboard.', function() {
- var billboardPacket = {
- billboard : {
- interval : '2000-01-01/2001-01-01',
- image : 'http://someImage.invalid/image',
- scale : 1.0,
- horizontalOrigin : 'CENTER',
- verticalOrigin : 'CENTER',
- color : {
- rgbaf : [1.0, 1.0, 1.0, 1.0]
- },
- eyeOffset : {
- cartesian : [3.0, 4.0, 5.0]
- },
- pixelOffset : {
- cartesian2 : [1.0, 2.0]
- },
- show : true
- }
- };
-
- var validTime = TimeInterval.fromIso8601(billboardPacket.billboard.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicBillboard.processCzmlPacket(dynamicObject, billboardPacket)).toEqual(true);
-
- expect(dynamicObject.billboard).toBeDefined();
- expect(dynamicObject.billboard.image.getValue(validTime)).toEqual(billboardPacket.billboard.image);
- expect(dynamicObject.billboard.scale.getValue(validTime)).toEqual(billboardPacket.billboard.scale);
- expect(dynamicObject.billboard.horizontalOrigin.getValue(validTime)).toEqual(HorizontalOrigin.CENTER);
- expect(dynamicObject.billboard.verticalOrigin.getValue(validTime)).toEqual(VerticalOrigin.CENTER);
- expect(dynamicObject.billboard.color.getValue(validTime)).toEqual(new Color(1.0, 1.0, 1.0, 1.0));
- expect(dynamicObject.billboard.eyeOffset.getValue(validTime)).toEqual(new Cartesian3(3.0, 4.0, 5.0));
- expect(dynamicObject.billboard.pixelOffset.getValue(validTime)).toEqual(new Cartesian2(1.0, 2.0));
- expect(dynamicObject.billboard.show.getValue(validTime)).toEqual(true);
-
- expect(dynamicObject.billboard).toBeDefined();
- expect(dynamicObject.billboard.image.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.billboard.scale.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.billboard.horizontalOrigin.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.billboard.verticalOrigin.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.billboard.color.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.billboard.eyeOffset.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.billboard.pixelOffset.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.billboard.show.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicBillboard.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.billboard).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured billboard', function() {
var expectedImage = 'image';
var expectedScale = 'scale';
diff --git a/Specs/DynamicScene/DynamicClockSpec.js b/Specs/DynamicScene/DynamicClockSpec.js
index 71b57e27ba8c..f4f10bc59fab 100644
--- a/Specs/DynamicScene/DynamicClockSpec.js
+++ b/Specs/DynamicScene/DynamicClockSpec.js
@@ -16,122 +16,58 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- var clockPacket = {
- clock : {
- interval : '2012-03-15T10:00:00Z/2012-03-16T10:00:00Z',
- currentTime : '2012-03-15T10:00:00Z',
- multiplier : 60.0,
- range : 'LOOP_STOP',
- step : 'SYSTEM_CLOCK_MULTIPLIER'
- }
- };
-
- var interval = TimeInterval.fromIso8601(clockPacket.clock.interval);
- var currentTime = JulianDate.fromIso8601(clockPacket.clock.currentTime);
- var multiplier = clockPacket.clock.multiplier;
- var range = ClockRange[clockPacket.clock.range];
- var step = ClockStep[clockPacket.clock.step];
-
- it('processCzmlPacket adds clock data.', function() {
- var dynamicObject = new DynamicObject('document');
- expect(DynamicClock.processCzmlPacket(dynamicObject, clockPacket)).toEqual(true);
- expect(dynamicObject.clock).toBeDefined();
- expect(dynamicObject.clock.startTime).toEqual(interval.start);
- expect(dynamicObject.clock.stopTime).toEqual(interval.stop);
- expect(dynamicObject.clock.currentTime).toEqual(currentTime);
- expect(dynamicObject.clock.clockRange).toEqual(range);
- expect(dynamicObject.clock.clockStep).toEqual(step);
- expect(dynamicObject.clock.multiplier).toEqual(multiplier);
- });
-
- it('processCzmlPacket only adds data on the document.', function() {
- var clockPacket = {
- clock : {
- interval : "2012-03-15T10:00:00Z/2012-03-16T10:00:00Z",
- currentTime : "2012-03-15T10:00:00Z",
- multiplier : 60.0,
- range : "LOOP_STOP",
- step : "SYSTEM_CLOCK_MULTIPLIER"
- }
- };
-
- var documentObject = new DynamicObject('document');
- var dynamicObject = new DynamicObject('notTheDocument');
- expect(DynamicClock.processCzmlPacket(dynamicObject, clockPacket)).toEqual(false);
- expect(dynamicObject.clock).toBeUndefined();
- expect(DynamicClock.processCzmlPacket(documentObject, clockPacket)).toEqual(true);
- expect(documentObject.clock).toBeDefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('document');
- expect(DynamicClock.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.clock).toBeUndefined();
- });
-
it('mergeProperties creates a clock', function() {
- var objectToMerge = new DynamicObject('document');
- DynamicClock.processCzmlPacket(objectToMerge, clockPacket);
+ var clockToMerge = new DynamicObject('1');
+ clockToMerge.startTime = new JulianDate();
+ clockToMerge.stopTime = new JulianDate();
+ clockToMerge.currentTime = new JulianDate();
+ clockToMerge.clockRange = ClockRange.CLAMPED;
+ clockToMerge.clockStep = ClockStep.TICK_DEPENDENT;
+ clockToMerge.multiplier = 1;
+ var objectToMerge = new DynamicObject('objectToMerge');
+ objectToMerge.clock = clockToMerge;
var targetObject = new DynamicObject('targetObject');
DynamicClock.mergeProperties(targetObject, objectToMerge);
- expect(targetObject.clock).toBeDefined();
- expect(targetObject.clock.startTime).toEqual(objectToMerge.clock.startTime);
- expect(targetObject.clock.stopTime).toEqual(objectToMerge.clock.stopTime);
- expect(targetObject.clock.currentTime).toEqual(objectToMerge.clock.currentTime);
- expect(targetObject.clock.clockRange).toEqual(objectToMerge.clock.clockRange);
- expect(targetObject.clock.clockStep).toEqual(objectToMerge.clock.clockStep);
- expect(targetObject.clock.multiplier).toEqual(objectToMerge.clock.multiplier);
- });
-
- it('mergeProperties does not overwrite the target clock if the merging object clock is undefined', function() {
- var objectToMerge = new DynamicObject('document');
-
- var targetObject = new DynamicObject('document');
- DynamicClock.processCzmlPacket(targetObject, clockPacket);
-
- DynamicClock.mergeProperties(targetObject, objectToMerge);
- expect(targetObject.clock).toBeDefined();
- expect(targetObject.clock.startTime).toEqual(interval.start);
- expect(targetObject.clock.stopTime).toEqual(interval.stop);
- expect(targetObject.clock.currentTime).toEqual(currentTime);
- expect(targetObject.clock.clockRange).toEqual(range);
- expect(targetObject.clock.clockStep).toEqual(step);
- expect(targetObject.clock.multiplier).toEqual(multiplier);
+ var targetClock = targetObject.clock;
+ expect(targetClock).toBeInstanceOf(DynamicClock);
+ expect(targetClock.startTime).toEqual(clockToMerge.startTime);
+ expect(targetClock.stopTime).toEqual(clockToMerge.stopTime);
+ expect(targetClock.currentTime).toEqual(clockToMerge.currentTime);
+ expect(targetClock.clockRange).toEqual(clockToMerge.clockRange);
+ expect(targetClock.clockStep).toEqual(clockToMerge.clockStep);
+ expect(targetClock.multiplier).toEqual(clockToMerge.multiplier);
});
it('mergeProperties always overwrites the target clock with mergeObject clock if it has one', function() {
- var objectToMerge = new DynamicObject('document');
- DynamicClock.processCzmlPacket(objectToMerge, clockPacket);
-
- var targetObject = new DynamicObject('document');
- var clockPacket2 = {
- clock : {
- interval : '2013-03-15T10:00:00Z/2014-03-16T10:00:00Z',
- currentTime : '2013-03-15T10:00:00Z',
- multiplier : 65.0,
- range : 'CLAMPED',
- step : 'SYSTEM_CLOCK'
- }
- };
-
- DynamicClock.processCzmlPacket(targetObject, clockPacket2);
- expect(targetObject.clock.startTime).toNotEqual(objectToMerge.clock.startTime);
- expect(targetObject.clock.stopTime).toNotEqual(objectToMerge.clock.stopTime);
- expect(targetObject.clock.currentTime).toNotEqual(objectToMerge.clock.currentTime);
- expect(targetObject.clock.clockRange).toNotEqual(objectToMerge.clock.clockRange);
- expect(targetObject.clock.clockStep).toNotEqual(objectToMerge.clock.clockStep);
- expect(targetObject.clock.multiplier).toNotEqual(objectToMerge.clock.multiplier);
+ var clockToMerge = new DynamicObject('1');
+ clockToMerge.startTime = new JulianDate();
+ clockToMerge.stopTime = new JulianDate();
+ clockToMerge.currentTime = new JulianDate();
+ clockToMerge.clockRange = ClockRange.CLAMPED;
+ clockToMerge.clockStep = ClockStep.TICK_DEPENDENT;
+ clockToMerge.multiplier = 1;
+ var objectToMerge = new DynamicObject('objectToMerge');
+ objectToMerge.clock = clockToMerge;
+
+ var targetClock = new DynamicClock();
+ targetClock.startTime = new JulianDate();
+ targetClock.stopTime = new JulianDate();
+ targetClock.currentTime = new JulianDate();
+ targetClock.clockRange = ClockRange.UNBOUNDED;
+ targetClock.clockStep = ClockStep.SYSTEM_CLOCK_MULTIPLIER;
+ targetClock.multiplier = 2;
+ var targetObject = new DynamicObject('targetObject');
+ targetObject.clock = targetClock;
DynamicClock.mergeProperties(targetObject, objectToMerge);
- expect(targetObject.clock.startTime).toEqual(objectToMerge.clock.startTime);
- expect(targetObject.clock.stopTime).toEqual(objectToMerge.clock.stopTime);
- expect(targetObject.clock.currentTime).toEqual(objectToMerge.clock.currentTime);
- expect(targetObject.clock.clockRange).toEqual(objectToMerge.clock.clockRange);
- expect(targetObject.clock.clockStep).toEqual(objectToMerge.clock.clockStep);
- expect(targetObject.clock.multiplier).toEqual(objectToMerge.clock.multiplier);
+ expect(targetClock.startTime).toEqual(clockToMerge.startTime);
+ expect(targetClock.stopTime).toEqual(clockToMerge.stopTime);
+ expect(targetClock.currentTime).toEqual(clockToMerge.currentTime);
+ expect(targetClock.clockRange).toEqual(clockToMerge.clockRange);
+ expect(targetClock.clockStep).toEqual(clockToMerge.clockStep);
+ expect(targetClock.multiplier).toEqual(clockToMerge.multiplier);
});
it('undefineProperties works', function() {
diff --git a/Specs/DynamicScene/DynamicConeSpec.js b/Specs/DynamicScene/DynamicConeSpec.js
index 8a1c7a1ea80c..911fdccc3105 100644
--- a/Specs/DynamicScene/DynamicConeSpec.js
+++ b/Specs/DynamicScene/DynamicConeSpec.js
@@ -14,159 +14,6 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('processCzmlPacket adds data for infinite cone.', function() {
- var conePacket = {
- cone : {
- innerHalfAngle : 1.0,
- outerHalfAngle : 1.1,
- minimumClockAngle : 1.2,
- maximumClockAngle : 1.3,
- radius : 2.0,
- show : true,
- showIntersection : false,
- intersectionWidth : 6.0,
- capMaterial : {
- solidColor : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- }
- }
- },
- innerMaterial : {
- solidColor : {
- color : {
- rgbaf : [0.2, 0.2, 0.2, 0.2]
- }
- }
- },
- outerMaterial : {
- solidColor : {
- color : {
- rgbaf : [0.3, 0.3, 0.3, 0.3]
- }
- }
- },
- silhouetteMaterial : {
- solidColor : {
- color : {
- rgbaf : [0.4, 0.4, 0.4, 0.4]
- }
- }
- },
- intersectionColor : {
- rgbaf : [0.5, 0.5, 0.5, 0.5]
- }
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicCone.processCzmlPacket(dynamicObject, conePacket)).toEqual(true);
-
- expect(dynamicObject.cone).toBeDefined();
- expect(dynamicObject.cone.innerHalfAngle.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.innerHalfAngle);
- expect(dynamicObject.cone.outerHalfAngle.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.outerHalfAngle);
- expect(dynamicObject.cone.minimumClockAngle.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.minimumClockAngle);
- expect(dynamicObject.cone.maximumClockAngle.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.maximumClockAngle);
- expect(dynamicObject.cone.radius.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.radius);
- expect(dynamicObject.cone.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.show);
- expect(dynamicObject.cone.showIntersection.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.showIntersection);
- expect(dynamicObject.cone.capMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.cone.innerMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.cone.outerMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
- expect(dynamicObject.cone.silhouetteMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
- expect(dynamicObject.cone.intersectionColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
- expect(dynamicObject.cone.intersectionWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.intersectionWidth);
- });
-
- it('processCzmlPacket adds data for constrained cone.', function() {
- var conePacket = {
- cone : {
- interval : '2000-01-01/2001-01-01',
- innerHalfAngle : 1.0,
- outerHalfAngle : 1.1,
- minimumClockAngle : 1.2,
- maximumClockAngle : 1.3,
- radius : 2.0,
- show : true,
- showIntersection : false,
- intersectionWidth : 4.0,
- capMaterial : {
- solidColor : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- }
- }
- },
- innerMaterial : {
- solidColor : {
- color : {
- rgbaf : [0.2, 0.2, 0.2, 0.2]
- }
- }
- },
- outerMaterial : {
- solidColor : {
- color : {
- rgbaf : [0.3, 0.3, 0.3, 0.3]
- }
- }
- },
- silhouetteMaterial : {
- solidColor : {
- color : {
- rgbaf : [0.4, 0.4, 0.4, 0.4]
- }
- }
- },
- intersectionColor : {
- rgbaf : [0.5, 0.5, 0.5, 0.5]
- }
- }
- };
-
- var validTime = TimeInterval.fromIso8601(conePacket.cone.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicCone.processCzmlPacket(dynamicObject, conePacket)).toEqual(true);
-
- expect(dynamicObject.cone).toBeDefined();
- expect(dynamicObject.cone.innerHalfAngle.getValue(validTime)).toEqual(conePacket.cone.innerHalfAngle);
- expect(dynamicObject.cone.outerHalfAngle.getValue(validTime)).toEqual(conePacket.cone.outerHalfAngle);
- expect(dynamicObject.cone.minimumClockAngle.getValue(validTime)).toEqual(conePacket.cone.minimumClockAngle);
- expect(dynamicObject.cone.maximumClockAngle.getValue(validTime)).toEqual(conePacket.cone.maximumClockAngle);
- expect(dynamicObject.cone.radius.getValue(validTime)).toEqual(conePacket.cone.radius);
- expect(dynamicObject.cone.show.getValue(validTime)).toEqual(conePacket.cone.show);
- expect(dynamicObject.cone.showIntersection.getValue(validTime)).toEqual(conePacket.cone.showIntersection);
- expect(dynamicObject.cone.capMaterial.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.cone.innerMaterial.getValue(validTime).color).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.cone.outerMaterial.getValue(validTime).color).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
- expect(dynamicObject.cone.silhouetteMaterial.getValue(validTime).color).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
- expect(dynamicObject.cone.intersectionColor.getValue(validTime)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
- expect(dynamicObject.cone.intersectionWidth.getValue(validTime)).toEqual(conePacket.cone.intersectionWidth);
-
- expect(dynamicObject.cone.innerHalfAngle.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.outerHalfAngle.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.minimumClockAngle.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.maximumClockAngle.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.radius.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.show.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.showIntersection.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.capMaterial.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.innerMaterial.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.outerMaterial.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.silhouetteMaterial.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.intersectionColor.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.cone.intersectionWidth.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicCone.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.cone).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured cone', function() {
var expectedCapMaterial = 13;
var expectedInnerHalfAngle = 14;
diff --git a/Specs/DynamicScene/DynamicEllipseSpec.js b/Specs/DynamicScene/DynamicEllipseSpec.js
index 0a76fcf16817..4ed05f017836 100644
--- a/Specs/DynamicScene/DynamicEllipseSpec.js
+++ b/Specs/DynamicScene/DynamicEllipseSpec.js
@@ -24,56 +24,6 @@ defineSuite([
var position = new Cartesian3(1234, 5678, 9101112);
- var ellipsePacket = {
- ellipse : {
- semiMajorAxis : 10,
- semiMinorAxis : 20,
- bearing : 1.0
- }
- };
-
- var ellipsePacketInterval = {
- ellipse : {
- interval : '2000-01-01/2001-01-01',
- semiMajorAxis : 10,
- semiMinorAxis : 20,
- bearing : 1.0
- }
- };
-
- it('processCzmlPacket adds data for infinite ellipse.', function() {
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicEllipse.processCzmlPacket(dynamicObject, ellipsePacket)).toEqual(true);
- expect(dynamicObject.ellipse).toBeDefined();
- expect(dynamicObject.ellipse.semiMajorAxis.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ellipsePacket.ellipse.semiMajorAxis);
- expect(dynamicObject.ellipse.semiMinorAxis.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ellipsePacket.ellipse.semiMinorAxis);
- expect(dynamicObject.ellipse.bearing.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ellipsePacket.ellipse.bearing);
- });
-
- it('processCzmlPacket adds data for constrained ellipse.', function() {
- var validTime = TimeInterval.fromIso8601(ellipsePacketInterval.ellipse.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicEllipse.processCzmlPacket(dynamicObject, ellipsePacketInterval)).toEqual(true);
-
- expect(dynamicObject.ellipse).toBeDefined();
- expect(dynamicObject.ellipse.semiMajorAxis.getValue(validTime)).toEqual(ellipsePacketInterval.ellipse.semiMajorAxis);
- expect(dynamicObject.ellipse.semiMinorAxis.getValue(validTime)).toEqual(ellipsePacketInterval.ellipse.semiMinorAxis);
- expect(dynamicObject.ellipse.bearing.getValue(validTime)).toEqual(ellipsePacketInterval.ellipse.bearing);
-
- expect(dynamicObject.ellipse.semiMajorAxis.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.ellipse.semiMinorAxis.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.ellipse.bearing.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicEllipse.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.ellipse).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured ellipse', function() {
var expectedSemiMajorAxis = new MockProperty();
var expectedSemiMinorAxis = new MockProperty();
diff --git a/Specs/DynamicScene/DynamicEllipsoidSpec.js b/Specs/DynamicScene/DynamicEllipsoidSpec.js
index 7ceefcf48083..0f1b3c0da895 100644
--- a/Specs/DynamicScene/DynamicEllipsoidSpec.js
+++ b/Specs/DynamicScene/DynamicEllipsoidSpec.js
@@ -18,75 +18,6 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- var expectedRadii = new Cartesian3(1.0, 2.0, 3.0);
-
- var ellipsoidPacket = {
- ellipsoid : {
- radii : {
- cartesian : [1.0, 2.0, 3.0]
- },
- show : true,
- material : {
- solidColor : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- }
- }
- }
- }
- };
-
- var ellipsoidPacketInterval = {
- ellipsoid : {
- interval : '2000-01-01/2001-01-01',
- radii : {
- cartesian : [1.0, 2.0, 3.0]
- },
- show : true,
- material : {
- solidColor : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- }
- }
- }
- }
- };
-
- it('processCzmlPacket adds data for infinite ellipsoid.', function() {
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicEllipsoid.processCzmlPacket(dynamicObject, ellipsoidPacket)).toEqual(true);
-
- expect(dynamicObject.ellipsoid).toBeDefined();
- expect(dynamicObject.ellipsoid.radii.getValue(Iso8601.MINIMUM_VALUE)).toEqual(expectedRadii);
- expect(dynamicObject.ellipsoid.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ellipsoidPacket.ellipsoid.show);
- expect(dynamicObject.ellipsoid.material.getValue(Iso8601.MINIMUM_VALUE).uniforms.color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- });
-
- it('processCzmlPacket adds data for constrained ellipsoid.', function() {
- var validTime = TimeInterval.fromIso8601(ellipsoidPacketInterval.ellipsoid.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicEllipsoid.processCzmlPacket(dynamicObject, ellipsoidPacketInterval)).toEqual(true);
-
- expect(dynamicObject.ellipsoid).toBeDefined();
- expect(dynamicObject.ellipsoid.radii.getValue(validTime)).toEqual(expectedRadii);
- expect(dynamicObject.ellipsoid.show.getValue(validTime)).toEqual(ellipsoidPacketInterval.ellipsoid.show);
- expect(dynamicObject.ellipsoid.material.getValue(validTime).uniforms.color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
-
- expect(dynamicObject.ellipsoid.radii.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.ellipsoid.show.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.ellipsoid.material.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicEllipsoid.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.ellipsoid).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured ellipsoid', function() {
var expectedMaterial = 4;
var expectedRadii = 5;
diff --git a/Specs/DynamicScene/DynamicLabelSpec.js b/Specs/DynamicScene/DynamicLabelSpec.js
index e0ae2cc4a9de..09aa5c7b7a28 100644
--- a/Specs/DynamicScene/DynamicLabelSpec.js
+++ b/Specs/DynamicScene/DynamicLabelSpec.js
@@ -28,116 +28,6 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('processCzmlPacket adds data for infinite label.', function() {
- var labelPacket = {
- label : {
- text : 'TestFacility',
- font : '10pt "Open Sans"',
- style : 'FILL',
- fillColor : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- },
- outlineColor : {
- rgbaf : [0.2, 0.2, 0.2, 0.2]
- },
- outlineWidth : 3.14,
- horizontalOrigin : 'LEFT',
- verticalOrigin : 'CENTER',
- eyeOffset : {
- cartesian : [1.0, 2.0, 3.0]
- },
- pixelOffset : {
- cartesian2 : [4.0, 5.0]
- },
- scale : 1.0,
- show : true
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicLabel.processCzmlPacket(dynamicObject, labelPacket)).toEqual(true);
- expect(dynamicObject.label).toBeDefined();
- expect(dynamicObject.label.text.getValue(Iso8601.MINIMUM_VALUE)).toEqual(labelPacket.label.text);
- expect(dynamicObject.label.font.getValue(Iso8601.MINIMUM_VALUE)).toEqual(labelPacket.label.font);
- expect(dynamicObject.label.style.getValue(Iso8601.MINIMUM_VALUE)).toEqual(LabelStyle.FILL);
- expect(dynamicObject.label.fillColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.label.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.label.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(labelPacket.label.outlineWidth);
- expect(dynamicObject.label.horizontalOrigin.getValue(Iso8601.MINIMUM_VALUE)).toEqual(HorizontalOrigin.LEFT);
- expect(dynamicObject.label.verticalOrigin.getValue(Iso8601.MINIMUM_VALUE)).toEqual(VerticalOrigin.CENTER);
- expect(dynamicObject.label.eyeOffset.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian3(1.0, 2.0, 3.0));
- expect(dynamicObject.label.pixelOffset.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian2(4.0, 5.0));
- expect(dynamicObject.label.scale.getValue(Iso8601.MINIMUM_VALUE)).toEqual(labelPacket.label.scale);
- expect(dynamicObject.label.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(labelPacket.label.show);
- });
-
- it('processCzmlPacket adds data for constrained label.', function() {
- var labelPacket = {
- label : {
- interval : '2000-01-01/2001-01-01',
- text : 'TestFacility',
- font : '10pt "Open Sans"',
- style : 'FILL',
- fillColor : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- },
- outlineColor : {
- rgbaf : [0.2, 0.2, 0.2, 0.2]
- },
- outlineWidth : 2.78,
- horizontalOrigin : 'LEFT',
- verticalOrigin : 'CENTER',
- eyeOffset : {
- cartesian : [1.0, 2.0, 3.0]
- },
- pixelOffset : {
- cartesian2 : [4.0, 5.0]
- },
- scale : 1.0,
- show : true
- }
- };
-
- var validTime = TimeInterval.fromIso8601(labelPacket.label.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicLabel.processCzmlPacket(dynamicObject, labelPacket)).toEqual(true);
- expect(dynamicObject.label).toBeDefined();
- expect(dynamicObject.label.text.getValue(validTime)).toEqual(labelPacket.label.text);
- expect(dynamicObject.label.font.getValue(validTime)).toEqual(labelPacket.label.font);
- expect(dynamicObject.label.style.getValue(validTime)).toEqual(LabelStyle.FILL);
- expect(dynamicObject.label.fillColor.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.label.outlineColor.getValue(validTime)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.label.outlineWidth.getValue(validTime)).toEqual(labelPacket.label.outlineWidth);
- expect(dynamicObject.label.horizontalOrigin.getValue(validTime)).toEqual(HorizontalOrigin.LEFT);
- expect(dynamicObject.label.verticalOrigin.getValue(validTime)).toEqual(VerticalOrigin.CENTER);
- expect(dynamicObject.label.eyeOffset.getValue(validTime)).toEqual(new Cartesian3(1.0, 2.0, 3.0));
- expect(dynamicObject.label.pixelOffset.getValue(validTime)).toEqual(new Cartesian2(4.0, 5.0));
- expect(dynamicObject.label.scale.getValue(validTime)).toEqual(labelPacket.label.scale);
- expect(dynamicObject.label.show.getValue(validTime)).toEqual(labelPacket.label.show);
-
- expect(dynamicObject.label.text.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.font.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.style.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.fillColor.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.outlineColor.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.outlineWidth.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.horizontalOrigin.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.verticalOrigin.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.eyeOffset.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.pixelOffset.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.scale.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.label.show.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicLabel.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.label).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured label', function() {
var expectedText = new MockProperty();
var expectedFont = new MockProperty();
diff --git a/Specs/DynamicScene/DynamicObjectSpec.js b/Specs/DynamicScene/DynamicObjectSpec.js
index aaaa02fc11a6..d4d906dd4727 100644
--- a/Specs/DynamicScene/DynamicObjectSpec.js
+++ b/Specs/DynamicScene/DynamicObjectSpec.js
@@ -40,132 +40,16 @@ defineSuite([
expect(object.id).toNotEqual(object2.id);
});
- it('processCzmlPacketPosition works.', function() {
- var packet = {
- 'position' : {
- 'cartesian' : [1.0, 2.0, 3.0]
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicObject.processCzmlPacketPosition(dynamicObject, packet)).toEqual(true);
- expect(dynamicObject.position.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian3(1.0, 2.0, 3.0));
- });
-
- it('processCzmlPacketPosition returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicObject.processCzmlPacketPosition(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.position).toBeUndefined();
- });
-
- it('processCzmlPacketOrientation works.', function() {
- var packet = {
- 'orientation' : {
- 'unitQuaternion' : [0.0, 0.0, 0.0, 1.0]
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicObject.processCzmlPacketOrientation(dynamicObject, packet)).toEqual(true);
- expect(dynamicObject.orientation.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Quaternion(0.0, 0.0, 0.0, 1.0));
- });
-
- it('processCzmlPacketOrientation returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicObject.processCzmlPacketOrientation(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.orientation).toBeUndefined();
- });
-
- it('processCzmlPacketVertexPositions works.', function() {
- var packet = {
- 'vertexPositions' : {
- 'cartesian' : [1.0, 2.0, 3.0, 5.0, 6.0, 7.0]
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicObject.processCzmlPacketVertexPositions(dynamicObject, packet)).toEqual(true);
- expect(dynamicObject.vertexPositions.getValue(Iso8601.MINIMUM_VALUE)).toEqual([new Cartesian3(1.0, 2.0, 3.0), new Cartesian3(5.0, 6.0, 7.0)]);
- });
-
- it('processCzmlPacketVertexPositions returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicObject.processCzmlPacketVertexPositions(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.vertexPositions).toBeUndefined();
- });
-
- it('processCzmlPacketViewFrom works.', function() {
- var packet = {
- 'viewFrom' : {
- 'cartesian' : [1.0, 2.0, 3.0]
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicObject.processCzmlPacketViewFrom(dynamicObject, packet)).toEqual(true);
- expect(dynamicObject.viewFrom.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Cartesian3(1.0, 2.0, 3.0));
- });
-
- it('processCzmlPacketViewFrom returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicObject.processCzmlPacketViewFrom(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.viewFrom).toBeUndefined();
- });
-
-
- it('processCzmlPacketAvailability works.', function() {
- var packet = {
- availability : '2000-01-01/2001-01-01'
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicObject.processCzmlPacketAvailability(dynamicObject, packet)).toEqual(true);
-
- var interval = TimeInterval.fromIso8601(packet.availability);
- expect(dynamicObject.availability).toEqual(interval);
- });
-
- it('processCzmlPacketAvailability returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicObject.processCzmlPacketAvailability(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.availability).toBeUndefined();
- });
-
it('isAvailable works.', function() {
- var packet = {
- availability : '2000-01-01/2001-01-01'
- };
-
var dynamicObject = new DynamicObject('dynamicObject');
- DynamicObject.processCzmlPacketAvailability(dynamicObject, packet);
-
- var interval = TimeInterval.fromIso8601(packet.availability);
+ var interval = TimeInterval.fromIso9601('2000-01-01/2001-01-01');
+ dynamicObject._setAvailability(interval);
expect(dynamicObject.isAvailable(interval.start.addSeconds(-1))).toEqual(false);
expect(dynamicObject.isAvailable(interval.start)).toEqual(true);
expect(dynamicObject.isAvailable(interval.stop)).toEqual(true);
expect(dynamicObject.isAvailable(interval.stop.addSeconds(1))).toEqual(false);
});
- it('isAvailable caching works.', function() {
- var packet = {
- availability : '2000-01-01/2001-01-01'
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- DynamicObject.processCzmlPacketAvailability(dynamicObject, packet);
-
- var interval = TimeInterval.fromIso8601(packet.availability);
- expect(dynamicObject.isAvailable(interval.start)).toEqual(true);
- expect(dynamicObject.isAvailable(interval.start)).toEqual(true);
- expect(dynamicObject.isAvailable(interval.stop)).toEqual(true);
- expect(dynamicObject.isAvailable(interval.stop)).toEqual(true);
- });
-
it('mergeProperties does not change a fully configured billboard', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.position = 1;
diff --git a/Specs/DynamicScene/DynamicPathSpec.js b/Specs/DynamicScene/DynamicPathSpec.js
index 6e0dc40c5a84..d50dcdf71c0e 100644
--- a/Specs/DynamicScene/DynamicPathSpec.js
+++ b/Specs/DynamicScene/DynamicPathSpec.js
@@ -16,89 +16,6 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('processCzmlPacket adds data for infinite path.', function() {
- var pathPacket = {
- path : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- },
- width : 1.0,
- resolution : 23.0,
- outlineColor : {
- rgbaf : [0.2, 0.2, 0.2, 0.2]
- },
- outlineWidth : 1.0,
- leadTime : 2.0,
- trailTime : 3.0,
- show : true
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPath.processCzmlPacket(dynamicObject, pathPacket)).toEqual(true);
-
- expect(dynamicObject.path).toBeDefined();
- expect(dynamicObject.path.color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.path.width.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pathPacket.path.width);
- expect(dynamicObject.path.resolution.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pathPacket.path.resolution);
- expect(dynamicObject.path.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.path.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pathPacket.path.outlineWidth);
- expect(dynamicObject.path.leadTime.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pathPacket.path.leadTime);
- expect(dynamicObject.path.trailTime.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pathPacket.path.trailTime);
- expect(dynamicObject.path.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
- });
-
- it('processCzmlPacket adds data for constrained path.', function() {
- var pathPacket = {
- path : {
- interval : '2000-01-01/2001-01-01',
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- },
- width : 1.0,
- resolution : 23.0,
- outlineColor : {
- rgbaf : [0.2, 0.2, 0.2, 0.2]
- },
- outlineWidth : 1.0,
- leadTime : 2.0,
- trailTime : 3.0,
- show : true
- }
- };
-
- var validTime = TimeInterval.fromIso8601(pathPacket.path.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPath.processCzmlPacket(dynamicObject, pathPacket)).toEqual(true);
-
- expect(dynamicObject.path).toBeDefined();
- expect(dynamicObject.path.color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.path.width.getValue(validTime)).toEqual(pathPacket.path.width);
- expect(dynamicObject.path.resolution.getValue(validTime)).toEqual(pathPacket.path.resolution);
- expect(dynamicObject.path.outlineColor.getValue(validTime)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.path.outlineWidth.getValue(validTime)).toEqual(pathPacket.path.outlineWidth);
- expect(dynamicObject.path.leadTime.getValue(validTime)).toEqual(pathPacket.path.leadTime);
- expect(dynamicObject.path.trailTime.getValue(validTime)).toEqual(pathPacket.path.trailTime);
- expect(dynamicObject.path.show.getValue(validTime)).toEqual(true);
-
- expect(dynamicObject.path.color.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.path.width.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.path.outlineColor.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.path.outlineWidth.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.path.leadTime.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.path.trailTime.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.path.show.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPath.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.path).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured path', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.path = new DynamicPath();
diff --git a/Specs/DynamicScene/DynamicPointSpec.js b/Specs/DynamicScene/DynamicPointSpec.js
index 81ce867d5e1a..0a55041abed9 100644
--- a/Specs/DynamicScene/DynamicPointSpec.js
+++ b/Specs/DynamicScene/DynamicPointSpec.js
@@ -14,75 +14,6 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('processCzmlPacket adds data for infinite point.', function() {
- var pointPacket = {
- point : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- },
- pixelSize : 1.0,
- outlineColor : {
- rgbaf : [0.2, 0.2, 0.2, 0.2]
- },
- outlineWidth : 1.0,
- show : true
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPoint.processCzmlPacket(dynamicObject, pointPacket)).toEqual(true);
-
- expect(dynamicObject.point).toBeDefined();
- expect(dynamicObject.point.color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.point.pixelSize.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pointPacket.point.pixelSize);
- expect(dynamicObject.point.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.point.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pointPacket.point.outlineWidth);
- expect(dynamicObject.point.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
- });
-
- it('processCzmlPacket adds data for constrained point.', function() {
- var pointPacket = {
- point : {
- interval : '2000-01-01/2001-01-01',
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- },
- pixelSize : 1.0,
- outlineColor : {
- rgbaf : [0.2, 0.2, 0.2, 0.2]
- },
- outlineWidth : 1.0,
- show : true
- }
- };
-
- var validTime = TimeInterval.fromIso8601(pointPacket.point.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPoint.processCzmlPacket(dynamicObject, pointPacket)).toEqual(true);
-
- expect(dynamicObject.point).toBeDefined();
- expect(dynamicObject.point.color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.point.pixelSize.getValue(validTime)).toEqual(pointPacket.point.pixelSize);
- expect(dynamicObject.point.outlineColor.getValue(validTime)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.point.outlineWidth.getValue(validTime)).toEqual(pointPacket.point.outlineWidth);
- expect(dynamicObject.point.show.getValue(validTime)).toEqual(true);
-
- expect(dynamicObject.point.color.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.point.pixelSize.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.point.outlineColor.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.point.outlineWidth.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.point.show.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPoint.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.point).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured point', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.point = new DynamicPoint();
diff --git a/Specs/DynamicScene/DynamicPolygonSpec.js b/Specs/DynamicScene/DynamicPolygonSpec.js
index 92b3a1f2b530..71141d98e06c 100644
--- a/Specs/DynamicScene/DynamicPolygonSpec.js
+++ b/Specs/DynamicScene/DynamicPolygonSpec.js
@@ -14,64 +14,6 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('processCzmlPacket adds data for infinite polygon.', function() {
- var polygonPacket = {
- polygon : {
- material : {
- solidColor : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- }
- }
- },
- show : true
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPolygon.processCzmlPacket(dynamicObject, polygonPacket)).toEqual(true);
-
- expect(dynamicObject.polygon).toBeDefined();
- expect(dynamicObject.polygon.material.getValue(Iso8601.MINIMUM_VALUE).uniforms.color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.polygon.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
- });
-
- it('processCzmlPacket adds data for constrained polygon.', function() {
- var polygonPacket = {
- polygon : {
- interval : '2000-01-01/2001-01-01',
- material : {
- solidColor : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- }
- }
- },
- show : true
- }
- };
-
- var validTime = TimeInterval.fromIso8601(polygonPacket.polygon.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPolygon.processCzmlPacket(dynamicObject, polygonPacket)).toEqual(true);
-
- expect(dynamicObject.polygon).toBeDefined();
- expect(dynamicObject.polygon.material.getValue(validTime).uniforms.color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.polygon.show.getValue(validTime)).toEqual(true);
-
- expect(dynamicObject.polygon.material.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.polygon.show.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPolygon.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.polygon).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured polygon', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.polygon = new DynamicPolygon();
diff --git a/Specs/DynamicScene/DynamicPolylineSpec.js b/Specs/DynamicScene/DynamicPolylineSpec.js
index edc604901a64..9d01220aceb6 100644
--- a/Specs/DynamicScene/DynamicPolylineSpec.js
+++ b/Specs/DynamicScene/DynamicPolylineSpec.js
@@ -16,75 +16,6 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('processCzmlPacket adds data for infinite polyline.', function() {
- var polylinePacket = {
- polyline : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- },
- width : 1.0,
- outlineColor : {
- rgbaf : [0.2, 0.2, 0.2, 0.2]
- },
- outlineWidth : 1.0,
- show : true
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPolyline.processCzmlPacket(dynamicObject, polylinePacket)).toEqual(true);
-
- expect(dynamicObject.polyline).toBeDefined();
- expect(dynamicObject.polyline.color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.polyline.width.getValue(Iso8601.MINIMUM_VALUE)).toEqual(polylinePacket.polyline.width);
- expect(dynamicObject.polyline.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.polyline.outlineWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(polylinePacket.polyline.outlineWidth);
- expect(dynamicObject.polyline.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
- });
-
- it('processCzmlPacket adds data for constrained polyline.', function() {
- var polylinePacket = {
- polyline : {
- interval : '2000-01-01/2001-01-01',
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- },
- width : 1.0,
- outlineColor : {
- rgbaf : [0.2, 0.2, 0.2, 0.2]
- },
- outlineWidth : 1.0,
- show : true
- }
- };
-
- var validTime = TimeInterval.fromIso8601(polylinePacket.polyline.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPolyline.processCzmlPacket(dynamicObject, polylinePacket)).toEqual(true);
-
- expect(dynamicObject.polyline).toBeDefined();
- expect(dynamicObject.polyline.color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.polyline.width.getValue(validTime)).toEqual(polylinePacket.polyline.width);
- expect(dynamicObject.polyline.outlineColor.getValue(validTime)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.polyline.outlineWidth.getValue(validTime)).toEqual(polylinePacket.polyline.outlineWidth);
- expect(dynamicObject.polyline.show.getValue(validTime)).toEqual(true);
-
- expect(dynamicObject.polyline.color.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.polyline.width.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.polyline.outlineColor.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.polyline.outlineWidth.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.polyline.show.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPolyline.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.polyline).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured polyline', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.polyline = new DynamicPolyline();
diff --git a/Specs/DynamicScene/DynamicPyramidSpec.js b/Specs/DynamicScene/DynamicPyramidSpec.js
index 88e135511eba..7eb288a3080f 100644
--- a/Specs/DynamicScene/DynamicPyramidSpec.js
+++ b/Specs/DynamicScene/DynamicPyramidSpec.js
@@ -18,101 +18,6 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('processCzmlPacket adds data for infinite pyramid.', function() {
- var pyramidPacket = {
- pyramid : {
- directions : {
- unitSpherical : [1.0, 2.0, 3.0, 4.0]
- },
- radius : 2.0,
- show : true,
- showIntersection : false,
- intersectionWidth : 7.0,
- material : {
- solidColor : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- }
- }
- },
- intersectionColor : {
- rgbaf : [0.5, 0.5, 0.5, 0.5]
- }
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPyramid.processCzmlPacket(dynamicObject, pyramidPacket)).toEqual(true);
-
- expect(dynamicObject.pyramid).toBeDefined();
- expect(dynamicObject.pyramid.directions.getValue(Iso8601.MINIMUM_VALUE)).toEqual(
- [new Spherical(pyramidPacket.pyramid.directions.unitSpherical[0], pyramidPacket.pyramid.directions.unitSpherical[1]),
- new Spherical(pyramidPacket.pyramid.directions.unitSpherical[2], pyramidPacket.pyramid.directions.unitSpherical[3])]);
- expect(dynamicObject.pyramid.radius.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.radius);
- expect(dynamicObject.pyramid.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.show);
- expect(dynamicObject.pyramid.showIntersection.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.showIntersection);
- expect(dynamicObject.pyramid.material.getValue(Iso8601.MINIMUM_VALUE).uniforms.color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.pyramid.intersectionColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
- expect(dynamicObject.pyramid.intersectionWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(7.0);
- });
-
- it('processCzmlPacket adds data for constrained pyramid.', function() {
- var pyramidPacket = {
- pyramid : {
- interval : '2000-01-01/2001-01-01',
- directions : {
- unitSpherical : [1.0, 2.0, 3.0, 4.0]
- },
- radius : 2.0,
- show : true,
- showIntersection : false,
- intersectionWidth : 8.0,
- material : {
- solidColor : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- }
- }
- },
- intersectionColor : {
- rgbaf : [0.5, 0.5, 0.5, 0.5]
- }
- }
- };
-
- var validTime = TimeInterval.fromIso8601(pyramidPacket.pyramid.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPyramid.processCzmlPacket(dynamicObject, pyramidPacket)).toEqual(true);
-
- expect(dynamicObject.pyramid).toBeDefined();
- expect(dynamicObject.pyramid.directions.getValue(validTime)).toEqual(
- [new Spherical(pyramidPacket.pyramid.directions.unitSpherical[0], pyramidPacket.pyramid.directions.unitSpherical[1]),
- new Spherical(pyramidPacket.pyramid.directions.unitSpherical[2], pyramidPacket.pyramid.directions.unitSpherical[3])]);
- expect(dynamicObject.pyramid.radius.getValue(validTime)).toEqual(pyramidPacket.pyramid.radius);
- expect(dynamicObject.pyramid.show.getValue(validTime)).toEqual(pyramidPacket.pyramid.show);
- expect(dynamicObject.pyramid.showIntersection.getValue(validTime)).toEqual(pyramidPacket.pyramid.showIntersection);
- expect(dynamicObject.pyramid.material.getValue(validTime).uniforms.color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.pyramid.intersectionColor.getValue(validTime)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
- expect(dynamicObject.pyramid.intersectionWidth.getValue(validTime)).toEqual(8.0);
-
- expect(dynamicObject.pyramid.directions.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.pyramid.radius.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.pyramid.show.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.pyramid.showIntersection.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.pyramid.material.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.pyramid.intersectionColor.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.pyramid.intersectionWidth.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicPyramid.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.pyramid).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured pyramid', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.pyramid = new DynamicPyramid();
diff --git a/Specs/DynamicScene/DynamicVectorSpec.js b/Specs/DynamicScene/DynamicVectorSpec.js
index f22b7165750a..03aba67d2206 100644
--- a/Specs/DynamicScene/DynamicVectorSpec.js
+++ b/Specs/DynamicScene/DynamicVectorSpec.js
@@ -20,77 +20,6 @@ defineSuite([
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
- it('processCzmlPacket adds data for infinite vector.', function() {
- var direction = new Cartesian3(1, 2, 3).normalize();
- var vectorPacket = {
- vector : {
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- },
- width : 1.0,
- length : 10.0,
- direction : {
- unitCartesian : [direction.x, direction.y, direction.z]
- },
- show : true
- }
- };
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicVector.processCzmlPacket(dynamicObject, vectorPacket)).toEqual(true);
-
- expect(dynamicObject.vector).toBeDefined();
- expect(dynamicObject.vector.color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.vector.width.getValue(Iso8601.MINIMUM_VALUE)).toEqual(vectorPacket.vector.width);
- expect(dynamicObject.vector.direction.getValue(Iso8601.MINIMUM_VALUE)).toEqual(direction);
- expect(dynamicObject.vector.length.getValue(Iso8601.MINIMUM_VALUE)).toEqual(vectorPacket.vector.length);
- expect(dynamicObject.vector.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
- });
-
- it('processCzmlPacket adds data for constrained vector.', function() {
- var direction = new Cartesian3(1, 2, 3).normalize();
- var vectorPacket = {
- vector : {
- interval : '2000-01-01/2001-01-01',
- color : {
- rgbaf : [0.1, 0.1, 0.1, 0.1]
- },
- width : 1.0,
- length : 10.0,
- direction : {
- unitCartesian : [direction.x, direction.y, direction.z]
- },
- show : true
- }
- };
-
- var validTime = TimeInterval.fromIso8601(vectorPacket.vector.interval).start;
- var invalidTime = validTime.addSeconds(-1);
-
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicVector.processCzmlPacket(dynamicObject, vectorPacket)).toEqual(true);
-
- expect(dynamicObject.vector).toBeDefined();
- expect(dynamicObject.vector.color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.vector.width.getValue(validTime)).toEqual(vectorPacket.vector.width);
- expect(dynamicObject.vector.direction.getValue(validTime)).toEqual(direction);
- expect(dynamicObject.vector.length.getValue(validTime)).toEqual(vectorPacket.vector.length);
- expect(dynamicObject.vector.show.getValue(validTime)).toEqual(true);
-
- expect(dynamicObject.vector.color.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.vector.width.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.vector.direction.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.vector.length.getValue(invalidTime)).toBeUndefined();
- expect(dynamicObject.vector.show.getValue(invalidTime)).toBeUndefined();
- });
-
- it('processCzmlPacket returns false if no data.', function() {
- var packet = {};
- var dynamicObject = new DynamicObject('dynamicObject');
- expect(DynamicVector.processCzmlPacket(dynamicObject, packet)).toEqual(false);
- expect(dynamicObject.vector).toBeUndefined();
- });
-
it('mergeProperties does not change a fully configured vector', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.vector = new DynamicVector();
From f7ccbbf5caa0646e08629f3e125d5ad05d597a3f Mon Sep 17 00:00:00 2001
From: mramato
Date: Tue, 20 Aug 2013 22:20:39 -0400
Subject: [PATCH 36/65] Delete MockProperty
It's functionally equivalent to ConstantProperty and the tests will ultimately be cleaner without it.
---
.../DynamicBillboardVisualizerSpec.js | 84 +++++++--------
...amicConeVisualizerUsingCustomSensorSpec.js | 92 ++++++++--------
Specs/DynamicScene/DynamicEllipseSpec.js | 78 +++++++-------
.../DynamicEllipsoidVisualizerSpec.js | 56 +++++-----
Specs/DynamicScene/DynamicLabelSpec.js | 100 +++++++++---------
.../DynamicLabelVisualizerSpec.js | 92 ++++++++--------
Specs/DynamicScene/DynamicObjectViewSpec.js | 12 ++-
.../DynamicScene/DynamicPathVisualizerSpec.js | 68 ++++++------
.../DynamicPointVisualizerSpec.js | 38 +++----
.../DynamicPolygonVisualizerSpec.js | 54 +++++-----
.../DynamicPolylineVisualizerSpec.js | 64 +++++------
.../DynamicPyramidVisualizerSpec.js | 58 +++++-----
Specs/DynamicScene/DynamicVectorSpec.js | 44 ++++----
.../DynamicVectorVisualizerSpec.js | 82 +++++++-------
Specs/MockProperty.js | 26 -----
.../Viewer/viewerDynamicObjectMixinSpec.js | 8 +-
16 files changed, 467 insertions(+), 489 deletions(-)
delete mode 100644 Specs/MockProperty.js
diff --git a/Specs/DynamicScene/DynamicBillboardVisualizerSpec.js b/Specs/DynamicScene/DynamicBillboardVisualizerSpec.js
index 10ed83d574ed..d07086aeee9f 100644
--- a/Specs/DynamicScene/DynamicBillboardVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicBillboardVisualizerSpec.js
@@ -3,7 +3,7 @@ defineSuite([
'DynamicScene/DynamicBillboardVisualizer',
'Specs/createScene',
'Specs/destroyScene',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
'DynamicScene/DynamicBillboard',
'DynamicScene/DynamicObjectCollection',
'DynamicScene/DynamicObject',
@@ -19,7 +19,7 @@ defineSuite([
DynamicBillboardVisualizer,
createScene,
destroyScene,
- MockProperty,
+ ConstantProperty,
DynamicBillboard,
DynamicObjectCollection,
DynamicObject,
@@ -90,7 +90,7 @@ defineSuite([
visualizer = new DynamicBillboardVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
visualizer.update(new JulianDate());
var billboardCollection = scene.getPrimitives().get(0);
expect(billboardCollection.getLength()).toEqual(0);
@@ -102,8 +102,8 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var billboard = testObject.billboard = new DynamicBillboard();
- billboard.show = new MockProperty(true);
- billboard.image = new MockProperty('Data/Images/Blue.png');
+ billboard.show = new ConstantProperty(true);
+ billboard.image = new ConstantProperty('Data/Images/Blue.png');
visualizer.update(new JulianDate());
var billboardCollection = scene.getPrimitives().get(0);
@@ -115,9 +115,9 @@ defineSuite([
visualizer = new DynamicBillboardVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
var billboard = testObject.billboard = new DynamicBillboard();
- billboard.show = new MockProperty(true);
+ billboard.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
var billboardCollection = scene.getPrimitives().get(0);
@@ -138,17 +138,17 @@ defineSuite([
var bb;
runs(function() {
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- billboard.show = new MockProperty(true);
- billboard.color = new MockProperty(new Color(0.5, 0.5, 0.5, 0.5));
- billboard.image = new MockProperty('Data/Images/Blue.png');
- billboard.eyeOffset = new MockProperty(new Cartesian3(1.0, 2.0, 3.0));
- billboard.scale = new MockProperty(12.5);
- billboard.rotation = new MockProperty(1.5);
- billboard.alignedAxis = new MockProperty(Cartesian3.UNIT_Z);
- billboard.horizontalOrigin = new MockProperty(HorizontalOrigin.RIGHT);
- billboard.verticalOrigin = new MockProperty(VerticalOrigin.TOP);
- billboard.pixelOffset = new MockProperty(new Cartesian2(3, 2));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ billboard.show = new ConstantProperty(true);
+ billboard.color = new ConstantProperty(new Color(0.5, 0.5, 0.5, 0.5));
+ billboard.image = new ConstantProperty('Data/Images/Blue.png');
+ billboard.eyeOffset = new ConstantProperty(new Cartesian3(1.0, 2.0, 3.0));
+ billboard.scale = new ConstantProperty(12.5);
+ billboard.rotation = new ConstantProperty(1.5);
+ billboard.alignedAxis = new ConstantProperty(Cartesian3.UNIT_Z);
+ billboard.horizontalOrigin = new ConstantProperty(HorizontalOrigin.RIGHT);
+ billboard.verticalOrigin = new ConstantProperty(VerticalOrigin.TOP);
+ billboard.pixelOffset = new ConstantProperty(new Cartesian2(3, 2));
visualizer.update(time);
@@ -174,17 +174,17 @@ defineSuite([
});
runs(function() {
- testObject.position = new MockProperty(new Cartesian3(5678, 1234, 1293434));
- billboard.show = new MockProperty(true);
- billboard.color = new MockProperty(new Color(0.15, 0.25, 0.35, 0.45));
- billboard.image = new MockProperty('Data/Images/Green.png');
- billboard.eyeOffset = new MockProperty(new Cartesian3(2.0, 3.0, 1.0));
- billboard.scale = new MockProperty(2.5);
- billboard.rotation = new MockProperty(2.9);
- billboard.alignedAxis = new MockProperty(Cartesian3.UNIT_Y);
- billboard.horizontalOrigin = new MockProperty(HorizontalOrigin.LEFT);
- billboard.verticalOrigin = new MockProperty(VerticalOrigin.BOTTOM);
- billboard.pixelOffset = new MockProperty(new Cartesian2(2, 3));
+ testObject.position = new ConstantProperty(new Cartesian3(5678, 1234, 1293434));
+ billboard.show = new ConstantProperty(true);
+ billboard.color = new ConstantProperty(new Color(0.15, 0.25, 0.35, 0.45));
+ billboard.image = new ConstantProperty('Data/Images/Green.png');
+ billboard.eyeOffset = new ConstantProperty(new Cartesian3(2.0, 3.0, 1.0));
+ billboard.scale = new ConstantProperty(2.5);
+ billboard.rotation = new ConstantProperty(2.9);
+ billboard.alignedAxis = new ConstantProperty(Cartesian3.UNIT_Y);
+ billboard.horizontalOrigin = new ConstantProperty(HorizontalOrigin.LEFT);
+ billboard.verticalOrigin = new ConstantProperty(VerticalOrigin.BOTTOM);
+ billboard.pixelOffset = new ConstantProperty(new Cartesian2(2, 3));
waitsFor(function() {
visualizer.update(time);
@@ -205,7 +205,7 @@ defineSuite([
});
runs(function() {
- billboard.show = new MockProperty(false);
+ billboard.show = new ConstantProperty(false);
waitsFor(function() {
visualizer.update(time);
@@ -226,9 +226,9 @@ defineSuite([
var time = new JulianDate();
var billboard = testObject.billboard = new DynamicBillboard();
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- billboard.show = new MockProperty(true);
- billboard.image = new MockProperty('Data/Images/Blue.png');
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ billboard.show = new ConstantProperty(true);
+ billboard.image = new ConstantProperty('Data/Images/Blue.png');
visualizer.update(time);
expect(billboardCollection.getLength()).toEqual(1);
var bb = billboardCollection.get(0);
@@ -258,9 +258,9 @@ defineSuite([
var time = new JulianDate();
var billboard = testObject.billboard = new DynamicBillboard();
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- billboard.show = new MockProperty(true);
- billboard.image = new MockProperty('Data/Images/Blue.png');
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ billboard.show = new ConstantProperty(true);
+ billboard.image = new ConstantProperty('Data/Images/Blue.png');
visualizer.update(time);
expect(billboardCollection.getLength()).toEqual(1);
var bb = billboardCollection.get(0);
@@ -270,17 +270,17 @@ defineSuite([
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
testObject.billboard = new DynamicBillboard();
- testObject.billboard.show = new MockProperty(true);
- testObject.billboard.image = new MockProperty('Data/Images/Blue.png');
+ testObject.billboard.show = new ConstantProperty(true);
+ testObject.billboard.image = new ConstantProperty('Data/Images/Blue.png');
var dynamicObjectCollection2 = new DynamicObjectCollection();
var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.position = new MockProperty(new Cartesian3(5678, 9101112, 1234));
+ testObject2.position = new ConstantProperty(new Cartesian3(5678, 9101112, 1234));
testObject2.billboard = new DynamicBillboard();
- testObject2.billboard.show = new MockProperty(true);
- testObject2.billboard.image = new MockProperty('Data/Images/Green.png');
+ testObject2.billboard.show = new ConstantProperty(true);
+ testObject2.billboard.image = new ConstantProperty('Data/Images/Green.png');
visualizer = new DynamicBillboardVisualizer(scene, dynamicObjectCollection);
diff --git a/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js b/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
index 304bbad0c9d7..119e034193b1 100644
--- a/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
+++ b/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
@@ -5,7 +5,7 @@ defineSuite([
'Core/Matrix4',
'Specs/createScene',
'Specs/destroyScene',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
'DynamicScene/DynamicCone',
'DynamicScene/DynamicObjectCollection',
'DynamicScene/DynamicObject',
@@ -22,7 +22,7 @@ defineSuite([
Matrix4,
createScene,
destroyScene,
- MockProperty,
+ ConstantProperty,
DynamicCone,
DynamicObjectCollection,
DynamicObject,
@@ -90,8 +90,8 @@ defineSuite([
visualizer = new DynamicConeVisualizerUsingCustomSensor(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -101,10 +101,10 @@ defineSuite([
visualizer = new DynamicConeVisualizerUsingCustomSensor(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var cone = testObject.cone = new DynamicCone();
- cone.maximumClockAngle = new MockProperty(1);
- cone.outerHalfAngle = new MockProperty(1);
+ cone.maximumClockAngle = new ConstantProperty(1);
+ cone.outerHalfAngle = new ConstantProperty(1);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -114,10 +114,10 @@ defineSuite([
visualizer = new DynamicConeVisualizerUsingCustomSensor(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
var cone = testObject.cone = new DynamicCone();
- cone.maximumClockAngle = new MockProperty(1);
- cone.outerHalfAngle = new MockProperty(1);
+ cone.maximumClockAngle = new ConstantProperty(1);
+ cone.outerHalfAngle = new ConstantProperty(1);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -128,23 +128,23 @@ defineSuite([
visualizer = new DynamicConeVisualizerUsingCustomSensor(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var cone = testObject.cone = new DynamicCone();
- cone.minimumClockAngle = new MockProperty(0.1);
- cone.maximumClockAngle = new MockProperty(0.2);
- cone.innerHalfAngle = new MockProperty(0.3);
- cone.outerHalfAngle = new MockProperty(0.4);
- cone.intersectionColor = new MockProperty(new Color(0.1, 0.2, 0.3, 0.4));
- cone.intersectionWidth = new MockProperty(0.5);
- cone.showIntersection = new MockProperty(true);
- cone.radius = new MockProperty(123.5);
- cone.show = new MockProperty(true);
+ cone.minimumClockAngle = new ConstantProperty(0.1);
+ cone.maximumClockAngle = new ConstantProperty(0.2);
+ cone.innerHalfAngle = new ConstantProperty(0.3);
+ cone.outerHalfAngle = new ConstantProperty(0.4);
+ cone.intersectionColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ cone.intersectionWidth = new ConstantProperty(0.5);
+ cone.showIntersection = new ConstantProperty(true);
+ cone.radius = new ConstantProperty(123.5);
+ cone.show = new ConstantProperty(true);
var blueMaterial = Material.fromType(scene.getContext(), Material.ColorType);
blueMaterial.uniforms.color = Color.BLUE;
- cone.outerMaterial = new MockProperty(blueMaterial);
+ cone.outerMaterial = new ConstantProperty(blueMaterial);
visualizer.update(time);
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -172,18 +172,18 @@ defineSuite([
visualizer = new DynamicConeVisualizerUsingCustomSensor(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var testObject2 = dynamicObjectCollection.getOrCreateObject('test2');
- testObject2.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject2.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject2.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject2.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var cone = testObject.cone = new DynamicCone();
- cone.intersectionColor = new MockProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ cone.intersectionColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
var cone2 = testObject2.cone = new DynamicCone();
- cone2.intersectionColor = new MockProperty(new Color(0.4, 0.3, 0.2, 0.1));
+ cone2.intersectionColor = new ConstantProperty(new Color(0.4, 0.3, 0.2, 0.1));
visualizer.update(time);
@@ -201,8 +201,8 @@ defineSuite([
visualizer = new DynamicConeVisualizerUsingCustomSensor(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
testObject.cone = new DynamicCone();
visualizer.update(time);
@@ -222,11 +222,11 @@ defineSuite([
visualizer = new DynamicConeVisualizerUsingCustomSensor(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var cone = testObject.cone = new DynamicCone();
- cone.maximumClockAngle = new MockProperty(1);
- cone.outerHalfAngle = new MockProperty(1);
+ cone.maximumClockAngle = new ConstantProperty(1);
+ cone.outerHalfAngle = new ConstantProperty(1);
var time = new JulianDate();
expect(scene.getPrimitives().getLength()).toEqual(0);
@@ -244,11 +244,11 @@ defineSuite([
visualizer = new DynamicConeVisualizerUsingCustomSensor(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var cone = testObject.cone = new DynamicCone();
- cone.maximumClockAngle = new MockProperty(1);
- cone.outerHalfAngle = new MockProperty(1);
+ cone.maximumClockAngle = new ConstantProperty(1);
+ cone.outerHalfAngle = new ConstantProperty(1);
var time = new JulianDate();
visualizer.update(time);
@@ -258,19 +258,19 @@ defineSuite([
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var cone = testObject.cone = new DynamicCone();
- cone.maximumClockAngle = new MockProperty(1);
- cone.outerHalfAngle = new MockProperty(1);
+ cone.maximumClockAngle = new ConstantProperty(1);
+ cone.outerHalfAngle = new ConstantProperty(1);
var dynamicObjectCollection2 = new DynamicObjectCollection();
var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.position = new MockProperty(new Cartesian3(5678, 9101112, 1234));
- testObject2.orientation = new MockProperty(new Quaternion(1, 0, 0, 0));
+ testObject2.position = new ConstantProperty(new Cartesian3(5678, 9101112, 1234));
+ testObject2.orientation = new ConstantProperty(new Quaternion(1, 0, 0, 0));
var cone2 = testObject2.cone = new DynamicCone();
- cone2.maximumClockAngle = new MockProperty(0.12);
- cone2.outerHalfAngle = new MockProperty(1.1);
+ cone2.maximumClockAngle = new ConstantProperty(0.12);
+ cone2.outerHalfAngle = new ConstantProperty(1.1);
visualizer = new DynamicConeVisualizerUsingCustomSensor(scene, dynamicObjectCollection);
diff --git a/Specs/DynamicScene/DynamicEllipseSpec.js b/Specs/DynamicScene/DynamicEllipseSpec.js
index 4ed05f017836..bf57c892b069 100644
--- a/Specs/DynamicScene/DynamicEllipseSpec.js
+++ b/Specs/DynamicScene/DynamicEllipseSpec.js
@@ -8,7 +8,7 @@ defineSuite([
'Core/Cartesian3',
'Core/Iso8601',
'Core/TimeInterval',
- 'Specs/MockProperty'
+ 'DynamicScene/ConstantProperty'
], function(
DynamicEllipse,
DynamicObject,
@@ -18,22 +18,22 @@ defineSuite([
Cartesian3,
Iso8601,
TimeInterval,
- MockProperty) {
+ ConstantProperty) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
var position = new Cartesian3(1234, 5678, 9101112);
it('mergeProperties does not change a fully configured ellipse', function() {
- var expectedSemiMajorAxis = new MockProperty();
- var expectedSemiMinorAxis = new MockProperty();
- var expectedBearing = new MockProperty();
+ var expectedSemiMajorAxis = new ConstantProperty(1);
+ var expectedSemiMinorAxis = new ConstantProperty(2);
+ var expectedBearing = new ConstantProperty(3);
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.ellipse = new DynamicEllipse();
- objectToMerge.semiMajorAxis = new MockProperty();
- objectToMerge.semiMinorAxis = new MockProperty();
- objectToMerge.bearing = new MockProperty();
+ objectToMerge.semiMajorAxis = new ConstantProperty(4);
+ objectToMerge.semiMinorAxis = new ConstantProperty(5);
+ objectToMerge.bearing = new ConstantProperty(6);
var mergedObject = new DynamicObject('mergedObject');
mergedObject.ellipse = new DynamicEllipse();
@@ -43,31 +43,31 @@ defineSuite([
DynamicEllipse.mergeProperties(mergedObject, objectToMerge);
- expect(mergedObject.ellipse.semiMajorAxis).toEqual(expectedSemiMajorAxis);
- expect(mergedObject.ellipse.semiMinorAxis).toEqual(expectedSemiMinorAxis);
- expect(mergedObject.ellipse.bearing).toEqual(expectedBearing);
+ expect(mergedObject.ellipse.semiMajorAxis).toBe(expectedSemiMajorAxis);
+ expect(mergedObject.ellipse.semiMinorAxis).toBe(expectedSemiMinorAxis);
+ expect(mergedObject.ellipse.bearing).toBe(expectedBearing);
});
it('mergeProperties creates and configures an undefined ellipse', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.ellipse = new DynamicEllipse();
- objectToMerge.semiMajorAxis = new MockProperty();
- objectToMerge.semiMinorAxis = new MockProperty();
- objectToMerge.bearing = new MockProperty();
+ objectToMerge.semiMajorAxis = new ConstantProperty(1);
+ objectToMerge.semiMinorAxis = new ConstantProperty(2);
+ objectToMerge.bearing = new ConstantProperty(3);
var mergedObject = new DynamicObject('mergedObject');
DynamicEllipse.mergeProperties(mergedObject, objectToMerge);
- expect(mergedObject.ellipse.semiMajorAxis).toEqual(objectToMerge.ellipse.semiMajorAxis);
- expect(mergedObject.ellipse.semiMinorAxis).toEqual(objectToMerge.ellipse.semiMinorAxis);
- expect(mergedObject.ellipse.bearing).toEqual(objectToMerge.ellipse.bearing);
+ expect(mergedObject.ellipse.semiMajorAxis).toBe(objectToMerge.ellipse.semiMajorAxis);
+ expect(mergedObject.ellipse.semiMinorAxis).toBe(objectToMerge.ellipse.semiMinorAxis);
+ expect(mergedObject.ellipse.bearing).toBe(objectToMerge.ellipse.bearing);
});
it('mergeProperties does not change when used with an undefined ellipse', function() {
- var expectedSemiMajorAxis = new MockProperty();
- var expectedSemiMinorAxis = new MockProperty();
- var expectedBearing = new MockProperty();
+ var expectedSemiMajorAxis = new ConstantProperty(1);
+ var expectedSemiMinorAxis = new ConstantProperty(2);
+ var expectedBearing = new ConstantProperty(3);
var objectToMerge = new DynamicObject('objectToMerge');
var mergedObject = new DynamicObject('mergedObject');
@@ -78,9 +78,9 @@ defineSuite([
DynamicEllipse.mergeProperties(mergedObject, objectToMerge);
- expect(mergedObject.ellipse.semiMajorAxis).toEqual(expectedSemiMajorAxis);
- expect(mergedObject.ellipse.semiMinorAxis).toEqual(expectedSemiMinorAxis);
- expect(mergedObject.ellipse.bearing).toEqual(expectedBearing);
+ expect(mergedObject.ellipse.semiMajorAxis).toBe(expectedSemiMajorAxis);
+ expect(mergedObject.ellipse.semiMinorAxis).toBe(expectedSemiMinorAxis);
+ expect(mergedObject.ellipse.bearing).toBe(expectedBearing);
});
it('undefineProperties works', function() {
@@ -98,24 +98,24 @@ defineSuite([
it('getValue with no semiMajorAxis returns undefined', function() {
var ellipse = new DynamicEllipse();
ellipse = new DynamicEllipse();
- ellipse.bearing = new MockProperty(0);
- ellipse.semiMinorAxis = new MockProperty(10);
+ ellipse.bearing = new ConstantProperty(0);
+ ellipse.semiMinorAxis = new ConstantProperty(10);
ellipse.semiMajorAxis = undefined;
expect(ellipse.getValue(new JulianDate(), position)).toBeUndefined();
- ellipse.semiMajorAxis = new MockProperty(undefined);
+ ellipse.semiMajorAxis = new ConstantProperty(undefined);
expect(ellipse.getValue(new JulianDate(), position)).toBeUndefined();
});
it('getValue with no semiMinorAxis returns undefined', function() {
var ellipse = new DynamicEllipse();
ellipse = new DynamicEllipse();
- ellipse.bearing = new MockProperty(0);
+ ellipse.bearing = new ConstantProperty(0);
ellipse.semiMinorAxis = undefined;
- ellipse.semiMajorAxis = new MockProperty(10);
+ ellipse.semiMajorAxis = new ConstantProperty(10);
expect(ellipse.getValue(new JulianDate(), position)).toBeUndefined();
- ellipse.semiMinorAxis = new MockProperty(undefined);
+ ellipse.semiMinorAxis = new ConstantProperty(undefined);
expect(ellipse.getValue(new JulianDate(), position)).toBeUndefined();
});
@@ -126,15 +126,15 @@ defineSuite([
var ellipse = new DynamicEllipse();
ellipse = new DynamicEllipse();
- ellipse.semiMinorAxis = new MockProperty(semiMinor);
- ellipse.semiMajorAxis = new MockProperty(semiMajor);
+ ellipse.semiMinorAxis = new ConstantProperty(semiMinor);
+ ellipse.semiMajorAxis = new ConstantProperty(semiMajor);
ellipse.bearing = undefined;
var expected = Shapes.computeEllipseBoundary(Ellipsoid.WGS84, position, semiMajor, semiMinor, bearing);
var result = ellipse.getValue(new JulianDate(), position);
expect(result).toEqual(expected);
- ellipse.bearing = new MockProperty(undefined);
+ ellipse.bearing = new ConstantProperty(undefined);
result = ellipse.getValue(new JulianDate(), position);
expect(result).toEqual(expected);
});
@@ -146,9 +146,9 @@ defineSuite([
var ellipse = new DynamicEllipse();
ellipse = new DynamicEllipse();
- ellipse.semiMinorAxis = new MockProperty(semiMinor);
- ellipse.semiMajorAxis = new MockProperty(semiMajor);
- ellipse.bearing = new MockProperty(bearing);
+ ellipse.semiMinorAxis = new ConstantProperty(semiMinor);
+ ellipse.semiMajorAxis = new ConstantProperty(semiMajor);
+ ellipse.bearing = new ConstantProperty(bearing);
var expected = Shapes.computeEllipseBoundary(Ellipsoid.WGS84, position, semiMajor, semiMinor, bearing);
var result = ellipse.getValue(new JulianDate(), position);
@@ -158,15 +158,15 @@ defineSuite([
it('getValue caches results.', function() {
var ellipse = new DynamicEllipse();
ellipse = new DynamicEllipse();
- ellipse.semiMinorAxis = new MockProperty(10);
- ellipse.semiMajorAxis = new MockProperty(20);
- ellipse.bearing = new MockProperty(50);
+ ellipse.semiMinorAxis = new ConstantProperty(10);
+ ellipse.semiMajorAxis = new ConstantProperty(20);
+ ellipse.bearing = new ConstantProperty(50);
var result1 = ellipse.getValue(new JulianDate(), position);
var result2 = ellipse.getValue(new JulianDate(), position);
expect(result1).toBe(result2);
- ellipse.bearing = new MockProperty(75);
+ ellipse.bearing = new ConstantProperty(75);
result2 = ellipse.getValue(new JulianDate(), position);
expect(result1).toNotBe(result2);
});
diff --git a/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js b/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js
index 7c2d75605ddb..e67f0b10be87 100644
--- a/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js
@@ -3,7 +3,7 @@ defineSuite([
'DynamicScene/DynamicEllipsoidVisualizer',
'Specs/createScene',
'Specs/destroyScene',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
'Core/JulianDate',
'Core/Matrix3',
'Core/Matrix4',
@@ -18,7 +18,7 @@ defineSuite([
DynamicEllipsoidVisualizer,
createScene,
destroyScene,
- MockProperty,
+ ConstantProperty,
JulianDate,
Matrix3,
Matrix4,
@@ -86,8 +86,8 @@ defineSuite([
visualizer = new DynamicEllipsoidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -97,9 +97,9 @@ defineSuite([
visualizer = new DynamicEllipsoidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var ellipsoid = testObject.ellipsoid = new DynamicEllipsoid();
- ellipsoid.radii = new MockProperty(new Cartesian3(1, 2, 3));
+ ellipsoid.radii = new ConstantProperty(new Cartesian3(1, 2, 3));
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -109,8 +109,8 @@ defineSuite([
visualizer = new DynamicEllipsoidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
testObject.ellipsoid = new DynamicEllipsoid();
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
@@ -121,9 +121,9 @@ defineSuite([
visualizer = new DynamicEllipsoidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
testObject.ellipsoid = new DynamicEllipsoid();
- testObject.ellipsoid.radii = new MockProperty(new Cartesian3(1, 2, 3));
+ testObject.ellipsoid.radii = new ConstantProperty(new Cartesian3(1, 2, 3));
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -134,16 +134,16 @@ defineSuite([
visualizer = new DynamicEllipsoidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var ellipsoid = testObject.ellipsoid = new DynamicEllipsoid();
- ellipsoid.directions = new MockProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
- ellipsoid.radii = new MockProperty(123.5);
- ellipsoid.show = new MockProperty(true);
+ ellipsoid.directions = new ConstantProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
+ ellipsoid.radii = new ConstantProperty(123.5);
+ ellipsoid.show = new ConstantProperty(true);
var redMaterial = Material.fromType(scene.getContext(), Material.ColorType);
redMaterial.uniforms.color = Color.RED;
- ellipsoid.material = new MockProperty(redMaterial);
+ ellipsoid.material = new ConstantProperty(redMaterial);
visualizer.update(time);
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -163,10 +163,10 @@ defineSuite([
visualizer = new DynamicEllipsoidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var ellipsoid = testObject.ellipsoid = new DynamicEllipsoid();
- ellipsoid.radii = new MockProperty(new Cartesian3(1, 2, 3));
+ ellipsoid.radii = new ConstantProperty(new Cartesian3(1, 2, 3));
var time = new JulianDate();
expect(scene.getPrimitives().getLength()).toEqual(0);
@@ -184,10 +184,10 @@ defineSuite([
visualizer = new DynamicEllipsoidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var ellipsoid = testObject.ellipsoid = new DynamicEllipsoid();
- ellipsoid.radii = new MockProperty(new Cartesian3(1, 2, 3));
+ ellipsoid.radii = new ConstantProperty(new Cartesian3(1, 2, 3));
var time = new JulianDate();
visualizer.update(time);
@@ -197,17 +197,17 @@ defineSuite([
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var ellipsoid = testObject.ellipsoid = new DynamicEllipsoid();
- ellipsoid.radii = new MockProperty(new Cartesian3(1, 2, 3));
+ ellipsoid.radii = new ConstantProperty(new Cartesian3(1, 2, 3));
var dynamicObjectCollection2 = new DynamicObjectCollection();
var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.position = new MockProperty(new Cartesian3(5678, 9101112, 1234));
- testObject2.orientation = new MockProperty(new Quaternion(1, 0, 0, 0));
+ testObject2.position = new ConstantProperty(new Cartesian3(5678, 9101112, 1234));
+ testObject2.orientation = new ConstantProperty(new Quaternion(1, 0, 0, 0));
var ellipsoid2 = testObject2.ellipsoid = new DynamicEllipsoid();
- ellipsoid2.radii = new MockProperty(new Cartesian3(4, 5, 6));
+ ellipsoid2.radii = new ConstantProperty(new Cartesian3(4, 5, 6));
visualizer = new DynamicEllipsoidVisualizer(scene, dynamicObjectCollection);
diff --git a/Specs/DynamicScene/DynamicLabelSpec.js b/Specs/DynamicScene/DynamicLabelSpec.js
index 09aa5c7b7a28..2c4c73cc3635 100644
--- a/Specs/DynamicScene/DynamicLabelSpec.js
+++ b/Specs/DynamicScene/DynamicLabelSpec.js
@@ -11,7 +11,7 @@ defineSuite([
'Scene/HorizontalOrigin',
'Scene/VerticalOrigin',
'Scene/LabelStyle',
- 'Specs/MockProperty'
+ 'DynamicScene/ConstantProperty'
], function(
DynamicLabel,
DynamicObject,
@@ -24,38 +24,38 @@ defineSuite([
HorizontalOrigin,
VerticalOrigin,
LabelStyle,
- MockProperty) {
+ ConstantProperty) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
it('mergeProperties does not change a fully configured label', function() {
- var expectedText = new MockProperty();
- var expectedFont = new MockProperty();
- var expectedStyle = new MockProperty();
- var expectedFillColor = new MockProperty();
- var expectedOutlineColor = new MockProperty();
- var expectedOutlineWidth = new MockProperty();
- var expectedHorizontalOrigin = new MockProperty();
- var expectedVerticalOrigin = new MockProperty();
- var expectedEyeOffset = new MockProperty();
- var expectedPixelOffset = new MockProperty();
- var expectedScale = new MockProperty();
- var expectedShow = new MockProperty();
+ var expectedText = new ConstantProperty('my text');
+ var expectedFont = new ConstantProperty('10px serif');
+ var expectedStyle = new ConstantProperty(LabelStyle.OUTLINE);
+ var expectedFillColor = new ConstantProperty(Color.RED);
+ var expectedOutlineColor = new ConstantProperty(Color.WHITE);
+ var expectedOutlineWidth = new ConstantProperty(4);
+ var expectedHorizontalOrigin = new ConstantProperty(HorizontalOrigin.RIGHT);
+ var expectedVerticalOrigin = new ConstantProperty(VerticalOrigin.TOP);
+ var expectedEyeOffset = new ConstantProperty(Cartesian3.UNIT_Z);
+ var expectedPixelOffset = new ConstantProperty(Cartesian2.UNIY_Y);
+ var expectedScale = new ConstantProperty(2);
+ var expectedShow = new ConstantProperty(true);
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.label = new DynamicLabel();
- objectToMerge.label.text = new MockProperty();
- objectToMerge.label.font = new MockProperty();
- objectToMerge.label.style = new MockProperty();
- objectToMerge.label.fillColor = new MockProperty();
- objectToMerge.label.outlineColor = new MockProperty();
- objectToMerge.label.outlineWidth = new MockProperty();
- objectToMerge.label.horizontalOrigin = new MockProperty();
- objectToMerge.label.verticalOrigin = new MockProperty();
- objectToMerge.label.eyeOffset = new MockProperty();
- objectToMerge.label.pixelOffset = new MockProperty();
- objectToMerge.label.scale = new MockProperty();
- objectToMerge.label.show = new MockProperty();
+ objectToMerge.label.text = new ConstantProperty('not it');
+ objectToMerge.label.font = new ConstantProperty('arial');
+ objectToMerge.label.style = new ConstantProperty(LabelStyle.FILL);
+ objectToMerge.label.fillColor = new ConstantProperty(Color.BLACK);
+ objectToMerge.label.outlineColor = new ConstantProperty(Color.BLUE);
+ objectToMerge.label.outlineWidth = new ConstantProperty(5);
+ objectToMerge.label.horizontalOrigin = new ConstantProperty(HorizontalOrigin.LEFT);
+ objectToMerge.label.verticalOrigin = new ConstantProperty(VerticalOrigin.BOTTOM);
+ objectToMerge.label.eyeOffset = new ConstantProperty(Cartesian3.UNIY_Y);
+ objectToMerge.label.pixelOffset = new ConstantProperty(Cartesian2.UNIY_X);
+ objectToMerge.label.scale = new ConstantProperty(1);
+ objectToMerge.label.show = new ConstantProperty(false);
var targetObject = new DynamicObject('targetObject');
targetObject.label = new DynamicLabel();
@@ -91,18 +91,18 @@ defineSuite([
it('mergeProperties creates and configures an undefined label', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.label = new DynamicLabel();
- objectToMerge.label.text = new MockProperty();
- objectToMerge.label.font = new MockProperty();
- objectToMerge.label.style = new MockProperty();
- objectToMerge.label.fillColor = new MockProperty();
- objectToMerge.label.outlineColor = new MockProperty();
- objectToMerge.label.outlineWidth = new MockProperty();
- objectToMerge.label.horizontalOrigin = new MockProperty();
- objectToMerge.label.verticalOrigin = new MockProperty();
- objectToMerge.label.eyeOffset = new MockProperty();
- objectToMerge.label.pixelOffset = new MockProperty();
- objectToMerge.label.scale = new MockProperty();
- objectToMerge.label.show = new MockProperty();
+ objectToMerge.label.text = new ConstantProperty('not it');
+ objectToMerge.label.font = new ConstantProperty('arial');
+ objectToMerge.label.style = new ConstantProperty(LabelStyle.FILL);
+ objectToMerge.label.fillColor = new ConstantProperty(Color.BLACK);
+ objectToMerge.label.outlineColor = new ConstantProperty(Color.BLUE);
+ objectToMerge.label.outlineWidth = new ConstantProperty(5);
+ objectToMerge.label.horizontalOrigin = new ConstantProperty(HorizontalOrigin.LEFT);
+ objectToMerge.label.verticalOrigin = new ConstantProperty(VerticalOrigin.BOTTOM);
+ objectToMerge.label.eyeOffset = new ConstantProperty(Cartesian3.UNIY_Y);
+ objectToMerge.label.pixelOffset = new ConstantProperty(Cartesian2.UNIY_X);
+ objectToMerge.label.scale = new ConstantProperty(1);
+ objectToMerge.label.show = new ConstantProperty(false);
var targetObject = new DynamicObject('targetObject');
@@ -123,18 +123,18 @@ defineSuite([
});
it('mergeProperties does not change when used with an undefined label', function() {
- var expectedText = new MockProperty();
- var expectedFont = new MockProperty();
- var expectedStyle = new MockProperty();
- var expectedFillColor = new MockProperty();
- var expectedOutlineColor = new MockProperty();
- var expectedOutlineWidth = new MockProperty();
- var expectedHorizontalOrigin = new MockProperty();
- var expectedVerticalOrigin = new MockProperty();
- var expectedEyeOffset = new MockProperty();
- var expectedPixelOffset = new MockProperty();
- var expectedScale = new MockProperty();
- var expectedShow = new MockProperty();
+ var expectedText = new ConstantProperty('my text');
+ var expectedFont = new ConstantProperty('10px serif');
+ var expectedStyle = new ConstantProperty(LabelStyle.OUTLINE);
+ var expectedFillColor = new ConstantProperty(Color.RED);
+ var expectedOutlineColor = new ConstantProperty(Color.WHITE);
+ var expectedOutlineWidth = new ConstantProperty(4);
+ var expectedHorizontalOrigin = new ConstantProperty(HorizontalOrigin.RIGHT);
+ var expectedVerticalOrigin = new ConstantProperty(VerticalOrigin.TOP);
+ var expectedEyeOffset = new ConstantProperty(Cartesian3.UNIT_Z);
+ var expectedPixelOffset = new ConstantProperty(Cartesian2.UNIY_Y);
+ var expectedScale = new ConstantProperty(2);
+ var expectedShow = new ConstantProperty(true);
var objectToMerge = new DynamicObject('objectToMerge');
diff --git a/Specs/DynamicScene/DynamicLabelVisualizerSpec.js b/Specs/DynamicScene/DynamicLabelVisualizerSpec.js
index 1ac09902534a..e189fbd6ee06 100644
--- a/Specs/DynamicScene/DynamicLabelVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicLabelVisualizerSpec.js
@@ -3,7 +3,7 @@ defineSuite([
'DynamicScene/DynamicLabelVisualizer',
'Specs/createScene',
'Specs/destroyScene',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
'DynamicScene/DynamicLabel',
'DynamicScene/DynamicObjectCollection',
'Core/JulianDate',
@@ -18,7 +18,7 @@ defineSuite([
DynamicLabelVisualizer,
createScene,
destroyScene,
- MockProperty,
+ ConstantProperty,
DynamicLabel,
DynamicObjectCollection,
JulianDate,
@@ -88,7 +88,7 @@ defineSuite([
visualizer = new DynamicLabelVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
visualizer.update(new JulianDate());
var labelCollection = scene.getPrimitives().get(0);
expect(labelCollection.getLength()).toEqual(0);
@@ -100,8 +100,8 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var label = testObject.label = new DynamicLabel();
- label.show = new MockProperty(true);
- label.text = new MockProperty('lorum ipsum');
+ label.show = new ConstantProperty(true);
+ label.text = new ConstantProperty('lorum ipsum');
visualizer.update(new JulianDate());
var labelCollection = scene.getPrimitives().get(0);
@@ -113,9 +113,9 @@ defineSuite([
visualizer = new DynamicLabelVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
var label = testObject.label = new DynamicLabel();
- label.show = new MockProperty(true);
+ label.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
var labelCollection = scene.getPrimitives().get(0);
@@ -135,19 +135,19 @@ defineSuite([
var label = testObject.label = new DynamicLabel();
var l;
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- label.text = new MockProperty('a');
- label.font = new MockProperty('sans serif');
- label.style = new MockProperty(LabelStyle.FILL);
- label.fillColor = new MockProperty(new Color(0.5, 0.8, 0.6, 0.7));
- label.outlineColor = new MockProperty(new Color(0.4, 0.3, 0.2, 0.1));
- label.outlineWidth = new MockProperty(4.5);
- label.horizontalOrigin = new MockProperty(HorizontalOrigin.RIGHT);
- label.verticalOrigin = new MockProperty(VerticalOrigin.TOP);
- label.eyeOffset = new MockProperty(new Cartesian3(1.0, 2.0, 3.0));
- label.pixelOffset = new MockProperty(new Cartesian2(3, 2));
- label.scale = new MockProperty(12.5);
- label.show = new MockProperty(true);
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ label.text = new ConstantProperty('a');
+ label.font = new ConstantProperty('sans serif');
+ label.style = new ConstantProperty(LabelStyle.FILL);
+ label.fillColor = new ConstantProperty(new Color(0.5, 0.8, 0.6, 0.7));
+ label.outlineColor = new ConstantProperty(new Color(0.4, 0.3, 0.2, 0.1));
+ label.outlineWidth = new ConstantProperty(4.5);
+ label.horizontalOrigin = new ConstantProperty(HorizontalOrigin.RIGHT);
+ label.verticalOrigin = new ConstantProperty(VerticalOrigin.TOP);
+ label.eyeOffset = new ConstantProperty(new Cartesian3(1.0, 2.0, 3.0));
+ label.pixelOffset = new ConstantProperty(new Cartesian2(3, 2));
+ label.scale = new ConstantProperty(12.5);
+ label.show = new ConstantProperty(true);
visualizer.update(time);
@@ -170,19 +170,19 @@ defineSuite([
expect(l.getScale()).toEqual(testObject.label.scale.getValue(time));
expect(l.getShow()).toEqual(testObject.label.show.getValue(time));
- testObject.position = new MockProperty(new Cartesian3(5678, 1234, 1293434));
- label.text = new MockProperty('b');
- label.font = new MockProperty('serif');
- label.style = new MockProperty(LabelStyle.FILL_AND_OUTLINE);
- label.fillColor = new MockProperty(new Color(0.1, 0.2, 0.3, 0.4));
- label.outlineColor = new MockProperty(new Color(0.8, 0.7, 0.6, 0.5));
- label.outlineWidth = new MockProperty(0.5);
- label.horizontalOrigin = new MockProperty(HorizontalOrigin.CENTER);
- label.verticalOrigin = new MockProperty(VerticalOrigin.BOTTOM);
- label.eyeOffset = new MockProperty(new Cartesian3(3.0, 1.0, 2.0));
- label.pixelOffset = new MockProperty(new Cartesian2(2, 3));
- label.scale = new MockProperty(2.5);
- label.show = new MockProperty(true);
+ testObject.position = new ConstantProperty(new Cartesian3(5678, 1234, 1293434));
+ label.text = new ConstantProperty('b');
+ label.font = new ConstantProperty('serif');
+ label.style = new ConstantProperty(LabelStyle.FILL_AND_OUTLINE);
+ label.fillColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ label.outlineColor = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ label.outlineWidth = new ConstantProperty(0.5);
+ label.horizontalOrigin = new ConstantProperty(HorizontalOrigin.CENTER);
+ label.verticalOrigin = new ConstantProperty(VerticalOrigin.BOTTOM);
+ label.eyeOffset = new ConstantProperty(new Cartesian3(3.0, 1.0, 2.0));
+ label.pixelOffset = new ConstantProperty(new Cartesian2(2, 3));
+ label.scale = new ConstantProperty(2.5);
+ label.show = new ConstantProperty(true);
visualizer.update(time);
expect(l.getPosition()).toEqual(testObject.position.getValue(time));
@@ -199,7 +199,7 @@ defineSuite([
expect(l.getScale()).toEqual(testObject.label.scale.getValue(time));
expect(l.getShow()).toEqual(testObject.label.show.getValue(time));
- label.show = new MockProperty(false);
+ label.show = new ConstantProperty(false);
visualizer.update(time);
});
@@ -215,9 +215,9 @@ defineSuite([
var time = new JulianDate();
var label = testObject.label = new DynamicLabel();
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- label.show = new MockProperty(true);
- label.text = new MockProperty('lorum ipsum');
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ label.show = new ConstantProperty(true);
+ label.text = new ConstantProperty('lorum ipsum');
visualizer.update(time);
expect(labelCollection.getLength()).toEqual(1);
@@ -243,9 +243,9 @@ defineSuite([
var time = new JulianDate();
var label = testObject.label = new DynamicLabel();
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- label.show = new MockProperty(true);
- label.text = new MockProperty('lorum ipsum');
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ label.show = new ConstantProperty(true);
+ label.text = new ConstantProperty('lorum ipsum');
visualizer.update(time);
expect(labelCollection.getLength()).toEqual(1);
var l = labelCollection.get(0);
@@ -255,17 +255,17 @@ defineSuite([
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
testObject.label = new DynamicLabel();
- testObject.label.show = new MockProperty(true);
- testObject.label.text = new MockProperty('lorum ipsum');
+ testObject.label.show = new ConstantProperty(true);
+ testObject.label.text = new ConstantProperty('lorum ipsum');
var dynamicObjectCollection2 = new DynamicObjectCollection();
var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.position = new MockProperty(new Cartesian3(5678, 9101112, 1234));
+ testObject2.position = new ConstantProperty(new Cartesian3(5678, 9101112, 1234));
testObject2.label = new DynamicLabel();
- testObject2.label.show = new MockProperty(true);
- testObject2.label.text = new MockProperty('the quick brown');
+ testObject2.label.show = new ConstantProperty(true);
+ testObject2.label.text = new ConstantProperty('the quick brown');
visualizer = new DynamicLabelVisualizer(scene, dynamicObjectCollection);
diff --git a/Specs/DynamicScene/DynamicObjectViewSpec.js b/Specs/DynamicScene/DynamicObjectViewSpec.js
index 66668b16ab5d..b708c0588fe8 100644
--- a/Specs/DynamicScene/DynamicObjectViewSpec.js
+++ b/Specs/DynamicScene/DynamicObjectViewSpec.js
@@ -1,18 +1,20 @@
/*global defineSuite*/
defineSuite([
'DynamicScene/DynamicObjectView',
+ 'Core/Cartesian3',
'Core/Ellipsoid',
'Core/JulianDate',
'DynamicScene/DynamicObject',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantPositionProperty',
'Specs/createScene',
'Specs/destroyScene'
], function(
DynamicObjectView,
+ Cartesian3,
Ellipsoid,
JulianDate,
DynamicObject,
- MockProperty,
+ ConstantPositionProperty,
createScene,
destroyScene) {
"use strict";
@@ -46,7 +48,7 @@ defineSuite([
it('update throws without time parameter', function() {
var dynamicObject = new DynamicObject();
- dynamicObject.position = new MockProperty();
+ dynamicObject.position = new ConstantPositionProperty(Cartesian3.ZERO);
var view = new DynamicObjectView(dynamicObject, scene);
expect(function() {
view.update(undefined);
@@ -63,7 +65,7 @@ defineSuite([
it('update throws without scene property', function() {
var dynamicObject = new DynamicObject();
- dynamicObject.position = new MockProperty();
+ dynamicObject.position = new ConstantPositionProperty(Cartesian3.ZERO);
var view = new DynamicObjectView(dynamicObject, undefined);
expect(function() {
view.update(new JulianDate());
@@ -72,7 +74,7 @@ defineSuite([
it('update throws without ellipsoid property', function() {
var dynamicObject = new DynamicObject();
- dynamicObject.position = new MockProperty();
+ dynamicObject.position = new ConstantPositionProperty(Cartesian3.ZERO);
var view = new DynamicObjectView(dynamicObject, scene);
view.ellipsoid = undefined;
expect(function() {
diff --git a/Specs/DynamicScene/DynamicPathVisualizerSpec.js b/Specs/DynamicScene/DynamicPathVisualizerSpec.js
index 4410c87d411c..1c3aaef0d12c 100644
--- a/Specs/DynamicScene/DynamicPathVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPathVisualizerSpec.js
@@ -3,7 +3,7 @@ defineSuite([
'DynamicScene/DynamicPathVisualizer',
'Specs/createScene',
'Specs/destroyScene',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
'Core/Cartesian3',
'Core/Color',
'Core/JulianDate',
@@ -13,7 +13,7 @@ defineSuite([
DynamicPathVisualizer,
createScene,
destroyScene,
- MockProperty,
+ ConstantProperty,
Cartesian3,
Color,
JulianDate,
@@ -77,7 +77,7 @@ defineSuite([
visualizer = new DynamicPathVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
+ testObject.position = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -88,7 +88,7 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var path = testObject.path = new DynamicPath();
- path.show = new MockProperty(true);
+ path.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
@@ -103,16 +103,16 @@ defineSuite([
expect(scene.getPrimitives().getLength()).toEqual(0);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
+ testObject.position = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
var path = testObject.path = new DynamicPath();
- path.show = new MockProperty(true);
- path.color = new MockProperty(new Color(0.8, 0.7, 0.6, 0.5));
- path.width = new MockProperty(12.5);
- path.outlineColor = new MockProperty(new Color(0.1, 0.2, 0.3, 0.4));
- path.outlineWidth = new MockProperty(2.5);
- path.leadTime = new MockProperty(25);
- path.trailTime = new MockProperty(10);
+ path.show = new ConstantProperty(true);
+ path.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ path.width = new ConstantProperty(12.5);
+ path.outlineColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ path.outlineWidth = new ConstantProperty(2.5);
+ path.leadTime = new ConstantProperty(25);
+ path.trailTime = new ConstantProperty(10);
visualizer.update(time);
@@ -131,11 +131,11 @@ defineSuite([
expect(material.uniforms.outlineColor).toEqual(testObject.path.outlineColor.getValue(time));
expect(material.uniforms.outlineWidth).toEqual(testObject.path.outlineWidth.getValue(time));
- testObject.position = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
- path.color = new MockProperty(new Color(0.1, 0.2, 0.3, 0.4));
- path.width = new MockProperty(2.5);
- path.outlineColor = new MockProperty(new Color(0.5, 0.6, 0.7, 0.8));
- path.outlineWidth = new MockProperty(12.5);
+ testObject.position = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
+ path.color = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ path.width = new ConstantProperty(2.5);
+ path.outlineColor = new ConstantProperty(new Color(0.5, 0.6, 0.7, 0.8));
+ path.outlineWidth = new ConstantProperty(12.5);
visualizer.update(time);
expect(primitive.getShow()).toEqual(testObject.path.show.getValue(time));
@@ -146,7 +146,7 @@ defineSuite([
expect(material.uniforms.outlineColor).toEqual(testObject.path.outlineColor.getValue(time));
expect(material.uniforms.outlineWidth).toEqual(testObject.path.outlineWidth.getValue(time));
- path.show = new MockProperty(false);
+ path.show = new ConstantProperty(false);
visualizer.update(time);
expect(primitive.getShow()).toEqual(testObject.path.show.getValue(time));
});
@@ -158,11 +158,11 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var time = new JulianDate();
- testObject.position = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
+ testObject.position = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
var path = testObject.path = new DynamicPath();
- path.show = new MockProperty(true);
- path.leadTime = new MockProperty(5);
- path.trailTime = new MockProperty(5);
+ path.show = new ConstantProperty(true);
+ path.leadTime = new ConstantProperty(5);
+ path.trailTime = new ConstantProperty(5);
visualizer.update(time);
var polylineCollection = scene.getPrimitives().get(0);
@@ -187,10 +187,10 @@ defineSuite([
var time = new JulianDate();
var path = testObject.path = new DynamicPath();
- testObject.position = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
- path.show = new MockProperty(true);
- path.leadTime = new MockProperty(5);
- path.trailTime = new MockProperty(5);
+ testObject.position = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
+ path.show = new ConstantProperty(true);
+ path.leadTime = new ConstantProperty(5);
+ path.trailTime = new ConstantProperty(5);
visualizer.update(time);
var polylineCollection = scene.getPrimitives().get(0);
@@ -202,19 +202,19 @@ defineSuite([
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
+ testObject.position = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
testObject.path = new DynamicPath();
- testObject.path.show = new MockProperty(true);
- testObject.path.leadTime = new MockProperty(5);
- testObject.path.trailTime = new MockProperty(5);
+ testObject.path.show = new ConstantProperty(true);
+ testObject.path.leadTime = new ConstantProperty(5);
+ testObject.path.trailTime = new ConstantProperty(5);
var dynamicObjectCollection2 = new DynamicObjectCollection();
var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.position = new MockProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
+ testObject2.position = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
testObject2.path = new DynamicPath();
- testObject2.path.show = new MockProperty(true);
- testObject2.path.leadTime = new MockProperty(5);
- testObject2.path.trailTime = new MockProperty(5);
+ testObject2.path.show = new ConstantProperty(true);
+ testObject2.path.leadTime = new ConstantProperty(5);
+ testObject2.path.trailTime = new ConstantProperty(5);
visualizer = new DynamicPathVisualizer(scene, dynamicObjectCollection);
diff --git a/Specs/DynamicScene/DynamicPointVisualizerSpec.js b/Specs/DynamicScene/DynamicPointVisualizerSpec.js
index 4c6fd9551ba8..cbd4529b56a6 100644
--- a/Specs/DynamicScene/DynamicPointVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPointVisualizerSpec.js
@@ -3,7 +3,7 @@ defineSuite([
'DynamicScene/DynamicPointVisualizer',
'Specs/createScene',
'Specs/destroyScene',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
'DynamicScene/DynamicPoint',
'DynamicScene/DynamicObjectCollection',
'Core/JulianDate',
@@ -14,7 +14,7 @@ defineSuite([
DynamicPointVisualizer,
createScene,
destroyScene,
- MockProperty,
+ ConstantProperty,
DynamicPoint,
DynamicObjectCollection,
JulianDate,
@@ -81,7 +81,7 @@ defineSuite([
visualizer = new DynamicPointVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
visualizer.update(new JulianDate());
var billboardCollection = scene.getPrimitives().get(0);
expect(billboardCollection.getLength()).toEqual(0);
@@ -93,7 +93,7 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var point = testObject.point = new DynamicPoint();
- point.show = new MockProperty(true);
+ point.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
var billboardCollection = scene.getPrimitives().get(0);
@@ -110,14 +110,14 @@ defineSuite([
expect(billboardCollection.getLength()).toEqual(0);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
var point = testObject.point = new DynamicPoint();
- point.show = new MockProperty(true);
- point.color = new MockProperty(new Color(0.8, 0.7, 0.6, 0.5));
- point.pixelSize = new MockProperty(12.5);
- point.outlineColor = new MockProperty(new Color(0.1, 0.2, 0.3, 0.4));
- point.outlineWidth = new MockProperty(2.5);
+ point.show = new ConstantProperty(true);
+ point.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ point.pixelSize = new ConstantProperty(12.5);
+ point.outlineColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ point.outlineWidth = new ConstantProperty(2.5);
visualizer.update(time);
@@ -150,7 +150,7 @@ defineSuite([
expect(bb._visualizerOutlineWidth).toEqual(testObject.point.outlineWidth.getValue(time));
expect(bb._visualizerPixelSize).toEqual(testObject.point.pixelSize.getValue(time));
- point.show = new MockProperty(false);
+ point.show = new ConstantProperty(false);
visualizer.update(time);
expect(bb.getShow()).toEqual(testObject.point.show.getValue(time));
});
@@ -163,9 +163,9 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var time = new JulianDate();
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
var point = testObject.point = new DynamicPoint();
- point.show = new MockProperty(true);
+ point.show = new ConstantProperty(true);
visualizer.update(time);
expect(billboardCollection.getLength()).toEqual(1);
@@ -190,8 +190,8 @@ defineSuite([
var time = new JulianDate();
var point = testObject.point = new DynamicPoint();
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- point.show = new MockProperty(true);
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ point.show = new ConstantProperty(true);
visualizer.update(time);
expect(billboardCollection.getLength()).toEqual(1);
@@ -202,15 +202,15 @@ defineSuite([
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
testObject.point = new DynamicPoint();
- testObject.point.show = new MockProperty(true);
+ testObject.point.show = new ConstantProperty(true);
var dynamicObjectCollection2 = new DynamicObjectCollection();
var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.position = new MockProperty(new Cartesian3(5678, 9101112, 1234));
+ testObject2.position = new ConstantProperty(new Cartesian3(5678, 9101112, 1234));
testObject2.point = new DynamicPoint();
- testObject2.point.show = new MockProperty(true);
+ testObject2.point.show = new ConstantProperty(true);
visualizer = new DynamicPointVisualizer(scene, dynamicObjectCollection);
diff --git a/Specs/DynamicScene/DynamicPolygonVisualizerSpec.js b/Specs/DynamicScene/DynamicPolygonVisualizerSpec.js
index 27837fa2a20e..05c7ec195045 100644
--- a/Specs/DynamicScene/DynamicPolygonVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPolygonVisualizerSpec.js
@@ -3,7 +3,7 @@ defineSuite([
'DynamicScene/DynamicPolygonVisualizer',
'Specs/createScene',
'Specs/destroyScene',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
'Core/Cartesian3',
'Core/Color',
'Core/JulianDate',
@@ -15,7 +15,7 @@ defineSuite([
DynamicPolygonVisualizer,
createScene,
destroyScene,
- MockProperty,
+ ConstantProperty,
Cartesian3,
Color,
JulianDate,
@@ -81,7 +81,7 @@ defineSuite([
visualizer = new DynamicPolygonVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.vertexPositions = new MockProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 910111)]);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 910111)]);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -92,7 +92,7 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var polygon = testObject.polygon = new DynamicPolygon();
- polygon.show = new MockProperty(true);
+ polygon.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
@@ -105,7 +105,7 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
testObject.ellipse = new DynamicEllipse();
var polygon = testObject.polygon = new DynamicPolygon();
- polygon.show = new MockProperty(true);
+ polygon.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
@@ -116,10 +116,10 @@ defineSuite([
visualizer = new DynamicPolygonVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
testObject.ellipse = new DynamicEllipse();
var polygon = testObject.polygon = new DynamicPolygon();
- polygon.show = new MockProperty(true);
+ polygon.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -135,17 +135,17 @@ defineSuite([
expect(scene.getPrimitives().getLength()).toEqual(0);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
var polygon = testObject.polygon = new DynamicPolygon();
- polygon.show = new MockProperty(true);
+ polygon.show = new ConstantProperty(true);
var colorMaterial = Material.fromType(scene.getContext(), Material.ColorType);
colorMaterial.uniforms.color = new Color(0.7, 0.6, 0.5, 0.4);
- polygon.material = new MockProperty(colorMaterial);
+ polygon.material = new ConstantProperty(colorMaterial);
var ellipse = testObject.ellipse = new DynamicEllipse();
- ellipse.bearing = new MockProperty(0);
- ellipse.semiMajorAxis = new MockProperty(1000);
- ellipse.semiMinorAxis = new MockProperty(1000);
+ ellipse.bearing = new ConstantProperty(0);
+ ellipse.semiMajorAxis = new ConstantProperty(1000);
+ ellipse.semiMinorAxis = new ConstantProperty(1000);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -168,13 +168,13 @@ defineSuite([
expect(scene.getPrimitives().getLength()).toEqual(0);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.vertexPositions = new MockProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 910111)]);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 910111)]);
var polygon = testObject.polygon = new DynamicPolygon();
- polygon.show = new MockProperty(true);
+ polygon.show = new ConstantProperty(true);
var colorMaterial = Material.fromType(scene.getContext(), Material.ColorType);
colorMaterial.uniforms.color = new Color(0.7, 0.6, 0.5, 0.4);
- polygon.material = new MockProperty(colorMaterial);
+ polygon.material = new ConstantProperty(colorMaterial);
visualizer.update(time);
@@ -186,16 +186,16 @@ defineSuite([
expect(primitive.show).toEqual(testObject.polygon.show.getValue(time));
expect(primitive.material).toEqual(testObject.polygon.material.getValue(time));
- testObject.vertexPositions = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112), new Cartesian3(1234, 5678, 910111)]);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112), new Cartesian3(1234, 5678, 910111)]);
colorMaterial = Material.fromType(scene.getContext(), Material.ColorType);
colorMaterial.uniforms.color = new Color(0.1, 0.2, 0.4, 0.3);
- polygon.material = new MockProperty(colorMaterial);
+ polygon.material = new ConstantProperty(colorMaterial);
visualizer.update(time);
expect(primitive.show).toEqual(testObject.polygon.show.getValue(time));
expect(primitive.material).toEqual(testObject.polygon.material.getValue(time));
- polygon.show = new MockProperty(false);
+ polygon.show = new ConstantProperty(false);
visualizer.update(time);
expect(primitive.show).toEqual(testObject.polygon.show.getValue(time));
});
@@ -207,9 +207,9 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var time = new JulianDate();
- testObject.vertexPositions = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112), new Cartesian3(1234, 5678, 910111)]);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112), new Cartesian3(1234, 5678, 910111)]);
var polygon = testObject.polygon = new DynamicPolygon();
- polygon.show = new MockProperty(true);
+ polygon.show = new ConstantProperty(true);
visualizer.update(time);
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -233,8 +233,8 @@ defineSuite([
var time = new JulianDate();
var polygon = testObject.polygon = new DynamicPolygon();
- testObject.vertexPositions = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112), new Cartesian3(1234, 5678, 910111)]);
- polygon.show = new MockProperty(true);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112), new Cartesian3(1234, 5678, 910111)]);
+ polygon.show = new ConstantProperty(true);
visualizer.update(time);
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -245,15 +245,15 @@ defineSuite([
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.vertexPositions = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112), new Cartesian3(1234, 5678, 910111)]);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112), new Cartesian3(1234, 5678, 910111)]);
testObject.polygon = new DynamicPolygon();
- testObject.polygon.show = new MockProperty(true);
+ testObject.polygon.show = new ConstantProperty(true);
var dynamicObjectCollection2 = new DynamicObjectCollection();
var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.vertexPositions = new MockProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 910111)]);
+ testObject2.vertexPositions = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 910111)]);
testObject2.polygon = new DynamicPolygon();
- testObject2.polygon.show = new MockProperty(true);
+ testObject2.polygon.show = new ConstantProperty(true);
visualizer = new DynamicPolygonVisualizer(scene, dynamicObjectCollection);
diff --git a/Specs/DynamicScene/DynamicPolylineVisualizerSpec.js b/Specs/DynamicScene/DynamicPolylineVisualizerSpec.js
index d33460537811..e81646a01730 100644
--- a/Specs/DynamicScene/DynamicPolylineVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPolylineVisualizerSpec.js
@@ -3,7 +3,7 @@ defineSuite([
'DynamicScene/DynamicPolylineVisualizer',
'Specs/createScene',
'Specs/destroyScene',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
'DynamicScene/DynamicEllipse',
'DynamicScene/DynamicPolyline',
'DynamicScene/DynamicObjectCollection',
@@ -17,7 +17,7 @@ defineSuite([
DynamicPolylineVisualizer,
createScene,
destroyScene,
- MockProperty,
+ ConstantProperty,
DynamicEllipse,
DynamicPolyline,
DynamicObjectCollection,
@@ -85,7 +85,7 @@ defineSuite([
visualizer = new DynamicPolylineVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.vertexPositions = new MockProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(1);
var polylineCollection = scene.getPrimitives().get(0);
@@ -98,7 +98,7 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var polyline = testObject.polyline = new DynamicPolyline();
- polyline.show = new MockProperty(true);
+ polyline.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -113,7 +113,7 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
testObject.ellipse = new DynamicEllipse();
var polyline = testObject.polyline = new DynamicPolyline();
- polyline.show = new MockProperty(true);
+ polyline.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -126,10 +126,10 @@ defineSuite([
visualizer = new DynamicPolylineVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
testObject.ellipse = new DynamicEllipse();
var polyline = testObject.polyline = new DynamicPolyline();
- polyline.show = new MockProperty(true);
+ polyline.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -146,14 +146,14 @@ defineSuite([
expect(scene.getPrimitives().getLength()).toEqual(1);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
var polyline = testObject.polyline = new DynamicPolyline();
- polyline.show = new MockProperty(true);
+ polyline.show = new ConstantProperty(true);
var ellipse = testObject.ellipse = new DynamicEllipse();
- ellipse.bearing = new MockProperty(0);
- ellipse.semiMajorAxis = new MockProperty(1000);
- ellipse.semiMinorAxis = new MockProperty(1000);
+ ellipse.bearing = new ConstantProperty(0);
+ ellipse.semiMajorAxis = new ConstantProperty(1000);
+ ellipse.semiMinorAxis = new ConstantProperty(1000);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -181,14 +181,14 @@ defineSuite([
expect(scene.getPrimitives().getLength()).toEqual(1);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.vertexPositions = new MockProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
var polyline = testObject.polyline = new DynamicPolyline();
- polyline.show = new MockProperty(true);
- polyline.color = new MockProperty(new Color(0.8, 0.7, 0.6, 0.5));
- polyline.width = new MockProperty(12.5);
- polyline.outlineColor = new MockProperty(new Color(0.1, 0.2, 0.3, 0.4));
- polyline.outlineWidth = new MockProperty(2.5);
+ polyline.show = new ConstantProperty(true);
+ polyline.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ polyline.width = new ConstantProperty(12.5);
+ polyline.outlineColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ polyline.outlineWidth = new ConstantProperty(2.5);
visualizer.update(time);
@@ -206,11 +206,11 @@ defineSuite([
expect(material.uniforms.outlineColor).toEqual(testObject.polyline.outlineColor.getValue(time));
expect(material.uniforms.outlineWidth).toEqual(testObject.polyline.outlineWidth.getValue(time));
- testObject.vertexPositions = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
- polyline.color = new MockProperty(new Color(0.1, 0.2, 0.3, 0.4));
- polyline.width = new MockProperty(2.5);
- polyline.outlineColor = new MockProperty(new Color(0.5, 0.6, 0.7, 0.8));
- polyline.outlineWidth = new MockProperty(12.5);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
+ polyline.color = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ polyline.width = new ConstantProperty(2.5);
+ polyline.outlineColor = new ConstantProperty(new Color(0.5, 0.6, 0.7, 0.8));
+ polyline.outlineWidth = new ConstantProperty(12.5);
visualizer.update(time);
expect(primitive.getShow()).toEqual(testObject.polyline.show.getValue(time));
@@ -222,7 +222,7 @@ defineSuite([
expect(material.uniforms.outlineColor).toEqual(testObject.polyline.outlineColor.getValue(time));
expect(material.uniforms.outlineWidth).toEqual(testObject.polyline.outlineWidth.getValue(time));
- polyline.show = new MockProperty(false);
+ polyline.show = new ConstantProperty(false);
visualizer.update(time);
expect(primitive.getShow()).toEqual(testObject.polyline.show.getValue(time));
});
@@ -234,9 +234,9 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var time = new JulianDate();
- testObject.vertexPositions = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
var polyline = testObject.polyline = new DynamicPolyline();
- polyline.show = new MockProperty(true);
+ polyline.show = new ConstantProperty(true);
visualizer.update(time);
var polylineCollection = scene.getPrimitives().get(0);
@@ -261,8 +261,8 @@ defineSuite([
var time = new JulianDate();
var polyline = testObject.polyline = new DynamicPolyline();
- testObject.vertexPositions = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
- polyline.show = new MockProperty(true);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
+ polyline.show = new ConstantProperty(true);
visualizer.update(time);
var polylineCollection = scene.getPrimitives().get(0);
@@ -274,15 +274,15 @@ defineSuite([
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.vertexPositions = new MockProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
+ testObject.vertexPositions = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
testObject.polyline = new DynamicPolyline();
- testObject.polyline.show = new MockProperty(true);
+ testObject.polyline.show = new ConstantProperty(true);
var dynamicObjectCollection2 = new DynamicObjectCollection();
var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.vertexPositions = new MockProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
+ testObject2.vertexPositions = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
testObject2.polyline = new DynamicPolyline();
- testObject2.polyline.show = new MockProperty(true);
+ testObject2.polyline.show = new ConstantProperty(true);
visualizer = new DynamicPolylineVisualizer(scene, dynamicObjectCollection);
diff --git a/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js b/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js
index 67ec80c370bb..7120c29440eb 100644
--- a/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js
@@ -3,7 +3,7 @@ defineSuite([
'DynamicScene/DynamicPyramidVisualizer',
'Specs/createScene',
'Specs/destroyScene',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
'Core/Color',
'Core/JulianDate',
'Core/Matrix3',
@@ -18,7 +18,7 @@ defineSuite([
DynamicPyramidVisualizer,
createScene,
destroyScene,
- MockProperty,
+ ConstantProperty,
Color,
JulianDate,
Matrix3,
@@ -86,8 +86,8 @@ defineSuite([
visualizer = new DynamicPyramidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -97,9 +97,9 @@ defineSuite([
visualizer = new DynamicPyramidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var pyramid = testObject.pyramid = new DynamicPyramid();
- pyramid.directions = new MockProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
+ pyramid.directions = new ConstantProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -109,9 +109,9 @@ defineSuite([
visualizer = new DynamicPyramidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
var pyramid = testObject.pyramid = new DynamicPyramid();
- pyramid.directions = new MockProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
+ pyramid.directions = new ConstantProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(0);
});
@@ -122,19 +122,19 @@ defineSuite([
visualizer = new DynamicPyramidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var pyramid = testObject.pyramid = new DynamicPyramid();
- pyramid.directions = new MockProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
- pyramid.intersectionColor = new MockProperty(new Color(0.1, 0.2, 0.3, 0.4));
- pyramid.intersectionWidth = new MockProperty(0.5);
- pyramid.showIntersection = new MockProperty(true);
- pyramid.radius = new MockProperty(123.5);
- pyramid.show = new MockProperty(true);
+ pyramid.directions = new ConstantProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
+ pyramid.intersectionColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ pyramid.intersectionWidth = new ConstantProperty(0.5);
+ pyramid.showIntersection = new ConstantProperty(true);
+ pyramid.radius = new ConstantProperty(123.5);
+ pyramid.show = new ConstantProperty(true);
var redMaterial = Material.fromType(scene.getContext(), Material.ColorType);
redMaterial.uniforms.color = Color.RED;
- pyramid.material = new MockProperty(redMaterial);
+ pyramid.material = new ConstantProperty(redMaterial);
visualizer.update(time);
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -157,10 +157,10 @@ defineSuite([
visualizer = new DynamicPyramidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var pyramid = testObject.pyramid = new DynamicPyramid();
- pyramid.directions = new MockProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
+ pyramid.directions = new ConstantProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
var time = new JulianDate();
expect(scene.getPrimitives().getLength()).toEqual(0);
@@ -178,10 +178,10 @@ defineSuite([
visualizer = new DynamicPyramidVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var pyramid = testObject.pyramid = new DynamicPyramid();
- pyramid.directions = new MockProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
+ pyramid.directions = new ConstantProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
var time = new JulianDate();
visualizer.update(time);
@@ -191,17 +191,17 @@ defineSuite([
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
- testObject.orientation = new MockProperty(new Quaternion(0, 0, 0, 1));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.orientation = new ConstantProperty(new Quaternion(0, 0, 0, 1));
var pyramid = testObject.pyramid = new DynamicPyramid();
- pyramid.directions = new MockProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
+ pyramid.directions = new ConstantProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
var dynamicObjectCollection2 = new DynamicObjectCollection();
var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.position = new MockProperty(new Cartesian3(5678, 9101112, 1234));
- testObject2.orientation = new MockProperty(new Quaternion(1, 0, 0, 0));
+ testObject2.position = new ConstantProperty(new Cartesian3(5678, 9101112, 1234));
+ testObject2.orientation = new ConstantProperty(new Quaternion(1, 0, 0, 0));
var pyramid2 = testObject2.pyramid = new DynamicPyramid();
- pyramid2.directions = new MockProperty([new Spherical(3, 0, 0), new Spherical(2, 0, 0), new Spherical(1, 0, 0), new Spherical(0.5, 0, 0)]);
+ pyramid2.directions = new ConstantProperty([new Spherical(3, 0, 0), new Spherical(2, 0, 0), new Spherical(1, 0, 0), new Spherical(0.5, 0, 0)]);
visualizer = new DynamicPyramidVisualizer(scene, dynamicObjectCollection);
diff --git a/Specs/DynamicScene/DynamicVectorSpec.js b/Specs/DynamicScene/DynamicVectorSpec.js
index 03aba67d2206..947654b96ee7 100644
--- a/Specs/DynamicScene/DynamicVectorSpec.js
+++ b/Specs/DynamicScene/DynamicVectorSpec.js
@@ -7,7 +7,7 @@ defineSuite([
'Core/Color',
'Core/Iso8601',
'Core/TimeInterval',
- 'Specs/MockProperty'
+ 'DynamicScene/ConstantProperty'
], function(
DynamicVector,
DynamicObject,
@@ -16,24 +16,24 @@ defineSuite([
Color,
Iso8601,
TimeInterval,
- MockProperty) {
+ ConstantProperty) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
it('mergeProperties does not change a fully configured vector', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.vector = new DynamicVector();
- objectToMerge.vector.color = new MockProperty();
- objectToMerge.vector.width = new MockProperty();
- objectToMerge.vector.length = new MockProperty();
- objectToMerge.vector.direction = new MockProperty();
- objectToMerge.vector.show = new MockProperty();
+ objectToMerge.vector.color = new ConstantProperty(Color.WHITE);
+ objectToMerge.vector.width = new ConstantProperty(1);
+ objectToMerge.vector.length = new ConstantProperty(2);
+ objectToMerge.vector.direction = new ConstantProperty(new Cartesian3(1, 0, 0));
+ objectToMerge.vector.show = new ConstantProperty(true);
- var color = new MockProperty();
- var width = new MockProperty();
- var length = new MockProperty();
- var direction = new MockProperty();
- var show = new MockProperty();
+ var color = new ConstantProperty(Color.RED);
+ var width = new ConstantProperty(2);
+ var length = new ConstantProperty(10);
+ var direction = new ConstantProperty(new Cartesian3(0, 0, 1));
+ var show = new ConstantProperty(false);
var targetObject = new DynamicObject('targetObject');
targetObject.vector = new DynamicVector();
@@ -55,11 +55,11 @@ defineSuite([
it('mergeProperties creates and configures an undefined vector', function() {
var objectToMerge = new DynamicObject('objectToMerge');
objectToMerge.vector = new DynamicVector();
- objectToMerge.vector.color = new MockProperty();
- objectToMerge.vector.width = new MockProperty();
- objectToMerge.vector.length = new MockProperty();
- objectToMerge.vector.direction = new MockProperty();
- objectToMerge.vector.show = new MockProperty();
+ objectToMerge.vector.color = new ConstantProperty(Color.WHITE);
+ objectToMerge.vector.width = new ConstantProperty(1);
+ objectToMerge.vector.length = new ConstantProperty(10);
+ objectToMerge.vector.direction = new ConstantProperty(new Cartesian3(0, 0, 1));
+ objectToMerge.vector.show = new ConstantProperty(true);
var targetObject = new DynamicObject('targetObject');
@@ -75,11 +75,11 @@ defineSuite([
it('mergeProperties does not change when used with an undefined vector', function() {
var objectToMerge = new DynamicObject('objectToMerge');
- var color = new MockProperty();
- var width = new MockProperty();
- var length = new MockProperty();
- var direction = new MockProperty();
- var show = new MockProperty();
+ var color = new ConstantProperty(Color.WHITE);
+ var width = new ConstantProperty(1);
+ var length = new ConstantProperty(10);
+ var direction = new ConstantProperty(new Cartesian3(0, 0, 1));
+ var show = new ConstantProperty(true);
var targetObject = new DynamicObject('targetObject');
targetObject.vector = new DynamicVector();
diff --git a/Specs/DynamicScene/DynamicVectorVisualizerSpec.js b/Specs/DynamicScene/DynamicVectorVisualizerSpec.js
index a41e9ba74b09..8c34bc886faa 100644
--- a/Specs/DynamicScene/DynamicVectorVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicVectorVisualizerSpec.js
@@ -3,7 +3,8 @@ defineSuite([
'DynamicScene/DynamicVectorVisualizer',
'Specs/createScene',
'Specs/destroyScene',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
+ 'DynamicScene/ConstantPositionProperty',
'DynamicScene/DynamicEllipse',
'DynamicScene/DynamicVector',
'DynamicScene/DynamicObjectCollection',
@@ -17,7 +18,8 @@ defineSuite([
DynamicVectorVisualizer,
createScene,
destroyScene,
- MockProperty,
+ ConstantProperty,
+ ConstantPositionProperty,
DynamicEllipse,
DynamicVector,
DynamicObjectCollection,
@@ -85,7 +87,7 @@ defineSuite([
visualizer = new DynamicVectorVisualizer(scene, dynamicObjectCollection);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(1);
var polylineCollection = scene.getPrimitives().get(0);
@@ -98,7 +100,7 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var vector = testObject.vector = new DynamicVector();
- vector.show = new MockProperty(true);
+ vector.show = new ConstantProperty(true);
visualizer.update(new JulianDate());
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -115,14 +117,14 @@ defineSuite([
expect(scene.getPrimitives().getLength()).toEqual(1);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject.position = new ConstantPositionProperty(new Cartesian3(1234, 5678, 9101112));
var vector = testObject.vector = new DynamicVector();
- vector.show = new MockProperty(true);
- vector.color = new MockProperty(new Color(0.8, 0.7, 0.6, 0.5));
- vector.width = new MockProperty(12.5);
- vector.length = new MockProperty(13.5);
- vector.direction = new MockProperty(new Cartesian3(1, 2, 3));
+ vector.show = new ConstantProperty(true);
+ vector.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ vector.width = new ConstantProperty(12.5);
+ vector.length = new ConstantProperty(13.5);
+ vector.direction = new ConstantProperty(new Cartesian3(1, 2, 3));
visualizer.update(time);
@@ -132,26 +134,26 @@ defineSuite([
var primitive = polylineCollection.get(0);
visualizer.update(time);
expect(primitive.getShow()).toEqual(testObject.vector.show.getValue(time));
- expect(primitive.getPositions()).toEqual([testObject.position.value, testObject.position.value.add(vector.direction.value.normalize().multiplyByScalar(vector.length.value))]);
+ expect(primitive.getPositions()).toEqual([testObject.position.getValue(time), testObject.position.getValue(time).add(vector.direction.getValue(time).normalize().multiplyByScalar(vector.length.getValue(time)))]);
expect(primitive.getWidth()).toEqual(testObject.vector.width.getValue(time));
var material = primitive.getMaterial();
expect(material.uniforms.color).toEqual(testObject.vector.color.getValue(time));
- testObject.position = new MockProperty(new Cartesian3(5678, 1234, 1101112));
- vector.color = new MockProperty(new Color(0.1, 0.2, 0.3, 0.4));
- vector.width = new MockProperty(2.5);
+ testObject.position = new ConstantProperty(new Cartesian3(5678, 1234, 1101112));
+ vector.color = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ vector.width = new ConstantProperty(2.5);
visualizer.update(time);
expect(primitive.getShow()).toEqual(testObject.vector.show.getValue(time));
- expect(primitive.getPositions()).toEqual([testObject.position.value, testObject.position.value.add(vector.direction.value.normalize().multiplyByScalar(vector.length.value))]);
+ expect(primitive.getPositions()).toEqual([testObject.position.getValue(time), testObject.position.getValue(time).add(vector.direction.getValue(time).normalize().multiplyByScalar(vector.length.getValue(time)))]);
expect(primitive.getWidth()).toEqual(testObject.vector.width.getValue(time));
material = primitive.getMaterial();
expect(material.uniforms.color).toEqual(testObject.vector.color.getValue(time));
- vector.show = new MockProperty(false);
+ vector.show = new ConstantProperty(false);
visualizer.update(time);
expect(primitive.getShow()).toEqual(testObject.vector.show.getValue(time));
});
@@ -163,13 +165,13 @@ defineSuite([
var testObject = dynamicObjectCollection.getOrCreateObject('test');
var time = new JulianDate();
- testObject.position = new MockProperty(new Cartesian3(5678, 1234, 1101112));
+ testObject.position = new ConstantProperty(new Cartesian3(5678, 1234, 1101112));
var vector = testObject.vector = new DynamicVector();
- vector.show = new MockProperty(true);
- vector.color = new MockProperty(new Color(0.8, 0.7, 0.6, 0.5));
- vector.width = new MockProperty(12.5);
- vector.length = new MockProperty(13.5);
- vector.direction = new MockProperty(new Cartesian3(1, 2, 3));
+ vector.show = new ConstantProperty(true);
+ vector.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ vector.width = new ConstantProperty(12.5);
+ vector.length = new ConstantProperty(13.5);
+ vector.direction = new ConstantProperty(new Cartesian3(1, 2, 3));
visualizer.update(time);
var polylineCollection = scene.getPrimitives().get(0);
@@ -194,12 +196,12 @@ defineSuite([
var time = new JulianDate();
var vector = testObject.vector = new DynamicVector();
- testObject.position = new MockProperty(new Cartesian3(5678, 1234, 1101112));
- vector.show = new MockProperty(true);
- vector.color = new MockProperty(new Color(0.8, 0.7, 0.6, 0.5));
- vector.width = new MockProperty(12.5);
- vector.length = new MockProperty(13.5);
- vector.direction = new MockProperty(new Cartesian3(1, 2, 3));
+ testObject.position = new ConstantProperty(new Cartesian3(5678, 1234, 1101112));
+ vector.show = new ConstantProperty(true);
+ vector.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ vector.width = new ConstantProperty(12.5);
+ vector.length = new ConstantProperty(13.5);
+ vector.direction = new ConstantProperty(new Cartesian3(1, 2, 3));
visualizer.update(time);
var polylineCollection = scene.getPrimitives().get(0);
@@ -211,23 +213,23 @@ defineSuite([
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
var dynamicObjectCollection = new DynamicObjectCollection();
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new MockProperty(new Cartesian3(5678, 1234, 1101112));
+ testObject.position = new ConstantProperty(new Cartesian3(5678, 1234, 1101112));
testObject.vector = new DynamicVector();
- testObject.vector.show = new MockProperty(true);
- testObject.vector.color = new MockProperty(new Color(0.8, 0.7, 0.6, 0.5));
- testObject.vector.width = new MockProperty(12.5);
- testObject.vector.length = new MockProperty(13.5);
- testObject.vector.direction = new MockProperty(new Cartesian3(1, 2, 3));
+ testObject.vector.show = new ConstantProperty(true);
+ testObject.vector.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ testObject.vector.width = new ConstantProperty(12.5);
+ testObject.vector.length = new ConstantProperty(13.5);
+ testObject.vector.direction = new ConstantProperty(new Cartesian3(1, 2, 3));
var dynamicObjectCollection2 = new DynamicObjectCollection();
var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.position = new MockProperty(new Cartesian3(1234, 5678, 9101112));
+ testObject2.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
testObject2.vector = new DynamicVector();
- testObject2.vector.show = new MockProperty(true);
- testObject2.vector.color = new MockProperty(new Color(0.8, 0.7, 0.6, 0.5));
- testObject2.vector.width = new MockProperty(12.5);
- testObject2.vector.length = new MockProperty(13.5);
- testObject2.vector.direction = new MockProperty(new Cartesian3(1, 2, 3));
+ testObject2.vector.show = new ConstantProperty(true);
+ testObject2.vector.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ testObject2.vector.width = new ConstantProperty(12.5);
+ testObject2.vector.length = new ConstantProperty(13.5);
+ testObject2.vector.direction = new ConstantProperty(new Cartesian3(1, 2, 3));
visualizer = new DynamicVectorVisualizer(scene, dynamicObjectCollection);
diff --git a/Specs/MockProperty.js b/Specs/MockProperty.js
deleted file mode 100644
index 7caf4fb5b1e4..000000000000
--- a/Specs/MockProperty.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*global define*/
-define([
- 'Core/defined',
- 'Core/ReferenceFrame'
- ], function(
- defined,
- ReferenceFrame) {
- "use strict";
-
- function MockProperty(value) {
- this.value = value;
- }
-
- MockProperty.prototype.getValue = function(time, result) {
- if (defined(this.value) && typeof this.value.clone === 'function') {
- return this.value.clone(result);
- }
- return this.value;
- };
-
- MockProperty.prototype.getReferenceFrame = function() {
- return ReferenceFrame.FIXED;
- };
-
- return MockProperty;
-});
diff --git a/Specs/Widgets/Viewer/viewerDynamicObjectMixinSpec.js b/Specs/Widgets/Viewer/viewerDynamicObjectMixinSpec.js
index eeabad1170c3..39b58353dcc2 100644
--- a/Specs/Widgets/Viewer/viewerDynamicObjectMixinSpec.js
+++ b/Specs/Widgets/Viewer/viewerDynamicObjectMixinSpec.js
@@ -4,14 +4,14 @@ defineSuite([
'Core/Cartesian3',
'DynamicScene/DynamicObject',
'Scene/CameraFlightPath',
- 'Specs/MockProperty',
+ 'DynamicScene/ConstantProperty',
'Widgets/Viewer/Viewer'
], function(
viewerDynamicObjectMixin,
Cartesian3,
DynamicObject,
CameraFlightPath,
- MockProperty,
+ ConstantProperty,
Viewer) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -44,7 +44,7 @@ defineSuite([
viewer.extend(viewerDynamicObjectMixin);
var dynamicObject = new DynamicObject();
- dynamicObject.position = new MockProperty(new Cartesian3(123456, 123456, 123456));
+ dynamicObject.position = new ConstantProperty(new Cartesian3(123456, 123456, 123456));
viewer.trackedObject = dynamicObject;
expect(viewer.trackedObject).toBe(dynamicObject);
@@ -58,7 +58,7 @@ defineSuite([
viewer.extend(viewerDynamicObjectMixin);
var dynamicObject = new DynamicObject();
- dynamicObject.position = new MockProperty(new Cartesian3(123456, 123456, 123456));
+ dynamicObject.position = new ConstantProperty(new Cartesian3(123456, 123456, 123456));
viewer.trackedObject = dynamicObject;
expect(viewer.trackedObject).toBe(dynamicObject);
From 4ac6beef166ccbbc25e58e2588c4f58a87323bef Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 21 Aug 2013 09:57:55 -0400
Subject: [PATCH 37/65] Specs for CompositePositionProperty
---
.../DynamicScene/CompositePositionProperty.js | 21 +--
.../CompositePositionPropertySpec.js | 150 ++++++++++++++++++
2 files changed, 162 insertions(+), 9 deletions(-)
create mode 100644 Specs/DynamicScene/CompositePositionPropertySpec.js
diff --git a/Source/DynamicScene/CompositePositionProperty.js b/Source/DynamicScene/CompositePositionProperty.js
index a1a54f3cd246..16ba2d4e0904 100644
--- a/Source/DynamicScene/CompositePositionProperty.js
+++ b/Source/DynamicScene/CompositePositionProperty.js
@@ -18,9 +18,9 @@ define([
"use strict";
/**
- * A {@link Property} which is defined by a TimeIntervalCollection, where the
- * data property of the interval is another Property instance which is evaluated
- * at the provided time.
+ * A {@link PositionProperty} which is defined by a TimeIntervalCollection, where the
+ * data property of the interval is another PositionProperty instance which is
+ * evaluated at the provided time.
*
* @alias CompositePositionProperty
* @constructor
@@ -33,7 +33,7 @@ define([
defineProperties(CompositePositionProperty.prototype, {
/**
* Always returns true, since this property always varies with simulation time.
- * @memberof SampledProperty
+ * @memberof CompositePositionProperty.prototype
*
* @type {Boolean}
*/
@@ -54,7 +54,11 @@ define([
}
},
/**
- * Gets or sets the reference frame that the position is defined in.
+ * Gets or sets the reference frame that the position presents itself as.
+ * Each PositionProperty making up this object has it's own reference frame,
+ * so this property merely exposes a "preferred" reference frame for clients.
+ * @memberof CompositePositionProperty.prototype
+ *
* @Type {ReferenceFrame}
*/
referenceFrame : {
@@ -69,7 +73,7 @@ define([
/**
* Returns the value of the property at the specified simulation time.
- * @memberof Property
+ * @memberof CompositePositionProperty
*
* @param {JulianDate} time The simulation time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
@@ -83,7 +87,7 @@ define([
/**
* Returns the value of the property at the specified simulation time in the specified reference frame.
- * @memberof PositionProperty
+ * @memberof CompositePositionProperty
*
* @param {JulianDate} time The simulation time for which to retrieve the value.
* @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The desired referenceFrame of the result.
@@ -99,8 +103,7 @@ define([
if (defined(interval)) {
var data = interval.data;
if (defined(data)) {
- var value = data.getValue(time, result);
- return PositionProperty.convertToReferenceFrame(time, value, data.referenceFrame, referenceFrame, value);
+ return data.getValueInReferenceFrame(time, referenceFrame, result);
}
}
return undefined;
diff --git a/Specs/DynamicScene/CompositePositionPropertySpec.js b/Specs/DynamicScene/CompositePositionPropertySpec.js
new file mode 100644
index 000000000000..d016be6b174b
--- /dev/null
+++ b/Specs/DynamicScene/CompositePositionPropertySpec.js
@@ -0,0 +1,150 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/CompositePositionProperty',
+ 'DynamicScene/ConstantPositionProperty',
+ 'DynamicScene/PositionProperty',
+ 'Core/Cartesian3',
+ 'Core/JulianDate',
+ 'Core/ReferenceFrame',
+ 'Core/TimeInterval',
+ 'Core/TimeIntervalCollection'
+ ], function(
+ CompositePositionProperty,
+ ConstantPositionProperty,
+ PositionProperty,
+ Cartesian3,
+ JulianDate,
+ ReferenceFrame,
+ TimeInterval,
+ TimeIntervalCollection) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('default constructor has expected values', function() {
+ var property = new CompositePositionProperty();
+ expect(property.isTimeVarying).toEqual(true);
+ expect(property.intervals).toBeInstanceOf(TimeIntervalCollection);
+ expect(property.getValue(new JulianDate())).toBeUndefined();
+ expect(property.referenceFrame).toBe(ReferenceFrame.FIXED);
+ });
+
+ it('constructor sets expected values', function() {
+ var property = new CompositePositionProperty(ReferenceFrame.INERTIAL);
+ expect(property.referenceFrame).toBe(ReferenceFrame.INERTIAL);
+ });
+
+ it('can modify reference frame', function() {
+ var property = new CompositePositionProperty();
+ expect(property.referenceFrame).toBe(ReferenceFrame.FIXED);
+ property.referenceFrame = ReferenceFrame.INERTIAL;
+ expect(property.referenceFrame).toBe(ReferenceFrame.INERTIAL);
+ });
+
+ it('works without a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantPositionProperty(new Cartesian3(1, 2, 3)));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantPositionProperty(new Cartesian3(4, 5, 6)));
+
+ var property = new CompositePositionProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var result1 = property.getValue(interval1.start);
+ expect(result1).not.toBe(interval1.data.getValue());
+ expect(result1).toEqual(interval1.data.getValue());
+
+ var result2 = property.getValue(interval2.stop);
+ expect(result2).not.toBe(interval2.data.getValue());
+ expect(result2).toEqual(interval2.data.getValue());
+ });
+
+ it('getValue works with a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantPositionProperty(new Cartesian3(1, 2, 3)));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantPositionProperty(new Cartesian3(4, 5, 6)));
+
+ var property = new CompositePositionProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var expected = new Cartesian3();
+ var result1 = property.getValue(interval1.start, expected);
+ expect(result1).toBe(expected);
+ expect(result1).toEqual(interval1.data.getValue());
+
+ var result2 = property.getValue(interval2.stop, expected);
+ expect(result2).toBe(expected);
+ expect(result2).toEqual(interval2.data.getValue());
+ });
+
+ it('getValue works without a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantPositionProperty(new Cartesian3(1, 2, 3)));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantPositionProperty(new Cartesian3(4, 5, 6)));
+
+ var property = new CompositePositionProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var result1 = property.getValue(interval1.start);
+ expect(result1).toEqual(interval1.data.getValue());
+
+ var result2 = property.getValue(interval2.stop);
+ expect(result2).toEqual(interval2.data.getValue());
+ });
+
+ it('getValue returns in fixed frame', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantPositionProperty(new Cartesian3(1, 2, 3), ReferenceFrame.INERTIAL));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantPositionProperty(new Cartesian3(4, 5, 6), ReferenceFrame.FIXED));
+
+ var property = new CompositePositionProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var valueInertial = new Cartesian3(1, 2, 3);
+ var valueFixed = PositionProperty.convertToReferenceFrame(interval1.start, valueInertial, ReferenceFrame.INERTIAL, ReferenceFrame.FIXED);
+
+ var result1 = property.getValue(interval1.start);
+ expect(result1).toEqual(valueFixed);
+
+ var result2 = property.getValue(interval2.stop);
+ expect(result2).toEqual(interval2.data.getValue());
+ });
+
+ it('getValueInReferenceFrame works with a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantPositionProperty(new Cartesian3(1, 2, 3), ReferenceFrame.INERTIAL));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantPositionProperty(new Cartesian3(4, 5, 6), ReferenceFrame.FIXED));
+
+ var property = new CompositePositionProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var expected = new Cartesian3();
+ var result1 = property.getValueInReferenceFrame(interval1.start, ReferenceFrame.INERTIAL, expected);
+ expect(result1).toBe(expected);
+ expect(result1).toEqual(interval1.data.getValueInReferenceFrame(interval1.start, ReferenceFrame.INERTIAL));
+
+ var result2 = property.getValueInReferenceFrame(interval2.stop, ReferenceFrame.FIXED, expected);
+ expect(result2).toBe(expected);
+ expect(result2).toEqual(interval2.data.getValueInReferenceFrame(interval2.stop, ReferenceFrame.FIXED));
+ });
+
+ it('getValueInReferenceFrame works without a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantPositionProperty(new Cartesian3(1, 2, 3), ReferenceFrame.INERTIAL));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantPositionProperty(new Cartesian3(4, 5, 6), ReferenceFrame.FIXED));
+
+ var property = new CompositePositionProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var result1 = property.getValueInReferenceFrame(interval1.start, ReferenceFrame.INERTIAL);
+ expect(result1).toEqual(interval1.data.getValueInReferenceFrame(interval1.start, ReferenceFrame.INERTIAL));
+
+ var result2 = property.getValueInReferenceFrame(interval2.stop, ReferenceFrame.FIXED);
+ expect(result2).toEqual(interval2.data.getValueInReferenceFrame(interval2.stop, ReferenceFrame.FIXED));
+ });
+
+ it('throws with no time parameter', function() {
+ var property = new CompositePositionProperty();
+ expect(function() {
+ property.getValue(undefined);
+ }).toThrow();
+ });
+});
\ No newline at end of file
From cd965d33cb9acb18441b54f32e76b22d3e288bdf Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 21 Aug 2013 10:26:54 -0400
Subject: [PATCH 38/65] TimeIntervalCollectionPositionProperty specs
---
.../TimeIntervalCollectionPositionProperty.js | 4 +-
...eIntervalCollectionPositionPropertySpec.js | 130 ++++++++++++++++++
2 files changed, 132 insertions(+), 2 deletions(-)
create mode 100644 Specs/DynamicScene/TimeIntervalCollectionPositionPropertySpec.js
diff --git a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
index d0f9b111ce0e..0d8f94377a47 100644
--- a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
@@ -55,7 +55,7 @@ define([
}
},
/**
- * Gets the reference frame that the position is defined in.
+ * Gets the reference frame that the positions are defined in.
* @Type {ReferenceFrame}
*/
referenceFrame : {
@@ -96,7 +96,7 @@ define([
var interval = this._intervals.findIntervalContainingDate(time);
if (defined(interval)) {
var value = interval.data;
- if (defined(value) && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Enumeration)) {
+ if (defined(value)) {
return PositionProperty.convertToReferenceFrame(time, value, this._referenceFrame, referenceFrame, result);
}
return value;
diff --git a/Specs/DynamicScene/TimeIntervalCollectionPositionPropertySpec.js b/Specs/DynamicScene/TimeIntervalCollectionPositionPropertySpec.js
new file mode 100644
index 000000000000..cbc4cf92be71
--- /dev/null
+++ b/Specs/DynamicScene/TimeIntervalCollectionPositionPropertySpec.js
@@ -0,0 +1,130 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/TimeIntervalCollectionPositionProperty',
+ 'DynamicScene/PositionProperty',
+ 'Core/Cartesian3',
+ 'Core/JulianDate',
+ 'Core/ReferenceFrame',
+ 'Core/TimeInterval',
+ 'Core/TimeIntervalCollection'
+ ], function(
+ TimeIntervalCollectionPositionProperty,
+ PositionProperty,
+ Cartesian3,
+ JulianDate,
+ ReferenceFrame,
+ TimeInterval,
+ TimeIntervalCollection) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('default constructor has expected values', function() {
+ var property = new TimeIntervalCollectionPositionProperty();
+ expect(property.isTimeVarying).toEqual(true);
+ expect(property.intervals).toBeInstanceOf(TimeIntervalCollection);
+ expect(property.getValue(new JulianDate())).toBeUndefined();
+ expect(property.referenceFrame).toBe(ReferenceFrame.FIXED);
+ });
+
+ it('getValue works without a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new Cartesian3(1, 2, 3));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new Cartesian3(4, 5, 6));
+
+ var property = new TimeIntervalCollectionPositionProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var result1 = property.getValue(interval1.start);
+ expect(result1).not.toBe(interval1.data);
+ expect(result1).toEqual(interval1.data);
+
+ var result2 = property.getValue(interval2.stop);
+ expect(result2).not.toBe(interval2.data);
+ expect(result2).toEqual(interval2.data);
+ });
+
+ it('getValue works with a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new Cartesian3(1, 2, 3));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new Cartesian3(4, 5, 6));
+
+ var property = new TimeIntervalCollectionPositionProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var expected = new Cartesian3();
+ var result1 = property.getValue(interval1.start, expected);
+ expect(result1).toBe(expected);
+ expect(result1).toEqual(interval1.data);
+
+ var result2 = property.getValue(interval2.stop, expected);
+ expect(result2).toBe(expected);
+ expect(result2).toEqual(interval2.data);
+ });
+
+ it('getValue returns in fixed frame', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new Cartesian3(1, 2, 3));
+
+ var property = new TimeIntervalCollectionPositionProperty(ReferenceFrame.INERTIAL);
+ property.intervals.addInterval(interval1);
+
+ var valueInertial = new Cartesian3(1, 2, 3);
+ var valueFixed = PositionProperty.convertToReferenceFrame(interval1.start, valueInertial, ReferenceFrame.INERTIAL, ReferenceFrame.FIXED);
+
+ var result = property.getValue(interval1.start);
+ expect(result).toEqual(valueFixed);
+ });
+
+ it('getValueInReferenceFrame works with a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new Cartesian3(1, 2, 3));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new Cartesian3(4, 5, 6));
+
+ var property = new TimeIntervalCollectionPositionProperty(ReferenceFrame.FIXED);
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var valueInertial = PositionProperty.convertToReferenceFrame(interval1.start, interval1.data, ReferenceFrame.FIXED, ReferenceFrame.INERTIAL);
+
+ var expected = new Cartesian3();
+ var result1 = property.getValueInReferenceFrame(interval1.start, ReferenceFrame.INERTIAL, expected);
+ expect(result1).toBe(expected);
+ expect(result1).toEqual(valueInertial);
+
+ var result2 = property.getValueInReferenceFrame(interval2.stop, ReferenceFrame.FIXED, expected);
+ expect(result2).toBe(expected);
+ expect(result2).toEqual(interval2.data);
+ });
+
+ it('getValueInReferenceFrame works without a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new Cartesian3(1, 2, 3));
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new Cartesian3(4, 5, 6));
+
+ var property = new TimeIntervalCollectionPositionProperty(ReferenceFrame.FIXED);
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var valueInertial = PositionProperty.convertToReferenceFrame(interval1.start, interval1.data, ReferenceFrame.FIXED, ReferenceFrame.INERTIAL);
+
+ var result1 = property.getValueInReferenceFrame(interval1.start, ReferenceFrame.INERTIAL);
+ expect(result1).toEqual(valueInertial);
+
+ var result2 = property.getValueInReferenceFrame(interval2.stop, ReferenceFrame.FIXED);
+ expect(result2).toEqual(interval2.data);
+ });
+
+ it('returns undefined for valid interval without data', function() {
+ var property = new TimeIntervalCollectionPositionProperty();
+
+ var interval = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, undefined);
+ property.intervals.addInterval(interval);
+
+ var result = property.getValue(interval.start);
+ expect(result).toBeUndefined();
+ });
+
+ it('throws with no time parameter', function() {
+ var property = new TimeIntervalCollectionPositionProperty();
+ expect(function() {
+ property.getValue(undefined);
+ }).toThrow();
+ });
+});
\ No newline at end of file
From a2d046c962c9df0c4771e19d25fdb3e94729a76e Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 21 Aug 2013 11:23:56 -0400
Subject: [PATCH 39/65] Specs for SampledPositionProperty and other cleanup.
---
.../DynamicScene/ConstantPositionProperty.js | 5 +
Source/DynamicScene/ReferenceProperty.js | 4 +
.../DynamicScene/SampledPositionProperty.js | 6 +
Source/DynamicScene/SampledProperty.js | 4 +
.../CompositePositionPropertySpec.js | 18 +-
Specs/DynamicScene/CompositePropertySpec.js | 18 +-
.../ConstantPositionPropertySpec.js | 9 +-
Specs/DynamicScene/ConstantPropertySpec.js | 23 +-
Specs/DynamicScene/ReferencePropertySpec.js | 2 +-
.../SampledPositionPropertySpec.js | 200 ++++++++++++++++++
10 files changed, 263 insertions(+), 26 deletions(-)
create mode 100644 Specs/DynamicScene/SampledPositionPropertySpec.js
diff --git a/Source/DynamicScene/ConstantPositionProperty.js b/Source/DynamicScene/ConstantPositionProperty.js
index cb220d1160c6..3e5f0fb6b73c 100644
--- a/Source/DynamicScene/ConstantPositionProperty.js
+++ b/Source/DynamicScene/ConstantPositionProperty.js
@@ -4,6 +4,7 @@ define([
'./PositionProperty',
'../Core/Cartesian3',
'../Core/defaultValue',
+ '../Core/defined',
'../Core/defineProperties',
'../Core/DeveloperError',
'../Core/ReferenceFrame'
@@ -12,6 +13,7 @@ define([
PositionProperty,
Cartesian3,
defaultValue,
+ defined,
defineProperties,
DeveloperError,
ReferenceFrame) {
@@ -75,6 +77,9 @@ define([
* @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
*/
ConstantPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
+ if (!defined(time)) {
+ throw new DeveloperError('time is required.');
+ }
var value = this._property.getValue(time, result);
return PositionProperty.convertToReferenceFrame(time, value, this._referenceFrame, referenceFrame, value);
};
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index 63a12f9d158c..34afbffbdb8f 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -126,6 +126,10 @@ define([
* @returns The result parameter or a new instance if the parameter was omitted.
*/
ReferenceProperty.prototype.getValue = function(time, result) {
+ if (!defined(time)) {
+ throw new DeveloperError('time is required.');
+ }
+
var targetProperty = resolve(this);
return defined(targetProperty) && this._targetObject.isAvailable(time) ? targetProperty.getValue(time, result) : undefined;
};
diff --git a/Source/DynamicScene/SampledPositionProperty.js b/Source/DynamicScene/SampledPositionProperty.js
index 88c5568b336c..3f88e9e00a78 100644
--- a/Source/DynamicScene/SampledPositionProperty.js
+++ b/Source/DynamicScene/SampledPositionProperty.js
@@ -4,6 +4,7 @@ define([
'../Core/defaultValue',
'../Core/defined',
'../Core/defineProperties',
+ '../Core/DeveloperError',
'../Core/ReferenceFrame',
'./PositionProperty',
'./SampledProperty'
@@ -12,6 +13,7 @@ define([
defaultValue,
defined,
defineProperties,
+ DeveloperError,
ReferenceFrame,
PositionProperty,
SampledProperty) {
@@ -80,6 +82,10 @@ define([
};
SampledPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
+ if (!defined(time)) {
+ throw new DeveloperError('time is required.');
+ }
+
result = this._property.getValue(time, result);
if (defined(result)) {
return PositionProperty.convertToReferenceFrame(time, result, this._referenceFrame, referenceFrame, result);
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 926b8758250c..71cc82891e2b 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -178,6 +178,10 @@ define([
* @exception {DeveloperError} time is required.
*/
SampledProperty.prototype.getValue = function(time, result) {
+ if (!defined(time)) {
+ throw new DeveloperError('time is required.');
+ }
+
var innerType = this._innerType;
var times = this._times;
var values = this._values;
diff --git a/Specs/DynamicScene/CompositePositionPropertySpec.js b/Specs/DynamicScene/CompositePositionPropertySpec.js
index d016be6b174b..83191c207f78 100644
--- a/Specs/DynamicScene/CompositePositionPropertySpec.js
+++ b/Specs/DynamicScene/CompositePositionPropertySpec.js
@@ -49,12 +49,12 @@ defineSuite([
property.intervals.addInterval(interval2);
var result1 = property.getValue(interval1.start);
- expect(result1).not.toBe(interval1.data.getValue());
- expect(result1).toEqual(interval1.data.getValue());
+ expect(result1).not.toBe(interval1.data.getValue(interval1.start));
+ expect(result1).toEqual(interval1.data.getValue(interval1.start));
var result2 = property.getValue(interval2.stop);
- expect(result2).not.toBe(interval2.data.getValue());
- expect(result2).toEqual(interval2.data.getValue());
+ expect(result2).not.toBe(interval2.data.getValue(interval2.stop));
+ expect(result2).toEqual(interval2.data.getValue(interval2.stop));
});
it('getValue works with a result parameter', function() {
@@ -68,11 +68,11 @@ defineSuite([
var expected = new Cartesian3();
var result1 = property.getValue(interval1.start, expected);
expect(result1).toBe(expected);
- expect(result1).toEqual(interval1.data.getValue());
+ expect(result1).toEqual(interval1.data.getValue(interval1.start));
var result2 = property.getValue(interval2.stop, expected);
expect(result2).toBe(expected);
- expect(result2).toEqual(interval2.data.getValue());
+ expect(result2).toEqual(interval2.data.getValue(interval2.stop));
});
it('getValue works without a result parameter', function() {
@@ -84,10 +84,10 @@ defineSuite([
property.intervals.addInterval(interval2);
var result1 = property.getValue(interval1.start);
- expect(result1).toEqual(interval1.data.getValue());
+ expect(result1).toEqual(interval1.data.getValue(interval1.start));
var result2 = property.getValue(interval2.stop);
- expect(result2).toEqual(interval2.data.getValue());
+ expect(result2).toEqual(interval2.data.getValue(interval2.stop));
});
it('getValue returns in fixed frame', function() {
@@ -105,7 +105,7 @@ defineSuite([
expect(result1).toEqual(valueFixed);
var result2 = property.getValue(interval2.stop);
- expect(result2).toEqual(interval2.data.getValue());
+ expect(result2).toEqual(interval2.data.getValue(interval2.stop));
});
it('getValueInReferenceFrame works with a result parameter', function() {
diff --git a/Specs/DynamicScene/CompositePropertySpec.js b/Specs/DynamicScene/CompositePropertySpec.js
index cca17aff7f51..24ea762ad8e5 100644
--- a/Specs/DynamicScene/CompositePropertySpec.js
+++ b/Specs/DynamicScene/CompositePropertySpec.js
@@ -32,12 +32,12 @@ defineSuite([
property.intervals.addInterval(interval2);
var result1 = property.getValue(interval1.start);
- expect(result1).not.toBe(interval1.data.getValue());
- expect(result1).toEqual(interval1.data.getValue());
+ expect(result1).not.toBe(interval1.data.getValue(interval1.start));
+ expect(result1).toEqual(interval1.data.getValue(interval1.start));
var result2 = property.getValue(interval2.stop);
- expect(result2).not.toBe(interval2.data.getValue());
- expect(result2).toEqual(interval2.data.getValue());
+ expect(result2).not.toBe(interval2.data.getValue(interval2.stop));
+ expect(result2).toEqual(interval2.data.getValue(interval2.stop));
});
it('works with a result parameter', function() {
@@ -51,11 +51,11 @@ defineSuite([
var expected = new Cartesian3();
var result1 = property.getValue(interval1.start, expected);
expect(result1).toBe(expected);
- expect(result1).toEqual(interval1.data.getValue());
+ expect(result1).toEqual(interval1.data.getValue(interval1.start));
var result2 = property.getValue(interval2.stop, expected);
expect(result2).toBe(expected);
- expect(result2).toEqual(interval2.data.getValue());
+ expect(result2).toEqual(interval2.data.getValue(interval2.stop));
});
it('works without a result parameter', function() {
@@ -67,13 +67,13 @@ defineSuite([
property.intervals.addInterval(interval2);
var result1 = property.getValue(interval1.start);
- expect(result1).toEqual(interval1.data.getValue());
+ expect(result1).toEqual(interval1.data.getValue(interval1.start));
var result2 = property.getValue(interval2.stop);
- expect(result2).toEqual(interval2.data.getValue());
+ expect(result2).toEqual(interval2.data.getValue(interval2.stop));
});
- it('throws with no time parameter', function() {
+ it('getValue throws with no time parameter', function() {
var property = new CompositeProperty();
expect(function() {
property.getValue(undefined);
diff --git a/Specs/DynamicScene/ConstantPositionPropertySpec.js b/Specs/DynamicScene/ConstantPositionPropertySpec.js
index ed0aba42e228..091dd8629940 100644
--- a/Specs/DynamicScene/ConstantPositionPropertySpec.js
+++ b/Specs/DynamicScene/ConstantPositionPropertySpec.js
@@ -30,7 +30,7 @@ defineSuite([
var value = new Cartesian3(1, 2, 3);
var property = new ConstantPositionProperty(value);
- var result = property.getValue();
+ var result = property.getValue(time);
expect(result).not.toBe(value);
expect(result).toEqual(value);
});
@@ -78,4 +78,11 @@ defineSuite([
return new ConstantPositionProperty(undefined);
}).toThrow();
});
+
+ it('getValue throws without time parameter', function() {
+ var property = new ConstantPositionProperty(new Cartesian3(1, 2, 3));
+ expect(function() {
+ property.getValue(undefined);
+ }).toThrow();
+ });
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/ConstantPropertySpec.js b/Specs/DynamicScene/ConstantPropertySpec.js
index 7df30d61e12a..04dd09892229 100644
--- a/Specs/DynamicScene/ConstantPropertySpec.js
+++ b/Specs/DynamicScene/ConstantPropertySpec.js
@@ -1,18 +1,22 @@
/*global defineSuite*/
defineSuite([
'DynamicScene/ConstantProperty',
- 'Core/Cartesian3'
+ 'Core/Cartesian3',
+ 'Core/JulianDate'
], function(
ConstantProperty,
- Cartesian3) {
+ Cartesian3,
+ JulianDate) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+ var time = new JulianDate();
+
it('works with basic types', function() {
var expected = 5;
var property = new ConstantProperty(expected);
expect(property.isTimeVarying).toEqual(false);
- expect(property.getValue()).toBe(expected);
+ expect(property.getValue(time)).toBe(expected);
});
it('works with clone function', function() {
@@ -24,7 +28,7 @@ defineSuite([
};
var property = new ConstantProperty(expected, cloneFunction);
expect(property.isTimeVarying).toEqual(false);
- expect(property.getValue()).toBe(expected);
+ expect(property.getValue(time)).toBe(expected);
expect(cloneCalled).toEqual(true);
});
@@ -33,7 +37,7 @@ defineSuite([
var property = new ConstantProperty(value);
expect(property.isTimeVarying).toEqual(false);
- var result = property.getValue();
+ var result = property.getValue(time);
expect(result).not.toBe(value);
expect(result).toEqual(value);
});
@@ -44,7 +48,7 @@ defineSuite([
expect(property.isTimeVarying).toEqual(false);
var expected = new Cartesian3();
- var result = property.getValue(undefined, expected);
+ var result = property.getValue(time, expected);
expect(result).toBe(expected);
expect(expected).toEqual(value);
});
@@ -61,4 +65,11 @@ defineSuite([
return new ConstantProperty({}, undefined);
}).toThrow();
});
+
+ it('getValue throws with no time parameter', function() {
+ var property = new ConstantProperty(5);
+ expect(function() {
+ property.getValue(undefined);
+ }).toThrow();
+ });
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/ReferencePropertySpec.js b/Specs/DynamicScene/ReferencePropertySpec.js
index ee82a8f991da..a65ee09a2e53 100644
--- a/Specs/DynamicScene/ReferencePropertySpec.js
+++ b/Specs/DynamicScene/ReferencePropertySpec.js
@@ -70,7 +70,7 @@ defineSuite([
it('getValue returned undefined for unresolved property', function() {
var property = ReferenceProperty.fromString(new DynamicObjectCollection(), 'object.property');
- expect(property.getValue()).toBeUndefined();
+ expect(property.getValue(new JulianDate())).toBeUndefined();
});
it('Resolves getValue property on direct collection', function() {
diff --git a/Specs/DynamicScene/SampledPositionPropertySpec.js b/Specs/DynamicScene/SampledPositionPropertySpec.js
new file mode 100644
index 000000000000..d0be6355a2ea
--- /dev/null
+++ b/Specs/DynamicScene/SampledPositionPropertySpec.js
@@ -0,0 +1,200 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/SampledPositionProperty',
+ 'DynamicScene/PositionProperty',
+ 'Core/Cartesian3',
+ 'Core/defined',
+ 'Core/JulianDate',
+ 'Core/LinearApproximation',
+ 'Core/ReferenceFrame'
+ ], function(
+ SampledPositionProperty,
+ PositionProperty,
+ Cartesian3,
+ defined,
+ JulianDate,
+ LinearApproximation,
+ ReferenceFrame) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('constructor sets expected defaults', function() {
+ var property = new SampledPositionProperty();
+ expect(property.isTimeVarying).toEqual(true);
+ expect(property.referenceFrame).toEqual(ReferenceFrame.FIXED);
+ expect(property.interpolationDegree).toEqual(1);
+ expect(property.interpolationAlgorithm).toEqual(LinearApproximation);
+ });
+
+ it('constructor sets expected values', function() {
+ var property = new SampledPositionProperty(ReferenceFrame.INERTIAL);
+ expect(property.isTimeVarying).toEqual(true);
+ expect(property.referenceFrame).toEqual(ReferenceFrame.INERTIAL);
+ expect(property.interpolationDegree).toEqual(1);
+ expect(property.interpolationAlgorithm).toEqual(LinearApproximation);
+ });
+
+ it('getValue works without a result parameter', function() {
+ var time = new JulianDate();
+ var value = new Cartesian3(1, 2, 3);
+ var property = new SampledPositionProperty();
+ property.addSample(time, value);
+
+ var result = property.getValue(time);
+ expect(result).not.toBe(value);
+ expect(result).toEqual(value);
+ });
+
+ it('getValue works with a result parameter', function() {
+ var time = new JulianDate();
+ var value = new Cartesian3(1, 2, 3);
+ var property = new SampledPositionProperty();
+ property.addSample(time, value);
+
+ var expected = new Cartesian3();
+ var result = property.getValue(time, expected);
+ expect(result).toBe(expected);
+ expect(expected).toEqual(value);
+ });
+
+ it('getValue returns in fixed frame', function() {
+ var time = new JulianDate();
+ var valueInertial = new Cartesian3(1, 2, 3);
+ var valueFixed = PositionProperty.convertToReferenceFrame(time, valueInertial, ReferenceFrame.INERTIAL, ReferenceFrame.FIXED);
+ var property = new SampledPositionProperty(ReferenceFrame.INERTIAL);
+ property.addSample(time, valueInertial);
+
+ var result = property.getValue(time);
+ expect(result).toEqual(valueFixed);
+ });
+
+ it('getValueInReferenceFrame works without a result parameter', function() {
+ var time = new JulianDate();
+ var value = new Cartesian3(1, 2, 3);
+ var property = new SampledPositionProperty();
+ property.addSample(time, value);
+
+ var result = property.getValueInReferenceFrame(time, ReferenceFrame.INERTIAL);
+ expect(result).not.toBe(value);
+ expect(result).toEqual(PositionProperty.convertToReferenceFrame(time, value, ReferenceFrame.FIXED, ReferenceFrame.INERTIAL));
+ });
+
+ it('getValueInReferenceFrame works with a result parameter', function() {
+ var time = new JulianDate();
+ var value = new Cartesian3(1, 2, 3);
+ var property = new SampledPositionProperty(ReferenceFrame.INERTIAL);
+ property.addSample(time, value);
+
+ var expected = new Cartesian3();
+ var result = property.getValueInReferenceFrame(time, ReferenceFrame.FIXED, expected);
+ expect(result).toBe(expected);
+ expect(expected).toEqual(PositionProperty.convertToReferenceFrame(time, value, ReferenceFrame.INERTIAL, ReferenceFrame.FIXED));
+ });
+
+ it('addSamplesFlatArray works', function() {
+ var data = [0, 7, 8, 9, 1, 8, 9, 10, 2, 9, 10, 11];
+ var epoch = new JulianDate(0, 0);
+
+ var property = new SampledPositionProperty();
+ property.addSamplesFlatArray(data, epoch);
+ expect(property.getValue(epoch)).toEqual(new Cartesian3(7, 8, 9));
+ expect(property.getValue(new JulianDate(0, 0.5))).toEqual(new Cartesian3(7.5, 8.5, 9.5));
+ });
+
+ it('addSample works', function() {
+ var values = [new Cartesian3(7, 8, 9), new Cartesian3(8, 9, 10), new Cartesian3(9, 10, 11)];
+ var times = [new JulianDate(0, 0), new JulianDate(1, 0), new JulianDate(2, 0)];
+
+ var property = new SampledPositionProperty();
+ property.addSample(times[0], values[0]);
+ property.addSample(times[1], values[1]);
+ property.addSample(times[2], values[2]);
+
+ expect(property.getValue(times[0])).toEqual(values[0]);
+ expect(property.getValue(times[1])).toEqual(values[1]);
+ expect(property.getValue(times[2])).toEqual(values[2]);
+ expect(property.getValue(new JulianDate(0.5, 0))).toEqual(new Cartesian3(7.5, 8.5, 9.5));
+ });
+
+ it('addSamples works', function() {
+ var values = [new Cartesian3(7, 8, 9), new Cartesian3(8, 9, 10), new Cartesian3(9, 10, 11)];
+ var times = [new JulianDate(0, 0), new JulianDate(1, 0), new JulianDate(2, 0)];
+
+ var property = new SampledPositionProperty();
+ property.addSamples(times, values);
+ expect(property.getValue(times[0])).toEqual(values[0]);
+ expect(property.getValue(times[1])).toEqual(values[1]);
+ expect(property.getValue(times[2])).toEqual(values[2]);
+ expect(property.getValue(new JulianDate(0.5, 0))).toEqual(new Cartesian3(7.5, 8.5, 9.5));
+ });
+
+ it('can set interpolationAlgorithm and degree', function() {
+ var data = [0, 7, 8, 9, 1, 8, 9, 10, 2, 9, 10, 11];
+ var epoch = new JulianDate(0, 0);
+
+ var timesCalled = 0;
+ var MockInterpolation = {
+ type : 'Mock',
+ getRequiredDataPoints : function(degree) {
+ return 3;
+ },
+
+ interpolateOrderZero : function(x, xTable, yTable, yStride, result) {
+ expect(x).toEqual(1);
+
+ expect(xTable.length).toEqual(3);
+ expect(xTable[0]).toBe(-2);
+ expect(xTable[1]).toBe(-1);
+ expect(xTable[2]).toBe(0);
+
+ expect(yTable.length).toEqual(9);
+ expect(yTable[0]).toBe(7);
+ expect(yTable[1]).toBe(8);
+ expect(yTable[2]).toBe(9);
+ expect(yTable[3]).toBe(8);
+ expect(yTable[4]).toBe(9);
+ expect(yTable[5]).toBe(10);
+ expect(yTable[6]).toBe(9);
+ expect(yTable[7]).toBe(10);
+ expect(yTable[8]).toBe(11);
+
+ expect(yStride).toEqual(3);
+
+ expect(result.length).toEqual(3);
+
+ result[0] = 2;
+ result[1] = 3;
+ result[2] = 4;
+ timesCalled++;
+ return result;
+ }
+ };
+
+ var property = new SampledPositionProperty();
+ property.addSamplesFlatArray(data, epoch);
+ property.interpolationDegree = 2;
+ property.interpolationAlgorithm = MockInterpolation;
+ expect(property.getValue(epoch)).toEqual(new Cartesian3(7, 8, 9));
+ expect(property.getValue(new JulianDate(0, 3))).toEqual(new Cartesian3(2, 3, 4));
+
+ expect(timesCalled).toEqual(1);
+ });
+
+ it('Returns undefined if trying to interpolate with less than enough samples.', function() {
+ var value = new Cartesian3(1, 2, 3);
+ var time = new JulianDate(0, 0);
+
+ var property = new SampledPositionProperty();
+ property.addSample(time, value);
+
+ expect(property.getValue(time)).toEqual(value);
+ expect(property.getValue(time.addSeconds(4))).toBeUndefined();
+ });
+
+ it('throws with no time parameter', function() {
+ var property = new SampledPositionProperty();
+ expect(function() {
+ property.getValue(undefined);
+ }).toThrow();
+ });
+});
\ No newline at end of file
From ba22d00dea488545e484d7aabb243ddb8e175521 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 21 Aug 2013 15:08:56 -0400
Subject: [PATCH 40/65] Fix CZML processing after recent property changes.
Still need to write specs as well as clean things up a bit.
---
Source/DynamicScene/CzmlDataSource.js | 272 ++++++++++++++-------
Specs/DynamicScene/ConstantPropertySpec.js | 7 -
2 files changed, 185 insertions(+), 94 deletions(-)
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index a6721bdbcdf9..bfbd477597eb 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -276,6 +276,23 @@ define([
}
}
+ var interpolators = {
+ HERMITE : HermitePolynomialApproximation,
+ LAGRANGE : LagrangePolynomialApproximation,
+ LINEAR : LinearApproximation
+ };
+
+ function updateInterpolationSettings(packetData, property) {
+ var interpolator = interpolators[packetData.interpolationAlgorithm];
+ if (defined(interpolator)) {
+ property.interpolationAlgorithm = interpolator;
+ }
+ if (defined(packetData.interpolationDegree)) {
+ property.interpolationDegree = packetData.interpolationDegree;
+ }
+
+ }
+
function processProperty(type, object, propertyName, packetData, constrainedInterval, sourceUri) {
var combinedInterval;
var packetInterval = packetData.interval;
@@ -294,6 +311,7 @@ define([
var unwrappedIntervalLength = defaultValue(unwrappedInterval.length, 1);
var isSampled = (typeof unwrappedInterval !== 'string') && unwrappedIntervalLength > packedLength;
+ //Any time a constant value is assigned, it completely blows away anything else.
if (!isSampled && !hasInterval) {
if (defined(type.unpack)) {
object[propertyName] = new ConstantProperty(type.unpack(unwrappedInterval, 0));
@@ -305,7 +323,27 @@ define([
var propertyCreated = false;
var property = object[propertyName];
+
+ //Without an interval, any sampled value is infinite, meaning it completely
+ //replaces any non-sampled property that may exist.
+ if (isSampled && !hasInterval) {
+ if (!(property instanceof SampledProperty)) {
+ property = new SampledProperty(type);
+ object[propertyName] = property;
+ propertyCreated = true;
+ }
+ property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ updateInterpolationSettings(packetData, property);
+ return propertyCreated;
+ }
+
+ var interval;
+
+ //A constant value with an interval is normally part of a TimeIntervalCollection,
+ //However, if the current property is not a time-interval collection, we need
+ //to turn it into a Composite, preserving the old data with the new interval.
if (!isSampled && hasInterval) {
+ //Create a new interval for the constant value.
combinedInterval = combinedInterval.clone();
if (defined(type.unpack)) {
combinedInterval.data = type.unpack(unwrappedInterval, 0);
@@ -313,6 +351,7 @@ define([
combinedInterval.data = unwrappedInterval;
}
+ //If no property exists, simply use a new interval collection
if (!defined(property)) {
property = new TimeIntervalCollectionProperty();
object[propertyName] = property;
@@ -320,44 +359,72 @@ define([
}
if (property instanceof TimeIntervalCollectionProperty) {
+ //If we create a collection, or it already existed, use it.
property.intervals.addInterval(combinedInterval);
+ } else if (property instanceof CompositeProperty) {
+ //If the collection was already a CompositeProperty, use it.
+ combinedInterval.data = new ConstantProperty(combinedInterval.data);
+ property.intervals.add(combinedInterval);
} else {
- //TODO Morph to CompositeProperty
- }
- } else if (isSampled && !hasInterval) {
- if (!(property instanceof SampledProperty)) {
- property = new SampledProperty(type);
- object[propertyName] = property;
+ //Otherwise, create a CompositeProperty but preserve the existing data.
+
+ //Put the old property in an infinite interval.
+ interval = Iso8601.MAXIMUM_INTERVAL.clone();
+ interval.data = property;
+
+ //Create the composite.
propertyCreated = true;
- }
- property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
- } else if (isSampled && hasInterval) {
- if (!defined(property)) {
property = new CompositeProperty();
object[propertyName] = property;
- propertyCreated = true;
- }
- if (property instanceof CompositeProperty) {
- var intervals = property.intervals;
- var interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
- var intervalData;
- if (defined(interval)) {
- intervalData = interval.data;
- } else {
- interval = combinedInterval.clone();
- intervalData = new SampledProperty(type);
- interval.data = intervalData;
- intervals.addInterval(interval);
- }
- if (!(intervalData instanceof SampledProperty)) {
- intervalData = new SampledProperty(type);
- interval.Data = intervalData;
- }
- intervalData.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
- } else {
- //TODO Morph to CompositeProperty
+
+ //add the old property interval
+ property.intervals.add(interval);
+
+ //Change the new data to a ConstantProperty and add it.
+ combinedInterval.data = new ConstantProperty(combinedInterval.data);
+ property.intervals.add(combinedInterval);
}
+
+ return propertyCreated;
+ }
+
+ //isSampled && hasInterval
+ if (!defined(property)) {
+ propertyCreated = true;
+ property = new CompositeProperty();
+ object[propertyName] = property;
+ }
+
+ //create a CompositeProperty but preserve the existing data.
+ if (!property instanceof CompositeProperty) {
+ //Put the old property in an infinite interval.
+ interval = Iso8601.MAXIMUM_INTERVAL.clone();
+ interval.data = property;
+
+ //Create the composite.
+ propertyCreated = true;
+ property = new CompositeProperty();
+ object[propertyName] = property;
+
+ //add the old property interval
+ property.intervals.add(interval);
+
+ //Change the new data to a ConstantProperty and add it.
+ combinedInterval.data = new ConstantProperty(combinedInterval.data);
+ property.intervals.add(combinedInterval);
+ }
+
+ //Check if the interval already exists in the composite
+ var intervals = property.intervals;
+ interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
+ if (!defined(interval) || !(interval.data instanceof SampledProperty)) {
+ //If not, create a SampledProperty for it.
+ interval = combinedInterval.clone();
+ interval.data = new SampledProperty(type);
+ intervals.addInterval(interval);
}
+ interval.data.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ updateInterpolationSettings(packetData, interval.data);
return propertyCreated;
}
@@ -377,23 +444,6 @@ define([
return updated;
}
- var interpolators = {
- HERMITE : HermitePolynomialApproximation,
- LAGRANGE : LagrangePolynomialApproximation,
- LINEAR : LinearApproximation
- };
-
- function updateInterpolationSettings(packetData, property) {
- var interpolator = interpolators[packetData.interpolationAlgorithm];
- if (defined(interpolator)) {
- property.interpolationAlgorithm = interpolator;
- }
- if (defined(packetData.interpolationDegree)) {
- property.interpolationDegree = packetData.interpolationDegree;
- }
-
- }
-
function processPositionProperty(object, propertyName, packetData, constrainedInterval, sourceUri) {
var combinedInterval;
var packetInterval = packetData.interval;
@@ -409,66 +459,114 @@ define([
var referenceFrame = ReferenceFrame[defaultValue(packetData.referenceFrame, "FIXED")];
var unwrappedInterval = unwrapCartesianInterval(packetData);
var hasInterval = defined(combinedInterval) && !combinedInterval.equals(Iso8601.MAXIMUM_INTERVAL);
- var isSampled = unwrappedInterval.length > Cartesian3.packedLength;
+ var packedLength = Cartesian3.packedLength;
+ var unwrappedIntervalLength = defaultValue(unwrappedInterval.length, 1);
+ var isSampled = (typeof unwrappedInterval !== 'string') && unwrappedIntervalLength > packedLength;
+ //Any time a constant value is assigned, it completely blows away anything else.
if (!isSampled && !hasInterval) {
- object[propertyName] = new ConstantPositionProperty(Cartesian3.unpack(unwrappedInterval, 0), referenceFrame);
+ object[propertyName] = new ConstantPositionProperty(Cartesian3.unpack(unwrappedInterval), referenceFrame);
return true;
}
var propertyCreated = false;
var property = object[propertyName];
- if (!isSampled && hasInterval) {
- combinedInterval = combinedInterval.clone();
- combinedInterval.data = Cartesian3.unpack(unwrappedInterval, 0);
- if (!defined(property)) {
- property = new TimeIntervalCollectionPositionProperty(referenceFrame);
- object[propertyName] = property;
- propertyCreated = true;
- }
- if (property instanceof TimeIntervalCollectionPositionProperty) {
- property.intervals.addInterval(combinedInterval);
- updateInterpolationSettings(packetData, property);
- } else {
- //TODO Morph to CompositePositionProperty
- }
- } else if (isSampled && !hasInterval) {
- if (!(property instanceof SampledPositionProperty)) {
+ //Without an interval, any sampled value is infinite, meaning it completely
+ //replaces any non-sampled property that may exist.
+ if (isSampled && !hasInterval) {
+ if (!(property instanceof SampledProperty) || property.referenceFrame !== referenceFrame) {
property = new SampledPositionProperty(referenceFrame);
object[propertyName] = property;
propertyCreated = true;
}
property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
updateInterpolationSettings(packetData, property);
- } else if (isSampled && hasInterval) {
+ return propertyCreated;
+ }
+
+ var interval;
+
+ //A constant value with an interval is normally part of a TimeIntervalCollection,
+ //However, if the current property is not a time-interval collection, we need
+ //to turn it into a Composite, preserving the old data with the new interval.
+ if (!isSampled && hasInterval) {
+ //Create a new interval for the constant value.
+ combinedInterval = combinedInterval.clone();
+ combinedInterval.data = Cartesian3.unpack(unwrappedInterval);
+
+ //If no property exists, simply use a new interval collection
if (!defined(property)) {
- property = new CompositePositionProperty(referenceFrame);
+ property = new TimeIntervalCollectionPositionProperty(referenceFrame);
object[propertyName] = property;
propertyCreated = true;
}
- if (property instanceof CompositePositionProperty) {
- var intervals = property.intervals;
- var interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
- var intervalData;
- if (defined(interval)) {
- intervalData = interval.data;
- } else {
- interval = combinedInterval.clone();
- intervalData = new SampledPositionProperty(referenceFrame);
- interval.data = intervalData;
- intervals.addInterval(interval);
- }
- if (!(intervalData instanceof SampledPositionProperty)) {
- intervalData = new SampledPositionProperty(referenceFrame);
- interval.Data = intervalData;
- }
- intervalData.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
- updateInterpolationSettings(packetData, property);
+
+ if (property instanceof TimeIntervalCollectionPositionProperty && property.referenceFrame === referenceFrame) {
+ //If we create a collection, or it already existed, use it.
+ property.intervals.addInterval(combinedInterval);
+ } else if (property instanceof CompositePositionProperty) {
+ //If the collection was already a CompositeProperty, use it.
+ combinedInterval.data = new ConstantPositionProperty(combinedInterval.data, referenceFrame);
+ property.intervals.add(combinedInterval);
} else {
- //TODO Morph to CompositePositionProperty
+ //Otherwise, create a CompositeProperty but preserve the existing data.
+
+ //Put the old property in an infinite interval.
+ interval = Iso8601.MAXIMUM_INTERVAL.clone();
+ interval.data = property;
+
+ //Create the composite.
+ propertyCreated = true;
+ property = new CompositePositionProperty(property.referenceFrame);
+ object[propertyName] = property;
+
+ //add the old property interval
+ property.intervals.add(interval);
+
+ //Change the new data to a ConstantProperty and add it.
+ combinedInterval.data = new ConstantPositionProperty(combinedInterval.data, referenceFrame);
+ property.intervals.add(combinedInterval);
}
+
+ return propertyCreated;
+ }
+
+ //isSampled && hasInterval
+ if (!defined(property)) {
+ propertyCreated = true;
+ property = new CompositePositionProperty(referenceFrame);
+ object[propertyName] = property;
+ } else if (!property instanceof CompositePositionProperty) {
+ //create a CompositeProperty but preserve the existing data.
+ //Put the old property in an infinite interval.
+ interval = Iso8601.MAXIMUM_INTERVAL.clone();
+ interval.data = property;
+
+ //Create the composite.
+ propertyCreated = true;
+ property = new CompositePositionProperty(property.referenceFrame);
+ object[propertyName] = property;
+
+ //add the old property interval
+ property.intervals.add(interval);
+
+ //Change the new data to a ConstantProperty and add it.
+ combinedInterval.data = new ConstantPositionProperty(combinedInterval.data, referenceFrame);
+ property.intervals.add(combinedInterval);
+ }
+
+ //Check if the interval already exists in the composite
+ var intervals = property.intervals;
+ interval = intervals.findInterval(combinedInterval.start, combinedInterval.stop, combinedInterval.isStartIncluded, combinedInterval.isStopIncluded);
+ if (!defined(interval) || !(interval.data instanceof SampledPositionProperty) || interval.data.referenceFrame !== referenceFrame) {
+ //If not, create a SampledProperty for it.
+ interval = combinedInterval.clone();
+ interval.data = new SampledPositionProperty(referenceFrame);
+ intervals.addInterval(interval);
}
+ interval.data.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ updateInterpolationSettings(packetData, interval.data);
return propertyCreated;
}
diff --git a/Specs/DynamicScene/ConstantPropertySpec.js b/Specs/DynamicScene/ConstantPropertySpec.js
index 04dd09892229..83374918f24a 100644
--- a/Specs/DynamicScene/ConstantPropertySpec.js
+++ b/Specs/DynamicScene/ConstantPropertySpec.js
@@ -65,11 +65,4 @@ defineSuite([
return new ConstantProperty({}, undefined);
}).toThrow();
});
-
- it('getValue throws with no time parameter', function() {
- var property = new ConstantProperty(5);
- expect(function() {
- property.getValue(undefined);
- }).toThrow();
- });
});
\ No newline at end of file
From 453f55a5276222b4d5b3531a4b74e4ba24c38576 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 21 Aug 2013 17:09:06 -0400
Subject: [PATCH 41/65] Fix DynamicPathVisualizer specs and add fallback for
generic sampling when not using a SampledProperty.
---
Source/DynamicScene/DynamicPathVisualizer.js | 69 +++++---
.../DynamicScene/DynamicPathVisualizerSpec.js | 150 +++++++++++-------
2 files changed, 140 insertions(+), 79 deletions(-)
diff --git a/Source/DynamicScene/DynamicPathVisualizer.js b/Source/DynamicScene/DynamicPathVisualizer.js
index 1e4a330e756b..400f51ed4515 100644
--- a/Source/DynamicScene/DynamicPathVisualizer.js
+++ b/Source/DynamicScene/DynamicPathVisualizer.js
@@ -29,21 +29,9 @@ define([
PolylineCollection) {
"use strict";
- function getValueRangeInReferenceFrame(positionProperty, start, stop, currentTime, referenceFrame, maximumStep, result) {
+ function subSampleSampledProperty(positionProperty, start, stop, updateTime, referenceFrame, maximumStep, result) {
var times = positionProperty._property._times;
- if (!defined(start)) {
- throw new DeveloperError('start is required');
- }
-
- if (!defined(stop)) {
- throw new DeveloperError('stop is required');
- }
-
- if (!defined(result)) {
- result = [];
- }
-
var r = 0;
//Always step exactly on start (but only use it if it exists.)
var tmp;
@@ -52,7 +40,7 @@ define([
result[r++] = tmp;
}
- var steppedOnNow = !defined(currentTime) || currentTime.lessThan(start) || currentTime.greaterThan(stop);
+ var steppedOnNow = !defined(updateTime) || updateTime.lessThanOrEquals(start) || updateTime.greaterThanOrEquals(stop);
//Iterate over all interval times and add the ones that fall in our
//time range. Note that times can contain data outside of
@@ -67,14 +55,14 @@ define([
var sampleStepSize;
while (t < len) {
- if (!steppedOnNow && current.greaterThanOrEquals(currentTime)) {
- tmp = positionProperty.getValueInReferenceFrame(currentTime, referenceFrame, result[r]);
+ if (!steppedOnNow && current.greaterThanOrEquals(updateTime)) {
+ tmp = positionProperty.getValueInReferenceFrame(updateTime, referenceFrame, result[r]);
if (defined(tmp)) {
result[r++] = tmp;
}
steppedOnNow = true;
}
- if (current.greaterThan(start) && current.lessThan(loopStop) && !current.equals(currentTime)) {
+ if (current.greaterThan(start) && current.lessThan(loopStop) && !current.equals(updateTime)) {
tmp = positionProperty.getValueInReferenceFrame(current, referenceFrame, result[r]);
if (defined(tmp)) {
result[r++] = tmp;
@@ -116,6 +104,49 @@ define([
return result;
}
+ function subSample(property, start, stop, updateTime, referenceFrame, maximumStep, result) {
+ if (!defined(result)) {
+ result = [];
+ }
+
+ if (property instanceof SampledPositionProperty) {
+ return subSampleSampledProperty(property, start, stop, updateTime, referenceFrame, maximumStep, result);
+ }
+
+ //Fallback to generic sampling.
+ var tmp;
+ var i = 0;
+ var index = 0;
+ var time = start;
+ var steppedOnNow = !defined(updateTime) || updateTime.lessThanOrEquals(start) || updateTime.greaterThanOrEquals(stop);
+ while (time.lessThan(stop)) {
+ if (!steppedOnNow && time.greaterThanOrEquals(updateTime)) {
+ steppedOnNow = true;
+ tmp = property.getValueInReferenceFrame(updateTime, referenceFrame, result[index]);
+ if (defined(tmp)) {
+ result[index] = tmp;
+ index++;
+ }
+ }
+ tmp = property.getValueInReferenceFrame(time, referenceFrame, result[index]);
+ if (defined(tmp)) {
+ result[index] = tmp;
+ index++;
+ }
+ i++;
+ time = start.addSeconds(maximumStep * i);
+ }
+ //Always sample stop.
+ tmp = property.getValueInReferenceFrame(stop, referenceFrame, result[index]);
+ if (defined(tmp)) {
+ result[index] = tmp;
+ index++;
+ }
+
+ result.length = index;
+ return result;
+ }
+
var toFixedScratch = new Matrix3();
var PolylineUpdater = function(scene, referenceFrame) {
this._unusedIndexes = [];
@@ -142,7 +173,7 @@ define([
}
var positionProperty = dynamicObject.position;
- if (!(positionProperty instanceof SampledPositionProperty)) {
+ if (!defined(positionProperty)) {
return;
}
@@ -249,7 +280,7 @@ define([
resolution = property.getValue(time);
}
- polyline.setPositions(getValueRangeInReferenceFrame(positionProperty, sampleStart, sampleStop, time, this._referenceFrame, resolution, polyline.getPositions()));
+ polyline.setPositions(subSample(positionProperty, sampleStart, sampleStop, time, this._referenceFrame, resolution, polyline.getPositions()));
property = dynamicPath.color;
if (defined(property)) {
diff --git a/Specs/DynamicScene/DynamicPathVisualizerSpec.js b/Specs/DynamicScene/DynamicPathVisualizerSpec.js
index 1c3aaef0d12c..8f59a0339ec1 100644
--- a/Specs/DynamicScene/DynamicPathVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPathVisualizerSpec.js
@@ -8,7 +8,8 @@ defineSuite([
'Core/Color',
'Core/JulianDate',
'DynamicScene/DynamicObjectCollection',
- 'DynamicScene/DynamicPath'
+ 'DynamicScene/DynamicPath',
+ 'DynamicScene/SampledPositionProperty'
], function(
DynamicPathVisualizer,
createScene,
@@ -18,7 +19,8 @@ defineSuite([
Color,
JulianDate,
DynamicObjectCollection,
- DynamicPath) {
+ DynamicPath,
+ SampledPositionProperty) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -95,7 +97,9 @@ defineSuite([
});
it('A DynamicPath causes a primtive to be created and updated.', function() {
- var time = new JulianDate();
+ var times = [new JulianDate(0, 0), new JulianDate(1, 0)];
+ var updateTime = new JulianDate(0.5, 0);
+ var positions = [new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)];
var dynamicObjectCollection = new DynamicObjectCollection();
visualizer = new DynamicPathVisualizer(scene, dynamicObjectCollection);
@@ -103,7 +107,9 @@ defineSuite([
expect(scene.getPrimitives().getLength()).toEqual(0);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
+ var position = new SampledPositionProperty();
+ testObject.position = position;
+ position.addSamples(times, positions);
var path = testObject.path = new DynamicPath();
path.show = new ConstantProperty(true);
@@ -114,62 +120,60 @@ defineSuite([
path.leadTime = new ConstantProperty(25);
path.trailTime = new ConstantProperty(10);
- visualizer.update(time);
+ visualizer.update(updateTime);
expect(scene.getPrimitives().getLength()).toEqual(1);
var polylineCollection = scene.getPrimitives().get(0);
var primitive = polylineCollection.get(0);
- expect(testObject.position.lastStart).toEqual(time.addSeconds(-path.trailTime.getValue()));
- expect(testObject.position.lastStop).toEqual(time.addSeconds(path.leadTime.getValue()));
- expect(primitive.getShow()).toEqual(testObject.path.show.getValue(time));
- expect(primitive.getPositions()).toEqual(testObject.position.getValue(time));
- expect(primitive.getWidth()).toEqual(testObject.path.width.getValue(time));
+ expect(primitive.getPositions()[0]).toEqual(testObject.position.getValue(updateTime.addSeconds(-path.trailTime.getValue())));
+ expect(primitive.getPositions()[1]).toEqual(testObject.position.getValue(updateTime));
+ expect(primitive.getPositions()[2]).toEqual(testObject.position.getValue(updateTime.addSeconds(path.leadTime.getValue())));
+ expect(primitive.getShow()).toEqual(testObject.path.show.getValue(updateTime));
+ expect(primitive.getWidth()).toEqual(testObject.path.width.getValue(updateTime));
var material = primitive.getMaterial();
- expect(material.uniforms.color).toEqual(testObject.path.color.getValue(time));
- expect(material.uniforms.outlineColor).toEqual(testObject.path.outlineColor.getValue(time));
- expect(material.uniforms.outlineWidth).toEqual(testObject.path.outlineWidth.getValue(time));
-
- testObject.position = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
- path.color = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
- path.width = new ConstantProperty(2.5);
- path.outlineColor = new ConstantProperty(new Color(0.5, 0.6, 0.7, 0.8));
- path.outlineWidth = new ConstantProperty(12.5);
-
- visualizer.update(time);
- expect(primitive.getShow()).toEqual(testObject.path.show.getValue(time));
- expect(primitive.getPositions()).toEqual(testObject.position.getValue(time));
- expect(primitive.getWidth()).toEqual(testObject.path.width.getValue(time));
-
- expect(material.uniforms.color).toEqual(testObject.path.color.getValue(time));
- expect(material.uniforms.outlineColor).toEqual(testObject.path.outlineColor.getValue(time));
- expect(material.uniforms.outlineWidth).toEqual(testObject.path.outlineWidth.getValue(time));
+ expect(material.uniforms.color).toEqual(testObject.path.color.getValue(updateTime));
+ expect(material.uniforms.outlineColor).toEqual(testObject.path.outlineColor.getValue(updateTime));
+ expect(material.uniforms.outlineWidth).toEqual(testObject.path.outlineWidth.getValue(updateTime));
path.show = new ConstantProperty(false);
- visualizer.update(time);
- expect(primitive.getShow()).toEqual(testObject.path.show.getValue(time));
+ visualizer.update(updateTime);
+ expect(primitive.getShow()).toEqual(testObject.path.show.getValue(updateTime));
});
it('clear hides primitives.', function() {
+ var times = [new JulianDate(0, 0), new JulianDate(1, 0)];
+ var updateTime = new JulianDate(0.5, 0);
+ var positions = [new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)];
+
var dynamicObjectCollection = new DynamicObjectCollection();
visualizer = new DynamicPathVisualizer(scene, dynamicObjectCollection);
+
expect(scene.getPrimitives().getLength()).toEqual(0);
+
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- var time = new JulianDate();
+ var position = new SampledPositionProperty();
+ testObject.position = position;
+ position.addSamples(times, positions);
- testObject.position = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
var path = testObject.path = new DynamicPath();
path.show = new ConstantProperty(true);
- path.leadTime = new ConstantProperty(5);
- path.trailTime = new ConstantProperty(5);
- visualizer.update(time);
+ path.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ path.width = new ConstantProperty(12.5);
+ path.outlineColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ path.outlineWidth = new ConstantProperty(2.5);
+ path.leadTime = new ConstantProperty(25);
+ path.trailTime = new ConstantProperty(10);
+
+ visualizer.update(updateTime);
+
+ expect(scene.getPrimitives().getLength()).toEqual(1);
var polylineCollection = scene.getPrimitives().get(0);
- expect(polylineCollection.getLength()).toEqual(1);
var primitive = polylineCollection.get(0);
- visualizer.update(time);
+ visualizer.update(updateTime);
//Clearing won't actually remove the primitive because of the
//internal cache used by the visualizer, instead it just hides it.
dynamicObjectCollection.clear();
@@ -177,50 +181,76 @@ defineSuite([
});
it('Visualizer sets dynamicObject property.', function() {
+ var times = [new JulianDate(0, 0), new JulianDate(1, 0)];
+ var updateTime = new JulianDate(0.5, 0);
+ var positions = [new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)];
+
var dynamicObjectCollection = new DynamicObjectCollection();
visualizer = new DynamicPathVisualizer(scene, dynamicObjectCollection);
expect(scene.getPrimitives().getLength()).toEqual(0);
var testObject = dynamicObjectCollection.getOrCreateObject('test');
+ var position = new SampledPositionProperty();
+ testObject.position = position;
+ position.addSamples(times, positions);
- var time = new JulianDate();
var path = testObject.path = new DynamicPath();
-
- testObject.position = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
path.show = new ConstantProperty(true);
- path.leadTime = new ConstantProperty(5);
- path.trailTime = new ConstantProperty(5);
+ path.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ path.width = new ConstantProperty(12.5);
+ path.outlineColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ path.outlineWidth = new ConstantProperty(2.5);
+ path.leadTime = new ConstantProperty(25);
+ path.trailTime = new ConstantProperty(10);
- visualizer.update(time);
+ visualizer.update(updateTime);
var polylineCollection = scene.getPrimitives().get(0);
- expect(polylineCollection.getLength()).toEqual(1);
var primitive = polylineCollection.get(0);
expect(primitive.dynamicObject).toEqual(testObject);
});
it('setDynamicObjectCollection removes old objects and add new ones.', function() {
+ var times = [new JulianDate(0, 0), new JulianDate(1, 0)];
+ var updateTime = new JulianDate(0.5, 0);
+ var positions = [new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)];
+
var dynamicObjectCollection = new DynamicObjectCollection();
+ visualizer = new DynamicPathVisualizer(scene, dynamicObjectCollection);
+
+ expect(scene.getPrimitives().getLength()).toEqual(0);
+
var testObject = dynamicObjectCollection.getOrCreateObject('test');
- testObject.position = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112)]);
- testObject.path = new DynamicPath();
- testObject.path.show = new ConstantProperty(true);
- testObject.path.leadTime = new ConstantProperty(5);
- testObject.path.trailTime = new ConstantProperty(5);
+ var position = new SampledPositionProperty();
+ testObject.position = position;
+ position.addSamples(times, positions);
- var dynamicObjectCollection2 = new DynamicObjectCollection();
- var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
- testObject2.position = new ConstantProperty([new Cartesian3(1234, 5678, 9101112), new Cartesian3(5678, 1234, 1101112)]);
- testObject2.path = new DynamicPath();
- testObject2.path.show = new ConstantProperty(true);
- testObject2.path.leadTime = new ConstantProperty(5);
- testObject2.path.trailTime = new ConstantProperty(5);
+ var path = testObject.path = new DynamicPath();
+ path.show = new ConstantProperty(true);
+ path.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ path.width = new ConstantProperty(12.5);
+ path.outlineColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ path.outlineWidth = new ConstantProperty(2.5);
+ path.leadTime = new ConstantProperty(25);
+ path.trailTime = new ConstantProperty(10);
- visualizer = new DynamicPathVisualizer(scene, dynamicObjectCollection);
+ visualizer.update(updateTime);
- var time = new JulianDate();
+ var dynamicObjectCollection2 = new DynamicObjectCollection();
+ var testObject2 = dynamicObjectCollection2.getOrCreateObject('test2');
+ var position2 = new SampledPositionProperty();
+ testObject2.position = position;
+ position2.addSamples(times, positions);
+
+ var path2 = testObject2.path = new DynamicPath();
+ path2.show = new ConstantProperty(true);
+ path2.color = new ConstantProperty(new Color(0.8, 0.7, 0.6, 0.5));
+ path2.width = new ConstantProperty(12.5);
+ path2.outlineColor = new ConstantProperty(new Color(0.1, 0.2, 0.3, 0.4));
+ path2.outlineWidth = new ConstantProperty(2.5);
+ path2.leadTime = new ConstantProperty(25);
+ path2.trailTime = new ConstantProperty(10);
- visualizer.update(time);
expect(scene.getPrimitives().getLength()).toEqual(1);
var polylineCollection = scene.getPrimitives().get(0);
expect(polylineCollection.getLength()).toEqual(1);
@@ -228,7 +258,7 @@ defineSuite([
expect(primitive.dynamicObject).toEqual(testObject);
visualizer.setDynamicObjectCollection(dynamicObjectCollection2);
- visualizer.update(time);
+ visualizer.update(updateTime);
expect(scene.getPrimitives().getLength()).toEqual(1);
polylineCollection = scene.getPrimitives().get(0);
primitive = polylineCollection.get(0);
From fe86ec5fdeb50c8f6e56b04fafaacb509a0dd280 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 21 Aug 2013 17:33:34 -0400
Subject: [PATCH 42/65] Handle all property types.
Still needs specs.
---
Source/DynamicScene/DynamicPathVisualizer.js | 92 +++++++++++++++-----
1 file changed, 71 insertions(+), 21 deletions(-)
diff --git a/Source/DynamicScene/DynamicPathVisualizer.js b/Source/DynamicScene/DynamicPathVisualizer.js
index 400f51ed4515..d7bf7712cae2 100644
--- a/Source/DynamicScene/DynamicPathVisualizer.js
+++ b/Source/DynamicScene/DynamicPathVisualizer.js
@@ -10,6 +10,8 @@ define([
'../Core/Transforms',
'../Core/ReferenceFrame',
'./SampledPositionProperty',
+ './CompositePositionProperty',
+ './TimeIntervalCollectionPositionProperty',
'../Scene/Material',
'../Scene/SceneMode',
'../Scene/PolylineCollection'
@@ -24,18 +26,20 @@ define([
Transforms,
ReferenceFrame,
SampledPositionProperty,
+ CompositePositionProperty,
+ TimeIntervalCollectionPositionProperty,
Material,
SceneMode,
PolylineCollection) {
"use strict";
- function subSampleSampledProperty(positionProperty, start, stop, updateTime, referenceFrame, maximumStep, result) {
- var times = positionProperty._property._times;
+ function subSampleSampledProperty(property, start, stop, updateTime, referenceFrame, maximumStep, startingIndex, result) {
+ var times = property._property._times;
- var r = 0;
+ var r = startingIndex;
//Always step exactly on start (but only use it if it exists.)
var tmp;
- tmp = positionProperty.getValueInReferenceFrame(start, referenceFrame, result[r]);
+ tmp = property.getValueInReferenceFrame(start, referenceFrame, result[r]);
if (defined(tmp)) {
result[r++] = tmp;
}
@@ -56,14 +60,14 @@ define([
while (t < len) {
if (!steppedOnNow && current.greaterThanOrEquals(updateTime)) {
- tmp = positionProperty.getValueInReferenceFrame(updateTime, referenceFrame, result[r]);
+ tmp = property.getValueInReferenceFrame(updateTime, referenceFrame, result[r]);
if (defined(tmp)) {
result[r++] = tmp;
}
steppedOnNow = true;
}
if (current.greaterThan(start) && current.lessThan(loopStop) && !current.equals(updateTime)) {
- tmp = positionProperty.getValueInReferenceFrame(current, referenceFrame, result[r]);
+ tmp = property.getValueInReferenceFrame(current, referenceFrame, result[r]);
if (defined(tmp)) {
result[r++] = tmp;
}
@@ -95,28 +99,18 @@ define([
}
//Always step exactly on stop (but only use it if it exists.)
- tmp = positionProperty.getValueInReferenceFrame(stop, referenceFrame, result[r]);
+ tmp = property.getValueInReferenceFrame(stop, referenceFrame, result[r]);
if (defined(tmp)) {
result[r++] = tmp;
}
- result.length = r;
- return result;
+ return r;
}
- function subSample(property, start, stop, updateTime, referenceFrame, maximumStep, result) {
- if (!defined(result)) {
- result = [];
- }
-
- if (property instanceof SampledPositionProperty) {
- return subSampleSampledProperty(property, start, stop, updateTime, referenceFrame, maximumStep, result);
- }
-
- //Fallback to generic sampling.
+ function subSampleGenericProperty(property, start, stop, updateTime, referenceFrame, maximumStep, startingIndex, result) {
var tmp;
var i = 0;
- var index = 0;
+ var index = startingIndex;
var time = start;
var steppedOnNow = !defined(updateTime) || updateTime.lessThanOrEquals(start) || updateTime.greaterThanOrEquals(stop);
while (time.lessThan(stop)) {
@@ -142,8 +136,64 @@ define([
result[index] = tmp;
index++;
}
+ return index;
+ }
- result.length = index;
+ function subSampleIntervalProperty(property, start, stop, updateTime, referenceFrame, maximumStep, startingIndex, result) {
+ var index = startingIndex;
+ var intervals = property.getIntervals();
+ for ( var i = 0; i < intervals.getLength(); i++) {
+ var interval = intervals.get(0);
+ if (interval.start.lessThanOrEquals(stop)) {
+ var tmp = property.getValueInReferenceFrame(stop, referenceFrame, result[index]);
+ if (defined(tmp)) {
+ result[index] = tmp;
+ index++;
+ }
+ }
+ }
+ return index;
+ }
+
+ function subSampleCompositeProperty(property, start, stop, updateTime, referenceFrame, maximumStep, startingIndex, result) {
+ var index = startingIndex;
+ var intervals = property.getIntervals();
+ for ( var i = 0; i < intervals.getLength(); i++) {
+ var interval = intervals.get(0);
+ if (interval.start.lessThanOrEquals(stop)) {
+ var intervalProperty = interval.data;
+ if (intervalProperty instanceof SampledPositionProperty) {
+ index = subSampleSampledProperty(intervalProperty, interval.start, interval.stop, updateTime, referenceFrame, maximumStep, index, result);
+ } else if (intervalProperty instanceof CompositePositionProperty) {
+ index = subSampleCompositeProperty(intervalProperty, interval.start, interval.stop, updateTime, referenceFrame, maximumStep, index, result);
+ } else if (intervalProperty instanceof TimeIntervalCollectionPositionProperty) {
+ index = subSampleIntervalProperty(intervalProperty, interval.start, interval.stop, updateTime, referenceFrame, maximumStep, index, result);
+ } else {
+ //Fallback to generic sampling.
+ index = subSampleGenericProperty(intervalProperty, interval.start, interval.stop, updateTime, referenceFrame, maximumStep, index, result);
+ }
+ }
+ }
+ return index;
+ }
+
+ function subSample(property, start, stop, updateTime, referenceFrame, maximumStep, result) {
+ if (!defined(result)) {
+ result = [];
+ }
+
+ var length = 0;
+ if (property instanceof SampledPositionProperty) {
+ length = subSampleSampledProperty(property, start, stop, updateTime, referenceFrame, maximumStep, 0, result);
+ } else if (property instanceof CompositePositionProperty) {
+ length = subSampleCompositeProperty(property, start, stop, updateTime, referenceFrame, maximumStep, 0, result);
+ } else if (property instanceof TimeIntervalCollectionPositionProperty) {
+ length = subSampleCompositeProperty(property, start, stop, updateTime, referenceFrame, maximumStep, 0, result);
+ } else {
+ //Fallback to generic sampling.
+ length = subSampleGenericProperty(property, start, stop, updateTime, referenceFrame, maximumStep, 0, result);
+ }
+ result.length = length;
return result;
}
From 2f86f644a2c845e659f70f4e3df932c3a5321546 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 22 Aug 2013 15:34:20 -0400
Subject: [PATCH 43/65] Remove delete `CzmlDefaults`.
It's no longer needed and had more than just CZML defaults in it anyway.
---
.../CompositeDynamicObjectCollection.js | 87 +++++++++++-
Source/DynamicScene/CzmlDataSource.js | 72 +++++-----
Source/DynamicScene/CzmlDefaults.js | 128 ------------------
Source/DynamicScene/DynamicBillboard.js | 5 -
Source/DynamicScene/DynamicClock.js | 4 -
Source/DynamicScene/DynamicCone.js | 5 -
Source/DynamicScene/DynamicEllipse.js | 5 -
Source/DynamicScene/DynamicEllipsoid.js | 5 -
Source/DynamicScene/DynamicLabel.js | 5 -
Source/DynamicScene/DynamicObject.js | 9 --
Source/DynamicScene/DynamicPath.js | 5 -
Source/DynamicScene/DynamicPoint.js | 5 -
Source/DynamicScene/DynamicPolygon.js | 5 -
Source/DynamicScene/DynamicPolyline.js | 5 -
Source/DynamicScene/DynamicPyramid.js | 5 -
Source/DynamicScene/DynamicVector.js | 5 -
Source/DynamicScene/VisualizerCollection.js | 27 +---
.../CompositeDynamicObjectCollectionSpec.js | 6 +-
.../DynamicScene/VisualizerCollectionSpec.js | 24 ----
19 files changed, 121 insertions(+), 291 deletions(-)
delete mode 100644 Source/DynamicScene/CzmlDefaults.js
diff --git a/Source/DynamicScene/CompositeDynamicObjectCollection.js b/Source/DynamicScene/CompositeDynamicObjectCollection.js
index a04fc359d731..66aef35fef98 100644
--- a/Source/DynamicScene/CompositeDynamicObjectCollection.js
+++ b/Source/DynamicScene/CompositeDynamicObjectCollection.js
@@ -7,7 +7,28 @@ define([
'../Core/TimeInterval',
'../Core/DeveloperError',
'./DynamicObject',
- './CzmlDefaults'
+ './DynamicBillboard',
+ './DynamicClock',
+ './DynamicEllipse',
+ './DynamicEllipsoid',
+ './DynamicCone',
+ './DynamicLabel',
+ './DynamicPath',
+ './DynamicPoint',
+ './DynamicPolygon',
+ './DynamicPolyline',
+ './DynamicPyramid',
+ './DynamicVector',
+ './DynamicBillboardVisualizer',
+ './DynamicEllipsoidVisualizer',
+ './DynamicConeVisualizerUsingCustomSensor', //CZML_TODO Replace with './DynamicConeVisualizer', once ComplexConicSensor works.
+ './DynamicLabelVisualizer',
+ './DynamicPathVisualizer',
+ './DynamicPointVisualizer',
+ './DynamicPolygonVisualizer',
+ './DynamicPolylineVisualizer',
+ './DynamicPyramidVisualizer',
+ './DynamicVectorVisualizer'
], function(
defaultValue,
defined,
@@ -16,7 +37,28 @@ define([
TimeInterval,
DeveloperError,
DynamicObject,
- CzmlDefaults) {
+ DynamicBillboard,
+ DynamicClock,
+ DynamicEllipse,
+ DynamicEllipsoid,
+ DynamicCone,
+ DynamicLabel,
+ DynamicPath,
+ DynamicPoint,
+ DynamicPolygon,
+ DynamicPolyline,
+ DynamicPyramid,
+ DynamicVector,
+ DynamicBillboardVisualizer,
+ DynamicEllipsoidVisualizer,
+ DynamicConeVisualizer,
+ DynamicLabelVisualizer,
+ DynamicPathVisualizer,
+ DynamicPointVisualizer,
+ DynamicPolygonVisualizer,
+ DynamicPolylineVisualizer,
+ DynamicPyramidVisualizer,
+ DynamicVectorVisualizer) {
"use strict";
/**
@@ -36,7 +78,6 @@ define([
*
* @see DynamicObjectCollection
* @see DynamicObject
- * @see CzmlDefaults
*/
var CompositeDynamicObjectCollection = function(collections, mergeFunctions, cleanFunctions) {
this._hash = {};
@@ -46,12 +87,12 @@ define([
/**
* The array of functions which merge DynamicObject instances together.
*/
- this.mergeFunctions = defaultValue(mergeFunctions, CzmlDefaults.mergers);
+ this.mergeFunctions = defaultValue(mergeFunctions, CompositeDynamicObjectCollection.mergers);
/**
* The array of functions which remove data from a DynamicObject instance.
*/
- this.cleanFunctions = defaultValue(cleanFunctions, CzmlDefaults.cleaners);
+ this.cleanFunctions = defaultValue(cleanFunctions, CompositeDynamicObjectCollection.cleaners);
/**
* An {@link Event} that is fired whenever DynamicObjects in the collection have properties added.
@@ -66,6 +107,42 @@ define([
this.setCollections(collections);
};
+ /**
+ * The standard set of mergers for processing CZML. This array is the default
+ * set of updater methods used by CompositeDynamicObjectCollection.
+ */
+ CompositeDynamicObjectCollection.mergers = [DynamicClock.mergeProperties,
+ DynamicBillboard.mergeProperties,
+ DynamicEllipse.mergeProperties,
+ DynamicEllipsoid.mergeProperties,
+ DynamicCone.mergeProperties,
+ DynamicLabel.mergeProperties,
+ DynamicPath.mergeProperties,
+ DynamicPoint.mergeProperties,
+ DynamicPolygon.mergeProperties,
+ DynamicPolyline.mergeProperties,
+ DynamicPyramid.mergeProperties,
+ DynamicVector.mergeProperties,
+ DynamicObject.mergeProperties];
+
+ /**
+ * The standard set of cleaners for processing CZML. This array is the default
+ * set of updater methods used by CompositeDynamicObjectCollection.
+ */
+ CompositeDynamicObjectCollection.cleaners = [DynamicBillboard.undefineProperties,
+ DynamicEllipse.undefineProperties,
+ DynamicEllipsoid.undefineProperties,
+ DynamicCone.undefineProperties,
+ DynamicLabel.undefineProperties,
+ DynamicPath.undefineProperties,
+ DynamicPoint.undefineProperties,
+ DynamicPolygon.undefineProperties,
+ DynamicPolyline.undefineProperties,
+ DynamicPyramid.undefineProperties,
+ DynamicVector.undefineProperties,
+ DynamicObject.undefineProperties,
+ DynamicClock.undefineProperties];
+
/**
* Computes the maximum availability of the DynamicObjects in the collection.
* If the collection contains a mix of infinitely available data and non-infinite data,
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index bfbd477597eb..5b3af234aa3d 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -30,7 +30,6 @@ define([
'./CompositeProperty',
'./ConstantPositionProperty',
'./ConstantProperty',
- './CzmlDefaults',
'./DynamicBillboard',
'./DynamicClock',
'./DynamicColorMaterial',
@@ -86,7 +85,6 @@ define([
CompositeProperty,
ConstantPositionProperty,
ConstantProperty,
- CzmlDefaults,
DynamicBillboard,
DynamicClock,
DynamicColorMaterial,
@@ -691,7 +689,7 @@ define([
return updated;
}
- function DynamicObjectprocessCzmlPacketPosition(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processPosition(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var positionData = packet.position;
if (!defined(positionData)) {
return false;
@@ -699,7 +697,7 @@ define([
return processPositionPacketData(dynamicObject, 'position', positionData, undefined, sourceUri);
}
- function DynamicObjectprocessCzmlPacketViewFrom(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processViewFrom(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var viewFromData = packet.viewFrom;
if (!defined(viewFromData)) {
return false;
@@ -707,7 +705,7 @@ define([
return processPacketData(Cartesian3, dynamicObject, 'viewFrom', viewFromData, undefined, sourceUri);
}
- function DynamicObjectprocessCzmlPacketOrientation(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processOrientation(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var orientationData = packet.orientation;
if (!defined(orientationData)) {
return false;
@@ -716,7 +714,7 @@ define([
return processPacketData(Quaternion, dynamicObject, 'orientation', orientationData, undefined, sourceUri);
}
- function DynamicObjectprocessCzmlPacketVertexPositions(dynamicObject, packet, dynamicObjectCollection) {
+ function processVertexPositions(dynamicObject, packet, dynamicObjectCollection) {
var vertexPositionsData = packet.vertexPositions;
if (!defined(vertexPositionsData)) {
return false;
@@ -731,7 +729,7 @@ define([
return propertyCreated;
}
- function DynamicObjectprocessCzmlPacketAvailability(dynamicObject, packet) {
+ function processAvailability(dynamicObject, packet) {
var availability = packet.availability;
if (!defined(availability)) {
return false;
@@ -745,7 +743,7 @@ define([
return propertyChanged;
}
- function DynamicBillboardprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processBillboard(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var billboardData = packet.billboard;
if (!defined(billboardData)) {
return false;
@@ -776,7 +774,7 @@ define([
return billboardUpdated;
}
- function DynamicClockprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processClock(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var clockUpdated = false;
var clockPacket = packet.clock;
if (defined(clockPacket)) {
@@ -813,7 +811,7 @@ define([
return clockUpdated;
}
- function DynamicConeprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processCone(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var coneData = packet.cone;
if (!defined(coneData)) {
return false;
@@ -846,7 +844,7 @@ define([
return coneUpdated;
}
- function DynamicEllipseprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processEllipse(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var ellipseData = packet.ellipse;
if (!defined(ellipseData)) {
return false;
@@ -870,7 +868,7 @@ define([
return ellipseUpdated;
}
- function DynamicEllipsoidprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processEllipsoid(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var ellipsoidData = packet.ellipsoid;
if (!defined(ellipsoidData)) {
return false;
@@ -893,7 +891,7 @@ define([
return ellipsoidUpdated;
}
- function DynamicLabelprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processLabel(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var labelData = packet.label;
if (!defined(labelData)) {
return false;
@@ -926,7 +924,7 @@ define([
return labelUpdated;
}
- function DynamicPathprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processPath(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var pathData = packet.path;
if (!defined(pathData)) {
return false;
@@ -954,7 +952,7 @@ define([
return pathUpdated;
}
- function DynamicPointprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processPoint(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var pointData = packet.point;
if (!defined(pointData)) {
return false;
@@ -980,7 +978,7 @@ define([
return pointUpdated;
}
- function DynamicPolygonprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processPolygon(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var polygonData = packet.polygon;
if (!defined(polygonData)) {
return false;
@@ -1002,7 +1000,7 @@ define([
return polygonUpdated;
}
- function DynamicPolylineprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processPolyline(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var polylineData = packet.polyline;
if (!defined(polylineData)) {
return false;
@@ -1027,7 +1025,7 @@ define([
return polylineUpdated;
}
- function DynamicPyramidprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processPyramid(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var pyramidData = packet.pyramid;
if (!defined(pyramidData)) {
return false;
@@ -1063,7 +1061,7 @@ define([
return pyramidUpdated;
}
- function DynamicVectorprocessCzmlPacket(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
+ function processVector(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var vectorData = packet.vector;
if (!defined(vectorData)) {
return false;
@@ -1089,23 +1087,23 @@ define([
return vectorUpdated;
}
- var updaters = [DynamicClockprocessCzmlPacket,
- DynamicBillboardprocessCzmlPacket,
- DynamicEllipseprocessCzmlPacket,
- DynamicEllipsoidprocessCzmlPacket,
- DynamicConeprocessCzmlPacket,
- DynamicLabelprocessCzmlPacket,
- DynamicPathprocessCzmlPacket,
- DynamicPointprocessCzmlPacket,
- DynamicPolygonprocessCzmlPacket,
- DynamicPolylineprocessCzmlPacket,
- DynamicPyramidprocessCzmlPacket,
- DynamicVectorprocessCzmlPacket,
- DynamicObjectprocessCzmlPacketPosition,
- DynamicObjectprocessCzmlPacketViewFrom,
- DynamicObjectprocessCzmlPacketOrientation,
- DynamicObjectprocessCzmlPacketVertexPositions,
- DynamicObjectprocessCzmlPacketAvailability];
+ var updaters = [processClock,//
+ processBillboard, //
+ processEllipse, //
+ processEllipsoid, //
+ processCone, //
+ processLabel, //
+ processPath, //
+ processPoint, //
+ processPolygon, //
+ processPolyline, //
+ processPyramid, //
+ processVector, //
+ processPosition, //
+ processViewFrom, //
+ processOrientation, //
+ processVertexPositions, //
+ processAvailability];
function processCzmlPacket(packet, dynamicObjectCollection, updatedObjects, updatedObjectsHash, updaterFunctions, sourceUri) {
var objectId = packet.id;
@@ -1309,7 +1307,7 @@ define([
* @param {Object} czml The parsed CZML object to be processed.
* @param {DynamicObjectCollection} dynamicObjectCollection The collection to create or updated objects within.
* @param {String} [sourceUri] The uri of the file where the CZML originated from. If provided, relative uri look-ups will use this as their base.
- * @param {Array} [updaterFunctions=CzmlDefaults.updaters] The array of updated functions to use for processing. If left undefined, all standard CZML data is processed.
+ * @param {Array} [updaterFunctions=CzmlDataSource.updaters] The array of updated functions to use for processing. If left undefined, all standard CZML data is processed.
*
* @exception {DeveloperError} czml is required.
* @exception {DeveloperError} dynamicObjectCollection is required.
diff --git a/Source/DynamicScene/CzmlDefaults.js b/Source/DynamicScene/CzmlDefaults.js
deleted file mode 100644
index 6f23b972dc2a..000000000000
--- a/Source/DynamicScene/CzmlDefaults.js
+++ /dev/null
@@ -1,128 +0,0 @@
-/*global define*/
-define([
- './DynamicObject',
- './DynamicBillboard',
- './DynamicClock',
- './DynamicEllipse',
- './DynamicEllipsoid',
- './DynamicCone',
- './DynamicLabel',
- './DynamicPath',
- './DynamicPoint',
- './DynamicPolygon',
- './DynamicPolyline',
- './DynamicPyramid',
- './DynamicVector',
- './DynamicBillboardVisualizer',
- './DynamicEllipsoidVisualizer',
- './DynamicConeVisualizerUsingCustomSensor', //CZML_TODO Replace with './DynamicConeVisualizer', once ComplexConicSensor works.
- './DynamicLabelVisualizer',
- './DynamicPathVisualizer',
- './DynamicPointVisualizer',
- './DynamicPolygonVisualizer',
- './DynamicPolylineVisualizer',
- './DynamicPyramidVisualizer',
- './DynamicVectorVisualizer'
- ], function(
- DynamicObject,
- DynamicBillboard,
- DynamicClock,
- DynamicEllipse,
- DynamicEllipsoid,
- DynamicCone,
- DynamicLabel,
- DynamicPath,
- DynamicPoint,
- DynamicPolygon,
- DynamicPolyline,
- DynamicPyramid,
- DynamicVector,
- DynamicBillboardVisualizer,
- DynamicEllipsoidVisualizer,
- DynamicConeVisualizer,
- DynamicLabelVisualizer,
- DynamicPathVisualizer,
- DynamicPointVisualizer,
- DynamicPolygonVisualizer,
- DynamicPolylineVisualizer,
- DynamicPyramidVisualizer,
- DynamicVectorVisualizer) {
- "use strict";
-
- /**
- * Helper class which provides the default set of CZML processing methods
- * needed to visualize the complete CZML standard. There's no reason to
- * access this class directly, as it just holds the defaults used by
- * DynamicObjectCollection, CompositeDynamicObjectCollection, and VisualizerCollection.
- *
- * @exports CzmlDefaults
- *
- * @see DynamicObjectCollection
- * @see CompositeDynamicObjectCollection
- * @see VisualizerCollection#createCzmlDefaultsCollection
- */
- var CzmlDefaults = {
- /**
- * The standard set of mergers for processing CZML. This array is the default
- * set of updater methods used by CompositeDynamicObjectCollection.
- *
- * @see CompositeDynamicObjectCollection
- */
- mergers : [DynamicClock.mergeProperties,
- DynamicBillboard.mergeProperties,
- DynamicEllipse.mergeProperties,
- DynamicEllipsoid.mergeProperties,
- DynamicCone.mergeProperties,
- DynamicLabel.mergeProperties,
- DynamicPath.mergeProperties,
- DynamicPoint.mergeProperties,
- DynamicPolygon.mergeProperties,
- DynamicPolyline.mergeProperties,
- DynamicPyramid.mergeProperties,
- DynamicVector.mergeProperties,
- DynamicObject.mergeProperties],
-
- /**
- * The standard set of cleaners for processing CZML. This array is the default
- * set of updater methods used by CompositeDynamicObjectCollection.
- *
- * @see CompositeDynamicObjectCollection
- */
- cleaners : [DynamicBillboard.undefineProperties,
- DynamicEllipse.undefineProperties,
- DynamicEllipsoid.undefineProperties,
- DynamicCone.undefineProperties,
- DynamicLabel.undefineProperties,
- DynamicPath.undefineProperties,
- DynamicPoint.undefineProperties,
- DynamicPolygon.undefineProperties,
- DynamicPolyline.undefineProperties,
- DynamicPyramid.undefineProperties,
- DynamicVector.undefineProperties,
- DynamicObject.undefineProperties,
- DynamicClock.undefineProperties],
-
- /**
- * Creates an array containing the standard CZML visualizers,
- * configured for the provided scene.
- *
- * @param scene The scene being used for visualization.
- * @returns {Array} The CZML standard visualizers.
- * @see VisualizerCollection#createCzmlDefaultsCollection
- */
- createVisualizers : function(scene) {
- return [new DynamicBillboardVisualizer(scene),
- new DynamicEllipsoidVisualizer(scene),
- new DynamicConeVisualizer(scene),
- new DynamicLabelVisualizer(scene),
- new DynamicPointVisualizer(scene),
- new DynamicPolygonVisualizer(scene),
- new DynamicPolylineVisualizer(scene),
- new DynamicPyramidVisualizer(scene),
- new DynamicVectorVisualizer(scene),
- new DynamicPathVisualizer(scene)];
- }
- };
-
- return CzmlDefaults;
-});
\ No newline at end of file
diff --git a/Source/DynamicScene/DynamicBillboard.js b/Source/DynamicScene/DynamicBillboard.js
index aa3d09c3f70c..8a4bee41384b 100644
--- a/Source/DynamicScene/DynamicBillboard.js
+++ b/Source/DynamicScene/DynamicBillboard.js
@@ -33,7 +33,6 @@ define([
* @see VisualizerCollection
* @see Billboard
* @see BillboardCollection
- * @see CzmlDefaults
*/
var DynamicBillboard = function() {
/**
@@ -107,8 +106,6 @@ define([
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicBillboard.mergeProperties = function(targetObject, objectToMerge) {
var billboardToMerge = objectToMerge.billboard;
@@ -139,8 +136,6 @@ define([
* @memberof DynamicBillboard
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the billboard from.
- *
- * @see CzmlDefaults
*/
DynamicBillboard.undefineProperties = function(dynamicObject) {
dynamicObject.billboard = undefined;
diff --git a/Source/DynamicScene/DynamicClock.js b/Source/DynamicScene/DynamicClock.js
index c2b996862b3e..2c27c574d786 100644
--- a/Source/DynamicScene/DynamicClock.js
+++ b/Source/DynamicScene/DynamicClock.js
@@ -95,8 +95,6 @@ define([
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicClock.mergeProperties = function(targetObject, objectToMerge) {
var clockToMerge = objectToMerge.clock;
@@ -124,8 +122,6 @@ define([
* @memberof DynamicClock
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the clock from.
- *
- * @see CzmlDefaults
*/
DynamicClock.undefineProperties = function(dynamicObject) {
dynamicObject.clock = undefined;
diff --git a/Source/DynamicScene/DynamicCone.js b/Source/DynamicScene/DynamicCone.js
index a138e860a34b..6274035298df 100644
--- a/Source/DynamicScene/DynamicCone.js
+++ b/Source/DynamicScene/DynamicCone.js
@@ -24,7 +24,6 @@ define([
* @see DynamicConeVisualizer
* @see VisualizerCollection
* @see ComplexConicSensor
- * @see CzmlDefaults
*/
var DynamicCone = function() {
/**
@@ -115,8 +114,6 @@ define([
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicCone.mergeProperties = function(targetObject, objectToMerge) {
var coneToMerge = objectToMerge.cone;
@@ -149,8 +146,6 @@ define([
* functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the cone from.
- *
- * @see CzmlDefaults
*/
DynamicCone.undefineProperties = function(dynamicObject) {
dynamicObject.cone = undefined;
diff --git a/Source/DynamicScene/DynamicEllipse.js b/Source/DynamicScene/DynamicEllipse.js
index 2dcf5904bbb6..9b729d5fac1b 100644
--- a/Source/DynamicScene/DynamicEllipse.js
+++ b/Source/DynamicScene/DynamicEllipse.js
@@ -27,7 +27,6 @@ define([
* @see DynamicObjectCollection
* @see DynamicEllipseVisualizer
* @see VisualizerCollection
- * @see CzmlDefaults
*/
var DynamicEllipse = function() {
/**
@@ -65,8 +64,6 @@ define([
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicEllipse.mergeProperties = function(targetObject, objectToMerge) {
var ellipseToMerge = objectToMerge.ellipse;
@@ -89,8 +86,6 @@ define([
* functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the ellipse from.
- *
- * @see CzmlDefaults
*/
DynamicEllipse.undefineProperties = function(dynamicObject) {
dynamicObject.ellipse = undefined;
diff --git a/Source/DynamicScene/DynamicEllipsoid.js b/Source/DynamicScene/DynamicEllipsoid.js
index 109271ba4c0e..99fd21382888 100644
--- a/Source/DynamicScene/DynamicEllipsoid.js
+++ b/Source/DynamicScene/DynamicEllipsoid.js
@@ -24,7 +24,6 @@ define([
* @see DynamicEllipsoidVisualizer
* @see VisualizerCollection
* @see CustomSensor
- * @see CzmlDefaults
*/
var DynamicEllipsoid = function() {
/**
@@ -55,8 +54,6 @@ define([
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicEllipsoid.mergeProperties = function(targetObject, objectToMerge) {
var ellipsoidToMerge = objectToMerge.ellipsoid;
@@ -79,8 +76,6 @@ define([
* functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the ellipsoid from.
- *
- * @see CzmlDefaults
*/
DynamicEllipsoid.undefineProperties = function(dynamicObject) {
dynamicObject.ellipsoid = undefined;
diff --git a/Source/DynamicScene/DynamicLabel.js b/Source/DynamicScene/DynamicLabel.js
index 27274d876f85..266865f2ff14 100644
--- a/Source/DynamicScene/DynamicLabel.js
+++ b/Source/DynamicScene/DynamicLabel.js
@@ -35,7 +35,6 @@ define([
* @see VisualizerCollection
* @see Label
* @see LabelCollection
- * @see CzmlDefaults
*/
var DynamicLabel = function() {
/**
@@ -120,8 +119,6 @@ define([
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicLabel.mergeProperties = function(targetObject, objectToMerge) {
var labelToMerge = objectToMerge.label;
@@ -153,8 +150,6 @@ define([
* functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the label from.
- *
- * @see CzmlDefaults
*/
DynamicLabel.undefineProperties = function(dynamicObject) {
dynamicObject.label = undefined;
diff --git a/Source/DynamicScene/DynamicObject.js b/Source/DynamicScene/DynamicObject.js
index c5b6808b5f73..1e7053b666a6 100644
--- a/Source/DynamicScene/DynamicObject.js
+++ b/Source/DynamicScene/DynamicObject.js
@@ -55,11 +55,6 @@ define([
*/
this.id = id;
- //Add standard CZML properties. Even though they won't all be used
- //for each object, having the superset explicitly listed here will allow the
- //compiler to optimize this class. It also allows us to document them.
- //Any changes to this list should coincide with changes to CzmlDefaults.updaters
-
/**
* The availability TimeInterval, if any, associated with this object.
* If availability is undefined, it is assumed that this object's
@@ -230,8 +225,6 @@ define([
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicObject.mergeProperties = function(targetObject, objectToMerge) {
targetObject.position = defaultValue(targetObject.position, objectToMerge.position);
@@ -250,8 +243,6 @@ define([
* CZML processing functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the billboard from.
- *
- * @see CzmlDefaults
*/
DynamicObject.undefineProperties = function(dynamicObject) {
dynamicObject.position = undefined;
diff --git a/Source/DynamicScene/DynamicPath.js b/Source/DynamicScene/DynamicPath.js
index b1da805de943..8f88bc7f403e 100644
--- a/Source/DynamicScene/DynamicPath.js
+++ b/Source/DynamicScene/DynamicPath.js
@@ -24,7 +24,6 @@ function(
* @see DynamicPathVisualizer
* @see VisualizerCollection
* @see Polyline
- * @see CzmlDefaults
*/
var DynamicPath = function() {
/**
@@ -85,8 +84,6 @@ function(
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicPath.mergeProperties = function(targetObject, objectToMerge) {
var pathToMerge = objectToMerge.path;
@@ -114,8 +111,6 @@ function(
* functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the path from.
- *
- * @see CzmlDefaults
*/
DynamicPath.undefineProperties = function(dynamicObject) {
dynamicObject.path = undefined;
diff --git a/Source/DynamicScene/DynamicPoint.js b/Source/DynamicScene/DynamicPoint.js
index 0535ab7dd6f2..8c33785196f0 100644
--- a/Source/DynamicScene/DynamicPoint.js
+++ b/Source/DynamicScene/DynamicPoint.js
@@ -25,7 +25,6 @@ define([
* @see VisualizerCollection
* @see Billboard
* @see BillboardCollection
- * @see CzmlDefaults
*/
var DynamicPoint = function() {
/**
@@ -63,8 +62,6 @@ define([
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicPoint.mergeProperties = function(targetObject, objectToMerge) {
var pointToMerge = objectToMerge.point;
@@ -89,8 +86,6 @@ define([
* functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the point from.
- *
- * @see CzmlDefaults
*/
DynamicPoint.undefineProperties = function(dynamicObject) {
dynamicObject.point = undefined;
diff --git a/Source/DynamicScene/DynamicPolygon.js b/Source/DynamicScene/DynamicPolygon.js
index 25693999ffb1..667e632c4fbd 100644
--- a/Source/DynamicScene/DynamicPolygon.js
+++ b/Source/DynamicScene/DynamicPolygon.js
@@ -22,7 +22,6 @@ define([
* @see DynamicPolygonVisualizer
* @see VisualizerCollection
* @see Polygon
- * @see CzmlDefaults
*/
var DynamicPolygon = function() {
/**
@@ -47,8 +46,6 @@ define([
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicPolygon.mergeProperties = function(targetObject, objectToMerge) {
var polygonToMerge = objectToMerge.polygon;
@@ -70,8 +67,6 @@ define([
* functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the polygon from.
- *
- * @see CzmlDefaults
*/
DynamicPolygon.undefineProperties = function(dynamicObject) {
dynamicObject.polygon = undefined;
diff --git a/Source/DynamicScene/DynamicPolyline.js b/Source/DynamicScene/DynamicPolyline.js
index e94b6b923c60..cc0b3f987b8d 100644
--- a/Source/DynamicScene/DynamicPolyline.js
+++ b/Source/DynamicScene/DynamicPolyline.js
@@ -24,7 +24,6 @@ function(
* @see DynamicPolylineVisualizer
* @see VisualizerCollection
* @see Polyline
- * @see CzmlDefaults
*/
var DynamicPolyline = function() {
/**
@@ -67,8 +66,6 @@ function(
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicPolyline.mergeProperties = function(targetObject, objectToMerge) {
var polylineToMerge = objectToMerge.polyline;
@@ -93,8 +90,6 @@ function(
* functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the polyline from.
- *
- * @see CzmlDefaults
*/
DynamicPolyline.undefineProperties = function(dynamicObject) {
dynamicObject.polyline = undefined;
diff --git a/Source/DynamicScene/DynamicPyramid.js b/Source/DynamicScene/DynamicPyramid.js
index 5b6f8570bdaa..7f0984611742 100644
--- a/Source/DynamicScene/DynamicPyramid.js
+++ b/Source/DynamicScene/DynamicPyramid.js
@@ -26,7 +26,6 @@ define([
* @see DynamicPyramidVisualizer
* @see VisualizerCollection
* @see CustomSensor
- * @see CzmlDefaults
*/
var DynamicPyramid = function() {
/**
@@ -81,8 +80,6 @@ define([
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicPyramid.mergeProperties = function(targetObject, objectToMerge) {
var pyramidToMerge = objectToMerge.pyramid;
@@ -109,8 +106,6 @@ define([
* functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the pyramid from.
- *
- * @see CzmlDefaults
*/
DynamicPyramid.undefineProperties = function(dynamicObject) {
dynamicObject.pyramid = undefined;
diff --git a/Source/DynamicScene/DynamicVector.js b/Source/DynamicScene/DynamicVector.js
index 211bdc8897fd..f772e7fc7ea4 100644
--- a/Source/DynamicScene/DynamicVector.js
+++ b/Source/DynamicScene/DynamicVector.js
@@ -25,7 +25,6 @@ function(
* @see DynamicObjectCollection
* @see DynamicVectorVisualizer
* @see VisualizerCollection
- * @see CzmlDefaults
*/
var DynamicVector = function() {
/**
@@ -68,8 +67,6 @@ function(
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
- *
- * @see CzmlDefaults
*/
DynamicVector.mergeProperties = function(targetObject, objectToMerge) {
var vectorToMerge = objectToMerge.vector;
@@ -94,8 +91,6 @@ function(
* functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the vector from.
- *
- * @see CzmlDefaults
*/
DynamicVector.undefineProperties = function(dynamicObject) {
dynamicObject.vector = undefined;
diff --git a/Source/DynamicScene/VisualizerCollection.js b/Source/DynamicScene/VisualizerCollection.js
index bcee8440b4d9..20205fb4dc31 100644
--- a/Source/DynamicScene/VisualizerCollection.js
+++ b/Source/DynamicScene/VisualizerCollection.js
@@ -3,14 +3,12 @@ define([
'../Core/defaultValue',
'../Core/defined',
'../Core/destroyObject',
- '../Core/DeveloperError',
- './CzmlDefaults'
+ '../Core/DeveloperError'
], function(
defaultValue,
defined,
destroyObject,
- DeveloperError,
- CzmlDefaults) {
+ DeveloperError) {
"use strict";
/**
@@ -21,8 +19,6 @@ define([
*
* @param {Object} The array of visualizers to use.
* @param {DynamicObjectCollection} The objects to be visualized.
- *
- * @see CzmlDefaults#createVisualizers
*/
var VisualizerCollection = function(visualizers, dynamicObjectCollection) {
this._visualizers = defined(visualizers) ? visualizers : [];
@@ -30,25 +26,6 @@ define([
this.setDynamicObjectCollection(dynamicObjectCollection);
};
- /**
- * Creates a new VisualizerCollection which includes all standard visualizers.
- *
- * @memberof VisualizerCollection
- *
- * @param {Scene} The scene where visualization will take place.
- * @param {DynamicObjectCollection} The objects to be visualized.
- *
- * @exception {DeveloperError} scene is required.
- *
- * @see CzmlDefaults#createVisualizers
- */
- VisualizerCollection.createCzmlStandardCollection = function(scene, dynamicObjectCollection) {
- if (!defined(scene)) {
- throw new DeveloperError('scene is required.');
- }
- return new VisualizerCollection(CzmlDefaults.createVisualizers(scene), dynamicObjectCollection);
- };
-
/**
* Gets a copy of the array of visualizers in the collection.
* @returns {Array} the array of visualizers in the collection.
diff --git a/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js b/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
index 6a463bad8030..ea0b56c98e59 100644
--- a/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
+++ b/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
@@ -6,7 +6,6 @@ defineSuite([
'Core/Iso8601',
'Core/TimeInterval',
'DynamicScene/CzmlDataSource',
- 'DynamicScene/CzmlDefaults',
'Scene/HorizontalOrigin'
], function(
CompositeDynamicObjectCollection,
@@ -15,7 +14,6 @@ defineSuite([
Iso8601,
TimeInterval,
CzmlDataSource,
- CzmlDefaults,
HorizontalOrigin) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -38,8 +36,8 @@ defineSuite([
it('default constructor sets expected properties.', function() {
var compositeDynamicObjectCollection = new CompositeDynamicObjectCollection();
- expect(compositeDynamicObjectCollection.mergeFunctions).toEqual(CzmlDefaults.mergers);
- expect(compositeDynamicObjectCollection.cleanFunctions).toEqual(CzmlDefaults.cleaners);
+ expect(compositeDynamicObjectCollection.mergeFunctions).toEqual(CompositeDynamicObjectCollection.mergers);
+ expect(compositeDynamicObjectCollection.cleanFunctions).toEqual(CompositeDynamicObjectCollection.cleaners);
expect(compositeDynamicObjectCollection.getCollections().length).toEqual(0);
var objects = compositeDynamicObjectCollection.getObjects();
expect(objects.length).toEqual(0);
diff --git a/Specs/DynamicScene/VisualizerCollectionSpec.js b/Specs/DynamicScene/VisualizerCollectionSpec.js
index e787f2652bcf..a1b336090db8 100644
--- a/Specs/DynamicScene/VisualizerCollectionSpec.js
+++ b/Specs/DynamicScene/VisualizerCollectionSpec.js
@@ -2,13 +2,11 @@
defineSuite([
'DynamicScene/VisualizerCollection',
'Core/JulianDate',
- 'DynamicScene/CzmlDefaults',
'Specs/createScene',
'Specs/destroyScene'
], function(
VisualizerCollection,
JulianDate,
- CzmlDefaults,
createScene,
destroyScene) {
"use strict";
@@ -56,28 +54,6 @@ defineSuite([
expect(mockVisualizer.mockCollection).toEqual(mockCollection);
});
- it('createCzmlStandardCollection uses CzmlDefaults', function() {
- var scene = createScene();
- var visualizers = VisualizerCollection.createCzmlStandardCollection(scene);
- var expected = CzmlDefaults.createVisualizers(scene);
-
- //Simple sanity check to make sure VisualizerCollection is using the correct defaults.
- var collection = visualizers.getVisualizers();
- for ( var i = 0; i < expected.length; i++) {
- expect(collection[i].prototype).toEqual(expected[i].prototype);
- expected[i].destroy();
- }
-
- visualizers = visualizers && visualizers.destroy();
- destroyScene(scene);
- });
-
- it('createCzmlStandardCollection throws without a scene', function() {
- expect(function() {
- return VisualizerCollection.createCzmlStandardCollection(undefined, new MockDynamicObjectCollection());
- }).toThrow();
- });
-
it('Constructor assigns expected paramters to properies', function() {
var mockVisualizer = new MockVisualizer();
var mockCollection = new MockDynamicObjectCollection();
From dd4f2a73fa365b113166fc412e482b9794f3b6fd Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 22 Aug 2013 15:53:16 -0400
Subject: [PATCH 44/65] Fix some broken specs
---
Specs/DynamicScene/DynamicEllipseSpec.js | 12 +++++++-----
Specs/DynamicScene/DynamicLabelSpec.js | 12 ++++++------
Specs/DynamicScene/DynamicObjectSpec.js | 2 +-
Specs/UndefinedProperty.js | 23 +++++++++++++++++++++++
4 files changed, 37 insertions(+), 12 deletions(-)
create mode 100644 Specs/UndefinedProperty.js
diff --git a/Specs/DynamicScene/DynamicEllipseSpec.js b/Specs/DynamicScene/DynamicEllipseSpec.js
index bf57c892b069..cc70a662b0a2 100644
--- a/Specs/DynamicScene/DynamicEllipseSpec.js
+++ b/Specs/DynamicScene/DynamicEllipseSpec.js
@@ -8,7 +8,8 @@ defineSuite([
'Core/Cartesian3',
'Core/Iso8601',
'Core/TimeInterval',
- 'DynamicScene/ConstantProperty'
+ 'DynamicScene/ConstantProperty',
+ 'Specs/UndefinedProperty'
], function(
DynamicEllipse,
DynamicObject,
@@ -18,7 +19,8 @@ defineSuite([
Cartesian3,
Iso8601,
TimeInterval,
- ConstantProperty) {
+ ConstantProperty,
+ UndefinedProperty) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -103,7 +105,7 @@ defineSuite([
ellipse.semiMajorAxis = undefined;
expect(ellipse.getValue(new JulianDate(), position)).toBeUndefined();
- ellipse.semiMajorAxis = new ConstantProperty(undefined);
+ ellipse.semiMajorAxis = new UndefinedProperty();
expect(ellipse.getValue(new JulianDate(), position)).toBeUndefined();
});
@@ -115,7 +117,7 @@ defineSuite([
ellipse.semiMajorAxis = new ConstantProperty(10);
expect(ellipse.getValue(new JulianDate(), position)).toBeUndefined();
- ellipse.semiMinorAxis = new ConstantProperty(undefined);
+ ellipse.semiMinorAxis = new UndefinedProperty();
expect(ellipse.getValue(new JulianDate(), position)).toBeUndefined();
});
@@ -134,7 +136,7 @@ defineSuite([
var result = ellipse.getValue(new JulianDate(), position);
expect(result).toEqual(expected);
- ellipse.bearing = new ConstantProperty(undefined);
+ ellipse.bearing = new UndefinedProperty();
result = ellipse.getValue(new JulianDate(), position);
expect(result).toEqual(expected);
});
diff --git a/Specs/DynamicScene/DynamicLabelSpec.js b/Specs/DynamicScene/DynamicLabelSpec.js
index 2c4c73cc3635..601b93672ee2 100644
--- a/Specs/DynamicScene/DynamicLabelSpec.js
+++ b/Specs/DynamicScene/DynamicLabelSpec.js
@@ -38,7 +38,7 @@ defineSuite([
var expectedHorizontalOrigin = new ConstantProperty(HorizontalOrigin.RIGHT);
var expectedVerticalOrigin = new ConstantProperty(VerticalOrigin.TOP);
var expectedEyeOffset = new ConstantProperty(Cartesian3.UNIT_Z);
- var expectedPixelOffset = new ConstantProperty(Cartesian2.UNIY_Y);
+ var expectedPixelOffset = new ConstantProperty(Cartesian2.UNIT_Y);
var expectedScale = new ConstantProperty(2);
var expectedShow = new ConstantProperty(true);
@@ -52,8 +52,8 @@ defineSuite([
objectToMerge.label.outlineWidth = new ConstantProperty(5);
objectToMerge.label.horizontalOrigin = new ConstantProperty(HorizontalOrigin.LEFT);
objectToMerge.label.verticalOrigin = new ConstantProperty(VerticalOrigin.BOTTOM);
- objectToMerge.label.eyeOffset = new ConstantProperty(Cartesian3.UNIY_Y);
- objectToMerge.label.pixelOffset = new ConstantProperty(Cartesian2.UNIY_X);
+ objectToMerge.label.eyeOffset = new ConstantProperty(Cartesian3.UNIT_Y);
+ objectToMerge.label.pixelOffset = new ConstantProperty(Cartesian2.UNIT_X);
objectToMerge.label.scale = new ConstantProperty(1);
objectToMerge.label.show = new ConstantProperty(false);
@@ -99,8 +99,8 @@ defineSuite([
objectToMerge.label.outlineWidth = new ConstantProperty(5);
objectToMerge.label.horizontalOrigin = new ConstantProperty(HorizontalOrigin.LEFT);
objectToMerge.label.verticalOrigin = new ConstantProperty(VerticalOrigin.BOTTOM);
- objectToMerge.label.eyeOffset = new ConstantProperty(Cartesian3.UNIY_Y);
- objectToMerge.label.pixelOffset = new ConstantProperty(Cartesian2.UNIY_X);
+ objectToMerge.label.eyeOffset = new ConstantProperty(Cartesian3.UNIT_Y);
+ objectToMerge.label.pixelOffset = new ConstantProperty(Cartesian2.UNIT_X);
objectToMerge.label.scale = new ConstantProperty(1);
objectToMerge.label.show = new ConstantProperty(false);
@@ -132,7 +132,7 @@ defineSuite([
var expectedHorizontalOrigin = new ConstantProperty(HorizontalOrigin.RIGHT);
var expectedVerticalOrigin = new ConstantProperty(VerticalOrigin.TOP);
var expectedEyeOffset = new ConstantProperty(Cartesian3.UNIT_Z);
- var expectedPixelOffset = new ConstantProperty(Cartesian2.UNIY_Y);
+ var expectedPixelOffset = new ConstantProperty(Cartesian2.UNIT_Y);
var expectedScale = new ConstantProperty(2);
var expectedShow = new ConstantProperty(true);
diff --git a/Specs/DynamicScene/DynamicObjectSpec.js b/Specs/DynamicScene/DynamicObjectSpec.js
index d4d906dd4727..253c4c6d8b04 100644
--- a/Specs/DynamicScene/DynamicObjectSpec.js
+++ b/Specs/DynamicScene/DynamicObjectSpec.js
@@ -42,7 +42,7 @@ defineSuite([
it('isAvailable works.', function() {
var dynamicObject = new DynamicObject('dynamicObject');
- var interval = TimeInterval.fromIso9601('2000-01-01/2001-01-01');
+ var interval = TimeInterval.fromIso8601('2000-01-01/2001-01-01');
dynamicObject._setAvailability(interval);
expect(dynamicObject.isAvailable(interval.start.addSeconds(-1))).toEqual(false);
expect(dynamicObject.isAvailable(interval.start)).toEqual(true);
diff --git a/Specs/UndefinedProperty.js b/Specs/UndefinedProperty.js
new file mode 100644
index 000000000000..bc494edaf9ef
--- /dev/null
+++ b/Specs/UndefinedProperty.js
@@ -0,0 +1,23 @@
+/*global define*/
+define(['../Core/defineProperties'], function(defineProperties) {
+ "use strict";
+
+ //A Property that always returns undefined.
+
+ var UndefinedProperty = function() {
+ };
+
+ defineProperties(UndefinedProperty.prototype, {
+ isTimeVarying : {
+ get : function() {
+ return false;
+ }
+ }
+ });
+
+ UndefinedProperty.prototype.getValue = function(time, result) {
+ return undefined;
+ };
+
+ return UndefinedProperty;
+});
From d2b65c41e0f4ec63df64a5ed9e0ad12b4355a295 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 22 Aug 2013 17:14:03 -0400
Subject: [PATCH 45/65] Refactoring DynamicScene Material support.
CZML processing of some Materials is broken, but everything else is looking good.
---
Source/DynamicScene/ColorMaterialProperty.js | 52 +++++++
Source/DynamicScene/CzmlDataSource.js | 46 ++----
Source/DynamicScene/DynamicColorMaterial.js | 20 ---
.../DynamicConeVisualizerUsingCustomSensor.js | 9 +-
.../DynamicEllipsoidVisualizer.js | 9 +-
Source/DynamicScene/DynamicGridMaterial.js | 55 -------
Source/DynamicScene/DynamicImageMaterial.js | 33 -----
.../DynamicScene/DynamicPolygonVisualizer.js | 9 +-
.../DynamicScene/DynamicPyramidVisualizer.js | 9 +-
Source/DynamicScene/GeoJsonDataSource.js | 6 +-
Source/DynamicScene/GridMaterialProperty.js | 92 ++++++++++++
Source/DynamicScene/ImageMaterialProperty.js | 70 +++++++++
Source/DynamicScene/MaterialProperty.js | 67 +++++++++
Source/DynamicScene/processMaterial.js | 138 ------------------
14 files changed, 309 insertions(+), 306 deletions(-)
create mode 100644 Source/DynamicScene/ColorMaterialProperty.js
delete mode 100644 Source/DynamicScene/DynamicColorMaterial.js
delete mode 100644 Source/DynamicScene/DynamicGridMaterial.js
delete mode 100644 Source/DynamicScene/DynamicImageMaterial.js
create mode 100644 Source/DynamicScene/GridMaterialProperty.js
create mode 100644 Source/DynamicScene/ImageMaterialProperty.js
create mode 100644 Source/DynamicScene/MaterialProperty.js
delete mode 100644 Source/DynamicScene/processMaterial.js
diff --git a/Source/DynamicScene/ColorMaterialProperty.js b/Source/DynamicScene/ColorMaterialProperty.js
new file mode 100644
index 000000000000..289e80293f0e
--- /dev/null
+++ b/Source/DynamicScene/ColorMaterialProperty.js
@@ -0,0 +1,52 @@
+/*global define*/
+define([
+ '../Core/defined',
+ '../Core/defineProperties'
+ ], function(
+ defined,
+ defineProperties) {
+ "use strict";
+
+ /**
+ * A utility class for processing CZML color materials.
+ * @alias ColorMaterialProperty
+ * @constructor
+ */
+ var ColorMaterialProperty = function() {
+ this.type = 'Color';
+
+ /**
+ * A DynamicProperty of type Color which determines the material's color.
+ * @type {DynamicProperty}
+ * @default undefined
+ */
+ this.color = undefined;
+ };
+
+ defineProperties(ColorMaterialProperty.prototype, {
+ /**
+ * Always returns false, since this property always varies with simulation time.
+ * @memberof ConstantProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return defined(this.color) ? this.color.isTimeVarying : false;
+ }
+ }
+ });
+
+ ColorMaterialProperty.prototype.getValue = function(time, result) {
+ if (!defined(result)) {
+ return {
+ color : this.color.getValue(time)
+ };
+ }
+
+ result.color = this.color.getValue(time, result.color);
+ return result;
+ };
+
+ return ColorMaterialProperty;
+});
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index 5b3af234aa3d..39349fb199c9 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -32,14 +32,14 @@ define([
'./ConstantProperty',
'./DynamicBillboard',
'./DynamicClock',
- './DynamicColorMaterial',
+ './ColorMaterialProperty',
'./DynamicCone',
'./DynamicLabel',
'./DynamicDirectionsProperty',
'./DynamicEllipse',
'./DynamicEllipsoid',
- './DynamicGridMaterial',
- './DynamicImageMaterial',
+ './GridMaterialProperty',
+ './ImageMaterialProperty',
'./DynamicObjectCollection',
'./DynamicPath',
'./DynamicPoint',
@@ -87,14 +87,14 @@ define([
ConstantProperty,
DynamicBillboard,
DynamicClock,
- DynamicColorMaterial,
+ ColorMaterialProperty,
DynamicCone,
DynamicLabel,
DynamicDirectionsProperty,
DynamicEllipse,
DynamicEllipsoid,
- DynamicGridMaterial,
- DynamicImageMaterial,
+ GridMaterialProperty,
+ ImageMaterialProperty,
DynamicObjectCollection,
DynamicPath,
DynamicPoint,
@@ -584,26 +584,6 @@ define([
return updated;
}
- function cloneIntoUniforms(material, uniforms) {
- if (!defined(uniforms)) {
- uniforms = {};
- }
- if (material instanceof DynamicColorMaterial) {
- //uniforms.color = material.color.getValue(time, uniforms.color);
- }
-
- if (material instanceof DynamicGridMaterial) {
- }
-
- if (material instanceof DynamicImageMaterial) {
- return material;
- }
-
- //TODO
- return material;
- //throw new RuntimeError('unknown material');
- }
-
function processMaterialProperty(object, propertyName, packetData, constrainedInterval, sourceUri) {
var combinedInterval;
var packetInterval = packetData.interval;
@@ -621,7 +601,7 @@ define([
var propertyCreated = false;
var property = object[propertyName];
if (!defined(property)) {
- property = new TimeIntervalCollectionProperty(cloneIntoUniforms);
+ property = new CompositeProperty();
object[propertyName] = property;
propertyCreated = true;
}
@@ -643,14 +623,14 @@ define([
var materialData;
if (defined(packetData.solidColor)) {
- if (!(existingMaterial instanceof DynamicColorMaterial)) {
- existingMaterial = new DynamicColorMaterial();
+ if (!(existingMaterial instanceof ColorMaterialProperty)) {
+ existingMaterial = new ColorMaterialProperty();
}
materialData = packetData.solidColor;
processPacketData(Color, existingMaterial, 'color', materialData.color);
} else if (defined(packetData.grid)) {
- if (!(existingMaterial instanceof DynamicGridMaterial)) {
- existingMaterial = new DynamicGridMaterial();
+ if (!(existingMaterial instanceof GridMaterialProperty)) {
+ existingMaterial = new GridMaterialProperty();
}
materialData = packetData.grid;
processPacketData(Color, existingMaterial, 'color', materialData.color, undefined, sourceUri);
@@ -660,8 +640,8 @@ define([
processPacketData(Number, existingMaterial, 'rowThickness', materialData.rowThickness, undefined, sourceUri);
processPacketData(Number, existingMaterial, 'columnThickness', materialData.columnThickness, undefined, sourceUri);
} else if (defined(packetData.image)) {
- if (!(existingMaterial instanceof DynamicImageMaterial)) {
- existingMaterial = new DynamicImageMaterial();
+ if (!(existingMaterial instanceof ImageMaterialProperty)) {
+ existingMaterial = new ImageMaterialProperty();
}
materialData = packetData.image;
processPacketData(Image, existingMaterial, 'image', materialData.image, undefined, sourceUri);
diff --git a/Source/DynamicScene/DynamicColorMaterial.js b/Source/DynamicScene/DynamicColorMaterial.js
deleted file mode 100644
index 6b5db6f1c83c..000000000000
--- a/Source/DynamicScene/DynamicColorMaterial.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/*global define*/
-define(function() {
- "use strict";
-
- /**
- * A utility class for processing CZML color materials.
- * @alias DynamicColorMaterial
- * @constructor
- */
- var DynamicColorMaterial = function() {
- /**
- * A DynamicProperty of type Color which determines the material's color.
- * @type {DynamicProperty}
- * @default undefined
- */
- this.color = undefined;
- };
-
- return DynamicColorMaterial;
-});
diff --git a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
index 1d253e598690..e012d6e1e4a2 100644
--- a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
+++ b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
@@ -13,7 +13,7 @@ define([
'../Core/Spherical',
'../Scene/CustomSensorVolume',
'../Scene/Material',
- './processMaterial'
+ './MaterialProperty'
], function(
Cartesian3,
Color,
@@ -28,7 +28,7 @@ define([
Spherical,
CustomSensorVolume,
Material,
- processMaterial) {
+ MaterialProperty) {
"use strict";
//CZML_TODO DynamicConeVisualizerUsingCustomSensor is a temporary workaround
@@ -364,10 +364,7 @@ define([
cone._visualizerOrientation = orientation.clone(cone._visualizerOrientation);
}
- var material = dynamicCone.outerMaterial;
- if (defined(material)) {
- cone.material = processMaterial(time, material, context, cone.material);
- }
+ cone.material = MaterialProperty.evaluateMaterial(time, context, dynamicCone.material, cone.material);
property = dynamicCone.intersectionColor;
if (defined(property)) {
diff --git a/Source/DynamicScene/DynamicEllipsoidVisualizer.js b/Source/DynamicScene/DynamicEllipsoidVisualizer.js
index 204dcebf6ef4..3f886a976525 100644
--- a/Source/DynamicScene/DynamicEllipsoidVisualizer.js
+++ b/Source/DynamicScene/DynamicEllipsoidVisualizer.js
@@ -8,7 +8,7 @@ define([
'../Core/Matrix4',
'../Scene/EllipsoidPrimitive',
'../Scene/Material',
- './processMaterial'
+ './MaterialProperty'
], function(
defaultValue,
defined,
@@ -18,7 +18,7 @@ define([
Matrix4,
EllipsoidPrimitive,
Material,
- processMaterial) {
+ MaterialProperty) {
"use strict";
var matrix3Scratch = new Matrix3();
@@ -254,10 +254,7 @@ define([
ellipsoid._visualizerOrientation = orientation.clone(ellipsoid._visualizerOrientation);
}
- var material = dynamicEllipsoid.material;
- if (defined(material)) {
- ellipsoid.material = processMaterial(time, material, context, ellipsoid.material);
- }
+ ellipsoid.material = MaterialProperty.evaluateMaterial(time, context, dynamicEllipsoid.material, ellipsoid.material);
}
DynamicEllipsoidVisualizer.prototype._onObjectsRemoved = function(dynamicObjectCollection, dynamicObjects) {
diff --git a/Source/DynamicScene/DynamicGridMaterial.js b/Source/DynamicScene/DynamicGridMaterial.js
deleted file mode 100644
index ac08b5c29bf2..000000000000
--- a/Source/DynamicScene/DynamicGridMaterial.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/*global define*/
-define(function() {
- "use strict";
-
- /**
- * A utility class for processing CZML grid materials.
- * @alias DynamicGridMaterial
- * @constructor
- */
- var DynamicGridMaterial = function() {
- /**
- * A DynamicProperty of type Color which determines the grid's color.
- * @type {DynamicProperty}
- * @default undefined
- */
- this.color = undefined;
-
- /**
- * A DynamicProperty of type Number which determines the grid cells alpha value, when combined with the color alpha.
- * @type {DynamicProperty}
- * @default undefined
- */
- this.cellAlpha = undefined;
-
- /**
- * A DynamicProperty of type Number which determines the number of horizontal rows.
- * @type {DynamicProperty}
- * @default undefined
- */
- this.rowCount = undefined;
-
- /**
- * A DynamicProperty of type Number which determines the number of vertical columns.
- * @type {DynamicProperty}
- * @default undefined
- */
- this.columnCount = undefined;
-
- /**
- * A DynamicProperty of type Number which determines the width of each horizontal line, in pixels.
- * @type {DynamicProperty}
- * @default undefined
- */
- this.rowThickness = undefined;
-
- /**
- * A DynamicProperty of type Number which determines the width of each vertical line, in pixels.
- * @type {DynamicProperty}
- * @default undefined
- */
- this.columnThickness = undefined;
- };
-
- return DynamicGridMaterial;
-});
diff --git a/Source/DynamicScene/DynamicImageMaterial.js b/Source/DynamicScene/DynamicImageMaterial.js
deleted file mode 100644
index f0d74204c153..000000000000
--- a/Source/DynamicScene/DynamicImageMaterial.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*global define*/
-define(function() {
- "use strict";
-
- /**
- * A utility class for processing CZML image materials.
- * @alias DynamicImageMaterial
- * @constructor
- */
- var DynamicImageMaterial = function() {
- /**
- * A DynamicProperty of type Number which determines the material's image.
- * @type {DynamicProperty}
- * @default undefined
- */
- this.image = undefined;
- /**
- * A DynamicProperty of type Number which determines the material's vertical repeat.
- * @type {DynamicProperty}
- * @default undefined
- */
- this.verticalRepeat = undefined;
- /**
- * A DynamicProperty of type Number which determines the material's horizontal repeat.
- *
- * @type {DynamicProperty}
- * @default undefined
- */
- this.horizontalRepeat = undefined;
- };
-
- return DynamicImageMaterial;
-});
diff --git a/Source/DynamicScene/DynamicPolygonVisualizer.js b/Source/DynamicScene/DynamicPolygonVisualizer.js
index 68f16e86e1db..2461941b8528 100644
--- a/Source/DynamicScene/DynamicPolygonVisualizer.js
+++ b/Source/DynamicScene/DynamicPolygonVisualizer.js
@@ -6,7 +6,7 @@ define([
'../Core/destroyObject',
'../Scene/Polygon',
'../Scene/Material',
- './processMaterial'
+ './MaterialProperty'
], function(
Cartesian3,
defined,
@@ -14,7 +14,7 @@ define([
destroyObject,
Polygon,
Material,
- processMaterial) {
+ MaterialProperty) {
"use strict";
/**
@@ -238,10 +238,7 @@ define([
polygon._visualizerPositions = vertexPositions;
}
- var material = dynamicPolygon.material;
- if (defined(material)) {
- polygon.material = processMaterial(time, material, context, polygon.material);
- }
+ polygon.material = MaterialProperty.evaluateMaterial(time, context, dynamicPolygon.material, polygon.material);
}
DynamicPolygonVisualizer.prototype._onObjectsRemoved = function(dynamicObjectCollection, dynamicObjects) {
diff --git a/Source/DynamicScene/DynamicPyramidVisualizer.js b/Source/DynamicScene/DynamicPyramidVisualizer.js
index 1797c8ff2d64..b5a88e2178f8 100644
--- a/Source/DynamicScene/DynamicPyramidVisualizer.js
+++ b/Source/DynamicScene/DynamicPyramidVisualizer.js
@@ -9,7 +9,7 @@ define([
'../Core/Matrix4',
'../Scene/CustomSensorVolume',
'../Scene/Material',
- './processMaterial'
+ './MaterialProperty'
], function(
defaultValue,
defined,
@@ -20,7 +20,7 @@ define([
Matrix4,
CustomSensorVolume,
Material,
- processMaterial) {
+ MaterialProperty) {
"use strict";
var matrix3Scratch = new Matrix3();
@@ -266,10 +266,7 @@ define([
orientation.clone(pyramid._visualizerOrientation);
}
- var material = dynamicPyramid.material;
- if (defined(material)) {
- pyramid.material = processMaterial(time, material, context, pyramid.material);
- }
+ pyramid.material = MaterialProperty.evaluateMaterial(time, context, dynamicPyramid.material, pyramid.material);
var property = dynamicPyramid.intersectionColor;
if (defined(property)) {
diff --git a/Source/DynamicScene/GeoJsonDataSource.js b/Source/DynamicScene/GeoJsonDataSource.js
index 87e67889ba94..5783bcf33e7c 100644
--- a/Source/DynamicScene/GeoJsonDataSource.js
+++ b/Source/DynamicScene/GeoJsonDataSource.js
@@ -15,7 +15,7 @@ define([
'./DynamicPoint',
'./DynamicPolyline',
'./DynamicPolygon',
- './DynamicColorMaterial',
+ './ColorMaterialProperty',
'./DynamicObjectCollection',
'../ThirdParty/when',
'../ThirdParty/topojson'
@@ -35,7 +35,7 @@ define([
DynamicPoint,
DynamicPolyline,
DynamicPolygon,
- DynamicColorMaterial,
+ ColorMaterialProperty,
DynamicObjectCollection,
when,
topojson) {
@@ -243,7 +243,7 @@ define([
var polygon = new DynamicPolygon();
defaultPolygon.polygon = polygon;
- var material = new DynamicColorMaterial();
+ var material = new ColorMaterialProperty();
material.color = new ConstantProperty(new Color(1.0, 1.0, 0.0, 0.1));
polygon.material = material;
diff --git a/Source/DynamicScene/GridMaterialProperty.js b/Source/DynamicScene/GridMaterialProperty.js
new file mode 100644
index 000000000000..dd33d5e63c9e
--- /dev/null
+++ b/Source/DynamicScene/GridMaterialProperty.js
@@ -0,0 +1,92 @@
+/*global define*/
+define([
+ '../Core/defined',
+ '../Core/defineProperties'
+ ], function(
+ defined,
+ defineProperties) {
+ "use strict";
+
+ /**
+ * A utility class for processing CZML grid materials.
+ * @alias GridMaterialProperty
+ * @constructor
+ */
+ var GridMaterialProperty = function() {
+ this.type = 'Grid';
+
+ /**
+ * A DynamicProperty of type Color which determines the grid's color.
+ * @type {DynamicProperty}
+ * @default undefined
+ */
+ this.color = undefined;
+
+ /**
+ * A DynamicProperty of type Number which determines the grid cells alpha value, when combined with the color alpha.
+ * @type {DynamicProperty}
+ * @default undefined
+ */
+ this.cellAlpha = undefined;
+
+ /**
+ * A DynamicProperty of type Number which determines the number of horizontal rows.
+ * @type {DynamicProperty}
+ * @default undefined
+ */
+ this.lineCount = undefined;
+
+ /**
+ * A DynamicProperty of type Number which determines the width of each horizontal line, in pixels.
+ * @type {DynamicProperty}
+ * @default undefined
+ */
+ this.lineThickness = undefined;
+ };
+
+ defineProperties(GridMaterialProperty.prototype, {
+ /**
+ * Always returns false, since this property always varies with simulation time.
+ * @memberof ConstantProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return (defined(this.color) ? this.color.isTimeVarying : false) || //
+ (defined(this.cellAlpha) ? this.cellAlpha.isTimeVarying : false) || //
+ (defined(this.lineCount) ? this.lineCount.isTimeVarying : false) || //
+ (defined(this.lineThickness) ? this.lineThickness.isTimeVarying : false);
+ }
+ }
+ });
+
+ GridMaterialProperty.prototype.getValue = function(time, result) {
+ var property = this.color;
+ if (defined(property)) {
+ result.color = property.getValue(time, result.color);
+ }
+
+ property = this.cellAlpha;
+ if (defined(property)) {
+ var cellAlpha = property.getValue(time);
+ if (defined(cellAlpha)) {
+ result.cellAlpha = cellAlpha;
+ }
+ }
+
+ property = this.lineCount;
+ if (defined(property)) {
+ result.lineCount = property.getValue(time, result.lineCount);
+ }
+
+ property = this.lineThickness;
+ if (defined(property)) {
+ result.lineThickness = property.getValue(time, result.lineThickness);
+ }
+
+ return result;
+ };
+
+ return GridMaterialProperty;
+});
diff --git a/Source/DynamicScene/ImageMaterialProperty.js b/Source/DynamicScene/ImageMaterialProperty.js
new file mode 100644
index 000000000000..66003e719118
--- /dev/null
+++ b/Source/DynamicScene/ImageMaterialProperty.js
@@ -0,0 +1,70 @@
+/*global define*/
+define([
+ '../Core/defined',
+ '../Core/defineProperties'
+ ], function(
+ defined,
+ defineProperties) {
+ "use strict";
+
+ /**
+ * A utility class for processing CZML image materials.
+ * @alias ImageMaterialProperty
+ * @constructor
+ */
+ var ImageMaterialProperty = function() {
+ this.type = 'Image';
+
+ /**
+ * A DynamicProperty of type Number which determines the material's image.
+ * @type {DynamicProperty}
+ * @default undefined
+ */
+ this.image = undefined;
+ /**
+ * A DynamicProperty of type Number which determines the material's vertical repeat.
+ * @type {DynamicProperty}
+ * @default undefined
+ */
+ this.verticalRepeat = undefined;
+ /**
+ * A DynamicProperty of type Number which determines the material's horizontal repeat.
+ *
+ * @type {DynamicProperty}
+ * @default undefined
+ */
+ this.horizontalRepeat = undefined;
+ };
+
+
+ defineProperties(ImageMaterialProperty.prototype, {
+ /**
+ * Always returns false, since this property always varies with simulation time.
+ * @memberof ConstantProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return (defined(this.image) ? this.image.isTimeVarying : false) || //
+ (defined(this.repeat) ? this.repeat.isTimeVarying : false);
+ }
+ }
+ });
+
+ ImageMaterialProperty.prototype.getValue = function(time, result) {
+ var property = this.image;
+ if (defined(property)) {
+ result.image = property.getValue(time, result.image);
+ }
+
+ property = this.repeat;
+ if (defined(property)) {
+ result.repeat = property.getValue(time, result.repeat);
+ }
+
+ return result;
+ };
+
+ return ImageMaterialProperty;
+});
diff --git a/Source/DynamicScene/MaterialProperty.js b/Source/DynamicScene/MaterialProperty.js
new file mode 100644
index 000000000000..6e03f9fb370d
--- /dev/null
+++ b/Source/DynamicScene/MaterialProperty.js
@@ -0,0 +1,67 @@
+/*global define*/
+define([
+ '../Core/defined',
+ '../Core/DeveloperError',
+ '../Scene/Material'
+ ], function(
+ defined,
+ DeveloperError,
+ Material) {
+ "use strict";
+
+ function throwInstantiationError() {
+ throw new DeveloperError('This type should not be instantiated directly.');
+ }
+
+ /**
+ * The base class for {@link Material} properties, which are {@link Property} objects
+ * that represent a Material whose uniforms change over time.
+ * This type defines an interface and cannot be instantiated directly.
+ *
+ * @alias MaterialProperty
+ * @constructor
+ *
+ * @see ColorMaterialProperty
+ * @see GridMaterialProperty
+ * @see ImageMaterialProperty
+ */
+ var MaterialProperty = throwInstantiationError;
+
+ /**
+ * Gets a value indicating if the property varies with simulation time or is constant.
+ * @memberof MaterialProperty
+ * @Type {Boolean}
+ */
+ MaterialProperty.prototype.isTimeVarying = undefined;
+
+ /**
+ * The type of Material.
+ * @Type {String}
+ */
+ MaterialProperty.prototype.type = undefined;
+
+ /**
+ * Returns the value of the property at the specified simulation time in the fixed frame.
+ * @memberof MaterialProperty
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ MaterialProperty.prototype.getValue = throwInstantiationError;
+
+ /**
+ * @private
+ */
+ MaterialProperty.evaluateMaterial = function(time, context, materialProperty, material) {
+ if (defined(materialProperty)) {
+ if (!defined(material) || (material.type !== materialProperty.type)) {
+ material = Material.fromType(context, materialProperty.type);
+ }
+ materialProperty.getValue(time, material.uniforms);
+ return material;
+ }
+ };
+
+ return MaterialProperty;
+});
\ No newline at end of file
diff --git a/Source/DynamicScene/processMaterial.js b/Source/DynamicScene/processMaterial.js
deleted file mode 100644
index db1aba0dc1ba..000000000000
--- a/Source/DynamicScene/processMaterial.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/*global define*/
-define([
- '../Core/defined',
- '../Core/RuntimeError',
- '../Scene/Material',
- './DynamicColorMaterial',
- './DynamicImageMaterial',
- './DynamicGridMaterial'
- ], function(
- defined,
- RuntimeError,
- Material,
- DynamicColorMaterial,
- DynamicImageMaterial,
- DynamicGridMaterial) {
- "use strict";
-
- function processColorMaterial(time, context, dynamicMaterial, result) {
- if (!defined(result) || (result.type !== Material.ColorType)) {
- result = Material.fromType(context, Material.ColorType);
- }
- result.uniforms.color = dynamicMaterial.color.getValue(time, result.uniforms.color);
- return result;
- }
-
- function processImageMaterial(time, context, dynamicMaterial, result) {
- if (!defined(result) || (result.type !== Material.ImageType)) {
- result = Material.fromType(context, Material.ImageType);
- }
-
- var xRepeat;
- var property = dynamicMaterial.verticalRepeat;
- if (defined(property)) {
- xRepeat = property.getValue(time);
- if (defined(xRepeat)) {
- result.uniforms.repeat.x = xRepeat;
- }
- }
-
- var yRepeat;
- property = dynamicMaterial.horizontalRepeat;
- if (defined(property)) {
- yRepeat = property.getValue(time);
- if (defined(yRepeat)) {
- result.uniforms.repeat.y = yRepeat;
- }
- }
-
- property = dynamicMaterial.image;
- if (defined(property)) {
- var url = dynamicMaterial.image.getValue(time);
- if (defined(url) && result.currentUrl !== url) {
- result.currentUrl = url;
- result.uniforms.image = url;
- }
- }
- return result;
- }
-
- function processGridMaterial(time, context, dynamicMaterial, result) {
- if (!defined(result) || (result.type !== Material.GridType)) {
- result = Material.fromType(context, Material.GridType);
- }
-
- var property = dynamicMaterial.color;
- if (defined(property)) {
- property.getValue(time, result.uniforms.color);
- }
-
- property = dynamicMaterial.cellAlpha;
- if (defined(property)) {
- var cellAlpha = property.getValue(time);
- if (defined(cellAlpha)) {
- result.uniforms.cellAlpha = cellAlpha;
- }
- }
-
- var lineCount = result.uniforms.lineCount;
-
- property = dynamicMaterial.rowCount;
- if (defined(property)) {
- var rowCount = property.getValue(time);
- if (defined(rowCount)) {
- lineCount.x = rowCount;
- }
- }
-
- property = dynamicMaterial.columnCount;
- if (defined(property)) {
- var columnCount = property.getValue(time);
- if (defined(columnCount)) {
- lineCount.y = columnCount;
- }
- }
-
- var lineThickness = result.uniforms.lineThickness;
-
- property = dynamicMaterial.rowThickness;
- if (defined(property)) {
- var rowThickness = property.getValue(time);
- if (defined(rowThickness)) {
- lineThickness.x = rowThickness;
- }
- }
-
- property = dynamicMaterial.columnThickness;
- if (defined(property)) {
- var columnThickness = property.getValue(time);
- if (defined(columnThickness)) {
- lineThickness.y = columnThickness;
- }
- }
-
- return result;
- }
-
- var processMaterial = function(time, property, context, result) {
- var dynamicMaterial = property;
- if (defined(property.getValue)) {
- dynamicMaterial = property.getValue(time);
- }
-
- if (defined(dynamicMaterial)) {
- if (dynamicMaterial instanceof DynamicColorMaterial) {
- return processColorMaterial(time, context, dynamicMaterial, result);
- } else if (dynamicMaterial instanceof DynamicImageMaterial) {
- return processImageMaterial(time, context, dynamicMaterial, result);
- } else if (dynamicMaterial instanceof DynamicGridMaterial) {
- return processGridMaterial(time, context, dynamicMaterial, result);
- }
- throw new RuntimeError('unknown material');
- }
-
- return result;
- };
-
- return processMaterial;
-});
\ No newline at end of file
From 10d3ebb52ab8fd884f6250d687e9eab10c5cf263 Mon Sep 17 00:00:00 2001
From: mramato
Date: Thu, 22 Aug 2013 22:29:52 -0400
Subject: [PATCH 46/65] Misc fixes.
---
Source/DynamicScene/CzmlDataSource.js | 130 +++++++++++-------
.../DynamicConeVisualizerUsingCustomSensor.js | 2 +-
Source/DynamicScene/MaterialProperty.js | 9 +-
...amicConeVisualizerUsingCustomSensorSpec.js | 2 +-
4 files changed, 89 insertions(+), 54 deletions(-)
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index 39349fb199c9..36e6ee5fafd1 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -9,6 +9,7 @@ define([
'../Core/createGuid',
'../Core/defaultValue',
'../Core/defined',
+ '../Core/defineProperties',
'../Core/DeveloperError',
'../Core/Ellipsoid',
'../Core/Event',
@@ -64,6 +65,7 @@ define([
createGuid,
defaultValue,
defined,
+ defineProperties,
DeveloperError,
Ellipsoid,
Event,
@@ -194,7 +196,7 @@ define([
var tmp = scratchCartesian;
var cartographic = czmlInterval.cartographicRadians;
if (defined(cartographic)) {
- if (cartographic.length > 3) {
+ if (cartographic.length === 3) {
scratchCartographic.longitude = cartographic[0];
scratchCartographic.latitude = cartographic[1];
scratchCartographic.height = cartographic[2];
@@ -204,9 +206,9 @@ define([
len = cartographic.length;
result = new Array(len);
for (i = 0; i < len; i += 4) {
- scratchCartographic.longitude = cartographic[i + 1];
- scratchCartographic.latitude = cartographic[i + 2];
- scratchCartographic.height = cartographic[i + 3];
+ scratchCartographic.longitude = cartographic[i + 0];
+ scratchCartographic.latitude = cartographic[i + 1];
+ scratchCartographic.height = cartographic[i + 2];
Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
result[i] = cartographic[i];
@@ -215,34 +217,37 @@ define([
result[i + 3] = tmp.z;
}
}
- } else {
- var cartographicDegrees = czmlInterval.cartographicDegrees;
- if (!defined(cartographicDegrees)) {
- return undefined;
- }
+ return result;
+ }
+
+ var cartographicDegrees = czmlInterval.cartographicDegrees;
+ if (!defined(cartographicDegrees)) {
+ return undefined;
+ }
- if (cartographicDegrees.length > 3) {
- scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[0]);
- scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[1]);
- scratchCartographic.height = cartographicDegrees[2];
+ if (cartographicDegrees.length > 3) {
+ scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[0]);
+ scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[1]);
+ scratchCartographic.height = cartographicDegrees[2];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+ result = [tmp.x, tmp.y, tmp.z];
+ } else {
+ len = cartographicDegrees.length;
+ result = new Array(len);
+ for (i = 0; i < len; i += 4) {
+ scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[i + 1]);
+ scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[i + 2]);
+ scratchCartographic.height = cartographicDegrees[i + 3];
Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
- result = [tmp.x, tmp.y, tmp.z];
- } else {
- len = cartographicDegrees.length;
- result = new Array(len);
- for (i = 0; i < len; i += 4) {
- scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[i + 1]);
- scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[i + 2]);
- scratchCartographic.height = cartographicDegrees[i + 3];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
- result[i] = cartographicDegrees[i];
- result[i + 1] = tmp.x;
- result[i + 2] = tmp.y;
- result[i + 3] = tmp.z;
- }
+ result[i] = cartographicDegrees[i];
+ result[i + 1] = tmp.x;
+ result[i + 2] = tmp.y;
+ result[i + 3] = tmp.z;
}
}
+
+ return result;
}
function unwrapInterval(type, czmlInterval, sourceUri) {
@@ -362,7 +367,7 @@ define([
} else if (property instanceof CompositeProperty) {
//If the collection was already a CompositeProperty, use it.
combinedInterval.data = new ConstantProperty(combinedInterval.data);
- property.intervals.add(combinedInterval);
+ property.intervals.addInterval(combinedInterval);
} else {
//Otherwise, create a CompositeProperty but preserve the existing data.
@@ -376,11 +381,11 @@ define([
object[propertyName] = property;
//add the old property interval
- property.intervals.add(interval);
+ property.intervals.addInterval(interval);
//Change the new data to a ConstantProperty and add it.
combinedInterval.data = new ConstantProperty(combinedInterval.data);
- property.intervals.add(combinedInterval);
+ property.intervals.addInterval(combinedInterval);
}
return propertyCreated;
@@ -394,7 +399,7 @@ define([
}
//create a CompositeProperty but preserve the existing data.
- if (!property instanceof CompositeProperty) {
+ if (!(property instanceof CompositeProperty)) {
//Put the old property in an infinite interval.
interval = Iso8601.MAXIMUM_INTERVAL.clone();
interval.data = property;
@@ -405,11 +410,7 @@ define([
object[propertyName] = property;
//add the old property interval
- property.intervals.add(interval);
-
- //Change the new data to a ConstantProperty and add it.
- combinedInterval.data = new ConstantProperty(combinedInterval.data);
- property.intervals.add(combinedInterval);
+ property.intervals.addInterval(interval);
}
//Check if the interval already exists in the composite
@@ -506,7 +507,7 @@ define([
} else if (property instanceof CompositePositionProperty) {
//If the collection was already a CompositeProperty, use it.
combinedInterval.data = new ConstantPositionProperty(combinedInterval.data, referenceFrame);
- property.intervals.add(combinedInterval);
+ property.intervals.addInterval(combinedInterval);
} else {
//Otherwise, create a CompositeProperty but preserve the existing data.
@@ -520,11 +521,11 @@ define([
object[propertyName] = property;
//add the old property interval
- property.intervals.add(interval);
+ property.intervals.addInterval(interval);
//Change the new data to a ConstantProperty and add it.
combinedInterval.data = new ConstantPositionProperty(combinedInterval.data, referenceFrame);
- property.intervals.add(combinedInterval);
+ property.intervals.addInterval(combinedInterval);
}
return propertyCreated;
@@ -535,7 +536,7 @@ define([
propertyCreated = true;
property = new CompositePositionProperty(referenceFrame);
object[propertyName] = property;
- } else if (!property instanceof CompositePositionProperty) {
+ } else if (!(property instanceof CompositePositionProperty)) {
//create a CompositeProperty but preserve the existing data.
//Put the old property in an infinite interval.
interval = Iso8601.MAXIMUM_INTERVAL.clone();
@@ -547,11 +548,7 @@ define([
object[propertyName] = property;
//add the old property interval
- property.intervals.add(interval);
-
- //Change the new data to a ConstantProperty and add it.
- combinedInterval.data = new ConstantPositionProperty(combinedInterval.data, referenceFrame);
- property.intervals.add(combinedInterval);
+ property.intervals.addInterval(interval);
}
//Check if the interval already exists in the composite
@@ -584,6 +581,40 @@ define([
return updated;
}
+ var Cartesian2WrapperProperty = function() {
+ this._x = new ConstantProperty(0);
+ this._y = new ConstantProperty(0);
+ };
+
+ defineProperties(Cartesian2WrapperProperty.prototype, {
+ isTimeVarying : {
+ get : function() {
+ return this._x.isTimeVarying || this._y.isTimeVarying;
+ }
+ }
+ });
+
+ Cartesian2WrapperProperty.prototype.getValue = function(time, result) {
+ if (!defined(result)) {
+ result = new Cartesian2();
+ }
+ result.x = this._x.getValue(time);
+ result.y = this._y.getValue(time);
+ return result;
+ };
+
+ function combineIntoCartesian2(object, packetDataX, packetDataY) {
+ if (!defined(packetDataX) && !defined(packetDataY)) {
+ return object;
+ }
+ if (!(object instanceof Cartesian2WrapperProperty)) {
+ object = new Cartesian2WrapperProperty();
+ }
+ processPacketData(Number, object, '_x', packetDataX);
+ processPacketData(Number, object, '_y', packetDataY);
+ return object;
+ }
+
function processMaterialProperty(object, propertyName, packetData, constrainedInterval, sourceUri) {
var combinedInterval;
var packetInterval = packetData.interval;
@@ -635,18 +666,15 @@ define([
materialData = packetData.grid;
processPacketData(Color, existingMaterial, 'color', materialData.color, undefined, sourceUri);
processPacketData(Number, existingMaterial, 'cellAlpha', materialData.cellAlpha, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'rowCount', materialData.rowCount, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'columnCount', materialData.columnCount, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'rowThickness', materialData.rowThickness, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'columnThickness', materialData.columnThickness, undefined, sourceUri);
+ existingMaterial.lineThickness = combineIntoCartesian2(existingMaterial.lineThickness, materialData.rowThickness, materialData.columnThickness);
+ existingMaterial.lineCount = combineIntoCartesian2(existingMaterial.lineCount, materialData.rowCount, materialData.columnCount);
} else if (defined(packetData.image)) {
if (!(existingMaterial instanceof ImageMaterialProperty)) {
existingMaterial = new ImageMaterialProperty();
}
materialData = packetData.image;
processPacketData(Image, existingMaterial, 'image', materialData.image, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'verticalRepeat', materialData.verticalRepeat, undefined, sourceUri);
- processPacketData(Number, existingMaterial, 'horizontalRepeat', materialData.horizontalRepeat, undefined, sourceUri);
+ existingMaterial.repeat = combineIntoCartesian2(existingMaterial.repeat, materialData.horizontalRepeat, materialData.verticalRepeat);
}
existingInterval.data = existingMaterial;
diff --git a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
index e012d6e1e4a2..09f50e89cb20 100644
--- a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
+++ b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
@@ -364,7 +364,7 @@ define([
cone._visualizerOrientation = orientation.clone(cone._visualizerOrientation);
}
- cone.material = MaterialProperty.evaluateMaterial(time, context, dynamicCone.material, cone.material);
+ cone.material = MaterialProperty.evaluateMaterial(time, context, dynamicCone.outerMaterial, cone.material);
property = dynamicCone.intersectionColor;
if (defined(property)) {
diff --git a/Source/DynamicScene/MaterialProperty.js b/Source/DynamicScene/MaterialProperty.js
index 6e03f9fb370d..78427ab9716a 100644
--- a/Source/DynamicScene/MaterialProperty.js
+++ b/Source/DynamicScene/MaterialProperty.js
@@ -55,12 +55,19 @@ define([
*/
MaterialProperty.evaluateMaterial = function(time, context, materialProperty, material) {
if (defined(materialProperty)) {
+ if (!defined(materialProperty.type) && defined(materialProperty.intervals)) {
+ var interval = materialProperty.intervals.findIntervalContainingDate(time);
+ if (!defined(interval) || !defined(interval.data)) {
+ return material;
+ }
+ materialProperty = interval.data;
+ }
if (!defined(material) || (material.type !== materialProperty.type)) {
material = Material.fromType(context, materialProperty.type);
}
materialProperty.getValue(time, material.uniforms);
- return material;
}
+ return material;
};
return MaterialProperty;
diff --git a/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js b/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
index 119e034193b1..20ed460dcf95 100644
--- a/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
+++ b/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
@@ -143,7 +143,7 @@ defineSuite([
cone.show = new ConstantProperty(true);
var blueMaterial = Material.fromType(scene.getContext(), Material.ColorType);
- blueMaterial.uniforms.color = Color.BLUE;
+ blueMaterial.uniforms.color = Color.BLUE.clone();
cone.outerMaterial = new ConstantProperty(blueMaterial);
visualizer.update(time);
From 830bbc25413e345d80f8d73c540568a49785b50a Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Fri, 23 Aug 2013 11:45:11 -0400
Subject: [PATCH 47/65] Tweak Material properties.
Ultimately, we need to refactor the Material object in general and figure out the best way to use them going forward.
---
Source/DynamicScene/ColorMaterialProperty.js | 11 ++++-
.../DynamicConeVisualizerUsingCustomSensor.js | 2 +-
.../DynamicEllipsoidVisualizer.js | 2 +-
.../DynamicScene/DynamicPolygonVisualizer.js | 2 +-
.../DynamicScene/DynamicPyramidVisualizer.js | 2 +-
Source/DynamicScene/GridMaterialProperty.js | 15 ++++++-
Source/DynamicScene/ImageMaterialProperty.js | 17 ++++++--
Source/DynamicScene/MaterialProperty.js | 40 +++++++++++++------
8 files changed, 67 insertions(+), 24 deletions(-)
diff --git a/Source/DynamicScene/ColorMaterialProperty.js b/Source/DynamicScene/ColorMaterialProperty.js
index 289e80293f0e..60fe2d6af916 100644
--- a/Source/DynamicScene/ColorMaterialProperty.js
+++ b/Source/DynamicScene/ColorMaterialProperty.js
@@ -13,8 +13,6 @@ define([
* @constructor
*/
var ColorMaterialProperty = function() {
- this.type = 'Color';
-
/**
* A DynamicProperty of type Color which determines the material's color.
* @type {DynamicProperty}
@@ -34,6 +32,15 @@ define([
get : function() {
return defined(this.color) ? this.color.isTimeVarying : false;
}
+ },
+ /**
+ * Gets the Material type.
+ * @type {String}
+ */
+ type : {
+ get : function() {
+ return 'Color';
+ }
}
});
diff --git a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
index 09f50e89cb20..9d1bab95156b 100644
--- a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
+++ b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
@@ -364,7 +364,7 @@ define([
cone._visualizerOrientation = orientation.clone(cone._visualizerOrientation);
}
- cone.material = MaterialProperty.evaluateMaterial(time, context, dynamicCone.outerMaterial, cone.material);
+ cone.material = MaterialProperty.GetValue(time, context, dynamicCone.outerMaterial, cone.material);
property = dynamicCone.intersectionColor;
if (defined(property)) {
diff --git a/Source/DynamicScene/DynamicEllipsoidVisualizer.js b/Source/DynamicScene/DynamicEllipsoidVisualizer.js
index 3f886a976525..81f6523e7feb 100644
--- a/Source/DynamicScene/DynamicEllipsoidVisualizer.js
+++ b/Source/DynamicScene/DynamicEllipsoidVisualizer.js
@@ -254,7 +254,7 @@ define([
ellipsoid._visualizerOrientation = orientation.clone(ellipsoid._visualizerOrientation);
}
- ellipsoid.material = MaterialProperty.evaluateMaterial(time, context, dynamicEllipsoid.material, ellipsoid.material);
+ ellipsoid.material = MaterialProperty.GetValue(time, context, dynamicEllipsoid.material, ellipsoid.material);
}
DynamicEllipsoidVisualizer.prototype._onObjectsRemoved = function(dynamicObjectCollection, dynamicObjects) {
diff --git a/Source/DynamicScene/DynamicPolygonVisualizer.js b/Source/DynamicScene/DynamicPolygonVisualizer.js
index 2461941b8528..f2f46b81bf84 100644
--- a/Source/DynamicScene/DynamicPolygonVisualizer.js
+++ b/Source/DynamicScene/DynamicPolygonVisualizer.js
@@ -238,7 +238,7 @@ define([
polygon._visualizerPositions = vertexPositions;
}
- polygon.material = MaterialProperty.evaluateMaterial(time, context, dynamicPolygon.material, polygon.material);
+ polygon.material = MaterialProperty.GetValue(time, context, dynamicPolygon.material, polygon.material);
}
DynamicPolygonVisualizer.prototype._onObjectsRemoved = function(dynamicObjectCollection, dynamicObjects) {
diff --git a/Source/DynamicScene/DynamicPyramidVisualizer.js b/Source/DynamicScene/DynamicPyramidVisualizer.js
index b5a88e2178f8..9fc3d92c31c2 100644
--- a/Source/DynamicScene/DynamicPyramidVisualizer.js
+++ b/Source/DynamicScene/DynamicPyramidVisualizer.js
@@ -266,7 +266,7 @@ define([
orientation.clone(pyramid._visualizerOrientation);
}
- pyramid.material = MaterialProperty.evaluateMaterial(time, context, dynamicPyramid.material, pyramid.material);
+ pyramid.material = MaterialProperty.GetValue(time, context, dynamicPyramid.material, pyramid.material);
var property = dynamicPyramid.intersectionColor;
if (defined(property)) {
diff --git a/Source/DynamicScene/GridMaterialProperty.js b/Source/DynamicScene/GridMaterialProperty.js
index dd33d5e63c9e..d50f87f4cfe3 100644
--- a/Source/DynamicScene/GridMaterialProperty.js
+++ b/Source/DynamicScene/GridMaterialProperty.js
@@ -13,8 +13,6 @@ define([
* @constructor
*/
var GridMaterialProperty = function() {
- this.type = 'Grid';
-
/**
* A DynamicProperty of type Color which determines the grid's color.
* @type {DynamicProperty}
@@ -58,10 +56,23 @@ define([
(defined(this.lineCount) ? this.lineCount.isTimeVarying : false) || //
(defined(this.lineThickness) ? this.lineThickness.isTimeVarying : false);
}
+ },
+ /**
+ * Gets the Material type.
+ * @type {String}
+ */
+ type : {
+ get : function() {
+ return 'Grid';
+ }
}
});
GridMaterialProperty.prototype.getValue = function(time, result) {
+ if (!defined(result)) {
+ result = {};
+ }
+
var property = this.color;
if (defined(property)) {
result.color = property.getValue(time, result.color);
diff --git a/Source/DynamicScene/ImageMaterialProperty.js b/Source/DynamicScene/ImageMaterialProperty.js
index 66003e719118..a5989117f1c2 100644
--- a/Source/DynamicScene/ImageMaterialProperty.js
+++ b/Source/DynamicScene/ImageMaterialProperty.js
@@ -13,9 +13,7 @@ define([
* @constructor
*/
var ImageMaterialProperty = function() {
- this.type = 'Image';
-
- /**
+ /**
* A DynamicProperty of type Number which determines the material's image.
* @type {DynamicProperty}
* @default undefined
@@ -49,10 +47,23 @@ define([
return (defined(this.image) ? this.image.isTimeVarying : false) || //
(defined(this.repeat) ? this.repeat.isTimeVarying : false);
}
+ },
+ /**
+ * Gets the Material type.
+ * @type {String}
+ */
+ type : {
+ get : function() {
+ return 'Image';
+ }
}
});
ImageMaterialProperty.prototype.getValue = function(time, result) {
+ if (!defined(result)) {
+ result = {};
+ }
+
var property = this.image;
if (defined(property)) {
result.image = property.getValue(time, result.image);
diff --git a/Source/DynamicScene/MaterialProperty.js b/Source/DynamicScene/MaterialProperty.js
index 78427ab9716a..7a1b4874a707 100644
--- a/Source/DynamicScene/MaterialProperty.js
+++ b/Source/DynamicScene/MaterialProperty.js
@@ -1,10 +1,12 @@
/*global define*/
define([
'../Core/defined',
+ '../Core/defineProperties',
'../Core/DeveloperError',
'../Scene/Material'
], function(
defined,
+ defineProperties,
DeveloperError,
Material) {
"use strict";
@@ -27,18 +29,30 @@ define([
*/
var MaterialProperty = throwInstantiationError;
- /**
- * Gets a value indicating if the property varies with simulation time or is constant.
- * @memberof MaterialProperty
- * @Type {Boolean}
- */
- MaterialProperty.prototype.isTimeVarying = undefined;
-
- /**
- * The type of Material.
- * @Type {String}
- */
- MaterialProperty.prototype.type = undefined;
+ defineProperties(MaterialProperty.prototype, {
+ /**
+ * Returns the value of the property at the specified simulation time in the fixed frame.
+ * @memberof MaterialProperty
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ */
+ isTimeVarying : {
+ get : function() {
+ throwInstantiationError();
+ }
+ },
+ /**
+ * Gets the Material type.
+ * @type {String}
+ */
+ type : {
+ get : function() {
+ throwInstantiationError();
+ }
+ }
+ });
/**
* Returns the value of the property at the specified simulation time in the fixed frame.
@@ -53,7 +67,7 @@ define([
/**
* @private
*/
- MaterialProperty.evaluateMaterial = function(time, context, materialProperty, material) {
+ MaterialProperty.GetValue = function(time, context, materialProperty, material) {
if (defined(materialProperty)) {
if (!defined(materialProperty.type) && defined(materialProperty.intervals)) {
var interval = materialProperty.intervals.findIntervalContainingDate(time);
From eb996a5898fe1f0665be4083d8e8c3a68224b335 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Fri, 23 Aug 2013 13:24:23 -0400
Subject: [PATCH 48/65] ColorMaterialProperty specs
Though after implementing it, I'm probably going to tweak how they work.
---
Source/DynamicScene/ColorMaterialProperty.js | 11 ++--
Source/DynamicScene/GridMaterialProperty.js | 5 +-
.../DynamicScene/ColorMaterialPropertySpec.js | 61 +++++++++++++++++++
3 files changed, 72 insertions(+), 5 deletions(-)
create mode 100644 Specs/DynamicScene/ColorMaterialPropertySpec.js
diff --git a/Source/DynamicScene/ColorMaterialProperty.js b/Source/DynamicScene/ColorMaterialProperty.js
index 60fe2d6af916..94aec9dbc02e 100644
--- a/Source/DynamicScene/ColorMaterialProperty.js
+++ b/Source/DynamicScene/ColorMaterialProperty.js
@@ -46,12 +46,15 @@ define([
ColorMaterialProperty.prototype.getValue = function(time, result) {
if (!defined(result)) {
- return {
- color : this.color.getValue(time)
- };
+ result = {};
}
- result.color = this.color.getValue(time, result.color);
+ if (defined(this.color)) {
+ var color = this.color.getValue(time, result.color);
+ if (defined(color)) {
+ result.color = color;
+ }
+ }
return result;
};
diff --git a/Source/DynamicScene/GridMaterialProperty.js b/Source/DynamicScene/GridMaterialProperty.js
index d50f87f4cfe3..303f2fc82b4a 100644
--- a/Source/DynamicScene/GridMaterialProperty.js
+++ b/Source/DynamicScene/GridMaterialProperty.js
@@ -75,7 +75,10 @@ define([
var property = this.color;
if (defined(property)) {
- result.color = property.getValue(time, result.color);
+ var color = property.getValue(time, result.color);
+ if (defined(color)) {
+ result.color = color;
+ }
}
property = this.cellAlpha;
diff --git a/Specs/DynamicScene/ColorMaterialPropertySpec.js b/Specs/DynamicScene/ColorMaterialPropertySpec.js
new file mode 100644
index 000000000000..245469a505e0
--- /dev/null
+++ b/Specs/DynamicScene/ColorMaterialPropertySpec.js
@@ -0,0 +1,61 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/ColorMaterialProperty',
+ 'DynamicScene/ConstantProperty',
+ 'DynamicScene/TimeIntervalCollectionProperty',
+ 'Core/Color',
+ 'Core/JulianDate',
+ 'Core/TimeInterval'
+ ], function(
+ ColorMaterialProperty,
+ ConstantProperty,
+ TimeIntervalCollectionProperty,
+ Color,
+ JulianDate,
+ TimeInterval) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('works with basic types', function() {
+ var property = new ColorMaterialProperty();
+ expect(property.type).toEqual('Color');
+ expect(property.isTimeVarying).toEqual(false);
+ expect(property.color).toBeUndefined();
+
+ var result = property.getValue();
+ expect(result.color).toBeUndefined();
+ });
+
+ it('works with constant values', function() {
+ var property = new ColorMaterialProperty();
+ property.color = new ConstantProperty(Color.RED);
+ expect(property.isTimeVarying).toEqual(false);
+
+ var result = property.getValue(new JulianDate());
+ expect(result.color).toEqual(Color.RED);
+ });
+
+ it('works with dynamic values', function() {
+ var property = new ColorMaterialProperty();
+ property.color = new TimeIntervalCollectionProperty();
+
+ var start = new JulianDate(1, 0);
+ var stop = new JulianDate(2, 0);
+ property.color.intervals.addInterval(new TimeInterval(start, stop, true, true, Color.BLUE));
+ expect(property.isTimeVarying).toEqual(true);
+
+ var result = {};
+ var returnedResult = property.getValue(start, result);
+ expect(returnedResult).toBe(result);
+ expect(result.color).toEqual(Color.BLUE);
+ });
+
+ it('works with a result parameter', function() {
+ var property = new ColorMaterialProperty();
+ property.color = new ConstantProperty(Color.RED);
+ expect(property.isTimeVarying).toEqual(false);
+
+ var result = property.getValue(new JulianDate());
+ expect(result.color).toEqual(Color.RED);
+ });
+});
\ No newline at end of file
From ca363bc114481e91e52d305eaf8faff46aea7075 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Fri, 23 Aug 2013 17:00:39 -0400
Subject: [PATCH 49/65] Material property specs.
---
Source/DynamicScene/ColorMaterialProperty.js | 31 ++---
.../DynamicScene/CompositeMaterialProperty.js | 92 ++++++++++++++
Source/DynamicScene/CzmlDataSource.js | 4 +-
Source/DynamicScene/GridMaterialProperty.js | 62 ++++------
Source/DynamicScene/ImageMaterialProperty.js | 42 ++-----
Source/DynamicScene/MaterialProperty.js | 12 +-
.../DynamicScene/ColorMaterialPropertySpec.js | 32 +++--
.../CompositeMaterialPropertySpec.js | 79 ++++++++++++
Specs/DynamicScene/CompositePropertySpec.js | 15 ---
.../DynamicScene/GridMaterialPropertySpec.js | 112 ++++++++++++++++++
.../DynamicScene/ImageMaterialPropertySpec.js | 86 ++++++++++++++
11 files changed, 443 insertions(+), 124 deletions(-)
create mode 100644 Source/DynamicScene/CompositeMaterialProperty.js
create mode 100644 Specs/DynamicScene/CompositeMaterialPropertySpec.js
create mode 100644 Specs/DynamicScene/GridMaterialPropertySpec.js
create mode 100644 Specs/DynamicScene/ImageMaterialPropertySpec.js
diff --git a/Source/DynamicScene/ColorMaterialProperty.js b/Source/DynamicScene/ColorMaterialProperty.js
index 94aec9dbc02e..a850dedfa25d 100644
--- a/Source/DynamicScene/ColorMaterialProperty.js
+++ b/Source/DynamicScene/ColorMaterialProperty.js
@@ -1,10 +1,14 @@
/*global define*/
define([
+ '../Core/Color',
'../Core/defined',
- '../Core/defineProperties'
+ '../Core/defineProperties',
+ './ConstantProperty'
], function(
+ Color,
defined,
- defineProperties) {
+ defineProperties,
+ ConstantProperty) {
"use strict";
/**
@@ -18,7 +22,7 @@ define([
* @type {DynamicProperty}
* @default undefined
*/
- this.color = undefined;
+ this.color = new ConstantProperty(Color.WHITE);
};
defineProperties(ColorMaterialProperty.prototype, {
@@ -32,29 +36,18 @@ define([
get : function() {
return defined(this.color) ? this.color.isTimeVarying : false;
}
- },
- /**
- * Gets the Material type.
- * @type {String}
- */
- type : {
- get : function() {
- return 'Color';
- }
}
});
+ ColorMaterialProperty.prototype.getType = function(time) {
+ return 'Color';
+ };
+
ColorMaterialProperty.prototype.getValue = function(time, result) {
if (!defined(result)) {
result = {};
}
-
- if (defined(this.color)) {
- var color = this.color.getValue(time, result.color);
- if (defined(color)) {
- result.color = color;
- }
- }
+ result.color = defined(this.color) ? this.color.getValue(time, result.color) : undefined;
return result;
};
diff --git a/Source/DynamicScene/CompositeMaterialProperty.js b/Source/DynamicScene/CompositeMaterialProperty.js
new file mode 100644
index 000000000000..52b28f220053
--- /dev/null
+++ b/Source/DynamicScene/CompositeMaterialProperty.js
@@ -0,0 +1,92 @@
+/*global define*/
+define([
+ '../Core/defined',
+ '../Core/defineProperties',
+ '../Core/DeveloperError',
+ '../Core/TimeIntervalCollection'
+ ], function(
+ defined,
+ defineProperties,
+ DeveloperError,
+ TimeIntervalCollection) {
+ "use strict";
+
+ /**
+ * A {@link Property} which is defined by a TimeIntervalCollection, where the
+ * data property of the interval is another Property instance which is evaluated
+ * at the provided time.
+ *
+ * @alias CompositeMaterialProperty
+ * @constructor
+ */
+ var CompositeMaterialProperty = function() {
+ this._intervals = new TimeIntervalCollection();
+ };
+
+ defineProperties(CompositeMaterialProperty.prototype, {
+ /**
+ * Always returns true, since this property always varies with simulation time.
+ * @memberof SampledProperty
+ *
+ * @type {Boolean}
+ */
+ isTimeVarying : {
+ get : function() {
+ return true;
+ }
+ },
+ /**
+ * Gets the interval collection.
+ * @memberof CompositeMaterialProperty.prototype
+ *
+ * @type {TimeIntervalCollection}
+ */
+ intervals : {
+ get : function() {
+ return this._intervals;
+ }
+ }
+ });
+
+ CompositeMaterialProperty.prototype.getType = function(time) {
+ if (!defined(time)) {
+ throw new DeveloperError('time is required');
+ }
+
+ var interval = this._intervals.findIntervalContainingDate(time);
+ if (defined(interval)) {
+ var data = interval.data;
+ if (defined(data)) {
+ return data.getType(time);
+ }
+ }
+ return undefined;
+ };
+
+ /**
+ * Returns the value of the property at the specified simulation time.
+ * @memberof Property
+ *
+ * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ */
+ CompositeMaterialProperty.prototype.getValue = function(time, result) {
+ if (!defined(time)) {
+ throw new DeveloperError('time is required');
+ }
+
+ var interval = this._intervals.findIntervalContainingDate(time);
+ if (defined(interval)) {
+ var data = interval.data;
+ if (defined(data)) {
+ return data.getValue(time, result);
+ }
+ }
+ return undefined;
+ };
+
+ return CompositeMaterialProperty;
+});
\ No newline at end of file
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index 36e6ee5fafd1..a9799c151567 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -27,6 +27,7 @@ define([
'../Scene/HorizontalOrigin',
'../Scene/LabelStyle',
'../Scene/VerticalOrigin',
+ './CompositeMaterialProperty',
'./CompositePositionProperty',
'./CompositeProperty',
'./ConstantPositionProperty',
@@ -83,6 +84,7 @@ define([
HorizontalOrigin,
LabelStyle,
VerticalOrigin,
+ CompositeMaterialProperty,
CompositePositionProperty,
CompositeProperty,
ConstantPositionProperty,
@@ -632,7 +634,7 @@ define([
var propertyCreated = false;
var property = object[propertyName];
if (!defined(property)) {
- property = new CompositeProperty();
+ property = new CompositeMaterialProperty();
object[propertyName] = property;
propertyCreated = true;
}
diff --git a/Source/DynamicScene/GridMaterialProperty.js b/Source/DynamicScene/GridMaterialProperty.js
index 303f2fc82b4a..ea2de4cbff75 100644
--- a/Source/DynamicScene/GridMaterialProperty.js
+++ b/Source/DynamicScene/GridMaterialProperty.js
@@ -1,10 +1,16 @@
/*global define*/
define([
+ '../Core/Cartesian2',
+ '../Core/Color',
'../Core/defined',
- '../Core/defineProperties'
+ '../Core/defineProperties',
+ './ConstantProperty'
], function(
+ Cartesian2,
+ Color,
defined,
- defineProperties) {
+ defineProperties,
+ ConstantProperty) {
"use strict";
/**
@@ -18,28 +24,28 @@ define([
* @type {DynamicProperty}
* @default undefined
*/
- this.color = undefined;
+ this.color = new ConstantProperty(Color.WHITE);
/**
* A DynamicProperty of type Number which determines the grid cells alpha value, when combined with the color alpha.
* @type {DynamicProperty}
* @default undefined
*/
- this.cellAlpha = undefined;
+ this.cellAlpha = new ConstantProperty(0.1);
/**
* A DynamicProperty of type Number which determines the number of horizontal rows.
* @type {DynamicProperty}
* @default undefined
*/
- this.lineCount = undefined;
+ this.lineCount = new ConstantProperty(new Cartesian2(8, 8));
/**
* A DynamicProperty of type Number which determines the width of each horizontal line, in pixels.
* @type {DynamicProperty}
* @default undefined
*/
- this.lineThickness = undefined;
+ this.lineThickness = new ConstantProperty(new Cartesian2(1.0, 1.0));
};
defineProperties(GridMaterialProperty.prototype, {
@@ -56,49 +62,21 @@ define([
(defined(this.lineCount) ? this.lineCount.isTimeVarying : false) || //
(defined(this.lineThickness) ? this.lineThickness.isTimeVarying : false);
}
- },
- /**
- * Gets the Material type.
- * @type {String}
- */
- type : {
- get : function() {
- return 'Grid';
- }
}
});
+ GridMaterialProperty.prototype.getType = function(time) {
+ return 'Grid';
+ };
+
GridMaterialProperty.prototype.getValue = function(time, result) {
if (!defined(result)) {
result = {};
}
-
- var property = this.color;
- if (defined(property)) {
- var color = property.getValue(time, result.color);
- if (defined(color)) {
- result.color = color;
- }
- }
-
- property = this.cellAlpha;
- if (defined(property)) {
- var cellAlpha = property.getValue(time);
- if (defined(cellAlpha)) {
- result.cellAlpha = cellAlpha;
- }
- }
-
- property = this.lineCount;
- if (defined(property)) {
- result.lineCount = property.getValue(time, result.lineCount);
- }
-
- property = this.lineThickness;
- if (defined(property)) {
- result.lineThickness = property.getValue(time, result.lineThickness);
- }
-
+ result.color = defined(this.color) ? this.color.getValue(time, result.color) : undefined;
+ result.cellAlpha = defined(this.cellAlpha) ? this.cellAlpha.getValue(time) : undefined;
+ result.lineCount = defined(this.lineCount) ? this.lineCount.getValue(time, result.lineCount) : undefined;
+ result.lineThickness = defined(this.lineThickness) ? this.lineThickness.getValue(time, result.lineThickness) : undefined;
return result;
};
diff --git a/Source/DynamicScene/ImageMaterialProperty.js b/Source/DynamicScene/ImageMaterialProperty.js
index a5989117f1c2..d1d38af90dd3 100644
--- a/Source/DynamicScene/ImageMaterialProperty.js
+++ b/Source/DynamicScene/ImageMaterialProperty.js
@@ -1,10 +1,14 @@
/*global define*/
define([
+ '../Core/Cartesian2',
'../Core/defined',
- '../Core/defineProperties'
+ '../Core/defineProperties',
+ './ConstantProperty'
], function(
+ Cartesian2,
defined,
- defineProperties) {
+ defineProperties,
+ ConstantProperty) {
"use strict";
/**
@@ -24,14 +28,7 @@ define([
* @type {DynamicProperty}
* @default undefined
*/
- this.verticalRepeat = undefined;
- /**
- * A DynamicProperty of type Number which determines the material's horizontal repeat.
- *
- * @type {DynamicProperty}
- * @default undefined
- */
- this.horizontalRepeat = undefined;
+ this.repeat = new ConstantProperty(new Cartesian2(1, 1));
};
@@ -47,33 +44,20 @@ define([
return (defined(this.image) ? this.image.isTimeVarying : false) || //
(defined(this.repeat) ? this.repeat.isTimeVarying : false);
}
- },
- /**
- * Gets the Material type.
- * @type {String}
- */
- type : {
- get : function() {
- return 'Image';
- }
}
});
+ ImageMaterialProperty.prototype.getType = function(time) {
+ return 'Image';
+ };
+
ImageMaterialProperty.prototype.getValue = function(time, result) {
if (!defined(result)) {
result = {};
}
- var property = this.image;
- if (defined(property)) {
- result.image = property.getValue(time, result.image);
- }
-
- property = this.repeat;
- if (defined(property)) {
- result.repeat = property.getValue(time, result.repeat);
- }
-
+ result.image = defined(this.image) ? this.image.getValue(time) : undefined;
+ result.repeat = defined(this.repeat) ? this.repeat.getValue(time, result.repeat) : undefined;
return result;
};
diff --git a/Source/DynamicScene/MaterialProperty.js b/Source/DynamicScene/MaterialProperty.js
index 7a1b4874a707..f2772253943c 100644
--- a/Source/DynamicScene/MaterialProperty.js
+++ b/Source/DynamicScene/MaterialProperty.js
@@ -69,15 +69,9 @@ define([
*/
MaterialProperty.GetValue = function(time, context, materialProperty, material) {
if (defined(materialProperty)) {
- if (!defined(materialProperty.type) && defined(materialProperty.intervals)) {
- var interval = materialProperty.intervals.findIntervalContainingDate(time);
- if (!defined(interval) || !defined(interval.data)) {
- return material;
- }
- materialProperty = interval.data;
- }
- if (!defined(material) || (material.type !== materialProperty.type)) {
- material = Material.fromType(context, materialProperty.type);
+ var type = materialProperty.getType(time);
+ if (!defined(material) || (material.type !== type)) {
+ material = Material.fromType(context, type);
}
materialProperty.getValue(time, material.uniforms);
}
diff --git a/Specs/DynamicScene/ColorMaterialPropertySpec.js b/Specs/DynamicScene/ColorMaterialPropertySpec.js
index 245469a505e0..e6248e2903eb 100644
--- a/Specs/DynamicScene/ColorMaterialPropertySpec.js
+++ b/Specs/DynamicScene/ColorMaterialPropertySpec.js
@@ -5,25 +5,27 @@ defineSuite([
'DynamicScene/TimeIntervalCollectionProperty',
'Core/Color',
'Core/JulianDate',
- 'Core/TimeInterval'
+ 'Core/TimeInterval',
+ 'Specs/UndefinedProperty'
], function(
ColorMaterialProperty,
ConstantProperty,
TimeIntervalCollectionProperty,
Color,
JulianDate,
- TimeInterval) {
+ TimeInterval,
+ UndefinedProperty) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
it('works with basic types', function() {
var property = new ColorMaterialProperty();
- expect(property.type).toEqual('Color');
expect(property.isTimeVarying).toEqual(false);
- expect(property.color).toBeUndefined();
+ expect(property.color).toBeDefined();
+ expect(property.getType()).toEqual('Color');
var result = property.getValue();
- expect(result.color).toBeUndefined();
+ expect(result.color).toEqual(Color.WHITE);
});
it('works with constant values', function() {
@@ -35,6 +37,16 @@ defineSuite([
expect(result.color).toEqual(Color.RED);
});
+ it('works with undefined values', function() {
+ var property = new ColorMaterialProperty();
+ property.color = new UndefinedProperty();
+ expect(property.isTimeVarying).toEqual(false);
+
+ var result = property.getValue();
+ expect(result.hasOwnProperty('color')).toEqual(true);
+ expect(result.color).toBeUndefined();
+ });
+
it('works with dynamic values', function() {
var property = new ColorMaterialProperty();
property.color = new TimeIntervalCollectionProperty();
@@ -44,9 +56,7 @@ defineSuite([
property.color.intervals.addInterval(new TimeInterval(start, stop, true, true, Color.BLUE));
expect(property.isTimeVarying).toEqual(true);
- var result = {};
- var returnedResult = property.getValue(start, result);
- expect(returnedResult).toBe(result);
+ var result = property.getValue(start);
expect(result.color).toEqual(Color.BLUE);
});
@@ -55,7 +65,11 @@ defineSuite([
property.color = new ConstantProperty(Color.RED);
expect(property.isTimeVarying).toEqual(false);
- var result = property.getValue(new JulianDate());
+ var result = {
+ color : Color.BLUE.clone()
+ };
+ var returnedResult = property.getValue(new JulianDate(), result);
+ expect(returnedResult).toBe(result);
expect(result.color).toEqual(Color.RED);
});
});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CompositeMaterialPropertySpec.js b/Specs/DynamicScene/CompositeMaterialPropertySpec.js
new file mode 100644
index 000000000000..124890d5d68b
--- /dev/null
+++ b/Specs/DynamicScene/CompositeMaterialPropertySpec.js
@@ -0,0 +1,79 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/CompositeMaterialProperty',
+ 'DynamicScene/ConstantProperty',
+ 'DynamicScene/ColorMaterialProperty',
+ 'DynamicScene/GridMaterialProperty',
+ 'Core/JulianDate',
+ 'Core/TimeInterval',
+ 'Core/TimeIntervalCollection'
+ ], function(
+ CompositeMaterialProperty,
+ ConstantProperty,
+ ColorMaterialProperty,
+ GridMaterialProperty,
+ JulianDate,
+ TimeInterval,
+ TimeIntervalCollection) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('default constructor has expected values', function() {
+ var property = new CompositeMaterialProperty();
+ expect(property.isTimeVarying).toEqual(true);
+ expect(property.intervals).toBeInstanceOf(TimeIntervalCollection);
+ expect(property.getType(new JulianDate())).toBeUndefined();
+ expect(property.getValue(new JulianDate())).toBeUndefined();
+ });
+
+ it('works without a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ColorMaterialProperty());
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new GridMaterialProperty());
+
+ var property = new CompositeMaterialProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var result1 = property.getValue(interval1.start);
+ expect(property.getType(interval1.start)).toEqual('Color');
+ expect(result1).not.toBe(interval1.data.getValue(interval1.start));
+ expect(result1).toEqual(interval1.data.getValue(interval1.start));
+
+ var result2 = property.getValue(interval2.stop);
+ expect(property.getType(interval2.stop)).toEqual('Grid');
+ expect(result2).not.toBe(interval2.data.getValue(interval2.stop));
+ expect(result2).toEqual(interval2.data.getValue(interval2.stop));
+ });
+
+ it('works with a result parameter', function() {
+ var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ColorMaterialProperty());
+ var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new GridMaterialProperty());
+
+ var property = new CompositeMaterialProperty();
+ property.intervals.addInterval(interval1);
+ property.intervals.addInterval(interval2);
+
+ var expected = {};
+ var result1 = property.getValue(interval1.start, expected);
+ expect(result1).toBe(expected);
+ expect(result1).toEqual(interval1.data.getValue(interval1.start));
+
+ var result2 = property.getValue(interval2.stop, expected);
+ expect(result2).toBe(expected);
+ expect(result2).toEqual(interval2.data.getValue(interval2.stop));
+ });
+
+ it('getValue throws with no time parameter', function() {
+ var property = new CompositeMaterialProperty();
+ expect(function() {
+ property.getValue(undefined);
+ }).toThrow();
+ });
+
+ it('getType throws with no time parameter', function() {
+ var property = new CompositeMaterialProperty();
+ expect(function() {
+ property.getType(undefined);
+ }).toThrow();
+ });
+});
\ No newline at end of file
diff --git a/Specs/DynamicScene/CompositePropertySpec.js b/Specs/DynamicScene/CompositePropertySpec.js
index 24ea762ad8e5..a35a403f8df9 100644
--- a/Specs/DynamicScene/CompositePropertySpec.js
+++ b/Specs/DynamicScene/CompositePropertySpec.js
@@ -58,21 +58,6 @@ defineSuite([
expect(result2).toEqual(interval2.data.getValue(interval2.stop));
});
- it('works without a result parameter', function() {
- var interval1 = new TimeInterval(new JulianDate(10, 0), new JulianDate(12, 0), true, true, new ConstantProperty(new Cartesian3(1, 2, 3)));
- var interval2 = new TimeInterval(new JulianDate(12, 0), new JulianDate(14, 0), false, true, new ConstantProperty(new Cartesian3(4, 5, 6)));
-
- var property = new CompositeProperty();
- property.intervals.addInterval(interval1);
- property.intervals.addInterval(interval2);
-
- var result1 = property.getValue(interval1.start);
- expect(result1).toEqual(interval1.data.getValue(interval1.start));
-
- var result2 = property.getValue(interval2.stop);
- expect(result2).toEqual(interval2.data.getValue(interval2.stop));
- });
-
it('getValue throws with no time parameter', function() {
var property = new CompositeProperty();
expect(function() {
diff --git a/Specs/DynamicScene/GridMaterialPropertySpec.js b/Specs/DynamicScene/GridMaterialPropertySpec.js
new file mode 100644
index 000000000000..f91353b9b774
--- /dev/null
+++ b/Specs/DynamicScene/GridMaterialPropertySpec.js
@@ -0,0 +1,112 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/GridMaterialProperty',
+ 'DynamicScene/ConstantProperty',
+ 'DynamicScene/TimeIntervalCollectionProperty',
+ 'Core/Cartesian2',
+ 'Core/Color',
+ 'Core/JulianDate',
+ 'Core/TimeInterval',
+ 'Specs/UndefinedProperty'
+ ], function(
+ GridMaterialProperty,
+ ConstantProperty,
+ TimeIntervalCollectionProperty,
+ Cartesian2,
+ Color,
+ JulianDate,
+ TimeInterval,
+ UndefinedProperty) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('works with basic types', function() {
+ var property = new GridMaterialProperty();
+ expect(property.isTimeVarying).toEqual(false);
+ expect(property.color).toBeDefined();
+ expect(property.cellAlpha).toBeDefined();
+ expect(property.lineCount).toBeDefined();
+ expect(property.lineThickness).toBeDefined();
+
+ expect(property.getType()).toEqual('Grid');
+
+ var result = property.getValue();
+ expect(result.color).toEqual(Color.WHITE);
+ expect(result.cellAlpha).toEqual(0.1);
+ expect(result.lineCount).toEqual(new Cartesian2(8, 8));
+ expect(result.lineThickness).toEqual(new Cartesian2(1.0, 1.0));
+ });
+
+ it('works with constant values', function() {
+ var property = new GridMaterialProperty();
+ property.color = new ConstantProperty(Color.RED);
+ property.cellAlpha = new ConstantProperty(1.0);
+ property.lineCount = new ConstantProperty(new Cartesian2(3.4, 5.0));
+ property.lineThickness = new ConstantProperty(new Cartesian2(2, 3));
+ expect(property.isTimeVarying).toEqual(false);
+
+ var result = property.getValue(new JulianDate());
+ expect(result.color).toEqual(Color.RED);
+ expect(result.cellAlpha).toEqual(1);
+ expect(result.lineCount).toEqual(new Cartesian2(3.4, 5.0));
+ expect(result.lineThickness).toEqual(new Cartesian2(2, 3));
+ });
+
+ it('works with undefined values', function() {
+ var property = new GridMaterialProperty();
+ property.color = new UndefinedProperty();
+ property.cellAlpha = new UndefinedProperty();
+ property.lineCount = new UndefinedProperty();
+ property.lineThickness = new UndefinedProperty();
+ expect(property.isTimeVarying).toEqual(false);
+
+ var result = property.getValue();
+ expect(result.hasOwnProperty('color')).toEqual(true);
+ expect(result.hasOwnProperty('cellAlpha')).toEqual(true);
+ expect(result.hasOwnProperty('lineCount')).toEqual(true);
+ expect(result.hasOwnProperty('lineThickness')).toEqual(true);
+ expect(result.color).toBeUndefined();
+ expect(result.cellAlpha).toBeUndefined();
+ expect(result.lineCount).toBeUndefined();
+ expect(result.lineThickness).toBeUndefined();
+ });
+
+ it('works with dynamic values', function() {
+ var property = new GridMaterialProperty();
+ property.color = new TimeIntervalCollectionProperty();
+ property.cellAlpha = new TimeIntervalCollectionProperty();
+ property.lineCount = new TimeIntervalCollectionProperty();
+ property.lineThickness = new TimeIntervalCollectionProperty();
+
+ var start = new JulianDate(1, 0);
+ var stop = new JulianDate(2, 0);
+ property.color.intervals.addInterval(new TimeInterval(start, stop, true, true, Color.BLUE));
+ property.cellAlpha.intervals.addInterval(new TimeInterval(start, stop, true, true, 1.0));
+ property.lineCount.intervals.addInterval(new TimeInterval(start, stop, true, true, new Cartesian2(3.4, 5.0)));
+ property.lineThickness.intervals.addInterval(new TimeInterval(start, stop, true, true, new Cartesian2(2, 3)));
+ expect(property.isTimeVarying).toEqual(true);
+
+ var result = property.getValue(start);
+ expect(result.color).toEqual(Color.BLUE);
+ expect(result.cellAlpha).toEqual(1);
+ expect(result.lineCount).toEqual(new Cartesian2(3.4, 5.0));
+ expect(result.lineThickness).toEqual(new Cartesian2(2, 3));
+ });
+
+ it('works with a result parameter', function() {
+ var property = new GridMaterialProperty();
+ property.color = new ConstantProperty(Color.RED);
+ property.cellAlpha = new ConstantProperty(1.0);
+ property.lineCount = new ConstantProperty(new Cartesian2(3.4, 5.0));
+ property.lineThickness = new ConstantProperty(new Cartesian2(2, 3));
+ expect(property.isTimeVarying).toEqual(false);
+
+ var result = {};
+ var returnedResult = property.getValue(new JulianDate(), result);
+ expect(result).toBe(returnedResult);
+ expect(result.color).toEqual(Color.RED);
+ expect(result.cellAlpha).toEqual(1.0);
+ expect(result.lineCount).toEqual(new Cartesian2(3.4, 5.0));
+ expect(result.lineThickness).toEqual(new Cartesian2(2, 3));
+ });
+});
\ No newline at end of file
diff --git a/Specs/DynamicScene/ImageMaterialPropertySpec.js b/Specs/DynamicScene/ImageMaterialPropertySpec.js
new file mode 100644
index 000000000000..88173950486a
--- /dev/null
+++ b/Specs/DynamicScene/ImageMaterialPropertySpec.js
@@ -0,0 +1,86 @@
+/*global defineSuite*/
+defineSuite([
+ 'DynamicScene/ImageMaterialProperty',
+ 'DynamicScene/ConstantProperty',
+ 'DynamicScene/TimeIntervalCollectionProperty',
+ 'Core/Cartesian2',
+ 'Core/JulianDate',
+ 'Core/TimeInterval',
+ 'Specs/UndefinedProperty'
+ ], function(
+ ImageMaterialProperty,
+ ConstantProperty,
+ TimeIntervalCollectionProperty,
+ Cartesian2,
+ JulianDate,
+ TimeInterval,
+ UndefinedProperty) {
+ "use strict";
+ /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
+
+ it('works with basic types', function() {
+ var property = new ImageMaterialProperty();
+ expect(property.isTimeVarying).toEqual(false);
+ expect(property.image).toBeUndefined();
+ expect(property.repeat).toBeDefined();
+
+ expect(property.getType()).toEqual('Image');
+
+ var result = property.getValue();
+ expect(result.image).toBeUndefined();
+ expect(result.repeat).toEqual(new Cartesian2(1.0, 1.0));
+ });
+
+ it('works with constant values', function() {
+ var property = new ImageMaterialProperty();
+ property.image = new ConstantProperty('http://test.invalid/image.png');
+ property.repeat = new ConstantProperty(new Cartesian2(2, 3));
+ expect(property.isTimeVarying).toEqual(false);
+
+ var result = property.getValue(new JulianDate());
+ expect(result.image).toEqual('http://test.invalid/image.png');
+ expect(result.repeat).toEqual(new Cartesian2(2, 3));
+ });
+
+ it('works with undefined values', function() {
+ var property = new ImageMaterialProperty();
+ property.image = new UndefinedProperty();
+ property.repeat = new UndefinedProperty();
+ expect(property.isTimeVarying).toEqual(false);
+
+ var result = property.getValue();
+ expect(result.hasOwnProperty('image')).toEqual(true);
+ expect(result.hasOwnProperty('repeat')).toEqual(true);
+ expect(result.image).toBeUndefined();
+ expect(result.repeat).toBeUndefined();
+ });
+
+ it('works with dynamic values', function() {
+ var property = new ImageMaterialProperty();
+ property.image = new TimeIntervalCollectionProperty();
+ property.repeat = new TimeIntervalCollectionProperty();
+
+ var start = new JulianDate(1, 0);
+ var stop = new JulianDate(2, 0);
+ property.image.intervals.addInterval(new TimeInterval(start, stop, true, true, 'http://test.invalid/image.png'));
+ property.repeat.intervals.addInterval(new TimeInterval(start, stop, true, true, new Cartesian2(2, 3)));
+ expect(property.isTimeVarying).toEqual(true);
+
+ var result = property.getValue(start);
+ expect(result.image).toEqual('http://test.invalid/image.png');
+ expect(result.repeat).toEqual(new Cartesian2(2, 3));
+ });
+
+ it('works with a result parameter', function() {
+ var property = new ImageMaterialProperty();
+ property.image = new ConstantProperty('http://test.invalid/image.png');
+ property.repeat = new ConstantProperty(new Cartesian2(2, 3));
+ expect(property.isTimeVarying).toEqual(false);
+
+ var result = {};
+ var returnedResult = property.getValue(new JulianDate(), result);
+ expect(result).toBe(returnedResult);
+ expect(result.image).toEqual('http://test.invalid/image.png');
+ expect(result.repeat).toEqual(new Cartesian2(2, 3));
+ });
+});
\ No newline at end of file
From 1959583e5663a122f31f4e21355579ebc385ac32 Mon Sep 17 00:00:00 2001
From: mramato
Date: Fri, 23 Aug 2013 20:34:23 -0400
Subject: [PATCH 50/65] Fix remaining spec failures.
---
Specs/DynamicScene/CzmlDataSourceSpec.js | 28 +++++++++----------
...amicConeVisualizerUsingCustomSensorSpec.js | 10 +++----
.../DynamicEllipsoidVisualizerSpec.js | 10 +++----
.../DynamicPolygonVisualizerSpec.js | 22 ++++++---------
.../DynamicPyramidVisualizerSpec.js | 10 +++----
5 files changed, 34 insertions(+), 46 deletions(-)
diff --git a/Specs/DynamicScene/CzmlDataSourceSpec.js b/Specs/DynamicScene/CzmlDataSourceSpec.js
index 6228b1b2e97c..36499d7b6090 100644
--- a/Specs/DynamicScene/CzmlDataSourceSpec.js
+++ b/Specs/DynamicScene/CzmlDataSourceSpec.js
@@ -486,10 +486,10 @@ defineSuite([
expect(dynamicObject.cone.radius.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.radius);
expect(dynamicObject.cone.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.show);
expect(dynamicObject.cone.showIntersection.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.showIntersection);
- expect(dynamicObject.cone.capMaterial.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.cone.innerMaterial.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.cone.outerMaterial.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
- expect(dynamicObject.cone.silhouetteMaterial.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
+ expect(dynamicObject.cone.capMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.cone.innerMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.cone.outerMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
+ expect(dynamicObject.cone.silhouetteMaterial.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
expect(dynamicObject.cone.intersectionColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
expect(dynamicObject.cone.intersectionWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(conePacket.cone.intersectionWidth);
});
@@ -555,10 +555,10 @@ defineSuite([
expect(dynamicObject.cone.radius.getValue(validTime)).toEqual(conePacket.cone.radius);
expect(dynamicObject.cone.show.getValue(validTime)).toEqual(conePacket.cone.show);
expect(dynamicObject.cone.showIntersection.getValue(validTime)).toEqual(conePacket.cone.showIntersection);
- expect(dynamicObject.cone.capMaterial.getValue(validTime).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
- expect(dynamicObject.cone.innerMaterial.getValue(validTime).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
- expect(dynamicObject.cone.outerMaterial.getValue(validTime).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
- expect(dynamicObject.cone.silhouetteMaterial.getValue(validTime).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
+ expect(dynamicObject.cone.capMaterial.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.cone.innerMaterial.getValue(validTime).color).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
+ expect(dynamicObject.cone.outerMaterial.getValue(validTime).color).toEqual(new Color(0.3, 0.3, 0.3, 0.3));
+ expect(dynamicObject.cone.silhouetteMaterial.getValue(validTime).color).toEqual(new Color(0.4, 0.4, 0.4, 0.4));
expect(dynamicObject.cone.intersectionColor.getValue(validTime)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
expect(dynamicObject.cone.intersectionWidth.getValue(validTime)).toEqual(conePacket.cone.intersectionWidth);
@@ -649,7 +649,7 @@ defineSuite([
expect(dynamicObject.ellipsoid).toBeDefined();
expect(dynamicObject.ellipsoid.radii.getValue(Iso8601.MINIMUM_VALUE)).toEqual(expectedRadii);
expect(dynamicObject.ellipsoid.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(ellipsoidPacket.ellipsoid.show);
- expect(dynamicObject.ellipsoid.material.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.ellipsoid.material.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
});
it('CZML adds data for constrained ellipsoid.', function() {
@@ -682,7 +682,7 @@ defineSuite([
expect(dynamicObject.ellipsoid).toBeDefined();
expect(dynamicObject.ellipsoid.radii.getValue(validTime)).toEqual(expectedRadii);
expect(dynamicObject.ellipsoid.show.getValue(validTime)).toEqual(ellipsoidPacketInterval.ellipsoid.show);
- expect(dynamicObject.ellipsoid.material.getValue(validTime).color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.ellipsoid.material.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
expect(dynamicObject.ellipsoid.radii.getValue(invalidTime)).toBeUndefined();
expect(dynamicObject.ellipsoid.show.getValue(invalidTime)).toBeUndefined();
@@ -1023,7 +1023,7 @@ defineSuite([
var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
expect(dynamicObject.polygon).toBeDefined();
- expect(dynamicObject.polygon.material.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.polygon.material.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
expect(dynamicObject.polygon.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(true);
});
@@ -1050,7 +1050,7 @@ defineSuite([
var dynamicObject = dataSource.getDynamicObjectCollection().getObjects()[0];
expect(dynamicObject.polygon).toBeDefined();
- expect(dynamicObject.polygon.material.getValue(validTime).color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.polygon.material.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
expect(dynamicObject.polygon.show.getValue(validTime)).toEqual(true);
expect(dynamicObject.polygon.material.getValue(invalidTime)).toBeUndefined();
@@ -1155,7 +1155,7 @@ defineSuite([
expect(dynamicObject.pyramid.radius.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.radius);
expect(dynamicObject.pyramid.show.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.show);
expect(dynamicObject.pyramid.showIntersection.getValue(Iso8601.MINIMUM_VALUE)).toEqual(pyramidPacket.pyramid.showIntersection);
- expect(dynamicObject.pyramid.material.getValue(Iso8601.MINIMUM_VALUE).color.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.pyramid.material.getValue(Iso8601.MINIMUM_VALUE).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
expect(dynamicObject.pyramid.intersectionColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
expect(dynamicObject.pyramid.intersectionWidth.getValue(Iso8601.MINIMUM_VALUE)).toEqual(7.0);
});
@@ -1198,7 +1198,7 @@ defineSuite([
expect(dynamicObject.pyramid.radius.getValue(validTime)).toEqual(pyramidPacket.pyramid.radius);
expect(dynamicObject.pyramid.show.getValue(validTime)).toEqual(pyramidPacket.pyramid.show);
expect(dynamicObject.pyramid.showIntersection.getValue(validTime)).toEqual(pyramidPacket.pyramid.showIntersection);
- expect(dynamicObject.pyramid.material.getValue(validTime).color.getValue(validTime)).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
+ expect(dynamicObject.pyramid.material.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
expect(dynamicObject.pyramid.intersectionColor.getValue(validTime)).toEqual(new Color(0.5, 0.5, 0.5, 0.5));
expect(dynamicObject.pyramid.intersectionWidth.getValue(validTime)).toEqual(8.0);
diff --git a/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js b/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
index 20ed460dcf95..accb3a6e211f 100644
--- a/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
+++ b/Specs/DynamicScene/DynamicConeVisualizerUsingCustomSensorSpec.js
@@ -9,7 +9,7 @@ defineSuite([
'DynamicScene/DynamicCone',
'DynamicScene/DynamicObjectCollection',
'DynamicScene/DynamicObject',
- 'Scene/Material',
+ 'DynamicScene/ColorMaterialProperty',
'Core/JulianDate',
'Core/Quaternion',
'Core/Cartesian3',
@@ -26,7 +26,7 @@ defineSuite([
DynamicCone,
DynamicObjectCollection,
DynamicObject,
- Material,
+ ColorMaterialProperty,
JulianDate,
Quaternion,
Cartesian3,
@@ -142,9 +142,7 @@ defineSuite([
cone.radius = new ConstantProperty(123.5);
cone.show = new ConstantProperty(true);
- var blueMaterial = Material.fromType(scene.getContext(), Material.ColorType);
- blueMaterial.uniforms.color = Color.BLUE.clone();
- cone.outerMaterial = new ConstantProperty(blueMaterial);
+ cone.outerMaterial = new ColorMaterialProperty();
visualizer.update(time);
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -158,7 +156,7 @@ defineSuite([
expect(c.showIntersection).toEqual(testObject.cone.showIntersection.getValue(time));
expect(c.radius).toEqual(testObject.cone.radius.getValue(time));
expect(c.show).toEqual(testObject.cone.show.getValue(time));
- expect(c.material).toEqual(testObject.cone.outerMaterial.getValue(time));
+ expect(c.material.uniforms).toEqual(testObject.cone.outerMaterial.getValue(time));
expect(c.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time).conjugate()), testObject.position.getValue(time)));
cone.show.value = false;
diff --git a/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js b/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js
index e67f0b10be87..2fd66a0b6d26 100644
--- a/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicEllipsoidVisualizerSpec.js
@@ -13,7 +13,7 @@ defineSuite([
'Core/Color',
'DynamicScene/DynamicEllipsoid',
'DynamicScene/DynamicObjectCollection',
- 'Scene/Material'
+ 'DynamicScene/ColorMaterialProperty'
], function(
DynamicEllipsoidVisualizer,
createScene,
@@ -28,7 +28,7 @@ defineSuite([
Color,
DynamicEllipsoid,
DynamicObjectCollection,
- Material) {
+ ColorMaterialProperty) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -141,16 +141,14 @@ defineSuite([
ellipsoid.directions = new ConstantProperty([new Spherical(0, 0, 0), new Spherical(1, 0, 0), new Spherical(2, 0, 0), new Spherical(3, 0, 0)]);
ellipsoid.radii = new ConstantProperty(123.5);
ellipsoid.show = new ConstantProperty(true);
- var redMaterial = Material.fromType(scene.getContext(), Material.ColorType);
- redMaterial.uniforms.color = Color.RED;
- ellipsoid.material = new ConstantProperty(redMaterial);
+ ellipsoid.material = new ColorMaterialProperty();
visualizer.update(time);
expect(scene.getPrimitives().getLength()).toEqual(1);
var p = scene.getPrimitives().get(0);
expect(p.radii).toEqual(testObject.ellipsoid.radii.getValue(time));
expect(p.show).toEqual(testObject.ellipsoid.show.getValue(time));
- expect(p.material).toEqual(testObject.ellipsoid.material.getValue(time));
+ expect(p.material.uniforms).toEqual(testObject.ellipsoid.material.getValue(time));
expect(p.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time).conjugate()), testObject.position.getValue(time)));
ellipsoid.show.value = false;
diff --git a/Specs/DynamicScene/DynamicPolygonVisualizerSpec.js b/Specs/DynamicScene/DynamicPolygonVisualizerSpec.js
index 05c7ec195045..82f8231f7c96 100644
--- a/Specs/DynamicScene/DynamicPolygonVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPolygonVisualizerSpec.js
@@ -10,7 +10,7 @@ defineSuite([
'DynamicScene/DynamicEllipse',
'DynamicScene/DynamicPolygon',
'DynamicScene/DynamicObjectCollection',
- 'Scene/Material'
+ 'DynamicScene/ColorMaterialProperty'
], function(
DynamicPolygonVisualizer,
createScene,
@@ -22,7 +22,7 @@ defineSuite([
DynamicEllipse,
DynamicPolygon,
DynamicObjectCollection,
- Material) {
+ ColorMaterialProperty) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -138,9 +138,7 @@ defineSuite([
testObject.position = new ConstantProperty(new Cartesian3(1234, 5678, 9101112));
var polygon = testObject.polygon = new DynamicPolygon();
polygon.show = new ConstantProperty(true);
- var colorMaterial = Material.fromType(scene.getContext(), Material.ColorType);
- colorMaterial.uniforms.color = new Color(0.7, 0.6, 0.5, 0.4);
- polygon.material = new ConstantProperty(colorMaterial);
+ polygon.material = new ColorMaterialProperty();
var ellipse = testObject.ellipse = new DynamicEllipse();
ellipse.bearing = new ConstantProperty(0);
@@ -154,7 +152,7 @@ defineSuite([
visualizer.update(time);
expect(primitive.show).toEqual(testObject.polygon.show.getValue(time));
- expect(primitive.material).toEqual(testObject.polygon.material.getValue(time));
+ expect(primitive.material.uniforms).toEqual(testObject.polygon.material.getValue(time));
expect(primitive.getPositions().length > 0);
});
@@ -172,9 +170,7 @@ defineSuite([
var polygon = testObject.polygon = new DynamicPolygon();
polygon.show = new ConstantProperty(true);
- var colorMaterial = Material.fromType(scene.getContext(), Material.ColorType);
- colorMaterial.uniforms.color = new Color(0.7, 0.6, 0.5, 0.4);
- polygon.material = new ConstantProperty(colorMaterial);
+ polygon.material = new ColorMaterialProperty();
visualizer.update(time);
@@ -184,16 +180,14 @@ defineSuite([
visualizer.update(time);
expect(primitive.show).toEqual(testObject.polygon.show.getValue(time));
- expect(primitive.material).toEqual(testObject.polygon.material.getValue(time));
+ expect(primitive.material.uniforms).toEqual(testObject.polygon.material.getValue(time));
testObject.vertexPositions = new ConstantProperty([new Cartesian3(5678, 1234, 1101112), new Cartesian3(1234, 5678, 9101112), new Cartesian3(1234, 5678, 910111)]);
- colorMaterial = Material.fromType(scene.getContext(), Material.ColorType);
- colorMaterial.uniforms.color = new Color(0.1, 0.2, 0.4, 0.3);
- polygon.material = new ConstantProperty(colorMaterial);
+ polygon.material = new ColorMaterialProperty();
visualizer.update(time);
expect(primitive.show).toEqual(testObject.polygon.show.getValue(time));
- expect(primitive.material).toEqual(testObject.polygon.material.getValue(time));
+ expect(primitive.material.uniforms).toEqual(testObject.polygon.material.getValue(time));
polygon.show = new ConstantProperty(false);
visualizer.update(time);
diff --git a/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js b/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js
index 7120c29440eb..d3bdb0eb85fa 100644
--- a/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js
+++ b/Specs/DynamicScene/DynamicPyramidVisualizerSpec.js
@@ -13,7 +13,7 @@ defineSuite([
'Core/Spherical',
'DynamicScene/DynamicPyramid',
'DynamicScene/DynamicObjectCollection',
- 'Scene/Material'
+ 'DynamicScene/ColorMaterialProperty'
], function(
DynamicPyramidVisualizer,
createScene,
@@ -28,7 +28,7 @@ defineSuite([
Spherical,
DynamicPyramid,
DynamicObjectCollection,
- Material) {
+ ColorMaterialProperty) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/
@@ -132,9 +132,7 @@ defineSuite([
pyramid.showIntersection = new ConstantProperty(true);
pyramid.radius = new ConstantProperty(123.5);
pyramid.show = new ConstantProperty(true);
- var redMaterial = Material.fromType(scene.getContext(), Material.ColorType);
- redMaterial.uniforms.color = Color.RED;
- pyramid.material = new ConstantProperty(redMaterial);
+ pyramid.material = new ColorMaterialProperty();
visualizer.update(time);
expect(scene.getPrimitives().getLength()).toEqual(1);
@@ -144,7 +142,7 @@ defineSuite([
expect(p.showIntersection).toEqual(testObject.pyramid.showIntersection.getValue(time));
expect(p.radius).toEqual(testObject.pyramid.radius.getValue(time));
expect(p.show).toEqual(testObject.pyramid.show.getValue(time));
- expect(p.material).toEqual(testObject.pyramid.material.getValue(time));
+ expect(p.material.uniforms).toEqual(testObject.pyramid.material.getValue(time));
expect(p.modelMatrix).toEqual(Matrix4.fromRotationTranslation(Matrix3.fromQuaternion(testObject.orientation.getValue(time).conjugate()), testObject.position.getValue(time)));
pyramid.show.value = false;
From 0c272fe1a1d6975334f297078ba532c50fd8e619 Mon Sep 17 00:00:00 2001
From: mramato
Date: Fri, 23 Aug 2013 22:00:53 -0400
Subject: [PATCH 51/65] Remove `isTimeVarying` from Property objects since
we're not using it yet and we'll need a more complete caching policy in
placewhen we refactor visualizers.
---
Source/DynamicScene/ColorMaterialProperty.js | 14 --------------
.../DynamicScene/CompositeMaterialProperty.js | 11 -----------
.../DynamicScene/CompositePositionProperty.js | 11 -----------
Source/DynamicScene/CompositeProperty.js | 11 -----------
Source/DynamicScene/ConstantPositionProperty.js | 11 -----------
Source/DynamicScene/ConstantProperty.js | 14 --------------
Source/DynamicScene/CzmlDataSource.js | 8 --------
Source/DynamicScene/GridMaterialProperty.js | 17 -----------------
Source/DynamicScene/ImageMaterialProperty.js | 16 ----------------
Source/DynamicScene/MaterialProperty.js | 13 -------------
Source/DynamicScene/PositionProperty.js | 7 -------
Source/DynamicScene/Property.js | 15 +++++----------
Source/DynamicScene/ReferenceProperty.js | 14 --------------
Source/DynamicScene/SampledPositionProperty.js | 11 -----------
Source/DynamicScene/SampledProperty.js | 11 -----------
.../TimeIntervalCollectionPositionProperty.js | 11 -----------
.../TimeIntervalCollectionProperty.js | 11 -----------
Specs/DynamicScene/ColorMaterialPropertySpec.js | 5 -----
.../CompositeMaterialPropertySpec.js | 1 -
.../CompositePositionPropertySpec.js | 1 -
Specs/DynamicScene/CompositePropertySpec.js | 1 -
.../ConstantPositionPropertySpec.js | 2 --
Specs/DynamicScene/ConstantPropertySpec.js | 4 ----
Specs/DynamicScene/GridMaterialPropertySpec.js | 5 -----
Specs/DynamicScene/ImageMaterialPropertySpec.js | 5 -----
.../DynamicScene/SampledPositionPropertySpec.js | 2 --
Specs/DynamicScene/SampledPropertySpec.js | 1 -
...imeIntervalCollectionPositionPropertySpec.js | 1 -
.../TimeIntervalCollectionPropertySpec.js | 1 -
Specs/UndefinedProperty.js | 8 --------
30 files changed, 5 insertions(+), 238 deletions(-)
diff --git a/Source/DynamicScene/ColorMaterialProperty.js b/Source/DynamicScene/ColorMaterialProperty.js
index a850dedfa25d..f732733fc8b4 100644
--- a/Source/DynamicScene/ColorMaterialProperty.js
+++ b/Source/DynamicScene/ColorMaterialProperty.js
@@ -25,20 +25,6 @@ define([
this.color = new ConstantProperty(Color.WHITE);
};
- defineProperties(ColorMaterialProperty.prototype, {
- /**
- * Always returns false, since this property always varies with simulation time.
- * @memberof ConstantProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return defined(this.color) ? this.color.isTimeVarying : false;
- }
- }
- });
-
ColorMaterialProperty.prototype.getType = function(time) {
return 'Color';
};
diff --git a/Source/DynamicScene/CompositeMaterialProperty.js b/Source/DynamicScene/CompositeMaterialProperty.js
index 52b28f220053..fddb90e57a33 100644
--- a/Source/DynamicScene/CompositeMaterialProperty.js
+++ b/Source/DynamicScene/CompositeMaterialProperty.js
@@ -24,17 +24,6 @@ define([
};
defineProperties(CompositeMaterialProperty.prototype, {
- /**
- * Always returns true, since this property always varies with simulation time.
- * @memberof SampledProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return true;
- }
- },
/**
* Gets the interval collection.
* @memberof CompositeMaterialProperty.prototype
diff --git a/Source/DynamicScene/CompositePositionProperty.js b/Source/DynamicScene/CompositePositionProperty.js
index 16ba2d4e0904..547b93dc8fc1 100644
--- a/Source/DynamicScene/CompositePositionProperty.js
+++ b/Source/DynamicScene/CompositePositionProperty.js
@@ -31,17 +31,6 @@ define([
};
defineProperties(CompositePositionProperty.prototype, {
- /**
- * Always returns true, since this property always varies with simulation time.
- * @memberof CompositePositionProperty.prototype
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return true;
- }
- },
/**
* Gets the interval collection.
* @memberof CompositePositionProperty.prototype
diff --git a/Source/DynamicScene/CompositeProperty.js b/Source/DynamicScene/CompositeProperty.js
index 0a60bb96a772..b47a11d5fc56 100644
--- a/Source/DynamicScene/CompositeProperty.js
+++ b/Source/DynamicScene/CompositeProperty.js
@@ -24,17 +24,6 @@ define([
};
defineProperties(CompositeProperty.prototype, {
- /**
- * Always returns true, since this property always varies with simulation time.
- * @memberof SampledProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return true;
- }
- },
/**
* Gets the interval collection.
* @memberof CompositeProperty.prototype
diff --git a/Source/DynamicScene/ConstantPositionProperty.js b/Source/DynamicScene/ConstantPositionProperty.js
index 3e5f0fb6b73c..52f6585cb577 100644
--- a/Source/DynamicScene/ConstantPositionProperty.js
+++ b/Source/DynamicScene/ConstantPositionProperty.js
@@ -33,17 +33,6 @@ define([
};
defineProperties(ConstantPositionProperty.prototype, {
- /**
- * Always returns true, since this property always varies with simulation time.
- * @memberof SampledProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return this._property.isTimeVarying;
- }
- },
/**
* Gets the reference frame that the position is defined in.
* @Type {ReferenceFrame}
diff --git a/Source/DynamicScene/ConstantProperty.js b/Source/DynamicScene/ConstantProperty.js
index 7483391880ea..d35dd539ab88 100644
--- a/Source/DynamicScene/ConstantProperty.js
+++ b/Source/DynamicScene/ConstantProperty.js
@@ -51,20 +51,6 @@ define([
this._clone = defaultValue(clone, noClone);
};
- defineProperties(ConstantProperty.prototype, {
- /**
- * Always returns false, since this property always varies with simulation time.
- * @memberof ConstantProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return false;
- }
- }
- });
-
/**
* Returns the value of the property at the specified simulation time.
* @memberof ConstantProperty
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index a9799c151567..872bf940c756 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -588,14 +588,6 @@ define([
this._y = new ConstantProperty(0);
};
- defineProperties(Cartesian2WrapperProperty.prototype, {
- isTimeVarying : {
- get : function() {
- return this._x.isTimeVarying || this._y.isTimeVarying;
- }
- }
- });
-
Cartesian2WrapperProperty.prototype.getValue = function(time, result) {
if (!defined(result)) {
result = new Cartesian2();
diff --git a/Source/DynamicScene/GridMaterialProperty.js b/Source/DynamicScene/GridMaterialProperty.js
index ea2de4cbff75..c4885d37d713 100644
--- a/Source/DynamicScene/GridMaterialProperty.js
+++ b/Source/DynamicScene/GridMaterialProperty.js
@@ -48,23 +48,6 @@ define([
this.lineThickness = new ConstantProperty(new Cartesian2(1.0, 1.0));
};
- defineProperties(GridMaterialProperty.prototype, {
- /**
- * Always returns false, since this property always varies with simulation time.
- * @memberof ConstantProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return (defined(this.color) ? this.color.isTimeVarying : false) || //
- (defined(this.cellAlpha) ? this.cellAlpha.isTimeVarying : false) || //
- (defined(this.lineCount) ? this.lineCount.isTimeVarying : false) || //
- (defined(this.lineThickness) ? this.lineThickness.isTimeVarying : false);
- }
- }
- });
-
GridMaterialProperty.prototype.getType = function(time) {
return 'Grid';
};
diff --git a/Source/DynamicScene/ImageMaterialProperty.js b/Source/DynamicScene/ImageMaterialProperty.js
index d1d38af90dd3..fc336f537f4f 100644
--- a/Source/DynamicScene/ImageMaterialProperty.js
+++ b/Source/DynamicScene/ImageMaterialProperty.js
@@ -31,22 +31,6 @@ define([
this.repeat = new ConstantProperty(new Cartesian2(1, 1));
};
-
- defineProperties(ImageMaterialProperty.prototype, {
- /**
- * Always returns false, since this property always varies with simulation time.
- * @memberof ConstantProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return (defined(this.image) ? this.image.isTimeVarying : false) || //
- (defined(this.repeat) ? this.repeat.isTimeVarying : false);
- }
- }
- });
-
ImageMaterialProperty.prototype.getType = function(time) {
return 'Image';
};
diff --git a/Source/DynamicScene/MaterialProperty.js b/Source/DynamicScene/MaterialProperty.js
index f2772253943c..6cf6366bcefb 100644
--- a/Source/DynamicScene/MaterialProperty.js
+++ b/Source/DynamicScene/MaterialProperty.js
@@ -30,19 +30,6 @@ define([
var MaterialProperty = throwInstantiationError;
defineProperties(MaterialProperty.prototype, {
- /**
- * Returns the value of the property at the specified simulation time in the fixed frame.
- * @memberof MaterialProperty
- *
- * @param {JulianDate} time The simulation time for which to retrieve the value.
- * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
- * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
- */
- isTimeVarying : {
- get : function() {
- throwInstantiationError();
- }
- },
/**
* Gets the Material type.
* @type {String}
diff --git a/Source/DynamicScene/PositionProperty.js b/Source/DynamicScene/PositionProperty.js
index b8840de31937..06c6ef128af7 100644
--- a/Source/DynamicScene/PositionProperty.js
+++ b/Source/DynamicScene/PositionProperty.js
@@ -34,13 +34,6 @@ define([
*/
var PositionProperty = throwInstantiationError;
- /**
- * Gets a value indicating if the property varies with simulation time or is constant.
- * @memberof PositionProperty
- * @Type {Boolean}
- */
- PositionProperty.prototype.isTimeVarying = undefined;
-
/**
* Gets the reference frame that the position is defined in.
* @memberof PositionProperty
diff --git a/Source/DynamicScene/Property.js b/Source/DynamicScene/Property.js
index bda4f2b13ed8..98da8dbb8832 100644
--- a/Source/DynamicScene/Property.js
+++ b/Source/DynamicScene/Property.js
@@ -9,8 +9,8 @@ define(['../Core/DeveloperError'
}
/**
- * The base class for all properties, which represent a value that can optionally
- * vary over time.
+ * The base class for all properties, which represent a value that can
+ * optionally vary over time.
* This type defines an interface and cannot be instantiated directly.
*
* @alias Property
@@ -18,19 +18,14 @@ define(['../Core/DeveloperError'
*
* @see CompositeProperty
* @see ConstantProperty
- * @see PositionProperty
- * @see RefereenceProperty
* @see SampledProperty
* @see TimeIntervalCollectionProperty
+ * @see MaterialProperty
+ * @see PositionProperty
+ * @see RefereenceProperty
*/
var Property = throwInstantiationError;
- /**
- * Gets a value indicating if the property varies with simulation time or is constant.
- * @memberof Property
- */
- Property.prototype.isTimeVarying = undefined;
-
/**
* Returns the value of the property at the specified simulation time.
* @memberof Property
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index 34afbffbdb8f..015612d1f650 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -104,20 +104,6 @@ define([
return new ReferenceProperty(dynamicObjectCollection, parts[0], parts[1]);
};
- defineProperties(ReferenceProperty.prototype, {
- /**
- * True if the property varies with simulation time, false otherwise.
- * @memberof ReferenceProperty
- * Type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- var targetProperty = resolve(this);
- return defined(targetProperty) ? targetProperty.isTimeVarying() : undefined;
- }
- }
- });
-
/**
* Retrieves the value of the property at the specified time.
*
diff --git a/Source/DynamicScene/SampledPositionProperty.js b/Source/DynamicScene/SampledPositionProperty.js
index 3f88e9e00a78..1cc49f4d2901 100644
--- a/Source/DynamicScene/SampledPositionProperty.js
+++ b/Source/DynamicScene/SampledPositionProperty.js
@@ -33,17 +33,6 @@ define([
};
defineProperties(SampledPositionProperty.prototype, {
- /**
- * Always returns true, since this property always varies with simulation time.
- * @memberof SampledPositionProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return this._property.isTimeVarying;
- }
- },
referenceFrame : {
get : function() {
return this._referenceFrame;
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 71cc82891e2b..f70875d6f620 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -136,17 +136,6 @@ define([
};
defineProperties(SampledProperty.prototype, {
- /**
- * Always returns true, since this property always varies with simulation time.
- * @memberof SampledProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return true;
- }
- },
interpolationDegree : {
get : function() {
return this._interpolationDegree;
diff --git a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
index 0d8f94377a47..4ea84652a92e 100644
--- a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
@@ -32,17 +32,6 @@ define([
};
defineProperties(TimeIntervalCollectionPositionProperty.prototype, {
- /**
- * Always returns true, since this property always varies with simulation time.
- * @memberof TimeIntervalCollectionPositionProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return true;
- }
- },
/**
* Gets the interval collection.
* @memberof TimeIntervalCollectionPositionProperty
diff --git a/Source/DynamicScene/TimeIntervalCollectionProperty.js b/Source/DynamicScene/TimeIntervalCollectionProperty.js
index 58fedfbebc77..c6fb48fdaf0a 100644
--- a/Source/DynamicScene/TimeIntervalCollectionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionProperty.js
@@ -30,17 +30,6 @@ define([
};
defineProperties(TimeIntervalCollectionProperty.prototype, {
- /**
- * Always returns true, since this property always varies with simulation time.
- * @memberof TimeIntervalCollectionProperty
- *
- * @type {Boolean}
- */
- isTimeVarying : {
- get : function() {
- return true;
- }
- },
/**
* Gets the interval collection.
* @memberof TimeIntervalCollectionProperty
diff --git a/Specs/DynamicScene/ColorMaterialPropertySpec.js b/Specs/DynamicScene/ColorMaterialPropertySpec.js
index e6248e2903eb..b8e7053cecde 100644
--- a/Specs/DynamicScene/ColorMaterialPropertySpec.js
+++ b/Specs/DynamicScene/ColorMaterialPropertySpec.js
@@ -20,7 +20,6 @@ defineSuite([
it('works with basic types', function() {
var property = new ColorMaterialProperty();
- expect(property.isTimeVarying).toEqual(false);
expect(property.color).toBeDefined();
expect(property.getType()).toEqual('Color');
@@ -31,7 +30,6 @@ defineSuite([
it('works with constant values', function() {
var property = new ColorMaterialProperty();
property.color = new ConstantProperty(Color.RED);
- expect(property.isTimeVarying).toEqual(false);
var result = property.getValue(new JulianDate());
expect(result.color).toEqual(Color.RED);
@@ -40,7 +38,6 @@ defineSuite([
it('works with undefined values', function() {
var property = new ColorMaterialProperty();
property.color = new UndefinedProperty();
- expect(property.isTimeVarying).toEqual(false);
var result = property.getValue();
expect(result.hasOwnProperty('color')).toEqual(true);
@@ -54,7 +51,6 @@ defineSuite([
var start = new JulianDate(1, 0);
var stop = new JulianDate(2, 0);
property.color.intervals.addInterval(new TimeInterval(start, stop, true, true, Color.BLUE));
- expect(property.isTimeVarying).toEqual(true);
var result = property.getValue(start);
expect(result.color).toEqual(Color.BLUE);
@@ -63,7 +59,6 @@ defineSuite([
it('works with a result parameter', function() {
var property = new ColorMaterialProperty();
property.color = new ConstantProperty(Color.RED);
- expect(property.isTimeVarying).toEqual(false);
var result = {
color : Color.BLUE.clone()
diff --git a/Specs/DynamicScene/CompositeMaterialPropertySpec.js b/Specs/DynamicScene/CompositeMaterialPropertySpec.js
index 124890d5d68b..87b94e2e7f46 100644
--- a/Specs/DynamicScene/CompositeMaterialPropertySpec.js
+++ b/Specs/DynamicScene/CompositeMaterialPropertySpec.js
@@ -20,7 +20,6 @@ defineSuite([
it('default constructor has expected values', function() {
var property = new CompositeMaterialProperty();
- expect(property.isTimeVarying).toEqual(true);
expect(property.intervals).toBeInstanceOf(TimeIntervalCollection);
expect(property.getType(new JulianDate())).toBeUndefined();
expect(property.getValue(new JulianDate())).toBeUndefined();
diff --git a/Specs/DynamicScene/CompositePositionPropertySpec.js b/Specs/DynamicScene/CompositePositionPropertySpec.js
index 83191c207f78..18d96daa3161 100644
--- a/Specs/DynamicScene/CompositePositionPropertySpec.js
+++ b/Specs/DynamicScene/CompositePositionPropertySpec.js
@@ -22,7 +22,6 @@ defineSuite([
it('default constructor has expected values', function() {
var property = new CompositePositionProperty();
- expect(property.isTimeVarying).toEqual(true);
expect(property.intervals).toBeInstanceOf(TimeIntervalCollection);
expect(property.getValue(new JulianDate())).toBeUndefined();
expect(property.referenceFrame).toBe(ReferenceFrame.FIXED);
diff --git a/Specs/DynamicScene/CompositePropertySpec.js b/Specs/DynamicScene/CompositePropertySpec.js
index a35a403f8df9..86d0815f3d0d 100644
--- a/Specs/DynamicScene/CompositePropertySpec.js
+++ b/Specs/DynamicScene/CompositePropertySpec.js
@@ -18,7 +18,6 @@ defineSuite([
it('default constructor has expected values', function() {
var property = new CompositeProperty();
- expect(property.isTimeVarying).toEqual(true);
expect(property.intervals).toBeInstanceOf(TimeIntervalCollection);
expect(property.getValue(new JulianDate())).toBeUndefined();
});
diff --git a/Specs/DynamicScene/ConstantPositionPropertySpec.js b/Specs/DynamicScene/ConstantPositionPropertySpec.js
index 091dd8629940..27431bf5eda9 100644
--- a/Specs/DynamicScene/ConstantPositionPropertySpec.js
+++ b/Specs/DynamicScene/ConstantPositionPropertySpec.js
@@ -18,11 +18,9 @@ defineSuite([
it('Constructor sets expected defaults', function() {
var property = new ConstantPositionProperty(new Cartesian3(1, 2, 3));
- expect(property.isTimeVarying).toEqual(false);
expect(property.referenceFrame).toBe(ReferenceFrame.FIXED);
property = new ConstantPositionProperty(new Cartesian3(1, 2, 3), ReferenceFrame.INERTIAL);
- expect(property.isTimeVarying).toEqual(false);
expect(property.referenceFrame).toBe(ReferenceFrame.INERTIAL);
});
diff --git a/Specs/DynamicScene/ConstantPropertySpec.js b/Specs/DynamicScene/ConstantPropertySpec.js
index 83374918f24a..78beba73343a 100644
--- a/Specs/DynamicScene/ConstantPropertySpec.js
+++ b/Specs/DynamicScene/ConstantPropertySpec.js
@@ -15,7 +15,6 @@ defineSuite([
it('works with basic types', function() {
var expected = 5;
var property = new ConstantProperty(expected);
- expect(property.isTimeVarying).toEqual(false);
expect(property.getValue(time)).toBe(expected);
});
@@ -27,7 +26,6 @@ defineSuite([
return expected;
};
var property = new ConstantProperty(expected, cloneFunction);
- expect(property.isTimeVarying).toEqual(false);
expect(property.getValue(time)).toBe(expected);
expect(cloneCalled).toEqual(true);
});
@@ -35,7 +33,6 @@ defineSuite([
it('works with clonable objects', function() {
var value = new Cartesian3(1, 2, 3);
var property = new ConstantProperty(value);
- expect(property.isTimeVarying).toEqual(false);
var result = property.getValue(time);
expect(result).not.toBe(value);
@@ -45,7 +42,6 @@ defineSuite([
it('works with clonable objects with result parameter', function() {
var value = new Cartesian3(1, 2, 3);
var property = new ConstantProperty(value);
- expect(property.isTimeVarying).toEqual(false);
var expected = new Cartesian3();
var result = property.getValue(time, expected);
diff --git a/Specs/DynamicScene/GridMaterialPropertySpec.js b/Specs/DynamicScene/GridMaterialPropertySpec.js
index f91353b9b774..7b366458f2d3 100644
--- a/Specs/DynamicScene/GridMaterialPropertySpec.js
+++ b/Specs/DynamicScene/GridMaterialPropertySpec.js
@@ -22,7 +22,6 @@ defineSuite([
it('works with basic types', function() {
var property = new GridMaterialProperty();
- expect(property.isTimeVarying).toEqual(false);
expect(property.color).toBeDefined();
expect(property.cellAlpha).toBeDefined();
expect(property.lineCount).toBeDefined();
@@ -43,7 +42,6 @@ defineSuite([
property.cellAlpha = new ConstantProperty(1.0);
property.lineCount = new ConstantProperty(new Cartesian2(3.4, 5.0));
property.lineThickness = new ConstantProperty(new Cartesian2(2, 3));
- expect(property.isTimeVarying).toEqual(false);
var result = property.getValue(new JulianDate());
expect(result.color).toEqual(Color.RED);
@@ -58,7 +56,6 @@ defineSuite([
property.cellAlpha = new UndefinedProperty();
property.lineCount = new UndefinedProperty();
property.lineThickness = new UndefinedProperty();
- expect(property.isTimeVarying).toEqual(false);
var result = property.getValue();
expect(result.hasOwnProperty('color')).toEqual(true);
@@ -84,7 +81,6 @@ defineSuite([
property.cellAlpha.intervals.addInterval(new TimeInterval(start, stop, true, true, 1.0));
property.lineCount.intervals.addInterval(new TimeInterval(start, stop, true, true, new Cartesian2(3.4, 5.0)));
property.lineThickness.intervals.addInterval(new TimeInterval(start, stop, true, true, new Cartesian2(2, 3)));
- expect(property.isTimeVarying).toEqual(true);
var result = property.getValue(start);
expect(result.color).toEqual(Color.BLUE);
@@ -99,7 +95,6 @@ defineSuite([
property.cellAlpha = new ConstantProperty(1.0);
property.lineCount = new ConstantProperty(new Cartesian2(3.4, 5.0));
property.lineThickness = new ConstantProperty(new Cartesian2(2, 3));
- expect(property.isTimeVarying).toEqual(false);
var result = {};
var returnedResult = property.getValue(new JulianDate(), result);
diff --git a/Specs/DynamicScene/ImageMaterialPropertySpec.js b/Specs/DynamicScene/ImageMaterialPropertySpec.js
index 88173950486a..4f94c596969a 100644
--- a/Specs/DynamicScene/ImageMaterialPropertySpec.js
+++ b/Specs/DynamicScene/ImageMaterialPropertySpec.js
@@ -20,7 +20,6 @@ defineSuite([
it('works with basic types', function() {
var property = new ImageMaterialProperty();
- expect(property.isTimeVarying).toEqual(false);
expect(property.image).toBeUndefined();
expect(property.repeat).toBeDefined();
@@ -35,7 +34,6 @@ defineSuite([
var property = new ImageMaterialProperty();
property.image = new ConstantProperty('http://test.invalid/image.png');
property.repeat = new ConstantProperty(new Cartesian2(2, 3));
- expect(property.isTimeVarying).toEqual(false);
var result = property.getValue(new JulianDate());
expect(result.image).toEqual('http://test.invalid/image.png');
@@ -46,7 +44,6 @@ defineSuite([
var property = new ImageMaterialProperty();
property.image = new UndefinedProperty();
property.repeat = new UndefinedProperty();
- expect(property.isTimeVarying).toEqual(false);
var result = property.getValue();
expect(result.hasOwnProperty('image')).toEqual(true);
@@ -64,7 +61,6 @@ defineSuite([
var stop = new JulianDate(2, 0);
property.image.intervals.addInterval(new TimeInterval(start, stop, true, true, 'http://test.invalid/image.png'));
property.repeat.intervals.addInterval(new TimeInterval(start, stop, true, true, new Cartesian2(2, 3)));
- expect(property.isTimeVarying).toEqual(true);
var result = property.getValue(start);
expect(result.image).toEqual('http://test.invalid/image.png');
@@ -75,7 +71,6 @@ defineSuite([
var property = new ImageMaterialProperty();
property.image = new ConstantProperty('http://test.invalid/image.png');
property.repeat = new ConstantProperty(new Cartesian2(2, 3));
- expect(property.isTimeVarying).toEqual(false);
var result = {};
var returnedResult = property.getValue(new JulianDate(), result);
diff --git a/Specs/DynamicScene/SampledPositionPropertySpec.js b/Specs/DynamicScene/SampledPositionPropertySpec.js
index d0be6355a2ea..65522d710093 100644
--- a/Specs/DynamicScene/SampledPositionPropertySpec.js
+++ b/Specs/DynamicScene/SampledPositionPropertySpec.js
@@ -20,7 +20,6 @@ defineSuite([
it('constructor sets expected defaults', function() {
var property = new SampledPositionProperty();
- expect(property.isTimeVarying).toEqual(true);
expect(property.referenceFrame).toEqual(ReferenceFrame.FIXED);
expect(property.interpolationDegree).toEqual(1);
expect(property.interpolationAlgorithm).toEqual(LinearApproximation);
@@ -28,7 +27,6 @@ defineSuite([
it('constructor sets expected values', function() {
var property = new SampledPositionProperty(ReferenceFrame.INERTIAL);
- expect(property.isTimeVarying).toEqual(true);
expect(property.referenceFrame).toEqual(ReferenceFrame.INERTIAL);
expect(property.interpolationDegree).toEqual(1);
expect(property.interpolationAlgorithm).toEqual(LinearApproximation);
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index 473b1db90b52..61e042347988 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -14,7 +14,6 @@ defineSuite([
it('constructor sets expected defaults', function() {
var property = new SampledProperty(Number);
- expect(property.isTimeVarying).toEqual(true);
expect(property.interpolationDegree).toEqual(1);
expect(property.interpolationAlgorithm).toEqual(LinearApproximation);
});
diff --git a/Specs/DynamicScene/TimeIntervalCollectionPositionPropertySpec.js b/Specs/DynamicScene/TimeIntervalCollectionPositionPropertySpec.js
index cbc4cf92be71..0ebc8ca2aef3 100644
--- a/Specs/DynamicScene/TimeIntervalCollectionPositionPropertySpec.js
+++ b/Specs/DynamicScene/TimeIntervalCollectionPositionPropertySpec.js
@@ -20,7 +20,6 @@ defineSuite([
it('default constructor has expected values', function() {
var property = new TimeIntervalCollectionPositionProperty();
- expect(property.isTimeVarying).toEqual(true);
expect(property.intervals).toBeInstanceOf(TimeIntervalCollection);
expect(property.getValue(new JulianDate())).toBeUndefined();
expect(property.referenceFrame).toBe(ReferenceFrame.FIXED);
diff --git a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
index 5fee0b5c7946..10a46aec9942 100644
--- a/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
+++ b/Specs/DynamicScene/TimeIntervalCollectionPropertySpec.js
@@ -16,7 +16,6 @@ defineSuite([
it('default constructor has expected values', function() {
var property = new TimeIntervalCollectionProperty();
- expect(property.isTimeVarying).toEqual(true);
expect(property.intervals).toBeInstanceOf(TimeIntervalCollection);
expect(property.getValue(new JulianDate())).toBeUndefined();
});
diff --git a/Specs/UndefinedProperty.js b/Specs/UndefinedProperty.js
index bc494edaf9ef..2a525029962d 100644
--- a/Specs/UndefinedProperty.js
+++ b/Specs/UndefinedProperty.js
@@ -7,14 +7,6 @@ define(['../Core/defineProperties'], function(defineProperties) {
var UndefinedProperty = function() {
};
- defineProperties(UndefinedProperty.prototype, {
- isTimeVarying : {
- get : function() {
- return false;
- }
- }
- });
-
UndefinedProperty.prototype.getValue = function(time, result) {
return undefined;
};
From 506d0c6cd5e19569d04cba18e6c689f95bfa5a83 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 26 Aug 2013 11:28:46 -0400
Subject: [PATCH 52/65] Clean up module imports.
---
Source/DynamicScene/ColorMaterialProperty.js | 2 --
.../DynamicScene/CompositePositionProperty.js | 6 ++----
Source/DynamicScene/ConstantProperty.js | 2 --
Source/DynamicScene/CzmlDataSource.js | 2 --
Source/DynamicScene/DynamicBillboard.js | 16 ++--------------
Source/DynamicScene/DynamicClock.js | 8 ++------
Source/DynamicScene/DynamicCone.js | 8 ++------
.../DynamicConeVisualizerUsingCustomSensor.js | 2 --
Source/DynamicScene/DynamicEllipse.js | 2 --
Source/DynamicScene/DynamicEllipsoid.js | 8 ++------
Source/DynamicScene/DynamicLabel.js | 18 ++----------------
Source/DynamicScene/DynamicObject.js | 10 ++--------
Source/DynamicScene/DynamicPath.js | 10 +++-------
Source/DynamicScene/DynamicPoint.js | 8 ++------
Source/DynamicScene/DynamicPolygon.js | 2 --
Source/DynamicScene/DynamicPolyline.js | 8 ++------
Source/DynamicScene/DynamicPyramid.js | 10 ++--------
Source/DynamicScene/DynamicVector.js | 12 +++---------
Source/DynamicScene/GeoJsonDataSource.js | 2 --
Source/DynamicScene/GridMaterialProperty.js | 2 --
Source/DynamicScene/ImageMaterialProperty.js | 2 --
Source/DynamicScene/ReferenceProperty.js | 2 --
.../TimeIntervalCollectionPositionProperty.js | 2 --
Source/DynamicScene/VisualizerCollection.js | 6 ++----
24 files changed, 28 insertions(+), 122 deletions(-)
diff --git a/Source/DynamicScene/ColorMaterialProperty.js b/Source/DynamicScene/ColorMaterialProperty.js
index f732733fc8b4..780c7b5e38c8 100644
--- a/Source/DynamicScene/ColorMaterialProperty.js
+++ b/Source/DynamicScene/ColorMaterialProperty.js
@@ -2,12 +2,10 @@
define([
'../Core/Color',
'../Core/defined',
- '../Core/defineProperties',
'./ConstantProperty'
], function(
Color,
defined,
- defineProperties,
ConstantProperty) {
"use strict";
diff --git a/Source/DynamicScene/CompositePositionProperty.js b/Source/DynamicScene/CompositePositionProperty.js
index 547b93dc8fc1..a2308f8a7813 100644
--- a/Source/DynamicScene/CompositePositionProperty.js
+++ b/Source/DynamicScene/CompositePositionProperty.js
@@ -5,16 +5,14 @@ define([
'../Core/defineProperties',
'../Core/DeveloperError',
'../Core/TimeIntervalCollection',
- '../Core/ReferenceFrame',
- './PositionProperty'
+ '../Core/ReferenceFrame'
], function(
defaultValue,
defined,
defineProperties,
DeveloperError,
TimeIntervalCollection,
- ReferenceFrame,
- PositionProperty) {
+ ReferenceFrame) {
"use strict";
/**
diff --git a/Source/DynamicScene/ConstantProperty.js b/Source/DynamicScene/ConstantProperty.js
index d35dd539ab88..407ced7090df 100644
--- a/Source/DynamicScene/ConstantProperty.js
+++ b/Source/DynamicScene/ConstantProperty.js
@@ -2,13 +2,11 @@
define([
'../Core/defaultValue',
'../Core/defined',
- '../Core/defineProperties',
'../Core/DeveloperError',
'../Core/Enumeration'
], function(
defaultValue,
defined,
- defineProperties,
DeveloperError,
Enumeration) {
"use strict";
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index 872bf940c756..a7743e374645 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -9,7 +9,6 @@ define([
'../Core/createGuid',
'../Core/defaultValue',
'../Core/defined',
- '../Core/defineProperties',
'../Core/DeveloperError',
'../Core/Ellipsoid',
'../Core/Event',
@@ -66,7 +65,6 @@ define([
createGuid,
defaultValue,
defined,
- defineProperties,
DeveloperError,
Ellipsoid,
Event,
diff --git a/Source/DynamicScene/DynamicBillboard.js b/Source/DynamicScene/DynamicBillboard.js
index 8a4bee41384b..5ee7946b62b5 100644
--- a/Source/DynamicScene/DynamicBillboard.js
+++ b/Source/DynamicScene/DynamicBillboard.js
@@ -1,22 +1,10 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/defaultValue',
- '../Core/defined',
- '../Core/Cartesian2',
- '../Core/Cartesian3',
- '../Scene/HorizontalOrigin',
- '../Scene/VerticalOrigin',
- '../Core/Color'
+ '../Core/defined'
], function(
- TimeInterval,
defaultValue,
- defined,
- Cartesian2,
- Cartesian3,
- HorizontalOrigin,
- VerticalOrigin,
- Color) {
+ defined) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicClock.js b/Source/DynamicScene/DynamicClock.js
index 2c27c574d786..fd528ad5095a 100644
--- a/Source/DynamicScene/DynamicClock.js
+++ b/Source/DynamicScene/DynamicClock.js
@@ -1,18 +1,14 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/Iso8601',
'../Core/ClockRange',
'../Core/ClockStep',
- '../Core/defined',
- '../Core/JulianDate'
+ '../Core/defined'
], function(
- TimeInterval,
Iso8601,
ClockRange,
ClockStep,
- defined,
- JulianDate) {
+ defined) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicCone.js b/Source/DynamicScene/DynamicCone.js
index 6274035298df..a06cd35ea3fe 100644
--- a/Source/DynamicScene/DynamicCone.js
+++ b/Source/DynamicScene/DynamicCone.js
@@ -1,14 +1,10 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/defaultValue',
- '../Core/defined',
- '../Core/Color'
+ '../Core/defined'
], function(
- TimeInterval,
defaultValue,
- defined,
- Color) {
+ defined) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
index 9d1bab95156b..eefa81a4d4b4 100644
--- a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
+++ b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
@@ -2,7 +2,6 @@
define([
'../Core/Cartesian3',
'../Core/Color',
- '../Core/defaultValue',
'../Core/defined',
'../Core/destroyObject',
'../Core/DeveloperError',
@@ -17,7 +16,6 @@ define([
], function(
Cartesian3,
Color,
- defaultValue,
defined,
destroyObject,
DeveloperError,
diff --git a/Source/DynamicScene/DynamicEllipse.js b/Source/DynamicScene/DynamicEllipse.js
index 9b729d5fac1b..56e64b67da17 100644
--- a/Source/DynamicScene/DynamicEllipse.js
+++ b/Source/DynamicScene/DynamicEllipse.js
@@ -1,13 +1,11 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined',
'../Core/Cartesian3',
'../Core/Ellipsoid',
'../Core/Shapes'
], function (
- TimeInterval,
defaultValue,
defined,
Cartesian3,
diff --git a/Source/DynamicScene/DynamicEllipsoid.js b/Source/DynamicScene/DynamicEllipsoid.js
index 99fd21382888..8e8d19a98ce6 100644
--- a/Source/DynamicScene/DynamicEllipsoid.js
+++ b/Source/DynamicScene/DynamicEllipsoid.js
@@ -1,14 +1,10 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/defaultValue',
- '../Core/defined',
- '../Core/Cartesian3'
+ '../Core/defined'
], function(
- TimeInterval,
defaultValue,
- defined,
- Cartesian3) {
+ defined) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicLabel.js b/Source/DynamicScene/DynamicLabel.js
index 266865f2ff14..55c0aa977f32 100644
--- a/Source/DynamicScene/DynamicLabel.js
+++ b/Source/DynamicScene/DynamicLabel.js
@@ -1,24 +1,10 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/defaultValue',
- '../Core/defined',
- '../Core/Cartesian2',
- '../Core/Cartesian3',
- '../Scene/HorizontalOrigin',
- '../Scene/VerticalOrigin',
- '../Scene/LabelStyle',
- '../Core/Color'
+ '../Core/defined'
], function(
- TimeInterval,
defaultValue,
- defined,
- Cartesian2,
- Cartesian3,
- HorizontalOrigin,
- VerticalOrigin,
- LabelStyle,
- Color) {
+ defined) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicObject.js b/Source/DynamicScene/DynamicObject.js
index 1e7053b666a6..3a1c657530d8 100644
--- a/Source/DynamicScene/DynamicObject.js
+++ b/Source/DynamicScene/DynamicObject.js
@@ -5,20 +5,14 @@ define([
'../Core/defined',
'../Core/DeveloperError',
'../Core/JulianDate',
- '../Core/Quaternion',
- '../Core/TimeInterval',
- './DynamicVertexPositionsProperty',
- '../Core/Cartesian3'
+ '../Core/TimeInterval'
], function(
createGuid,
defaultValue,
defined,
DeveloperError,
JulianDate,
- Quaternion,
- TimeInterval,
- DynamicVertexPositionsProperty,
- Cartesian3) {
+ TimeInterval) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicPath.js b/Source/DynamicScene/DynamicPath.js
index 8f88bc7f403e..c6cc37ccb73c 100644
--- a/Source/DynamicScene/DynamicPath.js
+++ b/Source/DynamicScene/DynamicPath.js
@@ -1,14 +1,10 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/defaultValue',
- '../Core/defined',
- '../Core/Color'],
-function(
- TimeInterval,
+ '../Core/defined'
+ ], function(
defaultValue,
- defined,
- Color) {
+ defined) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicPoint.js b/Source/DynamicScene/DynamicPoint.js
index 8c33785196f0..46a5cf79e788 100644
--- a/Source/DynamicScene/DynamicPoint.js
+++ b/Source/DynamicScene/DynamicPoint.js
@@ -1,14 +1,10 @@
/*global define*/
define([
'../Core/defined',
- '../Core/TimeInterval',
- '../Core/defaultValue',
- '../Core/Color'
+ '../Core/defaultValue'
], function(
defined,
- TimeInterval,
- defaultValue,
- Color) {
+ defaultValue) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicPolygon.js b/Source/DynamicScene/DynamicPolygon.js
index 667e632c4fbd..cf2f4cde79b4 100644
--- a/Source/DynamicScene/DynamicPolygon.js
+++ b/Source/DynamicScene/DynamicPolygon.js
@@ -1,10 +1,8 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/defaultValue',
'../Core/defined'
], function(
- TimeInterval,
defaultValue,
defined) {
"use strict";
diff --git a/Source/DynamicScene/DynamicPolyline.js b/Source/DynamicScene/DynamicPolyline.js
index cc0b3f987b8d..debd6f70fbaf 100644
--- a/Source/DynamicScene/DynamicPolyline.js
+++ b/Source/DynamicScene/DynamicPolyline.js
@@ -1,14 +1,10 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/defaultValue',
- '../Core/defined',
- '../Core/Color'],
+ '../Core/defined'],
function(
- TimeInterval,
defaultValue,
- defined,
- Color) {
+ defined) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicPyramid.js b/Source/DynamicScene/DynamicPyramid.js
index 7f0984611742..119aab1fb477 100644
--- a/Source/DynamicScene/DynamicPyramid.js
+++ b/Source/DynamicScene/DynamicPyramid.js
@@ -1,16 +1,10 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/defaultValue',
- '../Core/defined',
- '../Core/Color',
- './DynamicDirectionsProperty'
+ '../Core/defined'
], function(
- TimeInterval,
defaultValue,
- defined,
- Color,
- DynamicDirectionsProperty) {
+ defined) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicVector.js b/Source/DynamicScene/DynamicVector.js
index f772e7fc7ea4..b167d605ffdc 100644
--- a/Source/DynamicScene/DynamicVector.js
+++ b/Source/DynamicScene/DynamicVector.js
@@ -1,16 +1,10 @@
/*global define*/
define([
- '../Core/TimeInterval',
'../Core/defaultValue',
- '../Core/defined',
- '../Core/Cartesian3',
- '../Core/Color'],
-function(
- TimeInterval,
+ '../Core/defined'
+ ], function(
defaultValue,
- defined,
- Cartesian3,
- Color) {
+ defined) {
"use strict";
/**
diff --git a/Source/DynamicScene/GeoJsonDataSource.js b/Source/DynamicScene/GeoJsonDataSource.js
index 5783bcf33e7c..8330ad0873c5 100644
--- a/Source/DynamicScene/GeoJsonDataSource.js
+++ b/Source/DynamicScene/GeoJsonDataSource.js
@@ -4,7 +4,6 @@ define([
'../Core/Cartographic',
'../Core/Color',
'../Core/defined',
- '../Core/defineProperties',
'../Core/DeveloperError',
'../Core/RuntimeError',
'../Core/Ellipsoid',
@@ -24,7 +23,6 @@ define([
Cartographic,
Color,
defined,
- defineProperties,
DeveloperError,
RuntimeError,
Ellipsoid,
diff --git a/Source/DynamicScene/GridMaterialProperty.js b/Source/DynamicScene/GridMaterialProperty.js
index c4885d37d713..687aeae0ebf9 100644
--- a/Source/DynamicScene/GridMaterialProperty.js
+++ b/Source/DynamicScene/GridMaterialProperty.js
@@ -3,13 +3,11 @@ define([
'../Core/Cartesian2',
'../Core/Color',
'../Core/defined',
- '../Core/defineProperties',
'./ConstantProperty'
], function(
Cartesian2,
Color,
defined,
- defineProperties,
ConstantProperty) {
"use strict";
diff --git a/Source/DynamicScene/ImageMaterialProperty.js b/Source/DynamicScene/ImageMaterialProperty.js
index fc336f537f4f..dc3c79008738 100644
--- a/Source/DynamicScene/ImageMaterialProperty.js
+++ b/Source/DynamicScene/ImageMaterialProperty.js
@@ -2,12 +2,10 @@
define([
'../Core/Cartesian2',
'../Core/defined',
- '../Core/defineProperties',
'./ConstantProperty'
], function(
Cartesian2,
defined,
- defineProperties,
ConstantProperty) {
"use strict";
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index 015612d1f650..d590ae2aabd6 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -2,12 +2,10 @@
define([
'../Core/defaultValue',
'../Core/defined',
- '../Core/defineProperties',
'../Core/DeveloperError'
], function(
defaultValue,
defined,
- defineProperties,
DeveloperError) {
"use strict";
diff --git a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
index 4ea84652a92e..d9901fe0bf05 100644
--- a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
@@ -4,7 +4,6 @@ define([
'../Core/defined',
'../Core/defineProperties',
'../Core/DeveloperError',
- '../Core/Enumeration',
'../Core/ReferenceFrame',
'../Core/TimeIntervalCollection',
'./PositionProperty'
@@ -13,7 +12,6 @@ define([
defined,
defineProperties,
DeveloperError,
- Enumeration,
ReferenceFrame,
TimeIntervalCollection,
PositionProperty) {
diff --git a/Source/DynamicScene/VisualizerCollection.js b/Source/DynamicScene/VisualizerCollection.js
index 20205fb4dc31..e6a9b3ae261d 100644
--- a/Source/DynamicScene/VisualizerCollection.js
+++ b/Source/DynamicScene/VisualizerCollection.js
@@ -2,13 +2,11 @@
define([
'../Core/defaultValue',
'../Core/defined',
- '../Core/destroyObject',
- '../Core/DeveloperError'
+ '../Core/destroyObject'
], function(
defaultValue,
defined,
- destroyObject,
- DeveloperError) {
+ destroyObject) {
"use strict";
/**
From 1f883bc233278a2ec7ca17152c777a85672a0789 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 26 Aug 2013 14:20:17 -0400
Subject: [PATCH 53/65] Document top-level Property implementations.
Still need to do the remaining Material and Position properties.
Also mark `DynamicDirectionsProperty` and `DynamicVeryexPositionsProperty` as private, since they will be going away in a future pull request.
Add `InterpolationAlgorithm` base interface to allow for each documentation of interpolators.
---
Source/Core/InterpolationAlgorithm.js | 57 +++++++
Source/DynamicScene/CompositeProperty.js | 24 ++-
Source/DynamicScene/ConstantProperty.js | 24 ++-
Source/DynamicScene/CzmlDataSource.js | 8 +-
.../DynamicScene/DynamicDirectionsProperty.js | 33 +----
Source/DynamicScene/DynamicObject.js | 2 +-
Source/DynamicScene/DynamicPyramid.js | 4 +-
.../DynamicVertexPositionsProperty.js | 32 +---
Source/DynamicScene/MaterialProperty.js | 15 +-
Source/DynamicScene/PositionProperty.js | 44 ++++--
Source/DynamicScene/Property.js | 6 +-
Source/DynamicScene/ReferenceProperty.js | 36 ++---
.../DynamicScene/SampledPositionProperty.js | 4 +-
Source/DynamicScene/SampledProperty.js | 139 ++++++++++++++++--
.../TimeIntervalCollectionProperty.js | 43 +++++-
.../SampledPositionPropertySpec.js | 6 +-
Specs/DynamicScene/SampledPropertySpec.js | 6 +-
17 files changed, 325 insertions(+), 158 deletions(-)
create mode 100644 Source/Core/InterpolationAlgorithm.js
diff --git a/Source/Core/InterpolationAlgorithm.js b/Source/Core/InterpolationAlgorithm.js
new file mode 100644
index 000000000000..4de81390f6eb
--- /dev/null
+++ b/Source/Core/InterpolationAlgorithm.js
@@ -0,0 +1,57 @@
+/*global define*/
+define(['./DeveloperError'], function(DeveloperError) {
+ "use strict";
+
+ /**
+ * The interface for interpolation algorithms.
+ * @exports InterpolationAlgorithm
+ *
+ * @see LagrangePolynomialApproximation
+ * @see LinearApproximation
+ * @see HermitePolynomialApproximation
+ */
+ var InterpolationAlgorithm = {};
+
+ /**
+ * Gets the name of this interpolation algorithm.
+ * @type {String}
+ */
+ InterpolationAlgorithm.type = undefined;
+
+ /**
+ * Given the desired degree, returns the number of data points required for interpolation.
+ * @memberof InterpolationAlgorithm
+ *
+ * @param degree The desired degree of interpolation.
+ *
+ * @returns The number of required data points needed for the desired degree of interpolation.
+ */
+ InterpolationAlgorithm.getRequiredDataPoints = function(degree) {
+ throw new DeveloperError('This function defines an interface and should not be called directly.');
+ };
+
+ /**
+ * Interpolates values.
+ * @memberof InterpolationAlgorithm
+ *
+ * @param {Number} x The independent variable for which the dependent variables will be interpolated.
+ *
+ * @param {Array} xTable The array of independent variables to use to interpolate. The values
+ * in this array must be in increasing order and the same value must not occur twice in the array.
+ *
+ * @param {Array} yTable The array of dependent variables to use to interpolate. For a set of three
+ * dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
+ *
+ * @param {Number} yStride The number of dependent variable values in yTable corresponding to
+ * each independent variable value in xTable.
+ *
+ * @param {Array} [result] An existing array into which to store the result.
+ *
+ * @returns The array of interpolated values, or the result parameter if one was provided.
+ */
+ InterpolationAlgorithm.interpolateOrderZero = function(x, xTable, yTable, yStride, result) {
+ throw new DeveloperError('This function defines an interface and should not be called directly.');
+ };
+
+ return InterpolationAlgorithm;
+});
\ No newline at end of file
diff --git a/Source/DynamicScene/CompositeProperty.js b/Source/DynamicScene/CompositeProperty.js
index b47a11d5fc56..304cf567edd2 100644
--- a/Source/DynamicScene/CompositeProperty.js
+++ b/Source/DynamicScene/CompositeProperty.js
@@ -12,12 +12,24 @@ define([
"use strict";
/**
- * A {@link Property} which is defined by a TimeIntervalCollection, where the
- * data property of the interval is another Property instance which is evaluated
- * at the provided time.
+ * A {@link Property} which is defined by a {@link TimeIntervalCollection}, where the
+ * data property of each {@link TimeInterval} is another Property instance which is
+ * evaluated at the provided time.
*
* @alias CompositeProperty
* @constructor
+ *
+ * @example
+ * var constantProperty = ...;
+ * var sampledProperty = ...;
+ *
+ * //Create a composite property from two previously defined properties
+ * //where the property is valid on August 1st, 2012 and uses a constant
+ * //property for the first half of the day and a sampled property for the
+ * //remaining half.
+ * var composite = new CompositeProperty();
+ * composite.intervals.addInterval(TimeInterval.fromIso8601('2012-08-01T00:00:00.00Z/2012-08-01T12:00:00.00Z', true, true, constantProperty));
+ * composite.intervals.addInterval(TimeInterval.fromIso8601('2012-08-01T12:00:00.00Z/2012-08-02T00:00:00.00Z', false, false, sampledProperty));
*/
var CompositeProperty = function() {
this._intervals = new TimeIntervalCollection();
@@ -38,10 +50,10 @@ define([
});
/**
- * Returns the value of the property at the specified simulation time.
- * @memberof Property
+ * Gets the value of the property at the provided time.
+ * @memberof CompositeProperty
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*
diff --git a/Source/DynamicScene/ConstantProperty.js b/Source/DynamicScene/ConstantProperty.js
index 407ced7090df..0f5815ada1fd 100644
--- a/Source/DynamicScene/ConstantProperty.js
+++ b/Source/DynamicScene/ConstantProperty.js
@@ -26,11 +26,27 @@ define([
* @constructor
*
* @param {Object|Number|String} value The property value.
- * @param {Function} [clone=value.clone] A function which takes the value and result parameter and clones it.
+ * @param {Function} [clone=value.clone] A function which takes the value and a result parameter and clones it.
* This parameter is only required if the value is not a number or string and does not have a clone function.
*
* @exception {DeveloperError} value is required.
* @exception {DeveloperError} clone is a required function.
+ *
+ * @example
+ * //Create a constant value from a Cartesian2 instance.
+ * var constantProperty = new ConstantProperty(new Cartesian2(10, 12));
+ *
+ * @example
+ * //Create a ConstantPropety from a user-defined object.
+ * var myObject = {
+ * value : 6
+ * };
+ * function cloneMyObject(value, result) {
+ * return {
+ * value : value.value
+ * };
+ * }
+ * var constantProperty = new ConstantProperty(myObject, cloneMyObject);
*/
var ConstantProperty = function(value, clone) {
if (!defined(value)) {
@@ -50,10 +66,10 @@ define([
};
/**
- * Returns the value of the property at the specified simulation time.
- * @memberof ConstantProperty
+ * Gets the value of the property at the provided time.
+ * @memberof CompositeProperty
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {JulianDate} time The time for which to retrieve the value. This parameter is unused since the value never changes.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*/
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index a7743e374645..d637e39e5be9 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -335,7 +335,7 @@ define([
object[propertyName] = property;
propertyCreated = true;
}
- property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ property.addSamplesPackedArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
updateInterpolationSettings(packetData, property);
return propertyCreated;
}
@@ -422,7 +422,7 @@ define([
interval.data = new SampledProperty(type);
intervals.addInterval(interval);
}
- interval.data.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ interval.data.addSamplesPackedArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
updateInterpolationSettings(packetData, interval.data);
return propertyCreated;
}
@@ -479,7 +479,7 @@ define([
object[propertyName] = property;
propertyCreated = true;
}
- property.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ property.addSamplesPackedArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
updateInterpolationSettings(packetData, property);
return propertyCreated;
}
@@ -560,7 +560,7 @@ define([
interval.data = new SampledPositionProperty(referenceFrame);
intervals.addInterval(interval);
}
- interval.data.addSamplesFlatArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
+ interval.data.addSamplesPackedArray(unwrappedInterval, JulianDate.fromIso8601(packetData.epoch));
updateInterpolationSettings(packetData, interval.data);
return propertyCreated;
}
diff --git a/Source/DynamicScene/DynamicDirectionsProperty.js b/Source/DynamicScene/DynamicDirectionsProperty.js
index 178bb8fe7879..6ef7b2654e13 100644
--- a/Source/DynamicScene/DynamicDirectionsProperty.js
+++ b/Source/DynamicScene/DynamicDirectionsProperty.js
@@ -50,36 +50,12 @@ define([
};
/**
- * A dynamic property which maintains an array of directions that can change over time.
- * The directions can be represented as both Cartesian and Spherical coordinates.
- * Rather than creating instances of this object directly, it's typically
- * created and managed via loading CZML data into a DynamicObjectCollection.
- * Instances of this type are exposed via DynamicObject and it's sub-objects
- * and are responsible for interpreting and interpolating the data for visualization.
- *
- *
- * @alias DynamicDirectionsProperty
- * @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see ReferenceProperty
- * @see DynamicMaterialProperty
- * @see DynamicVertexPositionsProperty
+ * @private
*/
var DynamicDirectionsProperty = function() {
this._propertyIntervals = new TimeIntervalCollection();
};
- /**
- * Processes the provided CZML interval or intervals into this property.
- *
- * @memberof DynamicDirectionsProperty
- *
- * @param {Object} czmlIntervals The CZML data to process.
- * @param {TimeInterval} [constrainedInterval] Constrains the processing so that any times outside of this interval are ignored.
- * @param {DynamicObjectCollection} dynamicObjectCollection The DynamicObjectCollection to be used as a target for resolving links within this property.
- */
DynamicDirectionsProperty.prototype.processCzmlIntervals = function(czmlIntervals, constrainedInterval, dynamicObjectCollection) {
if (Array.isArray(czmlIntervals)) {
for ( var i = 0, len = czmlIntervals.length; i < len; i++) {
@@ -90,13 +66,6 @@ define([
}
};
- /**
- * Retrieves the values at the supplied time as Spherical coordinates.
- * @memberof DynamicDirectionsProperty
- *
- * @param {JulianDate} time The time for which to retrieve the value.
- * @returns An array of spherical coordinates for the provided time.
- */
DynamicDirectionsProperty.prototype.getValue = function(time) {
var interval = this._propertyIntervals.findIntervalContainingDate(time);
if (!defined(interval)) {
diff --git a/Source/DynamicScene/DynamicObject.js b/Source/DynamicScene/DynamicObject.js
index 3a1c657530d8..ce4aeaa9eb85 100644
--- a/Source/DynamicScene/DynamicObject.js
+++ b/Source/DynamicScene/DynamicObject.js
@@ -146,7 +146,7 @@ define([
/**
* Gets or sets the vertex positions.
- * @type {DynamicVertexPositionsProperty}
+ * @type {Property}
* @default undefined
*/
this.vertexPositions = undefined;
diff --git a/Source/DynamicScene/DynamicPyramid.js b/Source/DynamicScene/DynamicPyramid.js
index 119aab1fb477..628f0fef0006 100644
--- a/Source/DynamicScene/DynamicPyramid.js
+++ b/Source/DynamicScene/DynamicPyramid.js
@@ -29,8 +29,8 @@ define([
*/
this.show = undefined;
/**
- * A DynamicDirectionsProperty which determines the projection of the pyramid.
- * @type {DynamicDirectionsProperty}
+ * A Property which determines the projection of the pyramid.
+ * @type {Property}
* @default undefined
*/
this.directions = undefined;
diff --git a/Source/DynamicScene/DynamicVertexPositionsProperty.js b/Source/DynamicScene/DynamicVertexPositionsProperty.js
index 824132f6c91f..aa00b6be88ee 100644
--- a/Source/DynamicScene/DynamicVertexPositionsProperty.js
+++ b/Source/DynamicScene/DynamicVertexPositionsProperty.js
@@ -57,35 +57,12 @@ define([
};
/**
- * A dynamic property which maintains an array of positions that can change over time.
- * The positions can be represented as both Cartesian and Cartographic coordinates.
- * Rather than creating instances of this object directly, it's typically
- * created and managed via loading CZML data into a DynamicObjectCollection.
- * Instances of this type are exposed via DynamicObject and it's sub-objects
- * and are responsible for interpreting and interpolating the data for visualization.
- *
- * @alias DynamicVertexPositionsProperty
- * @internalconstructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see ReferenceProperty
- * @see DynamicMaterialProperty
- * @see DynamicDirectionsProperty
+ * @private
*/
var DynamicVertexPositionsProperty = function() {
this._propertyIntervals = new TimeIntervalCollection();
};
- /**
- * Processes the provided CZML interval or intervals into this property.
- *
- * @memberof DynamicVertexPositionsProperty
- *
- * @param {Object} czmlIntervals The CZML data to process.
- * @param {TimeInterval} [constrainedInterval] Constrains the processing so that any times outside of this interval are ignored.
- * @param {DynamicObjectCollection} dynamicObjectCollection The DynamicObjectCollection to be used as a target for resolving links within this property.
- */
DynamicVertexPositionsProperty.prototype.processCzmlIntervals = function(czmlIntervals, constrainedInterval, dynamicObjectCollection) {
if (Array.isArray(czmlIntervals)) {
for ( var i = 0, len = czmlIntervals.length; i < len; i++) {
@@ -96,13 +73,6 @@ define([
}
};
- /**
- * Retrieves the values at the supplied time as Cartesian coordinates.
- * @memberof DynamicVertexPositionsProperty
- *
- * @param {JulianDate} time The time for which to retrieve the value.
- * @returns An array of Cartesian coordinates for the provided time.
- */
DynamicVertexPositionsProperty.prototype.getValue = function(time) {
var interval = this._propertyIntervals.findIntervalContainingDate(time);
if (!defined(interval)) {
diff --git a/Source/DynamicScene/MaterialProperty.js b/Source/DynamicScene/MaterialProperty.js
index 6cf6366bcefb..554531b25206 100644
--- a/Source/DynamicScene/MaterialProperty.js
+++ b/Source/DynamicScene/MaterialProperty.js
@@ -16,8 +16,7 @@ define([
}
/**
- * The base class for {@link Material} properties, which are {@link Property} objects
- * that represent a Material whose uniforms change over time.
+ * The interface for all {@link Property} objects that represent {@link Material} uniforms.
* This type defines an interface and cannot be instantiated directly.
*
* @alias MaterialProperty
@@ -42,12 +41,14 @@ define([
});
/**
- * Returns the value of the property at the specified simulation time in the fixed frame.
- * @memberof MaterialProperty
+ * Gets the value of the property at the provided time.
+ * @memberof Property
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
- * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
- * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
*/
MaterialProperty.prototype.getValue = throwInstantiationError;
diff --git a/Source/DynamicScene/PositionProperty.js b/Source/DynamicScene/PositionProperty.js
index 06c6ef128af7..3ee5262afe2e 100644
--- a/Source/DynamicScene/PositionProperty.js
+++ b/Source/DynamicScene/PositionProperty.js
@@ -2,6 +2,7 @@
define([
'../Core/Cartesian3',
'../Core/defined',
+ '../Core/defineProperties',
'../Core/DeveloperError',
'../Core/Matrix3',
'../Core/ReferenceFrame',
@@ -9,6 +10,7 @@ define([
], function(
Cartesian3,
defined,
+ defineProperties,
DeveloperError,
Matrix3,
ReferenceFrame,
@@ -20,8 +22,9 @@ define([
}
/**
- * The base class for position properties, which are {@link Property} objects
- * with an associated {@link ReferenceFrame} and {@link Cartesian3} value.
+ * The interface for all position {@link Property} objects. Position properties
+ * represent a world location as a {@link Cartesian3} with an associated
+ * {@link ReferenceFrame}.
* This type defines an interface and cannot be instantiated directly.
*
* @alias PositionProperty
@@ -34,31 +37,42 @@ define([
*/
var PositionProperty = throwInstantiationError;
- /**
- * Gets the reference frame that the position is defined in.
- * @memberof PositionProperty
- * @Type {ReferenceFrame}
- */
- PositionProperty.prototype.referenceFrame = throwInstantiationError;
+ defineProperties(PositionProperty.prototype, {
+ /**
+ * Gets the reference frame that the position is defined in.
+ * @memberof PositionProperty
+ * @Type {ReferenceFrame}
+ */
+ referenceFrame : {
+ get : function() {
+ throwInstantiationError();
+ }
+ }
+ });
/**
- * Returns the value of the property at the specified simulation time in the fixed frame.
- * @memberof PositionProperty
+ * Gets the value of the property at the provided time.
+ * @memberof Property
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {JulianDate} time The time for which to retrieve the value.
* @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
*/
PositionProperty.prototype.getValue = throwInstantiationError;
/**
- * Returns the value of the property at the specified simulation time in the specified reference frame.
- * @memberof PositionProperty
+ * Gets the value of the property at the provided time and in the provided reference frame.
+ * @memberof Property
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
- * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The desired referenceFrame of the result.
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {ReferenceFrame} referenceFrame The desired referenceFrame of the result.
* @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ * @exception {DeveloperError} referenceFrame is required.
*/
PositionProperty.prototype.getValueInReferenceFrame = throwInstantiationError;
diff --git a/Source/DynamicScene/Property.js b/Source/DynamicScene/Property.js
index 98da8dbb8832..66ab3856691a 100644
--- a/Source/DynamicScene/Property.js
+++ b/Source/DynamicScene/Property.js
@@ -9,7 +9,7 @@ define(['../Core/DeveloperError'
}
/**
- * The base class for all properties, which represent a value that can
+ * The interface for all properties, which represent a value that can
* optionally vary over time.
* This type defines an interface and cannot be instantiated directly.
*
@@ -27,10 +27,10 @@ define(['../Core/DeveloperError'
var Property = throwInstantiationError;
/**
- * Returns the value of the property at the specified simulation time.
+ * Gets the value of the property at the provided time.
* @memberof Property
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index d590ae2aabd6..69eb8487ac08 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -24,9 +24,7 @@ define([
}
/**
- * A dynamic property which transparently links to another property, which may
- * or may not exist yet. It is up to the caller to know which kind of property
- * is being linked to.
+ * A {@link Property} which transparently links to another property on a provided object.
*
* @alias ReferenceProperty
* @constructor
@@ -38,13 +36,6 @@ define([
* @exception {DeveloperError} dynamicObjectCollection is required.
* @exception {DeveloperError} targetObjectId is required.
* @exception {DeveloperError} targetPropertyName is required.
- *
- * @see ReferenceProperty#fromString
- * @see DynamicProperty
- * @see DynamicDirectionsProperty
- * @see DynamicVertexPositionsProperty
- * @see DynamicObjectCollection
- * @see CompositeDynamicObjectCollection
*/
var ReferenceProperty = function(dynamicObjectCollection, targetObjectId, targetPropertyName) {
if (!defined(dynamicObjectCollection)) {
@@ -72,18 +63,11 @@ define([
* @param {DynamicObject} dynamicObjectCollection
* @param referenceString
*
+ * @returns A new instance of ReferenceProperty.
+ *
* @exception {DeveloperError} dynamicObjectCollection is required.
* @exception {DeveloperError} referenceString is required.
- * @exception {DeveloperError} referenceString must contain a single . delineating the target object ID and property name.
- *
- * @see ReferenceProperty#fromString
- * @see DynamicProperty
- * @see DynamicDirectionsProperty
- * @see DynamicVertexPositionsProperty
- * @see DynamicObjectCollection
- * @see CompositeDynamicObjectCollection
- *
- * @returns A new instance of ReferenceProperty.
+ * @exception {DeveloperError} referenceString must contain a single period delineating the target object ID and property name.
*/
ReferenceProperty.fromString = function(dynamicObjectCollection, referenceString) {
if (!defined(dynamicObjectCollection)) {
@@ -103,11 +87,15 @@ define([
};
/**
- * Retrieves the value of the property at the specified time.
+ * Gets the value of the property at the provided time.
+ * @memberof Property
+ *
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ *
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*
- * @param time The time to evaluate the property.
- * @param [result] The object to store the result in, if undefined a new instance will be created.
- * @returns The result parameter or a new instance if the parameter was omitted.
+ * @exception {DeveloperError} time is required.
*/
ReferenceProperty.prototype.getValue = function(time, result) {
if (!defined(time)) {
diff --git a/Source/DynamicScene/SampledPositionProperty.js b/Source/DynamicScene/SampledPositionProperty.js
index 1cc49f4d2901..599829214b1b 100644
--- a/Source/DynamicScene/SampledPositionProperty.js
+++ b/Source/DynamicScene/SampledPositionProperty.js
@@ -90,8 +90,8 @@ define([
this._property.addSamples(times, values);
};
- SampledPositionProperty.prototype.addSamplesFlatArray = function(data, epoch) {
- this._property.addSamplesFlatArray(data, epoch);
+ SampledPositionProperty.prototype.addSamplesPackedArray = function(data, epoch) {
+ this._property.addSamplesPackedArray(data, epoch);
};
return SampledPositionProperty;
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index f70875d6f620..05d36acdf291 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -102,27 +102,61 @@ define([
};
/**
- * A {@link Property} whose value never changes.
- *
+ * A {@link Property} whose value is interpolated for a given time from the
+ * provided set of samples and specified interpolation algorithm and degree.
* @alias SampledProperty
* @constructor
*
- * @exception {DeveloperError} value is required.
+ * @param {Object} type The type of property, which must be Number, String or implement {@link Packable}.
+ *
+ * @exception {DeveloperError} type is required.
+ *
+ * @example
+ * //Create a linearly interpolated Cartesian2
+ * var property = new SampledProperty(Cartesian2);
+ * property.interpolationDegree = 1;
+ * property.interpolationAlgorithm = LinearApproximation;
+ *
+ * //Populate it with data
+ * property.addSample(JulianDate.fromIso8601(`2012-08-01T00:00:00.00Z`), new Cartesian2(0, 0));
+ * property.addSample(JulianDate.fromIso8601(`2012-08-02T00:00:00.00Z`), new Cartesian2(4, 7));
+ *
+ * //Retrieve an interpolated value
+ * var result = property.getValue(JulianDate.fromIso8601(`2012-08-01T12:00:00.00Z`));
+ *
+ * @example
+ * //Create a simple numeric SampledProperty that uses third degree Hermite Polynomial Approximation
+ * var property = new SampledProperty(Number);
+ * property.interpolationDegree = 3;
+ * property.interpolationAlgorithm = HermitePolynomialApproximation;
+ *
+ * //Populate it with data
+ * property.addSample(JulianDate.fromIso8601(`2012-08-01T00:00:00.00Z`), 1.0);
+ * property.addSample(JulianDate.fromIso8601(`2012-08-01T00:01:00.00Z`), 6.0);
+ * property.addSample(JulianDate.fromIso8601(`2012-08-01T00:02:00.00Z`), 12.0);
+ * property.addSample(JulianDate.fromIso8601(`2012-08-01T00:03:30.00Z`), 5.0);
+ * property.addSample(JulianDate.fromIso8601(`2012-08-01T00:06:30.00Z`), 2.0);
+ *
+ * //Samples can be added in any order.
+ * property.addSample(JulianDate.fromIso8601(`2012-08-01T00:00:30.00Z`), 6.2);
+ *
+ * //Retrieve an interpolated value
+ * var result = property.getValue(JulianDate.fromIso8601(`2012-08-01T00:02:34.00Z`));
*/
var SampledProperty = function(type) {
if (!defined(type)) {
throw new DeveloperError('type is required.');
}
- this.type = type;
-
- if (type === Number) {
- type = PackableNumber;
+ var innerType = type;
+ if (innerType === Number) {
+ innerType = PackableNumber;
}
- var packedInterpolationLength = defaultValue(type.packedInterpolationLength, type.packedLength);
+ var packedInterpolationLength = defaultValue(innerType.packedInterpolationLength, innerType.packedLength);
- this._innerType = type;
+ this._type = type;
+ this._innerType = innerType;
this._interpolationDegree = 1;
this._interpolationAlgorithm = LinearApproximation;
this._numberOfPoints = 0;
@@ -136,6 +170,24 @@ define([
};
defineProperties(SampledProperty.prototype, {
+ /**
+ * Gets the type of property.
+ * @memberof SampledProperty
+ *
+ * @type {Object}
+ */
+ type : {
+ get : function() {
+ return this._type;
+ }
+ },
+ /**
+ * Gets or sets the degree of interpolation to perform when retrieving a value.
+ * @memberof SampledProperty
+ *
+ * @type {Object}
+ * @default 1
+ */
interpolationDegree : {
get : function() {
return this._interpolationDegree;
@@ -145,6 +197,13 @@ define([
this._updateTables = true;
}
},
+ /**
+ * Gets or sets the interpolation algorithm to use when retrieving a value.
+ * @memberof SampledProperty
+ *
+ * @type {InterpolationAlgorithm}
+ * @default LinearApproximation
+ */
interpolationAlgorithm : {
get : function() {
return this._interpolationAlgorithm;
@@ -157,12 +216,12 @@ define([
});
/**
- * Gets the value of the property, optionally cloning it.
+ * Gets the value of the property at the provided time.
* @memberof SampledProperty
*
- * @param {JulianDate} time The time for which to retrieve the value. This parameter is unused.
- * @param {Object} [result] The object to store the value into if the value is clonable. If the result is omitted or the value does not implement clone, the actual value is returned.
- * @returns The modified result parameter or the actual value instance if the value is not clonable.
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*
* @exception {DeveloperError} time is required.
*/
@@ -258,7 +317,24 @@ define([
return innerType.unpack(this._values, index * innerType.packedLength, result);
};
+ /**
+ * Adds a new sample
+ * @memberof SampledProperty
+ *
+ * @param {JulianDate} time The sample time.
+ * @param {Object} value The value at the provided time.
+ *
+ * @exception {DeveloperError} time is required.
+ * @exception {DeveloperError} value is required.
+ */
SampledProperty.prototype.addSample = function(time, value) {
+ if (!defined(time)) {
+ throw new DeveloperError('time is required.');
+ }
+ if (!defined(value)) {
+ throw new DeveloperError('value is required.');
+ }
+
var innerType = this._innerType;
var data = [time];
innerType.pack(value, data, 1);
@@ -266,7 +342,28 @@ define([
this._updateTables = true;
};
+ /**
+ * Adds an array of samples
+ * @memberof SampledProperty
+ *
+ * @param {Array} times An array of JulianDate instances where each index is a sample time.
+ * @param {Array} values The array of values, where each value corresponds to the provided times index.
+ *
+ * @exception {DeveloperError} times is required.
+ * @exception {DeveloperError} values is required.
+ * @exception {DeveloperError} times and values must be the same length..
+ */
SampledProperty.prototype.addSamples = function(times, values) {
+ if (!defined(times)) {
+ throw new DeveloperError('times is required.');
+ }
+ if (!defined(values)) {
+ throw new DeveloperError('values is required.');
+ }
+ if (times.length !== values.length) {
+ throw new DeveloperError('times and values must be the same length.');
+ }
+
var innerType = this._innerType;
var length = times.length;
var data = [];
@@ -278,8 +375,20 @@ define([
this._updateTables = true;
};
- SampledProperty.prototype.addSamplesFlatArray = function(data, epoch) {
- _mergeNewSamples(epoch, this._times, this._values, data, this._innerType.packedLength);
+ /**
+ * Adds samples as a single packed array where each index
+ * @memberof SampledProperty
+ *
+ * @param {Array} packedSamples The array of packed samples where each new sample is represented as a date, followed by the packed representation of the corresponding value.
+ * @param {JulianDate} [epoch] If any of the dates in packedSamples are numbers, they are considered an offset from this epoch.
+ *
+ * @exception {DeveloperError} packedSamples is required.
+ */
+ SampledProperty.prototype.addSamplesPackedArray = function(packedSamples, epoch) {
+ if (!defined(packedSamples)) {
+ throw new DeveloperError('packedSamples is required.');
+ }
+ _mergeNewSamples(epoch, this._times, this._values, packedSamples, this._innerType.packedLength);
this._updateTables = true;
};
diff --git a/Source/DynamicScene/TimeIntervalCollectionProperty.js b/Source/DynamicScene/TimeIntervalCollectionProperty.js
index c6fb48fdaf0a..da0e219f992f 100644
--- a/Source/DynamicScene/TimeIntervalCollectionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionProperty.js
@@ -14,15 +14,43 @@ define([
"use strict";
/**
- * A {@link Property} which is defined by an TimeIntervalCollection, where the
- * data property of the interval represents the value at simulation time.
+ * A {@link Property} which is defined by a TimeIntervalCollection, where the
+ * data property of each {@link TimeInterval} represents the value at time.
*
* @alias TimeIntervalCollectionProperty
* @constructor
*
- * @param {Function} [clone=value.clone] A function which takes the value and result parameter and clones it.
+ * @param {Function} [clone=value.clone] A function which takes the value and a result parameter and clones it.
* This parameter is only required if the value is not a number or string and does not have a clone function.
*
+ * @exception {DeveloperError} value is required.
+ * @exception {DeveloperError} clone is a required function.
+ *
+ * @example
+ * //Create a Cartesian2 interval property which contains data on August 1st, 2012
+ * //and uses a different value every 6 hours.
+ * var composite = new TimeIntervalCollectionProperty();
+ * composite.intervals.addInterval(TimeInterval.fromIso8601('2012-08-01T00:00:00.00Z/2012-08-01T06:00:00.00Z', true, false, new Cartesian2(2.0, 3.4)));
+ * composite.intervals.addInterval(TimeInterval.fromIso8601('2012-08-01T06:00:00.00Z/2012-08-01T12:00:00.00Z', true, false, new Cartesian2(12.0, 2.7)));
+ * composite.intervals.addInterval(TimeInterval.fromIso8601('2012-08-01T12:00:00.00Z/2012-08-01T18:00:00.00Z', true, false, new Cartesian2(5.0, 12.4)));
+ * composite.intervals.addInterval(TimeInterval.fromIso8601('2012-08-01T18:00:00.00Z/2012-08-02T00:00:00.00Z', true, true, new Cartesian2(85.0, 4.1)));
+ *
+ * @example
+ * //Create a TimeIntervalCollectionProperty that contains user-defined objects.
+ * var myObject = {
+ * value : 6
+ * };
+ * var myObject2 = {
+ * value : 12
+ * };
+ * function cloneMyObject(value, result) {
+ * return {
+ * value : value.value
+ * };
+ * }
+ * var composite = new TimeIntervalCollectionProperty(cloneMyObject);
+ * composite.intervals.addInterval(TimeInterval.fromIso8601('2012-08-01T00:00:00.00Z/2012-08-01T06:00:00.00Z', true, false, myObject));
+ * composite.intervals.addInterval(TimeInterval.fromIso8601('2012-08-01T06:00:00.00Z/2012-08-01T12:00:00.00Z', true, false, myObject2));
*/
var TimeIntervalCollectionProperty = function(clone) {
this._intervals = new TimeIntervalCollection();
@@ -44,14 +72,15 @@ define([
});
/**
- * Returns the value of the property at the specified simulation time.
- * @memberof TimeIntervalCollectionProperty
+ * Gets the value of the property at the provided time.
+ * @memberof Property
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*
* @exception {DeveloperError} time is required.
+ * @exception {DeveloperError} This value requires a clone function be specified for the TimeIntervalCollectionProperty constructor.
*/
TimeIntervalCollectionProperty.prototype.getValue = function(time, result) {
if (!defined(time)) {
@@ -64,6 +93,8 @@ define([
if (defined(value) && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Enumeration)) {
if (typeof value.clone === 'function') {
return value.clone(result);
+ } else if (!defined(this._clone)) {
+ throw new DeveloperError('This value requires a clone function be specified for the TimeIntervalCollectionProperty constructor.');
}
return this._clone(value, result);
}
diff --git a/Specs/DynamicScene/SampledPositionPropertySpec.js b/Specs/DynamicScene/SampledPositionPropertySpec.js
index 65522d710093..f7b0a94b1c5f 100644
--- a/Specs/DynamicScene/SampledPositionPropertySpec.js
+++ b/Specs/DynamicScene/SampledPositionPropertySpec.js
@@ -89,12 +89,12 @@ defineSuite([
expect(expected).toEqual(PositionProperty.convertToReferenceFrame(time, value, ReferenceFrame.INERTIAL, ReferenceFrame.FIXED));
});
- it('addSamplesFlatArray works', function() {
+ it('addSamplesPackedArray works', function() {
var data = [0, 7, 8, 9, 1, 8, 9, 10, 2, 9, 10, 11];
var epoch = new JulianDate(0, 0);
var property = new SampledPositionProperty();
- property.addSamplesFlatArray(data, epoch);
+ property.addSamplesPackedArray(data, epoch);
expect(property.getValue(epoch)).toEqual(new Cartesian3(7, 8, 9));
expect(property.getValue(new JulianDate(0, 0.5))).toEqual(new Cartesian3(7.5, 8.5, 9.5));
});
@@ -169,7 +169,7 @@ defineSuite([
};
var property = new SampledPositionProperty();
- property.addSamplesFlatArray(data, epoch);
+ property.addSamplesPackedArray(data, epoch);
property.interpolationDegree = 2;
property.interpolationAlgorithm = MockInterpolation;
expect(property.getValue(epoch)).toEqual(new Cartesian3(7, 8, 9));
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index 61e042347988..3036df0d2bfa 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -18,12 +18,12 @@ defineSuite([
expect(property.interpolationAlgorithm).toEqual(LinearApproximation);
});
- it('addSamplesFlatArray works', function() {
+ it('addSamplesPackedArray works', function() {
var data = [0, 7, 1, 8, 2, 9];
var epoch = new JulianDate(0, 0);
var property = new SampledProperty(Number);
- property.addSamplesFlatArray(data, epoch);
+ property.addSamplesPackedArray(data, epoch);
expect(property.getValue(epoch)).toEqual(7);
expect(property.getValue(new JulianDate(0, 0.5))).toEqual(7.5);
});
@@ -134,7 +134,7 @@ defineSuite([
};
var property = new SampledProperty(Number);
- property.addSamplesFlatArray(data, epoch);
+ property.addSamplesPackedArray(data, epoch);
expect(property.getValue(epoch)).toEqual(7);
expect(property.getValue(new JulianDate(0, 1))).toEqual(8);
From e6c82dc175a677bc62584e5f280442674d8409ae Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 26 Aug 2013 15:00:19 -0400
Subject: [PATCH 54/65] Finish Property documentation.
---
Source/DynamicScene/ColorMaterialProperty.js | 25 +++++-
.../DynamicScene/CompositeMaterialProperty.js | 17 ++--
.../DynamicScene/CompositePositionProperty.js | 30 +++++---
Source/DynamicScene/CompositeProperty.js | 3 +
.../DynamicScene/ConstantPositionProperty.js | 36 ++++++---
Source/DynamicScene/ConstantProperty.js | 2 +
Source/DynamicScene/GridMaterialProperty.js | 43 +++++++----
Source/DynamicScene/ImageMaterialProperty.js | 32 ++++++--
Source/DynamicScene/MaterialProperty.js | 26 +++----
Source/DynamicScene/PositionProperty.js | 6 +-
Source/DynamicScene/ReferenceProperty.js | 2 +-
.../DynamicScene/SampledPositionProperty.js | 77 +++++++++++++++++--
Source/DynamicScene/SampledProperty.js | 15 ++--
.../TimeIntervalCollectionPositionProperty.js | 36 +++++----
.../TimeIntervalCollectionProperty.js | 4 +-
15 files changed, 254 insertions(+), 100 deletions(-)
diff --git a/Source/DynamicScene/ColorMaterialProperty.js b/Source/DynamicScene/ColorMaterialProperty.js
index 780c7b5e38c8..176a51379f35 100644
--- a/Source/DynamicScene/ColorMaterialProperty.js
+++ b/Source/DynamicScene/ColorMaterialProperty.js
@@ -10,23 +10,40 @@ define([
"use strict";
/**
- * A utility class for processing CZML color materials.
+ * A {@link MaterialProperty} that maps to solid color {@link Material} uniforms.
* @alias ColorMaterialProperty
* @constructor
*/
var ColorMaterialProperty = function() {
/**
- * A DynamicProperty of type Color which determines the material's color.
- * @type {DynamicProperty}
- * @default undefined
+ * A {@link Color} {@link Property} which determines the material's color.
+ * @type {Property}
+ * @default new ConstantProperty(Color.WHITE)
*/
this.color = new ConstantProperty(Color.WHITE);
};
+ /**
+ * Gets the {@link Material} type at the provided time.
+ * @memberof MaterialProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the type.
+ * @type {String} The type of material.
+ */
ColorMaterialProperty.prototype.getType = function(time) {
return 'Color';
};
+ /**
+ * Gets the value of the property at the provided time.
+ * @memberof MaterialProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ */
ColorMaterialProperty.prototype.getValue = function(time, result) {
if (!defined(result)) {
result = {};
diff --git a/Source/DynamicScene/CompositeMaterialProperty.js b/Source/DynamicScene/CompositeMaterialProperty.js
index fddb90e57a33..44f4dc7ffbce 100644
--- a/Source/DynamicScene/CompositeMaterialProperty.js
+++ b/Source/DynamicScene/CompositeMaterialProperty.js
@@ -12,9 +12,7 @@ define([
"use strict";
/**
- * A {@link Property} which is defined by a TimeIntervalCollection, where the
- * data property of the interval is another Property instance which is evaluated
- * at the provided time.
+ * A {@link CompositeProperty} which is also a {@link MaterialProperty}.
*
* @alias CompositeMaterialProperty
* @constructor
@@ -37,6 +35,13 @@ define([
}
});
+ /**
+ * Gets the {@link Material} type at the provided time.
+ * @memberof CompositeMaterialProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the type.
+ * @type {String} The type of material.
+ */
CompositeMaterialProperty.prototype.getType = function(time) {
if (!defined(time)) {
throw new DeveloperError('time is required');
@@ -53,10 +58,10 @@ define([
};
/**
- * Returns the value of the property at the specified simulation time.
- * @memberof Property
+ * Gets the value of the property at the provided time.
+ * @memberof CompositeMaterialProperty
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*
diff --git a/Source/DynamicScene/CompositePositionProperty.js b/Source/DynamicScene/CompositePositionProperty.js
index a2308f8a7813..e9fcfd1ffa30 100644
--- a/Source/DynamicScene/CompositePositionProperty.js
+++ b/Source/DynamicScene/CompositePositionProperty.js
@@ -15,10 +15,9 @@ define([
ReferenceFrame) {
"use strict";
+
/**
- * A {@link PositionProperty} which is defined by a TimeIntervalCollection, where the
- * data property of the interval is another PositionProperty instance which is
- * evaluated at the provided time.
+ * A {@link CompositeProperty} which is also a {@link PositionProperty}.
*
* @alias CompositePositionProperty
* @constructor
@@ -41,12 +40,13 @@ define([
}
},
/**
- * Gets or sets the reference frame that the position presents itself as.
+ * Gets or sets the reference frame which this position presents itself as.
* Each PositionProperty making up this object has it's own reference frame,
- * so this property merely exposes a "preferred" reference frame for clients.
+ * so this property merely exposes a "preferred" reference frame for clients
+ * to use.
* @memberof CompositePositionProperty.prototype
*
- * @Type {ReferenceFrame}
+ * @Type {ReferenceFrame} The preferred reference frame.
*/
referenceFrame : {
get : function() {
@@ -59,10 +59,10 @@ define([
});
/**
- * Returns the value of the property at the specified simulation time.
+ * Gets the value of the property at the provided time in the fixed frame.
* @memberof CompositePositionProperty
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*
@@ -73,17 +73,23 @@ define([
};
/**
- * Returns the value of the property at the specified simulation time in the specified reference frame.
+ * Gets the value of the property at the provided time and in the provided reference frame.
* @memberof CompositePositionProperty
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
- * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The desired referenceFrame of the result.
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {ReferenceFrame} referenceFrame The desired referenceFrame of the result.
* @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ * @exception {DeveloperError} referenceFrame is required.
*/
CompositePositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
if (!defined(time)) {
- throw new DeveloperError('time is required');
+ throw new DeveloperError('time is required.');
+ }
+ if (!defined(referenceFrame)) {
+ throw new DeveloperError('referenceFrame is required.');
}
var interval = this._intervals.findIntervalContainingDate(time);
diff --git a/Source/DynamicScene/CompositeProperty.js b/Source/DynamicScene/CompositeProperty.js
index 304cf567edd2..f03b764b81d1 100644
--- a/Source/DynamicScene/CompositeProperty.js
+++ b/Source/DynamicScene/CompositeProperty.js
@@ -19,6 +19,9 @@ define([
* @alias CompositeProperty
* @constructor
*
+ * @see CompositeMaterialProperty
+ * @see CompositePositionProperty
+ *
* @example
* var constantProperty = ...;
* var sampledProperty = ...;
diff --git a/Source/DynamicScene/ConstantPositionProperty.js b/Source/DynamicScene/ConstantPositionProperty.js
index 52f6585cb577..852a654f7b8c 100644
--- a/Source/DynamicScene/ConstantPositionProperty.js
+++ b/Source/DynamicScene/ConstantPositionProperty.js
@@ -20,12 +20,20 @@ define([
"use strict";
/**
- * A {@link PositionProperty} whose value never changes.
+ * A {@link PositionProperty} whose value does not change in respect to the
+ * {@link ReferenceFrame} in which is it defined.
*
* @alias ConstantPositionProperty
* @constructor
*
+ * @param {Cartesian3} value The property value.
+ * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The reference frame in which the position is defined.
+ *
* @exception {DeveloperError} value is required.
+ *
+ * @example
+ * //Create a constant position in the inertial frame.
+ * var constantProperty = new ConstantPositionProperty(new Cartesian3(-4225824.0, 1261219.0, -5148934.0), ReferenceFrame.INERTIAL);
*/
var ConstantPositionProperty = function(value, referenceFrame) {
this._property = new ConstantProperty(value, Cartesian3.clone);
@@ -34,8 +42,10 @@ define([
defineProperties(ConstantPositionProperty.prototype, {
/**
- * Gets the reference frame that the position is defined in.
+ * Gets the reference frame in which the position is defined.
+ * @memberof ConstantPositionProperty.prototype
* @Type {ReferenceFrame}
+ * @default ReferenceFrame.FIXED;
*/
referenceFrame : {
get : function() {
@@ -45,30 +55,38 @@ define([
});
/**
- * Returns the value of the property at the specified simulation time in the fixed frame.
- * @memberof PositionProperty
+ * Gets the value of the property at the provided time in the fixed frame.
+ * @memberof ConstantPositionProperty
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
*/
ConstantPositionProperty.prototype.getValue = function(time, result) {
return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result);
};
/**
- * Returns the value of the property at the specified simulation time in the specified reference frame.
- * @memberof PositionProperty
+ * Gets the value of the property at the provided time and in the provided reference frame.
+ * @memberof ConstantPositionProperty
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
- * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The desired referenceFrame of the result.
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {ReferenceFrame} referenceFrame The desired referenceFrame of the result.
* @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ * @exception {DeveloperError} referenceFrame is required.
*/
ConstantPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
if (!defined(time)) {
throw new DeveloperError('time is required.');
}
+ if (!defined(referenceFrame)) {
+ throw new DeveloperError('referenceFrame is required.');
+ }
var value = this._property.getValue(time, result);
return PositionProperty.convertToReferenceFrame(time, value, this._referenceFrame, referenceFrame, value);
};
diff --git a/Source/DynamicScene/ConstantProperty.js b/Source/DynamicScene/ConstantProperty.js
index 0f5815ada1fd..b1a3954dd5e4 100644
--- a/Source/DynamicScene/ConstantProperty.js
+++ b/Source/DynamicScene/ConstantProperty.js
@@ -32,6 +32,8 @@ define([
* @exception {DeveloperError} value is required.
* @exception {DeveloperError} clone is a required function.
*
+ * @see ConstantPositionProperty
+ *
* @example
* //Create a constant value from a Cartesian2 instance.
* var constantProperty = new ConstantProperty(new Cartesian2(10, 12));
diff --git a/Source/DynamicScene/GridMaterialProperty.js b/Source/DynamicScene/GridMaterialProperty.js
index 687aeae0ebf9..6ff25de7bcf8 100644
--- a/Source/DynamicScene/GridMaterialProperty.js
+++ b/Source/DynamicScene/GridMaterialProperty.js
@@ -12,44 +12,61 @@ define([
"use strict";
/**
- * A utility class for processing CZML grid materials.
+ * A {@link MaterialProperty} that maps to grid {@link Material} uniforms.
* @alias GridMaterialProperty
* @constructor
*/
var GridMaterialProperty = function() {
/**
- * A DynamicProperty of type Color which determines the grid's color.
- * @type {DynamicProperty}
- * @default undefined
+ * A {@link Color} {@link Property} which determines the grid's color.
+ * @type {Property}
+ * @default new ConstantProperty(Color.WHITE)
*/
this.color = new ConstantProperty(Color.WHITE);
/**
- * A DynamicProperty of type Number which determines the grid cells alpha value, when combined with the color alpha.
- * @type {DynamicProperty}
- * @default undefined
+ * A numeric {@link Property} which determines the grid cells alpha value, when combined with the color alpha.
+ * @type {Property}
+ * @default new ConstantProperty(0.1)
*/
this.cellAlpha = new ConstantProperty(0.1);
/**
- * A DynamicProperty of type Number which determines the number of horizontal rows.
- * @type {DynamicProperty}
- * @default undefined
+ * A {@link Cartesian2} {@link Property} which determines the number of rows and columns in the grid.
+ * @type {Property}
+ * @default new ConstantProperty(new Cartesian2(8, 8))
*/
this.lineCount = new ConstantProperty(new Cartesian2(8, 8));
/**
- * A DynamicProperty of type Number which determines the width of each horizontal line, in pixels.
- * @type {DynamicProperty}
- * @default undefined
+ * A {@link Cartesian2} {@link Property} which determines the thickness of rows and columns in the grid.
+ * @type {Property}
+ * @default new ConstantProperty(new Cartesian2(1.0, 1.0))
*/
this.lineThickness = new ConstantProperty(new Cartesian2(1.0, 1.0));
};
+ /**
+ * Gets the {@link Material} type at the provided time.
+ * @memberof MaterialProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the type.
+ * @type {String} The type of material.
+ */
GridMaterialProperty.prototype.getType = function(time) {
return 'Grid';
};
+ /**
+ * Gets the value of the property at the provided time.
+ * @memberof MaterialProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ */
GridMaterialProperty.prototype.getValue = function(time, result) {
if (!defined(result)) {
result = {};
diff --git a/Source/DynamicScene/ImageMaterialProperty.js b/Source/DynamicScene/ImageMaterialProperty.js
index dc3c79008738..4f38d40fdd28 100644
--- a/Source/DynamicScene/ImageMaterialProperty.js
+++ b/Source/DynamicScene/ImageMaterialProperty.js
@@ -10,29 +10,45 @@ define([
"use strict";
/**
- * A utility class for processing CZML image materials.
+ * A {@link MaterialProperty} that maps to image {@link Material} uniforms.
* @alias ImageMaterialProperty
* @constructor
*/
var ImageMaterialProperty = function() {
- /**
- * A DynamicProperty of type Number which determines the material's image.
- * @type {DynamicProperty}
- * @default undefined
+ /**
+ * A string {@link Property} which is the url of the desired image.
+ * @type {Property}
*/
this.image = undefined;
/**
- * A DynamicProperty of type Number which determines the material's vertical repeat.
- * @type {DynamicProperty}
- * @default undefined
+ * A {@link Cartesian2} {@link Property} which determines the number of times the image repeats in each direction.
+ * @type {Property}
+ * @default new ConstantProperty(new Cartesian2(1, 1))
*/
this.repeat = new ConstantProperty(new Cartesian2(1, 1));
};
+ /**
+ * Gets the {@link Material} type at the provided time.
+ * @memberof MaterialProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the type.
+ * @type {String} The type of material.
+ */
ImageMaterialProperty.prototype.getType = function(time) {
return 'Image';
};
+ /**
+ * Gets the value of the property at the provided time.
+ * @memberof MaterialProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ */
ImageMaterialProperty.prototype.getValue = function(time, result) {
if (!defined(result)) {
result = {};
diff --git a/Source/DynamicScene/MaterialProperty.js b/Source/DynamicScene/MaterialProperty.js
index 554531b25206..26fc7bd63979 100644
--- a/Source/DynamicScene/MaterialProperty.js
+++ b/Source/DynamicScene/MaterialProperty.js
@@ -1,12 +1,10 @@
/*global define*/
define([
'../Core/defined',
- '../Core/defineProperties',
'../Core/DeveloperError',
'../Scene/Material'
], function(
defined,
- defineProperties,
DeveloperError,
Material) {
"use strict";
@@ -23,26 +21,26 @@ define([
* @constructor
*
* @see ColorMaterialProperty
+ * @see CompositeMaterialProperty
* @see GridMaterialProperty
* @see ImageMaterialProperty
*/
var MaterialProperty = throwInstantiationError;
- defineProperties(MaterialProperty.prototype, {
- /**
- * Gets the Material type.
- * @type {String}
- */
- type : {
- get : function() {
- throwInstantiationError();
- }
- }
- });
+ /**
+ * Gets the {@link Material} type at the provided time.
+ * @memberof MaterialProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the type.
+ * @type {String} The type of material.
+ */
+ MaterialProperty.prototype.getType = function(time) {
+ throwInstantiationError();
+ };
/**
* Gets the value of the property at the provided time.
- * @memberof Property
+ * @memberof MaterialProperty
*
* @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
diff --git a/Source/DynamicScene/PositionProperty.js b/Source/DynamicScene/PositionProperty.js
index 3ee5262afe2e..08a5b51b120c 100644
--- a/Source/DynamicScene/PositionProperty.js
+++ b/Source/DynamicScene/PositionProperty.js
@@ -40,7 +40,7 @@ define([
defineProperties(PositionProperty.prototype, {
/**
* Gets the reference frame that the position is defined in.
- * @memberof PositionProperty
+ * @memberof PositionProperty.prototype
* @Type {ReferenceFrame}
*/
referenceFrame : {
@@ -52,7 +52,7 @@ define([
/**
* Gets the value of the property at the provided time.
- * @memberof Property
+ * @memberof PositionProperty
*
* @param {JulianDate} time The time for which to retrieve the value.
* @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
@@ -64,7 +64,7 @@ define([
/**
* Gets the value of the property at the provided time and in the provided reference frame.
- * @memberof Property
+ * @memberof PositionProperty
*
* @param {JulianDate} time The time for which to retrieve the value.
* @param {ReferenceFrame} referenceFrame The desired referenceFrame of the result.
diff --git a/Source/DynamicScene/ReferenceProperty.js b/Source/DynamicScene/ReferenceProperty.js
index 69eb8487ac08..3acd040cf363 100644
--- a/Source/DynamicScene/ReferenceProperty.js
+++ b/Source/DynamicScene/ReferenceProperty.js
@@ -88,7 +88,7 @@ define([
/**
* Gets the value of the property at the provided time.
- * @memberof Property
+ * @memberof ReferenceProperty
*
* @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
diff --git a/Source/DynamicScene/SampledPositionProperty.js b/Source/DynamicScene/SampledPositionProperty.js
index 599829214b1b..46876162ecfc 100644
--- a/Source/DynamicScene/SampledPositionProperty.js
+++ b/Source/DynamicScene/SampledPositionProperty.js
@@ -20,12 +20,12 @@ define([
"use strict";
/**
- * A {@link Property} whose value never changes.
+ * A {@link SampledProperty} which is also a {@link PositionProperty}.
*
* @alias SampledPositionProperty
* @constructor
*
- * @exception {DeveloperError} value is required.
+ * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The reference frame in which the position is defined.
*/
var SampledPositionProperty = function(referenceFrame) {
this._property = new SampledProperty(Cartesian3);
@@ -33,11 +33,24 @@ define([
};
defineProperties(SampledPositionProperty.prototype, {
+ /**
+ * Gets the reference frame in which the position is defined.
+ * @memberof SampledPositionProperty.prototype
+ * @Type {ReferenceFrame}
+ * @default ReferenceFrame.FIXED;
+ */
referenceFrame : {
get : function() {
return this._referenceFrame;
}
},
+ /**
+ * Gets or sets the degree of interpolation to perform when retrieving a value.
+ * @memberof SampledPositionProperty.prototype
+ *
+ * @type {Object}
+ * @default 1
+ */
interpolationDegree : {
get : function() {
return this._property.interpolationDegree;
@@ -46,6 +59,13 @@ define([
this._property.interpolationDegree = value;
}
},
+ /**
+ * Gets or sets the interpolation algorithm to use when retrieving a value.
+ * @memberof SampledPositionProperty.prototype
+ *
+ * @type {InterpolationAlgorithm}
+ * @default LinearApproximation
+ */
interpolationAlgorithm : {
get : function() {
return this._property.interpolationAlgorithm;
@@ -57,12 +77,12 @@ define([
});
/**
- * Gets the value of the property, optionally cloning it.
+ * Gets the value of the property at the provided time.
* @memberof SampledPositionProperty
*
- * @param {JulianDate} time The time for which to retrieve the value. This parameter is unused.
- * @param {Object} [result] The object to store the value into if the value is clonable. If the result is omitted or the value does not implement clone, the actual value is returned.
- * @returns The modified result parameter or the actual value instance if the value is not clonable.
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
*
* @exception {DeveloperError} time is required.
*/
@@ -70,10 +90,25 @@ define([
return this.getValueInReferenceFrame(time, ReferenceFrame.FIXED, result);
};
+ /**
+ * Gets the value of the property at the provided time and in the provided reference frame.
+ * @memberof SampledPositionProperty
+ *
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {ReferenceFrame} referenceFrame The desired referenceFrame of the result.
+ * @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
+ * @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ * @exception {DeveloperError} referenceFrame is required.
+ */
SampledPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
if (!defined(time)) {
throw new DeveloperError('time is required.');
}
+ if (!defined(referenceFrame)) {
+ throw new DeveloperError('referenceFrame is required.');
+ }
result = this._property.getValue(time, result);
if (defined(result)) {
@@ -82,14 +117,44 @@ define([
return result;
};
+ /**
+ * Adds a new sample
+ * @memberof SampledPositionProperty
+ *
+ * @param {JulianDate} time The sample time.
+ * @param {Cartesian3} value The value at the provided time.
+ *
+ * @exception {DeveloperError} time is required.
+ * @exception {DeveloperError} value is required.
+ */
SampledPositionProperty.prototype.addSample = function(time, value) {
this._property.addSample(time, value);
};
+ /**
+ * Adds an array of samples
+ * @memberof SampledPositionProperty
+ *
+ * @param {Array} times An array of JulianDate instances where each index is a sample time.
+ * @param {Array} values The array of Cartesian3 instances, where each value corresponds to the provided times index.
+ *
+ * @exception {DeveloperError} times is required.
+ * @exception {DeveloperError} values is required.
+ * @exception {DeveloperError} times and values must be the same length..
+ */
SampledPositionProperty.prototype.addSamples = function(times, values) {
this._property.addSamples(times, values);
};
+ /**
+ * Adds samples as a single packed array where each new sample is represented as a date, followed by the packed representation of the corresponding value.
+ * @memberof SampledPositionProperty
+ *
+ * @param {Array} packedSamples The array of packed samples.
+ * @param {JulianDate} [epoch] If any of the dates in packedSamples are numbers, they are considered an offset from this epoch.
+ *
+ * @exception {DeveloperError} packedSamples is required.
+ */
SampledPositionProperty.prototype.addSamplesPackedArray = function(data, epoch) {
this._property.addSamplesPackedArray(data, epoch);
};
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 05d36acdf291..50c5ce9343ef 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -111,6 +111,8 @@ define([
*
* @exception {DeveloperError} type is required.
*
+ * @see SampledPositionProperty
+ *
* @example
* //Create a linearly interpolated Cartesian2
* var property = new SampledProperty(Cartesian2);
@@ -172,8 +174,7 @@ define([
defineProperties(SampledProperty.prototype, {
/**
* Gets the type of property.
- * @memberof SampledProperty
- *
+ * @memberof SampledProperty.prototype
* @type {Object}
*/
type : {
@@ -183,8 +184,7 @@ define([
},
/**
* Gets or sets the degree of interpolation to perform when retrieving a value.
- * @memberof SampledProperty
- *
+ * @memberof SampledProperty.prototype
* @type {Object}
* @default 1
*/
@@ -199,8 +199,7 @@ define([
},
/**
* Gets or sets the interpolation algorithm to use when retrieving a value.
- * @memberof SampledProperty
- *
+ * @memberof SampledProperty.prototype
* @type {InterpolationAlgorithm}
* @default LinearApproximation
*/
@@ -376,10 +375,10 @@ define([
};
/**
- * Adds samples as a single packed array where each index
+ * Adds samples as a single packed array where each new sample is represented as a date, followed by the packed representation of the corresponding value.
* @memberof SampledProperty
*
- * @param {Array} packedSamples The array of packed samples where each new sample is represented as a date, followed by the packed representation of the corresponding value.
+ * @param {Array} packedSamples The array of packed samples.
* @param {JulianDate} [epoch] If any of the dates in packedSamples are numbers, they are considered an offset from this epoch.
*
* @exception {DeveloperError} packedSamples is required.
diff --git a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
index d9901fe0bf05..8a2e6c72a906 100644
--- a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
@@ -18,11 +18,12 @@ define([
"use strict";
/**
- * A {@link Property} which is defined by an TimeIntervalCollection, where the
- * data property of the interval represents the value at simulation time.
+ * A {@link TimeIntervalCollectionProperty} which is also a {@link PositionProperty}.
*
* @alias TimeIntervalCollectionPositionProperty
* @constructor
+ *
+ * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The reference frame in which the position is defined.
*/
var TimeIntervalCollectionPositionProperty = function(referenceFrame) {
this._intervals = new TimeIntervalCollection();
@@ -32,8 +33,7 @@ define([
defineProperties(TimeIntervalCollectionPositionProperty.prototype, {
/**
* Gets the interval collection.
- * @memberof TimeIntervalCollectionPositionProperty
- *
+ * @memberof TimeIntervalCollectionPositionProperty.prototype
* @type {TimeIntervalCollection}
*/
intervals : {
@@ -42,8 +42,10 @@ define([
}
},
/**
- * Gets the reference frame that the positions are defined in.
+ * Gets the reference frame in which the position is defined.
+ * @memberof TimeIntervalCollectionPositionProperty.prototype
* @Type {ReferenceFrame}
+ * @default ReferenceFrame.FIXED;
*/
referenceFrame : {
get : function() {
@@ -53,10 +55,10 @@ define([
});
/**
- * Returns the value of the property at the specified simulation time.
- * @memberof TimeIntervalCollectionPositionProperty
+ * Gets the value of the property at the provided time in the fixed frame.
+ * @memberof CompositePositionProperty
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
+ * @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Object} The modified result parameter or a new instance if the result parameter was not supplied.
*
@@ -67,17 +69,23 @@ define([
};
/**
- * Returns the value of the property at the specified simulation time in the specified reference frame.
- * @memberof PositionProperty
+ * Gets the value of the property at the provided time and in the provided reference frame.
+ * @memberof CompositePositionProperty
*
- * @param {JulianDate} time The simulation time for which to retrieve the value.
- * @param {ReferenceFrame} [referenceFrame=ReferenceFrame.FIXED] The desired referenceFrame of the result.
+ * @param {JulianDate} time The time for which to retrieve the value.
+ * @param {ReferenceFrame} referenceFrame The desired referenceFrame of the result.
* @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
* @returns {Cartesian3} The modified result parameter or a new instance if the result parameter was not supplied.
+ *
+ * @exception {DeveloperError} time is required.
+ * @exception {DeveloperError} referenceFrame is required.
*/
- TimeIntervalCollectionPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
+ CompositePositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
if (!defined(time)) {
- throw new DeveloperError('time is required');
+ throw new DeveloperError('time is required.');
+ }
+ if (!defined(referenceFrame)) {
+ throw new DeveloperError('referenceFrame is required.');
}
var interval = this._intervals.findIntervalContainingDate(time);
diff --git a/Source/DynamicScene/TimeIntervalCollectionProperty.js b/Source/DynamicScene/TimeIntervalCollectionProperty.js
index da0e219f992f..07835e2eaa66 100644
--- a/Source/DynamicScene/TimeIntervalCollectionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionProperty.js
@@ -60,7 +60,7 @@ define([
defineProperties(TimeIntervalCollectionProperty.prototype, {
/**
* Gets the interval collection.
- * @memberof TimeIntervalCollectionProperty
+ * @memberof TimeIntervalCollectionProperty.prototype
*
* @type {TimeIntervalCollection}
*/
@@ -73,7 +73,7 @@ define([
/**
* Gets the value of the property at the provided time.
- * @memberof Property
+ * @memberof TimeIntervalCollectionProperty
*
* @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
From 83da53dee5f8ece5257a959dbbc852e0f751b7ce Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 26 Aug 2013 15:05:42 -0400
Subject: [PATCH 55/65] Fix copy/paste error.
---
Source/DynamicScene/TimeIntervalCollectionPositionProperty.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
index 8a2e6c72a906..c1aed0a575ee 100644
--- a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
@@ -80,7 +80,7 @@ define([
* @exception {DeveloperError} time is required.
* @exception {DeveloperError} referenceFrame is required.
*/
- CompositePositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
+ TimeIntervalCollectionPositionProperty.prototype.getValueInReferenceFrame = function(time, referenceFrame, result) {
if (!defined(time)) {
throw new DeveloperError('time is required.');
}
From 440a573175cbecb14b45851581ce95b29742902a Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 26 Aug 2013 16:10:20 -0400
Subject: [PATCH 56/65] Clean up doc for Dynamic objects.
Remove all references to CZML/DynamicProperty and replace them with their new equivalents.
---
.../CompositeDynamicObjectCollection.js | 24 +-----
Source/DynamicScene/DynamicBillboard.js | 65 +++++----------
Source/DynamicScene/DynamicClock.js | 2 -
Source/DynamicScene/DynamicCone.js | 79 +++++++------------
Source/DynamicScene/DynamicEllipse.js | 28 ++-----
Source/DynamicScene/DynamicEllipsoid.js | 29 ++-----
Source/DynamicScene/DynamicLabel.js | 76 ++++++------------
Source/DynamicScene/DynamicObject.js | 18 +----
Source/DynamicScene/DynamicPath.js | 55 ++++---------
Source/DynamicScene/DynamicPoint.js | 36 +++------
Source/DynamicScene/DynamicPolygon.js | 24 ++----
Source/DynamicScene/DynamicPolyline.js | 40 +++-------
Source/DynamicScene/DynamicPyramid.js | 46 ++++-------
Source/DynamicScene/DynamicVector.js | 39 +++------
14 files changed, 162 insertions(+), 399 deletions(-)
diff --git a/Source/DynamicScene/CompositeDynamicObjectCollection.js b/Source/DynamicScene/CompositeDynamicObjectCollection.js
index 66aef35fef98..9c039eafff51 100644
--- a/Source/DynamicScene/CompositeDynamicObjectCollection.js
+++ b/Source/DynamicScene/CompositeDynamicObjectCollection.js
@@ -18,17 +18,7 @@ define([
'./DynamicPolygon',
'./DynamicPolyline',
'./DynamicPyramid',
- './DynamicVector',
- './DynamicBillboardVisualizer',
- './DynamicEllipsoidVisualizer',
- './DynamicConeVisualizerUsingCustomSensor', //CZML_TODO Replace with './DynamicConeVisualizer', once ComplexConicSensor works.
- './DynamicLabelVisualizer',
- './DynamicPathVisualizer',
- './DynamicPointVisualizer',
- './DynamicPolygonVisualizer',
- './DynamicPolylineVisualizer',
- './DynamicPyramidVisualizer',
- './DynamicVectorVisualizer'
+ './DynamicVector'
], function(
defaultValue,
defined,
@@ -48,17 +38,7 @@ define([
DynamicPolygon,
DynamicPolyline,
DynamicPyramid,
- DynamicVector,
- DynamicBillboardVisualizer,
- DynamicEllipsoidVisualizer,
- DynamicConeVisualizer,
- DynamicLabelVisualizer,
- DynamicPathVisualizer,
- DynamicPointVisualizer,
- DynamicPolygonVisualizer,
- DynamicPolylineVisualizer,
- DynamicPyramidVisualizer,
- DynamicVectorVisualizer) {
+ DynamicVector) {
"use strict";
/**
diff --git a/Source/DynamicScene/DynamicBillboard.js b/Source/DynamicScene/DynamicBillboard.js
index 5ee7946b62b5..72886732fa33 100644
--- a/Source/DynamicScene/DynamicBillboard.js
+++ b/Source/DynamicScene/DynamicBillboard.js
@@ -8,79 +8,60 @@ define([
"use strict";
/**
- * Represents a time-dynamic billboard, typically used in conjunction with DynamicBillboardVisualizer and
- * DynamicObjectCollection to visualize CZML.
+ * An optionally time-dynamic billboard.
*
* @alias DynamicBillboard
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicBillboardVisualizer
- * @see VisualizerCollection
- * @see Billboard
- * @see BillboardCollection
*/
var DynamicBillboard = function() {
/**
- * A DynamicProperty of type Image which determines the billboard's texture.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the string {@link Property} specifying the URL of the billboard's texture.
+ * @type {Property}
*/
this.image = undefined;
/**
- * A DynamicProperty of type Number which determines the billboard's scale.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the billboard's scale.
+ * @type {Property}
*/
this.scale = undefined;
/**
- * A DynamicProperty of type Number which determines the billboard's rotation.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the billboard's rotation.
+ * @type {Property}
*/
this.rotation = undefined;
/**
- * A DynamicProperty of type Cartesian3 which determines the billboard's aligned axis.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Cartesian3} {@link Property} specifying the billboard rotation's aligned axis.
+ * @type {Property}
*/
this.alignedAxis = undefined;
/**
- * A DynamicProperty of type HorizontalOrigin which determines the billboard's horizontal origin.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link HorizontalOrigin} {@link Property} specifying the billboard's horizontal origin.
+ * @type {Property}
*/
this.horizontalOrigin = undefined;
/**
- * A DynamicProperty of type VerticalOrigin which determines the billboard's vertical origin.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link VerticalOrigin} {@link Property} specifying the billboard's vertical origin.
+ * @type {Property}
*/
this.verticalOrigin = undefined;
/**
- * A DynamicProperty of type Color which determines the billboard's color.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Color} {@link Property} specifying the billboard's color.
+ * @type {Property}
*/
this.color = undefined;
/**
- * A DynamicProperty of type Cartesian3 which determines the billboard's eye offset.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Cartesian3} {@link Property} specifying the billboard's eye offset.
+ * @type {Property}
*/
this.eyeOffset = undefined;
/**
- * A DynamicProperty of type Cartesian2 which determines the billboard's pixel offset.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Cartesian2} {@link Property} specifying the billboard's pixel offset.
+ * @type {Property}
*/
this.pixelOffset = undefined;
/**
- * A DynamicProperty of type Boolean which determines the billboard's visibility.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the billboard's visibility.
+ * @type {Property}
*/
this.show = undefined;
};
@@ -88,8 +69,6 @@ define([
/**
* Given two DynamicObjects, takes the billboard properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
* @memberof DynamicBillboard
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
@@ -119,8 +98,6 @@ define([
/**
* Given a DynamicObject, undefines the billboard associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
* @memberof DynamicBillboard
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the billboard from.
diff --git a/Source/DynamicScene/DynamicClock.js b/Source/DynamicScene/DynamicClock.js
index fd528ad5095a..af67ebd07b47 100644
--- a/Source/DynamicScene/DynamicClock.js
+++ b/Source/DynamicScene/DynamicClock.js
@@ -113,8 +113,6 @@ define([
/**
* Given a DynamicObject, undefines the clock associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
* @memberof DynamicClock
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the clock from.
diff --git a/Source/DynamicScene/DynamicCone.js b/Source/DynamicScene/DynamicCone.js
index a06cd35ea3fe..d12bc7ca8d18 100644
--- a/Source/DynamicScene/DynamicCone.js
+++ b/Source/DynamicScene/DynamicCone.js
@@ -8,96 +8,75 @@ define([
"use strict";
/**
- * Represents a time-dynamic cone, typically used in conjunction with DynamicConeVisualizer and
- * DynamicObjectCollection to visualize CZML.
+ * An optionally time-dynamic cone.
*
* @alias DynamicCone
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicConeVisualizer
- * @see VisualizerCollection
- * @see ComplexConicSensor
*/
var DynamicCone = function() {
/**
- * A DynamicProperty of type Number which determines the cone's minimum clock-angle.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the cone's minimum clock angle.
+ * @type {Property}
*/
this.minimumClockAngle = undefined;
/**
- * A DynamicProperty of type Number which determines the cone's maximum clock-angle.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the cone's maximum clock angle.
+ * @type {Property}
*/
this.maximumClockAngle = undefined;
/**
- * A DynamicProperty of type Number which determines the cone's inner half-angle.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the cone's inner half-angle.
+ * @type {Property}
*/
this.innerHalfAngle = undefined;
/**
- * A DynamicProperty of type Number which determines the cone's outer half-angle.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the cone's outer half-angle.
+ * @type {Property}
*/
this.outerHalfAngle = undefined;
/**
- * A DynamicMaterialProperty which determines the cone's cap material.
- * @type {DynamicMaterialProperty}
- * @default undefined
+ * Gets or sets the {@link MaterialProperty} specifying the the cone's cap material.
+ * @type {MaterialProperty}
*/
this.capMaterial = undefined;
/**
- * A DynamicMaterialProperty which determines the cone's inner material.
- * @type {DynamicMaterialProperty}
- * @default undefined
+ * Gets or sets the {@link MaterialProperty} specifying the the cone's inner material.
+ * @type {MaterialProperty}
*/
this.innerMaterial = undefined;
/**
- * A DynamicMaterialProperty which determines the cone's outer material.
- * @type {DynamicMaterialProperty}
- * @default undefined
+ * Gets or sets the {@link MaterialProperty} specifying the the cone's outer material.
+ * @type {MaterialProperty}
*/
this.outerMaterial = undefined;
/**
- * A DynamicMaterialProperty which determines the cone's silhouette material.
- * @type {DynamicMaterialProperty}
- * @default undefined
+ * Gets or sets the {@link MaterialProperty} specifying the the cone's silhouette material.
+ * @type {MaterialProperty}
*/
this.silhouetteMaterial = undefined;
/**
- * A DynamicProperty of type Color which determines the color of the line formed by the intersection of the cone and other central bodies.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Color} {@link Property} specifying the color of the line formed by the intersection of the cone and other central bodies.
+ * @type {Property}
*/
this.intersectionColor = undefined;
/**
- * A DynamicProperty of type Number which determines the approximate pixel width of the line formed by the intersection of the cone and other central bodies.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the width of the line formed by the intersection of the cone and other central bodies.
+ * @type {Property}
*/
this.intersectionWidth = undefined;
/**
- * A DynamicProperty of type Boolean which determines the cone's intersection visibility
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the visibility of the line formed by the intersection of the cone and other central bodies.
+ * @type {Property}
*/
this.showIntersection = undefined;
/**
- * A DynamicProperty of type Number which determines the cone's radius.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the radius of the cone's projection.
+ * @type {Property}
*/
this.radius = undefined;
/**
- * A DynamicProperty of type Boolean which determines the cone's visibility
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the visibility of the cone.
+ * @type {Property}
*/
this.show = undefined;
};
@@ -105,8 +84,6 @@ define([
/**
* Given two DynamicObjects, takes the cone properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
@@ -138,8 +115,6 @@ define([
/**
* Given a DynamicObject, undefines the cone associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the cone from.
*/
diff --git a/Source/DynamicScene/DynamicEllipse.js b/Source/DynamicScene/DynamicEllipse.js
index 56e64b67da17..759c7050970a 100644
--- a/Source/DynamicScene/DynamicEllipse.js
+++ b/Source/DynamicScene/DynamicEllipse.js
@@ -14,36 +14,26 @@ define([
"use strict";
/**
- * Represents a time-dynamic ellipse, typically used in conjunction with DynamicEllipseVisualizer and
- * DynamicObjectCollection to visualize CZML.
+ * An optionally time-dynamic ellipse.
*
* @alias DynamicEllipse
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicEllipseVisualizer
- * @see VisualizerCollection
*/
var DynamicEllipse = function() {
/**
- * A DynamicProperty of type Number which determines the ellipse's semiMajorAxis.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the ellipse's semi-major-axis.
+ * @type {Property}
*/
this.semiMajorAxis = undefined;
/**
- * A DynamicProperty of type Number which determines the ellipse's semiMinorAxis.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the ellipse's semi-minor-axis.
+ * @type {Property}
*/
this.semiMinorAxis = undefined;
/**
- * A DynamicProperty of type Number which determines the bearing of the ellipse.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the ellipse's bearing.
+ * @type {Property}
*/
this.bearing = undefined;
@@ -57,8 +47,6 @@ define([
/**
* Given two DynamicObjects, takes the ellipse properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
@@ -80,8 +68,6 @@ define([
/**
* Given a DynamicObject, undefines the ellipse associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the ellipse from.
*/
diff --git a/Source/DynamicScene/DynamicEllipsoid.js b/Source/DynamicScene/DynamicEllipsoid.js
index 8e8d19a98ce6..70ae052898d0 100644
--- a/Source/DynamicScene/DynamicEllipsoid.js
+++ b/Source/DynamicScene/DynamicEllipsoid.js
@@ -8,36 +8,25 @@ define([
"use strict";
/**
- * Represents a time-dynamic ellipsoid, typically used in conjunction with DynamicEllipsoidVisualizer and
- * DynamicObjectCollection to visualize CZML.
+ * An optionally time-dynamic ellipsoid.
*
* @alias DynamicEllipsoid
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicEllipsoidVisualizer
- * @see VisualizerCollection
- * @see CustomSensor
*/
var DynamicEllipsoid = function() {
/**
- * A DynamicProperty of type Boolean which determines the ellipsoid's visibility.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the visibility of the ellipsoid.
+ * @type {Property}
*/
this.show = undefined;
/**
- * A DynamicProperty of type Cartesian3 which determines the ellipsoid's radii.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Cartesian3} {@link Property} specifying the radii of the ellipsoid.
+ * @type {Property}
*/
this.radii = undefined;
/**
- * A DynamicMaterialProperty which determines the material.
- * @type {DynamicMaterialProperty}
- * @default undefined
+ * Gets or sets the {@link MaterialProperty} specifying the appearance of the ellipsoid.
+ * @type {MaterialProperty}
*/
this.material = undefined;
};
@@ -45,8 +34,6 @@ define([
/**
* Given two DynamicObjects, takes the ellipsoid properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
@@ -68,8 +55,6 @@ define([
/**
* Given a DynamicObject, undefines the ellipsoid associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the ellipsoid from.
*/
diff --git a/Source/DynamicScene/DynamicLabel.js b/Source/DynamicScene/DynamicLabel.js
index 55c0aa977f32..2c503eddc3a1 100644
--- a/Source/DynamicScene/DynamicLabel.js
+++ b/Source/DynamicScene/DynamicLabel.js
@@ -8,91 +8,69 @@ define([
"use strict";
/**
- * Represents a time-dynamic label, typically used in conjunction with DynamicLabelVisualizer and
- * DynamicObjectCollection to visualize CZML.
- *
+ * An optionally time-dynamic label.
* @alias DynamicLabel
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicLabelVisualizer
- * @see VisualizerCollection
- * @see Label
- * @see LabelCollection
*/
var DynamicLabel = function() {
/**
- * A DynamicProperty of type String which determines the label's text.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the string {@link Property} specifying the the label's text.
+ * @type {Property}
*/
this.text = undefined;
/**
- * A DynamicProperty of type String which determines the label's font.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the string {@link Property} specifying the the label's font.
+ * @type {Property}
*/
this.font = undefined;
/**
- * A DynamicProperty of type LabelStyle which determines the label's style.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link LabelStyle} {@link Property} specifying the the label's style.
+ * @type {Property}
*/
this.style = undefined;
/**
- * A DynamicProperty of type Color which determines the label's fill color.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Color} {@link Property} specifying the the label's fill color.
+ * @type {Property}
*/
this.fillColor = undefined;
/**
- * A DynamicProperty of type Color which determines the label's outline color.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Color} {@link Property} specifying the the label's outline color.
+ * @type {Property}
*/
this.outlineColor = undefined;
/**
- * A DynamicProperty of type Number which determines the label's outline width.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the label outline's width.
+ * @type {Property}
*/
this.outlineWidth = undefined;
/**
- * A DynamicProperty of type HorizontalOrigin which determines the label's horizontal origin.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link HorizontalOrigin} {@link Property} specifying the label's horizontal origin.
+ * @type {Property}
*/
this.horizontalOrigin = undefined;
/**
- * A DynamicProperty of type VerticalOrigin which determines the label's vertical origin.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link VerticalOrigin} {@link Property} specifying the label's vertical origin.
+ * @type {Property}
*/
this.verticalOrigin = undefined;
/**
- * A DynamicProperty of type Cartesian3 which determines the label's eye offset.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Cartesian3} {@link Property} specifying the label's eye offset.
+ * @type {Property}
*/
this.eyeOffset = undefined;
/**
- * A DynamicProperty of type Cartesian2 which determines the label's pixel offset.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Cartesian2} {@link Property} specifying the label's pixel offset.
+ * @type {Property}
*/
this.pixelOffset = undefined;
/**
- * A DynamicProperty of type Number which determines the label's scale.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the label's scale.
+ * @type {Property}
*/
this.scale = undefined;
/**
- * A DynamicProperty of type Boolean which determines the label's visibility.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the label's visibility.
+ * @type {Property}
*/
this.show = undefined;
};
@@ -100,8 +78,6 @@ define([
/**
* Given two DynamicObjects, takes the label properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
@@ -132,8 +108,6 @@ define([
/**
* Given a DynamicObject, undefines the label associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the label from.
*/
diff --git a/Source/DynamicScene/DynamicObject.js b/Source/DynamicScene/DynamicObject.js
index ce4aeaa9eb85..c26a529a8794 100644
--- a/Source/DynamicScene/DynamicObject.js
+++ b/Source/DynamicScene/DynamicObject.js
@@ -16,7 +16,7 @@ define([
"use strict";
/**
- * DynamicObject instances are the primary data store for processed CZML data.
+ * DynamicObject instances are the primary data store for processed data.
* They are used primarily by the visualizers to create and maintain graphic
* primitives that represent the DynamicObject's properties at a specific time.
* @alias DynamicObject
@@ -24,17 +24,8 @@ define([
*
* @param {Object} [id] A unique identifier for this object. If no id is provided, a GUID is generated.
*
- * @see DynamicProperty
- * @see DynamicVertexiPositionsProperty
+ * @see Property
* @see DynamicObjectCollection
- * @see CompositeDynamicObjectCollection
- * @see DynamicBillboard
- * @see DynamicCone
- * @see DynamicLabel
- * @see DynamicPoint
- * @see DynamicPolygon
- * @see DynamicPolyline
- * @see DynamicPyramid
*/
var DynamicObject = function(id) {
this._cachedAvailabilityDate = undefined;
@@ -69,7 +60,7 @@ define([
/**
* Gets or sets the orientation.
- * @type {DynamicProperty}
+ * @type {Property}
* @default undefined
*/
this.orientation = undefined;
@@ -214,8 +205,7 @@ define([
/**
* Given two DynamicObjects, takes the position, orientation, vertexPositions and availability
* properties from the second and assigns them to the first, assuming such properties did not
- * already exist. This method is not normally called directly, but is part of the array of CZML
- * processing functions that is passed into the CompositeDynamicObjectCollection constructor.
+ * already exist.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
diff --git a/Source/DynamicScene/DynamicPath.js b/Source/DynamicScene/DynamicPath.js
index c6cc37ccb73c..a0c748d8d583 100644
--- a/Source/DynamicScene/DynamicPath.js
+++ b/Source/DynamicScene/DynamicPath.js
@@ -8,66 +8,49 @@ define([
"use strict";
/**
- * Represents a time-dynamic path, typically used in conjunction with DynamicPathVisualizer and
- * DynamicObjectCollection to visualize CZML.
- *
+ * A time-dynamic path representing the visualization of a moving object.
* @alias DynamicPath
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicPathVisualizer
- * @see VisualizerCollection
- * @see Polyline
*/
var DynamicPath = function() {
/**
- * A DynamicProperty of type Color which determines the line's color.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Color} {@link Property} specifying the the path's color.
+ * @type {Property}
*/
this.color = undefined;
/**
- * A DynamicProperty of type Color which determines the line's outline color.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Color} {@link Property} specifying the the path's outline color.
+ * @type {Property}
*/
this.outlineColor = undefined;
/**
- * A DynamicProperty of type Number which determines the line's outline width.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the path's outline width.
+ * @type {Property}
*/
this.outlineWidth = undefined;
/**
- * A DynamicProperty of type Boolean which determines the lines's visibility.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the path's visibility.
+ * @type {Property}
*/
this.show = undefined;
/**
- * A DynamicProperty of type Number which determines the line's width.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the path's width.
+ * @type {Property}
*/
this.width = undefined;
/**
- * A DynamicProperty of type Number which determines the maximum step size, in seconds, to take when sampling the position.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the maximum step size, in seconds, to take when sampling the position.
+ * @type {Property}
*/
this.resolution = undefined;
/**
- * A DynamicProperty of type Number which determines the number of seconds in front of the object to show.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the number of seconds in front of the object to show.
+ * @type {Property}
*/
this.leadTime = undefined;
/**
- * A DynamicProperty of type Number which determines the the number of seconds behind the object to show.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the number of seconds behind the object to show.
+ * @type {Property}
*/
this.trailTime = undefined;
};
@@ -75,8 +58,6 @@ define([
/**
* Given two DynamicObjects, takes the path properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
@@ -103,8 +84,6 @@ define([
/**
* Given a DynamicObject, undefines the path associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the path from.
*/
diff --git a/Source/DynamicScene/DynamicPoint.js b/Source/DynamicScene/DynamicPoint.js
index 46a5cf79e788..4383b2ad4252 100644
--- a/Source/DynamicScene/DynamicPoint.js
+++ b/Source/DynamicScene/DynamicPoint.js
@@ -8,44 +8,34 @@ define([
"use strict";
/**
- * Represents a time-dynamic point, typically used in conjunction with DynamicPointVisualizer and
- * DynamicObjectCollection to visualize CZML.
- *
+ * An optionally time-dynamic billboard.
* @alias DynamicPoint
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicPointVisualizer
- * @see VisualizerCollection
- * @see Billboard
- * @see BillboardCollection
*/
var DynamicPoint = function() {
/**
- * A DynamicProperty of type Color which determines the point's color.
- * @type DynamicProperty
+ * Gets or sets the {@link Color} {@link Property} specifying the the point's color.
+ * @type {Property}
*/
this.color = undefined;
/**
- * A DynamicProperty of type Number which determines the point's pixel size.
- * @type DynamicProperty
+ * Gets or sets the numeric {@link Property} specifying the point's size in pixels.
+ * @type {Property}
*/
this.pixelSize = undefined;
/**
- * A DynamicProperty of type Color which determines the point's outline color.
- * @type DynamicProperty
+ * Gets or sets the {@link Color} {@link Property} specifying the the point's outline color.
+ * @type {Property}
*/
this.outlineColor = undefined;
/**
- * A DynamicProperty of type Number which determines the point's outline width.
- * @type DynamicProperty
+ * Gets or sets the numeric {@link Property} specifying the the point's outline width.
+ * @type {Property}
*/
this.outlineWidth = undefined;
/**
- * A DynamicProperty of type Boolean which determines the point's visibility.
- * @type DynamicProperty
+ * Gets or sets the boolean {@link Property} specifying the point's visibility.
+ * @type {Property}
*/
this.show = undefined;
};
@@ -53,8 +43,6 @@ define([
/**
* Given two DynamicObjects, takes the point properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
@@ -78,8 +66,6 @@ define([
/**
* Given a DynamicObject, undefines the point associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the point from.
*/
diff --git a/Source/DynamicScene/DynamicPolygon.js b/Source/DynamicScene/DynamicPolygon.js
index cf2f4cde79b4..ff4922fdad6d 100644
--- a/Source/DynamicScene/DynamicPolygon.js
+++ b/Source/DynamicScene/DynamicPolygon.js
@@ -8,30 +8,20 @@ define([
"use strict";
/**
- * Represents a time-dynamic polygon, typically used in conjunction with DynamicPolygonVisualizer and
- * DynamicObjectCollection to visualize CZML.
+ * An optionally time-dynamic polygon.
*
* @alias DynamicPolygon
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicPolygonVisualizer
- * @see VisualizerCollection
- * @see Polygon
*/
var DynamicPolygon = function() {
/**
- * A DynamicProperty of type Boolean which determines the polygon's visibility.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the polygon's visibility.
+ * @type {Property}
*/
this.show = undefined;
/**
- * A DynamicMaterialProperty which determines the polygon's material.
- * @type {DynamicMaterialProperty}
- * @default undefined
+ * Gets or sets the {@link MaterialProperty} specifying the appearance of the polygon.
+ * @type {MaterialProperty}
*/
this.material = undefined;
};
@@ -39,8 +29,6 @@ define([
/**
* Given two DynamicObjects, takes the polygon properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
@@ -61,8 +49,6 @@ define([
/**
* Given a DynamicObject, undefines the polygon associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the polygon from.
*/
diff --git a/Source/DynamicScene/DynamicPolyline.js b/Source/DynamicScene/DynamicPolyline.js
index debd6f70fbaf..a08d6e13f976 100644
--- a/Source/DynamicScene/DynamicPolyline.js
+++ b/Source/DynamicScene/DynamicPolyline.js
@@ -8,48 +8,34 @@ function(
"use strict";
/**
- * Represents a time-dynamic polyline, typically used in conjunction with DynamicPolylineVisualizer and
- * DynamicObjectCollection to visualize CZML.
- *
+ * An optionally time-dynamic polyline.
* @alias DynamicPolyline
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicPolylineVisualizer
- * @see VisualizerCollection
- * @see Polyline
*/
var DynamicPolyline = function() {
/**
- * A DynamicProperty of type Color which determines the line's color.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Color} {@link Property} specifying the the line's color.
+ * @type {Property}
*/
this.color = undefined;
/**
- * A DynamicProperty of type Color which determines the line's outline color.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Color} {@link Property} specifying the the line's outline color.
+ * @type {Property}
*/
this.outlineColor = undefined;
/**
- * A DynamicProperty of type Number which determines the line's outline width.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the line's outline width.
+ * @type {Property}
*/
this.outlineWidth = undefined;
/**
- * A DynamicProperty of type Boolean which determines the lines's visibility.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the line's visibility.
+ * @type {Property}
*/
this.show = undefined;
/**
- * A DynamicProperty of type Number which determines the line's width.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the line's width.
+ * @type {Property}
*/
this.width = undefined;
};
@@ -57,8 +43,6 @@ function(
/**
* Given two DynamicObjects, takes the polyline properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
@@ -82,8 +66,6 @@ function(
/**
* Given a DynamicObject, undefines the polyline associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the polyline from.
*/
diff --git a/Source/DynamicScene/DynamicPyramid.js b/Source/DynamicScene/DynamicPyramid.js
index 628f0fef0006..cac9d288a810 100644
--- a/Source/DynamicScene/DynamicPyramid.js
+++ b/Source/DynamicScene/DynamicPyramid.js
@@ -8,60 +8,46 @@ define([
"use strict";
/**
- * Represents a time-dynamic pyramid, typically used in conjunction with DynamicPyramidVisualizer and
- * DynamicObjectCollection to visualize CZML.
+ * An optionally time-dynamic pyramid.
*
* @alias DynamicPyramid
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicPyramidVisualizer
- * @see VisualizerCollection
- * @see CustomSensor
*/
var DynamicPyramid = function() {
/**
- * A DynamicProperty of type Boolean which determines the pyramid's visibility.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the visibility of the pyramid.
+ * @type {Property}
*/
this.show = undefined;
/**
- * A Property which determines the projection of the pyramid.
+ * A {@link Property} which returns an array of {@link Spherical} instances representing the pyramid's projection.
* @type {Property}
* @default undefined
*/
this.directions = undefined;
/**
- * A DynamicProperty of type Number which determines the pyramid's radius.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the radius of the pyramid's projection.
+ * @type {Property}
*/
this.radius = undefined;
/**
- * A DynamicProperty of type Boolean which determines the pyramid's intersection visibility.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the visibility of the line formed by the intersection of the pyramid and other central bodies.
+ * @type {Property}
*/
this.showIntersection = undefined;
/**
- * A DynamicProperty of type Color which determines the color of the line formed by the intersection of the pyramid and other central bodies.
- * @type {DynamicProperty}
- * @default undefined
+ * 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.
+ * @type {Property}
*/
this.intersectionColor = undefined;
/**
- * A DynamicProperty of type Number which determines the approximate pixel width of the line formed by the intersection of the pyramid and other central bodies.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the width of the line formed by the intersection of the pyramid and other central bodies.
+ * @type {Property}
*/
this.intersectionWidth = undefined;
/**
- * A DynamicMaterialProperty which determines the material.
- * @type {DynamicMaterialProperty}
- * @default undefined
+ * Gets or sets the {@link MaterialProperty} specifying the the pyramid's appearance.
+ * @type {MaterialProperty}
*/
this.material = undefined;
};
@@ -69,8 +55,6 @@ define([
/**
* Given two DynamicObjects, takes the pyramid properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
@@ -96,8 +80,6 @@ define([
/**
* Given a DynamicObject, undefines the pyramid associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the pyramid from.
*/
diff --git a/Source/DynamicScene/DynamicVector.js b/Source/DynamicScene/DynamicVector.js
index b167d605ffdc..4ea710a85355 100644
--- a/Source/DynamicScene/DynamicVector.js
+++ b/Source/DynamicScene/DynamicVector.js
@@ -8,47 +8,34 @@ define([
"use strict";
/**
- * Represents a time-dynamic vector, typically used in conjunction with DynamicVectorVisualizer and
- * DynamicObjectCollection to visualize CZML.
- *
+ * An optionally time-dynamic vector.
* @alias DynamicVector
* @constructor
- *
- * @see DynamicObject
- * @see DynamicProperty
- * @see DynamicObjectCollection
- * @see DynamicVectorVisualizer
- * @see VisualizerCollection
*/
var DynamicVector = function() {
/**
- * A DynamicProperty of type Color which determines the vector's color.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Color} {@link Property} specifying the the vector's color.
+ * @type {Property}
*/
this.color = undefined;
/**
- * A DynamicProperty of type Boolean which determines the vector's visibility.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the boolean {@link Property} specifying the vector's visibility.
+ * @type {Property}
*/
this.show = undefined;
/**
- * A DynamicProperty of type Number which determines the vector's width.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the vector's width.
+ * @type {Property}
*/
this.width = undefined;
/**
- * A DynamicProperty of type Cartesian3 which determines the vector's direction.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the {@link Cartesian3} {@link Property} specifying the the vector's direction.
+ * @type {Property}
*/
this.direction = undefined;
/**
- * A DynamicProperty of type Number which determines the vector's graphical length.
- * @type {DynamicProperty}
- * @default undefined
+ * Gets or sets the numeric {@link Property} specifying the the vector's graphical length in meters.
+ * @type {Property}
*/
this.length = undefined;
};
@@ -56,8 +43,6 @@ define([
/**
* Given two DynamicObjects, takes the vector properties from the second
* and assigns them to the first, assuming such a property did not already exist.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} targetObject The DynamicObject which will have properties merged onto it.
* @param {DynamicObject} objectToMerge The DynamicObject containing properties to be merged.
@@ -81,8 +66,6 @@ define([
/**
* Given a DynamicObject, undefines the vector associated with it.
- * This method is not normally called directly, but is part of the array of CZML processing
- * functions that is passed into the CompositeDynamicObjectCollection constructor.
*
* @param {DynamicObject} dynamicObject The DynamicObject to remove the vector from.
*/
From 17b81e14eb51cc8cb80965070afe06425caf26e4 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 26 Aug 2013 16:12:41 -0400
Subject: [PATCH 57/65] Remove `CzmlDataSource.processCzml` as it's no longer
needed.
---
Source/DynamicScene/CzmlDataSource.js | 33 ++-----------------
.../CompositeDynamicObjectCollectionSpec.js | 12 +++----
.../DynamicVertexPositionsPropertySpec.js | 2 +-
3 files changed, 9 insertions(+), 38 deletions(-)
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index d637e39e5be9..7a709c58845b 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -1126,7 +1126,7 @@ define([
function loadCzml(dataSource, czml, sourceUri) {
var dynamicObjectCollection = dataSource._dynamicObjectCollection;
- CzmlDataSource.processCzml(czml, dynamicObjectCollection, sourceUri);
+ CzmlDataSource._processCzml(czml, dynamicObjectCollection, sourceUri);
var availability = dynamicObjectCollection.computeAvailability();
var clock;
@@ -1299,36 +1299,7 @@ define([
});
};
- /**
- * Processes the provided CZML, creating or updating DynamicObject instances for each
- * corresponding CZML identifier.
- * @exports processCzml
- *
- * @param {Object} czml The parsed CZML object to be processed.
- * @param {DynamicObjectCollection} dynamicObjectCollection The collection to create or updated objects within.
- * @param {String} [sourceUri] The uri of the file where the CZML originated from. If provided, relative uri look-ups will use this as their base.
- * @param {Array} [updaterFunctions=CzmlDataSource.updaters] The array of updated functions to use for processing. If left undefined, all standard CZML data is processed.
- *
- * @exception {DeveloperError} czml is required.
- * @exception {DeveloperError} dynamicObjectCollection is required.
- *
- * @returns An array containing all DynamicObject instances that were created or updated.
- *
- * @example
- * var url = 'http://someUrl.com/myCzmlFile.czml';
- * var dynamicObjectCollection = new DynamicObjectCollection();
- * loadJson(url).then(function(czml) {
- * CzmlDataSource.processCzml(czml, dynamicObjectCollection, url);
- * });
- */
- CzmlDataSource.processCzml = function(czml, dynamicObjectCollection, sourceUri, updaterFunctions) {
- if (!defined(czml)) {
- throw new DeveloperError('czml is required.');
- }
- if (!defined(dynamicObjectCollection)) {
- throw new DeveloperError('dynamicObjectCollection is required.');
- }
-
+ CzmlDataSource._processCzml = function(czml, dynamicObjectCollection, sourceUri, updaterFunctions) {
var updatedObjects = [];
var updatedObjectsHash = {};
updaterFunctions = defined(updaterFunctions) ? updaterFunctions : updaters;
diff --git a/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js b/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
index ea0b56c98e59..0b384b5b50db 100644
--- a/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
+++ b/Specs/DynamicScene/CompositeDynamicObjectCollectionSpec.js
@@ -118,10 +118,10 @@ defineSuite([
it('setCollections works with existing dynamicObjectCollections', function() {
var dynamicObjectCollection1 = new DynamicObjectCollection();
- CzmlDataSource.processCzml(czml1, dynamicObjectCollection1);
+ CzmlDataSource._processCzml(czml1, dynamicObjectCollection1);
var dynamicObjectCollection2 = new DynamicObjectCollection();
- CzmlDataSource.processCzml(czml2, dynamicObjectCollection2);
+ CzmlDataSource._processCzml(czml2, dynamicObjectCollection2);
var compositeDynamicObjectCollection = new CompositeDynamicObjectCollection();
compositeDynamicObjectCollection.setCollections([dynamicObjectCollection1, dynamicObjectCollection2]);
@@ -140,10 +140,10 @@ defineSuite([
it('Constructing with existing dynamicObjectCollections merges expected objects', function() {
var dynamicObjectCollection1 = new DynamicObjectCollection();
- CzmlDataSource.processCzml(czml1, dynamicObjectCollection1);
+ CzmlDataSource._processCzml(czml1, dynamicObjectCollection1);
var dynamicObjectCollection2 = new DynamicObjectCollection();
- CzmlDataSource.processCzml(czml2, dynamicObjectCollection2);
+ CzmlDataSource._processCzml(czml2, dynamicObjectCollection2);
var compositeDynamicObjectCollection = new CompositeDynamicObjectCollection([dynamicObjectCollection1, dynamicObjectCollection2]);
@@ -173,7 +173,7 @@ defineSuite([
'horizontalOrigin' : 'CENTER'
}
};
- CzmlDataSource.processCzml(czml3, dynamicObjectCollection1);
+ CzmlDataSource._processCzml(czml3, dynamicObjectCollection1);
var objects = compositeDynamicObjectCollection.getObjects();
expect(objects.length).toEqual(1);
@@ -193,7 +193,7 @@ defineSuite([
'scale' : 3.0
}
};
- CzmlDataSource.processCzml(czml4, dynamicObjectCollection2);
+ CzmlDataSource._processCzml(czml4, dynamicObjectCollection2);
objects = compositeDynamicObjectCollection.getObjects();
expect(objects.length).toEqual(1);
diff --git a/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js b/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js
index 7d97963f7a1d..a3fe97d2efa8 100644
--- a/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js
+++ b/Specs/DynamicScene/DynamicVertexPositionsPropertySpec.js
@@ -126,7 +126,7 @@ defineSuite([
it('getValue works for reference data', function() {
var objects = new DynamicObjectCollection();
- CzmlDataSource.processCzml(testObjects, objects);
+ CzmlDataSource._processCzml(testObjects, objects);
var test1 = objects.getObject('test1');
var test2 = objects.getObject('test2');
var test3 = objects.getObject('test3');
From b817bcb7bc8712841d4a482d1eee108bcfbcc94a Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 26 Aug 2013 16:47:29 -0400
Subject: [PATCH 58/65] Update CHANGES
---
CHANGES.md | 24 ++++++++++++++
Source/Core/PackableNumber.js | 43 --------------------------
Source/DynamicScene/SampledProperty.js | 14 +++++++--
3 files changed, 36 insertions(+), 45 deletions(-)
delete mode 100644 Source/Core/PackableNumber.js
diff --git a/CHANGES.md b/CHANGES.md
index 8067f5b703ba..509b1313f13c 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -4,6 +4,30 @@ Change Log
Beta Releases
-------------
+### b21 - 2013-10-01
+* Breaking changes:
+ * Removed `processCzml`, use `CzmlDataSource` instead.
+ * Completely refactored the `DynamicScene` property system. See [#1080](https://github.com/AnalyticalGraphicsInc/cesium/pull/1080) for complete details.
+ * Removed `CzmlBoolean`, `CzmlCartesian2`, `CzmlCartesian3`, `CzmlColor`, `CzmlDefaults`, `CzmlDirection`, `CzmlHorizontalOrigin`, `CzmlImage`, `CzmlLabelStyle`, `CzmlNumber`, `CzmlPosition`, `CzmlString`, `CzmlUnitCartesian3`, `CzmlUnitQuaternion`, `CzmlUnitSpherical`, and `CzmlVerticalOrigin` since they are no longer needed.
+ * Removed `DynamicProperty', `DynamicMaterialProperty`, `DynamicDirectionsProperty`, and `DynamicVertexPositionsProperty`; replacing them with an all new system of properties.
+ * `Property` - base interface for all properties.
+ * `CompositeProperty` - a property composed of other properties.
+ * `ConstantProperty` - a property whose value never changes.
+ * `SampledProperty` - a property whose value is interpolated from a set of samples.
+ * `TimeIntervalCollectionProperty` - a property whose value changes based on time interval.
+ * `MaterialProperty` - base interface for all material properties.
+ * `CompositeMaterialProperty` - a `CompositeProperty` for materials.
+ * `ColorMaterialProperty` - a property that maps to a color material. (replaces `DynamicColorMaterial`)
+ * `GridMaterialProperty` - a property that maps to a grid material. (replaces `DynamicGridMaterial`)
+ * `ImageMaterialProperty` - a property that maps to an image material. (replaces `DynamicImageMaterial`)
+ * `PositionProperty`- base interface for all position properties.
+ * `CompositePositionProperty` - a `CompositeProperty` for positions.
+ * `ConstantPositionProperty` - a whose value does not change in respect to the `ReferenceFrame` in which is it defined.
+ * `SampledPositionProperty` - a `SampledProperty` for positions.
+ * `TimeIntervalCollectionPositionProperty` - A `TimeIntervalCollectionProperty` for positions.
+* Added `Packable` and `PackableForInterpolation` interfaces to aid interpolation and in-memory data storage. Also made most core Cesium types implement them.
+* Added `InterpolationAlgorithm` interface to codify the base interface already being used by `LagrangePolynomialApproximation, `LinearApproximation`, and `HermitePolynomialApproximation`.
+
### b20 - 2013-09-03
_This releases fixes 2D and other issues with Chrome 29.0.1547.57 ([#1002](https://github.com/AnalyticalGraphicsInc/cesium/issues/1002) and [#1047](https://github.com/AnalyticalGraphicsInc/cesium/issues/1047))._
diff --git a/Source/Core/PackableNumber.js b/Source/Core/PackableNumber.js
deleted file mode 100644
index 0bc3f4a62843..000000000000
--- a/Source/Core/PackableNumber.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*global define*/
-define([
- '../Core/defaultValue',
- '../Core/defined',
- '../Core/DeveloperError'
- ], function(
- defaultValue,
- defined,
- DeveloperError) {
- "use strict";
-
- /**
- * @private
- */
- var PackableNumber = {
-
- packedLength : 1,
-
- pack : function(value, array, startingIndex) {
- if (!defined(value)) {
- throw new DeveloperError('value is required');
- }
-
- if (!defined(array)) {
- throw new DeveloperError('array is required');
- }
-
- startingIndex = defaultValue(startingIndex, 0);
-
- array[startingIndex] = value;
- },
-
- unpack : function(array, startingIndex, result) {
- if (!defined(array)) {
- throw new DeveloperError('array is required');
- }
-
- startingIndex = defaultValue(startingIndex, 0);
- return array[startingIndex];
- }
- };
- return PackableNumber;
-});
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index 50c5ce9343ef..e0bad7246354 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -5,7 +5,6 @@ define([
'../Core/defined',
'../Core/defineProperties',
'../Core/DeveloperError',
- '../Core/PackableNumber',
'../Core/JulianDate',
'../Core/LinearApproximation'
], function(
@@ -14,11 +13,22 @@ define([
defined,
defineProperties,
DeveloperError,
- PackableNumber,
JulianDate,
LinearApproximation) {
"use strict";
+ var PackableNumber = {
+ packedLength : 1,
+ pack : function(value, array, startingIndex) {
+ startingIndex = defaultValue(startingIndex, 0);
+ array[startingIndex] = value;
+ },
+ unpack : function(array, startingIndex, result) {
+ startingIndex = defaultValue(startingIndex, 0);
+ return array[startingIndex];
+ }
+ };
+
//We can't use splice for inserting new elements because function apply can't handle
//a huge number of arguments. See https://code.google.com/p/chromium/issues/detail?id=56588
function arrayInsert(array, startIndex, items) {
From e801dd5bcea8f7488b7ef5a5fc74141174e041a9 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Mon, 26 Aug 2013 17:02:04 -0400
Subject: [PATCH 59/65] Fix bad markdown.
---
CHANGES.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 509b1313f13c..6727d2addca8 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -7,9 +7,9 @@ Beta Releases
### b21 - 2013-10-01
* Breaking changes:
* Removed `processCzml`, use `CzmlDataSource` instead.
- * Completely refactored the `DynamicScene` property system. See [#1080](https://github.com/AnalyticalGraphicsInc/cesium/pull/1080) for complete details.
+ * Completely refactored the `DynamicScene` property system to vastly improve the API. See [#1080](https://github.com/AnalyticalGraphicsInc/cesium/pull/1080) for complete details.
* Removed `CzmlBoolean`, `CzmlCartesian2`, `CzmlCartesian3`, `CzmlColor`, `CzmlDefaults`, `CzmlDirection`, `CzmlHorizontalOrigin`, `CzmlImage`, `CzmlLabelStyle`, `CzmlNumber`, `CzmlPosition`, `CzmlString`, `CzmlUnitCartesian3`, `CzmlUnitQuaternion`, `CzmlUnitSpherical`, and `CzmlVerticalOrigin` since they are no longer needed.
- * Removed `DynamicProperty', `DynamicMaterialProperty`, `DynamicDirectionsProperty`, and `DynamicVertexPositionsProperty`; replacing them with an all new system of properties.
+ * Removed `DynamicProperty`, `DynamicMaterialProperty`, `DynamicDirectionsProperty`, and `DynamicVertexPositionsProperty`; replacing them with an all new system of properties.
* `Property` - base interface for all properties.
* `CompositeProperty` - a property composed of other properties.
* `ConstantProperty` - a property whose value never changes.
@@ -26,7 +26,7 @@ Beta Releases
* `SampledPositionProperty` - a `SampledProperty` for positions.
* `TimeIntervalCollectionPositionProperty` - A `TimeIntervalCollectionProperty` for positions.
* Added `Packable` and `PackableForInterpolation` interfaces to aid interpolation and in-memory data storage. Also made most core Cesium types implement them.
-* Added `InterpolationAlgorithm` interface to codify the base interface already being used by `LagrangePolynomialApproximation, `LinearApproximation`, and `HermitePolynomialApproximation`.
+* Added `InterpolationAlgorithm` interface to codify the base interface already being used by `LagrangePolynomialApproximation`, `LinearApproximation`, and `HermitePolynomialApproximation`.
### b20 - 2013-09-03
From 8a8e07d0056e3dd558992e24db2b9470f142639f Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 27 Aug 2013 11:45:13 -0400
Subject: [PATCH 60/65] Changes after review.
---
CHANGES.md | 2 +-
Source/Core/PackableForInterpolation.js | 2 +-
Source/Core/Quaternion.js | 6 +-
Source/Core/TimeIntervalCollection.js | 16 +++++
.../DynamicScene/CompositeMaterialProperty.js | 18 ++---
.../DynamicScene/CompositePositionProperty.js | 9 +--
Source/DynamicScene/CompositeProperty.js | 9 +--
Source/DynamicScene/CzmlDataSource.js | 72 ++++++++++---------
.../DynamicConeVisualizerUsingCustomSensor.js | 2 +-
.../DynamicEllipsoidVisualizer.js | 2 +-
.../DynamicScene/DynamicPolygonVisualizer.js | 2 +-
.../DynamicScene/DynamicPyramidVisualizer.js | 2 +-
Source/DynamicScene/MaterialProperty.js | 6 +-
.../DynamicScene/SampledPositionProperty.js | 2 +-
Source/DynamicScene/SampledProperty.js | 12 ++--
.../TimeIntervalCollectionPositionProperty.js | 10 +--
.../TimeIntervalCollectionProperty.js | 20 +++---
Specs/Core/TimeIntervalCollectionSpec.js | 24 +++++++
Specs/DynamicScene/SampledPropertySpec.js | 14 ++--
19 files changed, 125 insertions(+), 105 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 6727d2addca8..1e96172a73c3 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -22,7 +22,7 @@ Beta Releases
* `ImageMaterialProperty` - a property that maps to an image material. (replaces `DynamicImageMaterial`)
* `PositionProperty`- base interface for all position properties.
* `CompositePositionProperty` - a `CompositeProperty` for positions.
- * `ConstantPositionProperty` - a whose value does not change in respect to the `ReferenceFrame` in which is it defined.
+ * `ConstantPositionProperty` - a `PositionProperty` whose value does not change in respect to the `ReferenceFrame` in which is it defined.
* `SampledPositionProperty` - a `SampledProperty` for positions.
* `TimeIntervalCollectionPositionProperty` - A `TimeIntervalCollectionProperty` for positions.
* Added `Packable` and `PackableForInterpolation` interfaces to aid interpolation and in-memory data storage. Also made most core Cesium types implement them.
diff --git a/Source/Core/PackableForInterpolation.js b/Source/Core/PackableForInterpolation.js
index f9e3a781ea2a..cbcb5c10298e 100644
--- a/Source/Core/PackableForInterpolation.js
+++ b/Source/Core/PackableForInterpolation.js
@@ -29,7 +29,7 @@ define(['../Core/DeveloperError'], function(DeveloperError) {
* @param {Array} packedArray The packed array.
* @param {Number} [startingIndex=0] The index of the first element to be converted.
* @param {Number} [lastIndex=packedArray.length] The index of the last element to be converted.
- * @param {Object} [result] The object into which to store the result.
+ * @param {Array} [result] The object into which to store the result.
*
* @exception {DeveloperError} packedArray is required.
*/
diff --git a/Source/Core/Quaternion.js b/Source/Core/Quaternion.js
index b4d76ed66a6d..b0d3dfb49398 100644
--- a/Source/Core/Quaternion.js
+++ b/Source/Core/Quaternion.js
@@ -256,7 +256,7 @@ define([
* @param {Array} packedArray The packed array.
* @param {Number} [startingIndex=0] The index of the first element to be converted.
* @param {Number} [lastIndex=packedArray.length] The index of the last element to be converted.
- * @param {Quaternion} [result] The object into which to store the result.
+ * @param {Array} [result] The object into which to store the result.
*
* @exception {DeveloperError} packedArray is required.
*/
@@ -307,9 +307,7 @@ define([
Quaternion.unpack(sourceArray, lastIndex * 4, sampledQuaternionQuaternion0);
if (magnitude === 0) {
- //Can't just use Quaternion.IDENTITY here because sampledQuaternionTempQuaternion may be modified in the future.
- sampledQuaternionTempQuaternion.x = sampledQuaternionTempQuaternion.y = sampledQuaternionTempQuaternion.z = 0.0;
- sampledQuaternionTempQuaternion.w = 1.0;
+ Quaternion.clone(Quaternion.IDENTITY, sampledQuaternionTempQuaternion);
} else {
Quaternion.fromAxisAngle(sampledQuaternionRotation, magnitude, sampledQuaternionTempQuaternion);
}
diff --git a/Source/Core/TimeIntervalCollection.js b/Source/Core/TimeIntervalCollection.js
index 7282f44541c9..d31f772ea4bf 100644
--- a/Source/Core/TimeIntervalCollection.js
+++ b/Source/Core/TimeIntervalCollection.js
@@ -115,6 +115,22 @@ define([
return index >= 0 ? this._intervals[index] : undefined;
};
+ /**
+ * Returns the data for the interval which contains the specified date.
+ *
+ * @param {JulianDate} date The date to search for.
+ *
+ * @memberof TimeIntervalCollection
+ *
+ * @returns The data for the interval containing the specified date, or undefined if no such interval exists.
+ *
+ * @exception {DeveloperError} date is required.
+ */
+ TimeIntervalCollection.prototype.findDataForIntervalContainingDate = function(date) {
+ var index = this.indexOf(date);
+ return index >= 0 ? this._intervals[index].data : undefined;
+ };
+
/**
* Returns true if the specified date is contained in the interval collection.
*
diff --git a/Source/DynamicScene/CompositeMaterialProperty.js b/Source/DynamicScene/CompositeMaterialProperty.js
index 44f4dc7ffbce..557a17444201 100644
--- a/Source/DynamicScene/CompositeMaterialProperty.js
+++ b/Source/DynamicScene/CompositeMaterialProperty.js
@@ -47,12 +47,9 @@ define([
throw new DeveloperError('time is required');
}
- var interval = this._intervals.findIntervalContainingDate(time);
- if (defined(interval)) {
- var data = interval.data;
- if (defined(data)) {
- return data.getType(time);
- }
+ var innerProperty = this._intervals.findDataForIntervalContainingDate(time);
+ if (defined(innerProperty)) {
+ return innerProperty.getType(time);
}
return undefined;
};
@@ -72,12 +69,9 @@ define([
throw new DeveloperError('time is required');
}
- var interval = this._intervals.findIntervalContainingDate(time);
- if (defined(interval)) {
- var data = interval.data;
- if (defined(data)) {
- return data.getValue(time, result);
- }
+ var innerProperty = this._intervals.findDataForIntervalContainingDate(time);
+ if (defined(innerProperty)) {
+ return innerProperty.getValue(time, result);
}
return undefined;
};
diff --git a/Source/DynamicScene/CompositePositionProperty.js b/Source/DynamicScene/CompositePositionProperty.js
index e9fcfd1ffa30..d9d05d65c9af 100644
--- a/Source/DynamicScene/CompositePositionProperty.js
+++ b/Source/DynamicScene/CompositePositionProperty.js
@@ -92,12 +92,9 @@ define([
throw new DeveloperError('referenceFrame is required.');
}
- var interval = this._intervals.findIntervalContainingDate(time);
- if (defined(interval)) {
- var data = interval.data;
- if (defined(data)) {
- return data.getValueInReferenceFrame(time, referenceFrame, result);
- }
+ var innerProperty = this._intervals.findDataForIntervalContainingDate(time);
+ if (defined(innerProperty)) {
+ return innerProperty.getValueInReferenceFrame(time, referenceFrame, result);
}
return undefined;
};
diff --git a/Source/DynamicScene/CompositeProperty.js b/Source/DynamicScene/CompositeProperty.js
index f03b764b81d1..db7daa3bf110 100644
--- a/Source/DynamicScene/CompositeProperty.js
+++ b/Source/DynamicScene/CompositeProperty.js
@@ -67,12 +67,9 @@ define([
throw new DeveloperError('time is required');
}
- var interval = this._intervals.findIntervalContainingDate(time);
- if (defined(interval)) {
- var data = interval.data;
- if (defined(data)) {
- return data.getValue(time, result);
- }
+ var innerProperty = this._intervals.findDataForIntervalContainingDate(time);
+ if (defined(innerProperty)) {
+ return innerProperty.getValue(time, result);
}
return undefined;
};
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index 7a709c58845b..d4b26b2ac237 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -193,15 +193,14 @@ define([
return result;
}
- var tmp = scratchCartesian;
var cartographic = czmlInterval.cartographicRadians;
if (defined(cartographic)) {
if (cartographic.length === 3) {
scratchCartographic.longitude = cartographic[0];
scratchCartographic.latitude = cartographic[1];
scratchCartographic.height = cartographic[2];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
- result = [tmp.x, tmp.y, tmp.z];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, scratchCartesian);
+ result = [scratchCartesian.x, scratchCartesian.y, scratchCartesian.z];
} else {
len = cartographic.length;
result = new Array(len);
@@ -209,12 +208,12 @@ define([
scratchCartographic.longitude = cartographic[i + 0];
scratchCartographic.latitude = cartographic[i + 1];
scratchCartographic.height = cartographic[i + 2];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, scratchCartesian);
result[i] = cartographic[i];
- result[i + 1] = tmp.x;
- result[i + 2] = tmp.y;
- result[i + 3] = tmp.z;
+ result[i + 1] = scratchCartesian.x;
+ result[i + 2] = scratchCartesian.y;
+ result[i + 3] = scratchCartesian.z;
}
}
return result;
@@ -229,8 +228,8 @@ define([
scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[0]);
scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[1]);
scratchCartographic.height = cartographicDegrees[2];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
- result = [tmp.x, tmp.y, tmp.z];
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, scratchCartesian);
+ result = [scratchCartesian.x, scratchCartesian.y, scratchCartesian.z];
} else {
len = cartographicDegrees.length;
result = new Array(len);
@@ -238,12 +237,12 @@ define([
scratchCartographic.longitude = CesiumMath.toRadians(cartographicDegrees[i + 1]);
scratchCartographic.latitude = CesiumMath.toRadians(cartographicDegrees[i + 2]);
scratchCartographic.height = cartographicDegrees[i + 3];
- Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, tmp);
+ Ellipsoid.WGS84.cartographicToCartesian(scratchCartographic, scratchCartesian);
result[i] = cartographicDegrees[i];
- result[i + 1] = tmp.x;
- result[i + 2] = tmp.y;
- result[i + 3] = tmp.z;
+ result[i + 1] = scratchCartesian.x;
+ result[i + 2] = scratchCartesian.y;
+ result[i + 3] = scratchCartesian.z;
}
}
@@ -714,7 +713,7 @@ define([
return processPacketData(Quaternion, dynamicObject, 'orientation', orientationData, undefined, sourceUri);
}
- function processVertexPositions(dynamicObject, packet, dynamicObjectCollection) {
+ function processVertexPositions(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var vertexPositionsData = packet.vertexPositions;
if (!defined(vertexPositionsData)) {
return false;
@@ -729,7 +728,7 @@ define([
return propertyCreated;
}
- function processAvailability(dynamicObject, packet) {
+ function processAvailability(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
var availability = packet.availability;
if (!defined(availability)) {
return false;
@@ -1087,24 +1086,6 @@ define([
return vectorUpdated;
}
- var updaters = [processClock,//
- processBillboard, //
- processEllipse, //
- processEllipsoid, //
- processCone, //
- processLabel, //
- processPath, //
- processPoint, //
- processPolygon, //
- processPolyline, //
- processPyramid, //
- processVector, //
- processPosition, //
- processViewFrom, //
- processOrientation, //
- processVertexPositions, //
- processAvailability];
-
function processCzmlPacket(packet, dynamicObjectCollection, updatedObjects, updatedObjectsHash, updaterFunctions, sourceUri) {
var objectId = packet.id;
if (!defined(objectId)) {
@@ -1166,6 +1147,29 @@ define([
this._timeVarying = true;
};
+ /**
+ * Gets the array of CZML processing functions.
+ * @memberof CzmlDataSource
+ * @type Array
+ */
+ CzmlDataSource.updaters = [processClock,//
+ processBillboard, //
+ processEllipse, //
+ processEllipsoid, //
+ processCone, //
+ processLabel, //
+ processPath, //
+ processPoint, //
+ processPolygon, //
+ processPolyline, //
+ processPyramid, //
+ processVector, //
+ processPosition, //
+ processViewFrom, //
+ processOrientation, //
+ processVertexPositions, //
+ processAvailability];
+
/**
* Gets an event that will be raised when non-time-varying data changes
* or if the return value of getIsTimeVarying changes.
@@ -1302,7 +1306,7 @@ define([
CzmlDataSource._processCzml = function(czml, dynamicObjectCollection, sourceUri, updaterFunctions) {
var updatedObjects = [];
var updatedObjectsHash = {};
- updaterFunctions = defined(updaterFunctions) ? updaterFunctions : updaters;
+ updaterFunctions = defined(updaterFunctions) ? updaterFunctions : CzmlDataSource.updaters;
if (Array.isArray(czml)) {
for ( var i = 0, len = czml.length; i < len; i++) {
diff --git a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
index eefa81a4d4b4..cd02d78f858c 100644
--- a/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
+++ b/Source/DynamicScene/DynamicConeVisualizerUsingCustomSensor.js
@@ -362,7 +362,7 @@ define([
cone._visualizerOrientation = orientation.clone(cone._visualizerOrientation);
}
- cone.material = MaterialProperty.GetValue(time, context, dynamicCone.outerMaterial, cone.material);
+ cone.material = MaterialProperty.getValue(time, context, dynamicCone.outerMaterial, cone.material);
property = dynamicCone.intersectionColor;
if (defined(property)) {
diff --git a/Source/DynamicScene/DynamicEllipsoidVisualizer.js b/Source/DynamicScene/DynamicEllipsoidVisualizer.js
index 81f6523e7feb..2f09a250ddad 100644
--- a/Source/DynamicScene/DynamicEllipsoidVisualizer.js
+++ b/Source/DynamicScene/DynamicEllipsoidVisualizer.js
@@ -254,7 +254,7 @@ define([
ellipsoid._visualizerOrientation = orientation.clone(ellipsoid._visualizerOrientation);
}
- ellipsoid.material = MaterialProperty.GetValue(time, context, dynamicEllipsoid.material, ellipsoid.material);
+ ellipsoid.material = MaterialProperty.getValue(time, context, dynamicEllipsoid.material, ellipsoid.material);
}
DynamicEllipsoidVisualizer.prototype._onObjectsRemoved = function(dynamicObjectCollection, dynamicObjects) {
diff --git a/Source/DynamicScene/DynamicPolygonVisualizer.js b/Source/DynamicScene/DynamicPolygonVisualizer.js
index f2f46b81bf84..9afe1b3ea1ba 100644
--- a/Source/DynamicScene/DynamicPolygonVisualizer.js
+++ b/Source/DynamicScene/DynamicPolygonVisualizer.js
@@ -238,7 +238,7 @@ define([
polygon._visualizerPositions = vertexPositions;
}
- polygon.material = MaterialProperty.GetValue(time, context, dynamicPolygon.material, polygon.material);
+ polygon.material = MaterialProperty.getValue(time, context, dynamicPolygon.material, polygon.material);
}
DynamicPolygonVisualizer.prototype._onObjectsRemoved = function(dynamicObjectCollection, dynamicObjects) {
diff --git a/Source/DynamicScene/DynamicPyramidVisualizer.js b/Source/DynamicScene/DynamicPyramidVisualizer.js
index 9fc3d92c31c2..5c15824c6d40 100644
--- a/Source/DynamicScene/DynamicPyramidVisualizer.js
+++ b/Source/DynamicScene/DynamicPyramidVisualizer.js
@@ -266,7 +266,7 @@ define([
orientation.clone(pyramid._visualizerOrientation);
}
- pyramid.material = MaterialProperty.GetValue(time, context, dynamicPyramid.material, pyramid.material);
+ pyramid.material = MaterialProperty.getValue(time, context, dynamicPyramid.material, pyramid.material);
var property = dynamicPyramid.intersectionColor;
if (defined(property)) {
diff --git a/Source/DynamicScene/MaterialProperty.js b/Source/DynamicScene/MaterialProperty.js
index 26fc7bd63979..00102a079092 100644
--- a/Source/DynamicScene/MaterialProperty.js
+++ b/Source/DynamicScene/MaterialProperty.js
@@ -34,9 +34,7 @@ define([
* @param {JulianDate} time The time for which to retrieve the type.
* @type {String} The type of material.
*/
- MaterialProperty.prototype.getType = function(time) {
- throwInstantiationError();
- };
+ MaterialProperty.prototype.getType = throwInstantiationError;
/**
* Gets the value of the property at the provided time.
@@ -53,7 +51,7 @@ define([
/**
* @private
*/
- MaterialProperty.GetValue = function(time, context, materialProperty, material) {
+ MaterialProperty.getValue = function(time, context, materialProperty, material) {
if (defined(materialProperty)) {
var type = materialProperty.getType(time);
if (!defined(material) || (material.type !== type)) {
diff --git a/Source/DynamicScene/SampledPositionProperty.js b/Source/DynamicScene/SampledPositionProperty.js
index 46876162ecfc..048ab08fac44 100644
--- a/Source/DynamicScene/SampledPositionProperty.js
+++ b/Source/DynamicScene/SampledPositionProperty.js
@@ -151,7 +151,7 @@ define([
* @memberof SampledPositionProperty
*
* @param {Array} packedSamples The array of packed samples.
- * @param {JulianDate} [epoch] If any of the dates in packedSamples are numbers, they are considered an offset from this epoch.
+ * @param {JulianDate} [epoch] If any of the dates in packedSamples are numbers, they are considered an offset from this epoch, in seconds.
*
* @exception {DeveloperError} packedSamples is required.
*/
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index e0bad7246354..a56e0693e175 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -60,7 +60,7 @@ define([
return epoch.addSeconds(date);
}
- var _mergeNewSamples = function(epoch, times, values, newData, packedLength) {
+ var mergeNewSamples = function(epoch, times, values, newData, packedLength) {
var newDataIndex = 0;
var i;
var prevItem;
@@ -347,7 +347,7 @@ define([
var innerType = this._innerType;
var data = [time];
innerType.pack(value, data, 1);
- _mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
+ mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
this._updateTables = true;
};
@@ -380,7 +380,7 @@ define([
data.push(times[i]);
innerType.pack(values[i], data, data.length);
}
- _mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
+ mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
this._updateTables = true;
};
@@ -389,7 +389,7 @@ define([
* @memberof SampledProperty
*
* @param {Array} packedSamples The array of packed samples.
- * @param {JulianDate} [epoch] If any of the dates in packedSamples are numbers, they are considered an offset from this epoch.
+ * @param {JulianDate} [epoch] If any of the dates in packedSamples are numbers, they are considered an offset from this epoch, in seconds.
*
* @exception {DeveloperError} packedSamples is required.
*/
@@ -397,12 +397,12 @@ define([
if (!defined(packedSamples)) {
throw new DeveloperError('packedSamples is required.');
}
- _mergeNewSamples(epoch, this._times, this._values, packedSamples, this._innerType.packedLength);
+ mergeNewSamples(epoch, this._times, this._values, packedSamples, this._innerType.packedLength);
this._updateTables = true;
};
//Exposed for testing.
- SampledProperty._mergeNewSamples = _mergeNewSamples;
+ SampledProperty._mergeNewSamples = mergeNewSamples;
return SampledProperty;
});
\ No newline at end of file
diff --git a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
index c1aed0a575ee..6ce5ea72d8dc 100644
--- a/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionPositionProperty.js
@@ -88,13 +88,9 @@ define([
throw new DeveloperError('referenceFrame is required.');
}
- var interval = this._intervals.findIntervalContainingDate(time);
- if (defined(interval)) {
- var value = interval.data;
- if (defined(value)) {
- return PositionProperty.convertToReferenceFrame(time, value, this._referenceFrame, referenceFrame, result);
- }
- return value;
+ var position = this._intervals.findDataForIntervalContainingDate(time);
+ if (defined(position)) {
+ return PositionProperty.convertToReferenceFrame(time, position, this._referenceFrame, referenceFrame, result);
}
return undefined;
};
diff --git a/Source/DynamicScene/TimeIntervalCollectionProperty.js b/Source/DynamicScene/TimeIntervalCollectionProperty.js
index 07835e2eaa66..cc535e363d47 100644
--- a/Source/DynamicScene/TimeIntervalCollectionProperty.js
+++ b/Source/DynamicScene/TimeIntervalCollectionProperty.js
@@ -87,20 +87,16 @@ define([
throw new DeveloperError('time is required');
}
- var interval = this._intervals.findIntervalContainingDate(time);
- if (defined(interval)) {
- var value = interval.data;
- if (defined(value) && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Enumeration)) {
- if (typeof value.clone === 'function') {
- return value.clone(result);
- } else if (!defined(this._clone)) {
- throw new DeveloperError('This value requires a clone function be specified for the TimeIntervalCollectionProperty constructor.');
- }
- return this._clone(value, result);
+ var value = this._intervals.findDataForIntervalContainingDate(time);
+ if (defined(value) && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Enumeration)) {
+ if (typeof value.clone === 'function') {
+ return value.clone(result);
+ } else if (!defined(this._clone)) {
+ throw new DeveloperError('This value requires a clone function be specified for the TimeIntervalCollectionProperty constructor.');
}
- return value;
+ return this._clone(value, result);
}
- return undefined;
+ return value;
};
return TimeIntervalCollectionProperty;
diff --git a/Specs/Core/TimeIntervalCollectionSpec.js b/Specs/Core/TimeIntervalCollectionSpec.js
index 298c69ca7744..ceb0b39a6068 100644
--- a/Specs/Core/TimeIntervalCollectionSpec.js
+++ b/Specs/Core/TimeIntervalCollectionSpec.js
@@ -251,6 +251,23 @@ defineSuite([
expect(intervals.findIntervalContainingDate(interval3.stop).data).toEqual(3);
});
+ it('findDataForIntervalContainingDate works', function() {
+ var interval1 = new TimeInterval(JulianDate.fromTotalDays(1), JulianDate.fromTotalDays(2.5), true, true, 1);
+ var interval2 = new TimeInterval(JulianDate.fromTotalDays(2), JulianDate.fromTotalDays(3), false, true, 2);
+
+ var intervals = new TimeIntervalCollection();
+ intervals.addInterval(interval1);
+ expect(intervals.findDataForIntervalContainingDate(interval1.start)).toEqual(1);
+ expect(intervals.findDataForIntervalContainingDate(interval1.stop)).toEqual(1);
+
+ intervals.addInterval(interval2);
+ expect(intervals.findDataForIntervalContainingDate(interval1.start)).toEqual(1);
+ expect(intervals.findDataForIntervalContainingDate(interval1.stop)).toEqual(2);
+ expect(intervals.findDataForIntervalContainingDate(interval2.stop)).toEqual(2);
+
+ expect(intervals.findDataForIntervalContainingDate(JulianDate.fromTotalDays(5))).toBeUndefined();
+ });
+
it('addInterval correctly intervals that have the same data when using equalsCallback', function() {
var intervals = new TimeIntervalCollection();
@@ -463,6 +480,13 @@ defineSuite([
}).toThrow();
});
+ it('findDataForIntervalContainingDate throws with undefined date', function() {
+ var intervals = new TimeIntervalCollection();
+ expect(function() {
+ intervals.findDataForIntervalContainingDate(undefined);
+ }).toThrow();
+ });
+
it('contains throws with undefined date', function() {
var intervals = new TimeIntervalCollection();
expect(function() {
diff --git a/Specs/DynamicScene/SampledPropertySpec.js b/Specs/DynamicScene/SampledPropertySpec.js
index 3036df0d2bfa..49270c074d6e 100644
--- a/Specs/DynamicScene/SampledPropertySpec.js
+++ b/Specs/DynamicScene/SampledPropertySpec.js
@@ -157,7 +157,7 @@ defineSuite([
expect(property.getValue(time.addSeconds(4))).toBeUndefined();
});
- it('_mergeNewSamples works with huge data sets.', function() {
+ it('mergeNewSamples works with huge data sets.', function() {
var times = [];
var values = [];
var epoch = new JulianDate();
@@ -179,7 +179,7 @@ defineSuite([
expect(values).toEqual(expectedValues);
});
- it('_mergeNewSamples works for sorted non-intersecting data.', function() {
+ it('mergeNewSamples works for sorted non-intersecting data.', function() {
var times = [];
var values = [];
var epoch = new JulianDate();
@@ -197,7 +197,7 @@ defineSuite([
expect(values).toEqual(expectedValues);
});
- it('_mergeNewSamples works for ISO8601 dates', function() {
+ it('mergeNewSamples works for ISO8601 dates', function() {
var times = [];
var values = [];
var epoch = JulianDate.fromIso8601('2010-01-01T12:00:00');
@@ -215,7 +215,7 @@ defineSuite([
expect(values).toEqual(expectedValues);
});
- it('_mergeNewSamples works for elements of size 2.', function() {
+ it('mergeNewSamples works for elements of size 2.', function() {
var times = [];
var values = [];
var epoch = new JulianDate();
@@ -233,7 +233,7 @@ defineSuite([
expect(values).toEqual(expectedValues);
});
- it('_mergeNewSamples works for unsorted intersecting data.', function() {
+ it('mergeNewSamples works for unsorted intersecting data.', function() {
var times = [];
var values = [];
var epoch = new JulianDate();
@@ -251,7 +251,7 @@ defineSuite([
expect(values).toEqual(expectedValues);
});
- it('_mergeNewSamples works for data with repeated values.', function() {
+ it('mergeNewSamples works for data with repeated values.', function() {
var times = [];
var values = [];
var epoch = new JulianDate();
@@ -273,7 +273,7 @@ defineSuite([
values : [0.0, 5, 120.0, 7, 240.0, 9, 360.0, 11, 480.0, 13, 600.0, 15, 720.0, 17, 840.0, 18, 960.0, 19, 1080.0, 20]
}];
- it('_mergeNewSamples works with interwoven data', function() {
+ it('mergeNewSamples works with interwoven data', function() {
var times = [];
var values = [];
SampledProperty._mergeNewSamples(interwovenData[0].epoch, times, values, interwovenData[0].values, 1);
From 69b098cc38a8a0141a7b9ffafa4535adc8d4f21b Mon Sep 17 00:00:00 2001
From: Scott Hunter
Date: Tue, 27 Aug 2013 14:22:47 -0400
Subject: [PATCH 61/65] Minor whitespace cleanup.
---
Source/DynamicScene/CompositePositionProperty.js | 1 -
Source/DynamicScene/CzmlDataSource.js | 1 -
Source/DynamicScene/Property.js | 7 ++++---
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/Source/DynamicScene/CompositePositionProperty.js b/Source/DynamicScene/CompositePositionProperty.js
index d9d05d65c9af..76ad6e1e6919 100644
--- a/Source/DynamicScene/CompositePositionProperty.js
+++ b/Source/DynamicScene/CompositePositionProperty.js
@@ -15,7 +15,6 @@ define([
ReferenceFrame) {
"use strict";
-
/**
* A {@link CompositeProperty} which is also a {@link PositionProperty}.
*
diff --git a/Source/DynamicScene/CzmlDataSource.js b/Source/DynamicScene/CzmlDataSource.js
index d4b26b2ac237..2bfda8211c3c 100644
--- a/Source/DynamicScene/CzmlDataSource.js
+++ b/Source/DynamicScene/CzmlDataSource.js
@@ -292,7 +292,6 @@ define([
if (defined(packetData.interpolationDegree)) {
property.interpolationDegree = packetData.interpolationDegree;
}
-
}
function processProperty(type, object, propertyName, packetData, constrainedInterval, sourceUri) {
diff --git a/Source/DynamicScene/Property.js b/Source/DynamicScene/Property.js
index 66ab3856691a..daff7b16f024 100644
--- a/Source/DynamicScene/Property.js
+++ b/Source/DynamicScene/Property.js
@@ -1,7 +1,8 @@
/*global define*/
-define(['../Core/DeveloperError'
- ], function(
- DeveloperError) {
+define([
+ '../Core/DeveloperError'
+ ], function(
+ DeveloperError) {
"use strict";
function throwInstantiationError() {
From 210359b220d7a1d9d15489a4662ce3b46f9e72a7 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Tue, 27 Aug 2013 14:06:18 -0400
Subject: [PATCH 62/65] Rename `SampledProperty._updateTables` to
`SampledProperty._updateTableLength`
---
Source/DynamicScene/SampledProperty.js | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/Source/DynamicScene/SampledProperty.js b/Source/DynamicScene/SampledProperty.js
index a56e0693e175..9119173f9251 100644
--- a/Source/DynamicScene/SampledProperty.js
+++ b/Source/DynamicScene/SampledProperty.js
@@ -177,7 +177,7 @@ define([
this._xTable = [];
this._yTable = [];
this._packedInterpolationLength = packedInterpolationLength;
- this._updateTables = true;
+ this._updateTableLength = true;
this._interpolationResult = new Array(packedInterpolationLength);
};
@@ -204,7 +204,7 @@ define([
},
set : function(value) {
this._interpolationDegree = value;
- this._updateTables = true;
+ this._updateTableLength = true;
}
},
/**
@@ -219,7 +219,7 @@ define([
},
set : function(value) {
this._interpolationAlgorithm = value;
- this._updateTables = true;
+ this._updateTableLength = true;
}
}
});
@@ -249,8 +249,8 @@ define([
var interpolationAlgorithm = this._interpolationAlgorithm;
var packedInterpolationLength = this._packedInterpolationLength;
- if (this._updateTables) {
- this._updateTables = false;
+ if (this._updateTableLength) {
+ this._updateTableLength = false;
var numberOfPoints = Math.min(interpolationAlgorithm.getRequiredDataPoints(this._interpolationDegree), times.length);
if (numberOfPoints !== this._numberOfPoints) {
this._numberOfPoints = numberOfPoints;
@@ -348,7 +348,7 @@ define([
var data = [time];
innerType.pack(value, data, 1);
mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
- this._updateTables = true;
+ this._updateTableLength = true;
};
/**
@@ -381,7 +381,7 @@ define([
innerType.pack(values[i], data, data.length);
}
mergeNewSamples(undefined, this._times, this._values, data, innerType.packedLength);
- this._updateTables = true;
+ this._updateTableLength = true;
};
/**
@@ -398,7 +398,7 @@ define([
throw new DeveloperError('packedSamples is required.');
}
mergeNewSamples(epoch, this._times, this._values, packedSamples, this._innerType.packedLength);
- this._updateTables = true;
+ this._updateTableLength = true;
};
//Exposed for testing.
From 9d408157182f5566d6a6e303c02422a1fccb4091 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Wed, 28 Aug 2013 09:56:54 -0400
Subject: [PATCH 63/65] modify CHANGES so everything is in the b20 release
---
CHANGES.md | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/CHANGES.md b/CHANGES.md
index 0ef7904491ac..f61735907177 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -4,9 +4,11 @@ Change Log
Beta Releases
-------------
-### b21 - 2013-10-01
+### b20 - 2013-09-03
+
+_This releases fixes 2D and other issues with Chrome 29.0.1547.57 ([#1002](https://github.com/AnalyticalGraphicsInc/cesium/issues/1002) and [#1047](https://github.com/AnalyticalGraphicsInc/cesium/issues/1047))._
+
* Breaking changes:
- * Removed `processCzml`, use `CzmlDataSource` instead.
* Completely refactored the `DynamicScene` property system to vastly improve the API. See [#1080](https://github.com/AnalyticalGraphicsInc/cesium/pull/1080) for complete details.
* Removed `CzmlBoolean`, `CzmlCartesian2`, `CzmlCartesian3`, `CzmlColor`, `CzmlDefaults`, `CzmlDirection`, `CzmlHorizontalOrigin`, `CzmlImage`, `CzmlLabelStyle`, `CzmlNumber`, `CzmlPosition`, `CzmlString`, `CzmlUnitCartesian3`, `CzmlUnitQuaternion`, `CzmlUnitSpherical`, and `CzmlVerticalOrigin` since they are no longer needed.
* Removed `DynamicProperty`, `DynamicMaterialProperty`, `DynamicDirectionsProperty`, and `DynamicVertexPositionsProperty`; replacing them with an all new system of properties.
@@ -25,14 +27,7 @@ Beta Releases
* `ConstantPositionProperty` - a `PositionProperty` whose value does not change in respect to the `ReferenceFrame` in which is it defined.
* `SampledPositionProperty` - a `SampledProperty` for positions.
* `TimeIntervalCollectionPositionProperty` - A `TimeIntervalCollectionProperty` for positions.
-* Added `Packable` and `PackableForInterpolation` interfaces to aid interpolation and in-memory data storage. Also made most core Cesium types implement them.
-* Added `InterpolationAlgorithm` interface to codify the base interface already being used by `LagrangePolynomialApproximation`, `LinearApproximation`, and `HermitePolynomialApproximation`.
-
-### b20 - 2013-09-03
-
-_This releases fixes 2D and other issues with Chrome 29.0.1547.57 ([#1002](https://github.com/AnalyticalGraphicsInc/cesium/issues/1002) and [#1047](https://github.com/AnalyticalGraphicsInc/cesium/issues/1047))._
-
-* Breaking changes:
+ * Removed `processCzml`, use `CzmlDataSource` instead.
* The `CameraFlightPath` functions `createAnimation`, `createAnimationCartographic`, and `createAnimationExtent` now take the scene as their first parameter instead of the frame state.
* Replaced `ExtentGeometry` parameters for extruded extent to make them consistent with other geometries.
* `options.extrudedOptions.height` -> `options.extrudedHeight`
@@ -69,6 +64,9 @@ var geometry = BoxGeometry.createGeometry(box);
* Added `Math.setRandomNumberSeed` and `Math.nextRandomNumber` for generating repeatable random numbers.
* Added `Color.fromRandom` to generate random and partially random colors.
* Added `Scene.debugShowFrustums` and `Scene.debugFrustumStatistics` for rendering debugging.
+* Added an `onCancel` callback to `CameraFlightPath` functions that will be executed if the flight is canceled.
+* Added `Packable` and `PackableForInterpolation` interfaces to aid interpolation and in-memory data storage. Also made most core Cesium types implement them.
+* Added `InterpolationAlgorithm` interface to codify the base interface already being used by `LagrangePolynomialApproximation`, `LinearApproximation`, and `HermitePolynomialApproximation`.
* Improved geometry batching performance by moving work to a web worker.
* Improved `WallGeometry` to follow the curvature of the earth.
* Fixed broken surface rendering in Columbus View when using the `EllipsoidTerrainProvider`.
@@ -78,7 +76,6 @@ var geometry = BoxGeometry.createGeometry(box);
* Fixed triangulation for polygons that cross the international date line.
* Fixed `EllipsoidPrimitive` rendering for some oblate ellipsoids. [#1067](https://github.com/AnalyticalGraphicsInc/cesium/pull/1067).
* `CameraFlightPath` now automatically disables and restores mouse input for the flights it generates.
-* Added an `onCancel` callback to `CameraFlightPath` functions that will be executed if the flight is canceled.
### b19 - 2013-08-01
From 21558ab116e2049b4cf9f7aaadc0397c6c9d7e49 Mon Sep 17 00:00:00 2001
From: mramato
Date: Wed, 28 Aug 2013 21:42:20 -0400
Subject: [PATCH 64/65] Fix documentation build.
Also fix bad doc do to re-use of throwInstantiationError
---
Source/Core/Packable.js | 10 ++++------
Source/Core/PackableForInterpolation.js | 10 ++++------
Source/DynamicScene/DataSource.js | 5 +++++
Source/DynamicScene/MaterialProperty.js | 2 ++
Source/DynamicScene/PositionProperty.js | 6 +++---
Source/DynamicScene/Property.js | 1 +
Source/Renderer/DrawCommand.js | 3 +--
7 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/Source/Core/Packable.js b/Source/Core/Packable.js
index cbc7e3ae2762..bd94142b565d 100644
--- a/Source/Core/Packable.js
+++ b/Source/Core/Packable.js
@@ -25,6 +25,7 @@ define(['../Core/DeveloperError'], function(DeveloperError) {
/**
* Stores the provided instance into the provided array.
* @memberof Packable
+ * @function
*
* @param {Object} value The value to pack.
* @param {Array} array The array to pack into.
@@ -33,13 +34,12 @@ define(['../Core/DeveloperError'], function(DeveloperError) {
* @exception {DeveloperError} value is required.
* @exception {DeveloperError} array is required.
*/
- pack : function(value, array, startingIndex) {
- throwInstantiationError();
- },
+ pack : throwInstantiationError,
/**
* Retrieves an instance from a packed array.
* @memberof Packable
+ * @function
*
* @param {Array} array The packed array.
* @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
@@ -47,9 +47,7 @@ define(['../Core/DeveloperError'], function(DeveloperError) {
*
* @exception {DeveloperError} array is required.
*/
- unpack : function(array, startingIndex, result) {
- throwInstantiationError();
- }
+ unpack : throwInstantiationError
};
return Packable;
diff --git a/Source/Core/PackableForInterpolation.js b/Source/Core/PackableForInterpolation.js
index cbcb5c10298e..13daf90b8ff0 100644
--- a/Source/Core/PackableForInterpolation.js
+++ b/Source/Core/PackableForInterpolation.js
@@ -25,6 +25,7 @@ define(['../Core/DeveloperError'], function(DeveloperError) {
/**
* Converts a packed array into a form suitable for interpolation.
* @memberof PackableForInterpolation
+ * @function
*
* @param {Array} packedArray The packed array.
* @param {Number} [startingIndex=0] The index of the first element to be converted.
@@ -33,13 +34,12 @@ define(['../Core/DeveloperError'], function(DeveloperError) {
*
* @exception {DeveloperError} packedArray is required.
*/
- convertPackedArrayForInterpolation : function(packedArray, startingIndex, lastIndex, result) {
- throwInstantiationError();
- },
+ convertPackedArrayForInterpolation : throwInstantiationError,
/**
* Retrieves an instance from a packed array converted with {@link convertPackedArrayForInterpolation}.
* @memberof PackableForInterpolation
+ * @function
*
* @param {Array} array The original packed array.
* @param {Array} sourceArray The converted array.
@@ -50,9 +50,7 @@ define(['../Core/DeveloperError'], function(DeveloperError) {
* @exception {DeveloperError} array is required.
* @exception {DeveloperError} sourceArray is required.
*/
- unpackInterpolationResult : function(array, sourceArray, startingIndex, lastIndex, result) {
- throwInstantiationError();
- }
+ unpackInterpolationResult : throwInstantiationError
};
return PackableForInterpolation;
diff --git a/Source/DynamicScene/DataSource.js b/Source/DynamicScene/DataSource.js
index eae546eb92e3..fa8986c27f91 100644
--- a/Source/DynamicScene/DataSource.js
+++ b/Source/DynamicScene/DataSource.js
@@ -21,6 +21,7 @@ define(['../Core/DeveloperError'
* Gets an event that will be raised when non-time-Varying data changes
* or if the return value of getIsTimeVarying changes.
* @memberof DataSource
+ * @function
*
* @returns {Event} The event.
*/
@@ -29,6 +30,7 @@ define(['../Core/DeveloperError'
/**
* Gets an event that will be raised if an error is encountered during processing.
* @memberof DataSource
+ * @function
*
* @returns {Event} The event.
*/
@@ -37,6 +39,7 @@ define(['../Core/DeveloperError'
/**
* Gets the top level clock associated with this data source, or undefined if no clock exists.
* @memberof DataSource
+ * @function
*
* @returns {DynamicClock} The clock associated with this data source, or undefined if none exists.
*/
@@ -45,6 +48,7 @@ define(['../Core/DeveloperError'
/**
* Gets the DynamicObjectCollection generated by this data source.
* @memberof DataSource
+ * @function
*
* @returns {DynamicObjectCollection} The collection of objects generated by this data source.
*/
@@ -54,6 +58,7 @@ define(['../Core/DeveloperError'
* Gets a value indicating if the data varies with simulation time. If the return value of
* this function changes, the changed event will be raised.
* @memberof DataSource
+ * @function
*
* @returns {Boolean} True if the data is varies with simulation time, false otherwise.
*/
diff --git a/Source/DynamicScene/MaterialProperty.js b/Source/DynamicScene/MaterialProperty.js
index 00102a079092..5868ec014fd4 100644
--- a/Source/DynamicScene/MaterialProperty.js
+++ b/Source/DynamicScene/MaterialProperty.js
@@ -30,6 +30,7 @@ define([
/**
* Gets the {@link Material} type at the provided time.
* @memberof MaterialProperty
+ * @function
*
* @param {JulianDate} time The time for which to retrieve the type.
* @type {String} The type of material.
@@ -39,6 +40,7 @@ define([
/**
* Gets the value of the property at the provided time.
* @memberof MaterialProperty
+ * @function
*
* @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
diff --git a/Source/DynamicScene/PositionProperty.js b/Source/DynamicScene/PositionProperty.js
index 08a5b51b120c..e0a48c14feb5 100644
--- a/Source/DynamicScene/PositionProperty.js
+++ b/Source/DynamicScene/PositionProperty.js
@@ -44,15 +44,14 @@ define([
* @Type {ReferenceFrame}
*/
referenceFrame : {
- get : function() {
- throwInstantiationError();
- }
+ get : throwInstantiationError
}
});
/**
* Gets the value of the property at the provided time.
* @memberof PositionProperty
+ * @function
*
* @param {JulianDate} time The time for which to retrieve the value.
* @param {Cartesian3} [result] The object to store the value into, if omitted, a new instance is created and returned.
@@ -65,6 +64,7 @@ define([
/**
* Gets the value of the property at the provided time and in the provided reference frame.
* @memberof PositionProperty
+ * @function
*
* @param {JulianDate} time The time for which to retrieve the value.
* @param {ReferenceFrame} referenceFrame The desired referenceFrame of the result.
diff --git a/Source/DynamicScene/Property.js b/Source/DynamicScene/Property.js
index daff7b16f024..468aee688659 100644
--- a/Source/DynamicScene/Property.js
+++ b/Source/DynamicScene/Property.js
@@ -30,6 +30,7 @@ define([
/**
* Gets the value of the property at the provided time.
* @memberof Property
+ * @function
*
* @param {JulianDate} time The time for which to retrieve the value.
* @param {Object} [result] The object to store the value into, if omitted, a new instance is created and returned.
diff --git a/Source/Renderer/DrawCommand.js b/Source/Renderer/DrawCommand.js
index 52e1cdb03aa6..596a7898b119 100644
--- a/Source/Renderer/DrawCommand.js
+++ b/Source/Renderer/DrawCommand.js
@@ -165,9 +165,8 @@ define(function() {
this.debugShowBoundingVolume = false;
/**
+ * Used to implement Scene.debugShowFrustums.
* @private
- *
- * Used to implement {@see Scene.debugShowFrustums}.
*/
this.debugOverlappingFrustums = 0;
};
From b7a000db43255498cbefb452a294c82b5f2c3d38 Mon Sep 17 00:00:00 2001
From: Matthew Amato
Date: Thu, 29 Aug 2013 09:16:26 -0400
Subject: [PATCH 65/65] Fix CHANGES after merge.
---
CHANGES.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/CHANGES.md b/CHANGES.md
index 5c097dafddba..20a2542158d4 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -10,6 +10,7 @@ _This releases fixes 2D and other issues with Chrome 29.0.1547.57 ([#1002](https
* Breaking changes:
* The `CameraFlightPath` functions `createAnimation`, `createAnimationCartographic`, and `createAnimationExtent` now take `scene` as their first parameter instead of `frameState`.
+ * `Source/Widgets/Viewer/lighter.css` was deleted, use `Source/Widgets/lighter.css` instead.
* Completely refactored the `DynamicScene` property system to vastly improve the API. See [#1080](https://github.com/AnalyticalGraphicsInc/cesium/pull/1080) for complete details.
* Removed `CzmlBoolean`, `CzmlCartesian2`, `CzmlCartesian3`, `CzmlColor`, `CzmlDefaults`, `CzmlDirection`, `CzmlHorizontalOrigin`, `CzmlImage`, `CzmlLabelStyle`, `CzmlNumber`, `CzmlPosition`, `CzmlString`, `CzmlUnitCartesian3`, `CzmlUnitQuaternion`, `CzmlUnitSpherical`, and `CzmlVerticalOrigin` since they are no longer needed.
* Removed `DynamicProperty`, `DynamicMaterialProperty`, `DynamicDirectionsProperty`, and `DynamicVertexPositionsProperty`; replacing them with an all new system of properties.