Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into referenceProperties
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGES.md
	Source/DynamicScene/CzmlDataSource.js
  • Loading branch information
mramato committed Jun 5, 2014
2 parents 0c83811 + 38889b0 commit fa40155
Show file tree
Hide file tree
Showing 7 changed files with 112 additions and 96 deletions.
7 changes: 4 additions & 3 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ Beta Releases
### 1.0 - 2014-07-01

* Breaking changes ([why so many?](https://groups.google.com/forum/#!topic/cesium-dev/Y_mG11IZD9k))
* Renamed `Simon1994PlanetaryPositions` functions `ComputeSunPositionInEarthInertialFrame` and `ComputeMoonPositionInEarthInertialFrame` to `computeSunPositionInEarthInertialFrame` and `computeMoonPositionInEarthInertialFrame`, respectively.
* Replaced `Scene.scene2D.projection` property with read-only `Scene.mapProjection`. Set this with the `mapProjection` option for the `Viewer`, `CesiumWidget`, or `Scene` constructors.
* `Scene` constructor function now takes an `options` parameter instead of individual parameters.
* Renamed `Simon1994PlanetaryPositions` functions `ComputeSunPositionInEarthInertialFrame` and `ComputeMoonPositionInEarthInertialFrame` to `computeSunPositionInEarthInertialFrame` and `computeMoonPositionInEarthInertialFrame`, respectively.
* Replaced `Scene.scene2D.projection` property with read-only `Scene.mapProjection`. Set this with the `mapProjection` option for the `Viewer`, `CesiumWidget`, or `Scene` constructors.
* `Scene` constructor function now takes an `options` parameter instead of individual parameters.
* Replaced `color`, `outlineColor`, and `outlineWidth` in `DynamicPath` with a `material` property.
* CZML property references now use a `#` symbol to separate identifier from property path. `objectId.position` should now be `objectId#position`.
* `DynamicObject.id` can now include period characters.
* `ReferenceProperty` can now handle sub-properties, for example, `myObject#billboard.scale`.
Expand Down
38 changes: 33 additions & 5 deletions Source/DynamicScene/CzmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1192,14 +1192,42 @@ define([
dynamicObject.path = path = new DynamicPath();
}

processPacketData(Color, path, 'color', pathData.color, interval, sourceUri, dynamicObjectCollection);
processPacketData(Number, path, 'width', pathData.width, interval, sourceUri, dynamicObjectCollection);
processPacketData(Color, path, 'outlineColor', pathData.outlineColor, interval, sourceUri, dynamicObjectCollection);
processPacketData(Number, path, 'outlineWidth', pathData.outlineWidth, interval, sourceUri, dynamicObjectCollection);
//Since CZML does not support PolylineOutlineMaterial, we map its properties into one.
var materialToProcess = path.material;
if (defined(interval)) {
var materialInterval;
var composite = materialToProcess;
if (!(composite instanceof CompositeMaterialProperty)) {
composite = new CompositeMaterialProperty();
path.material = composite;
if (defined(materialToProcess)) {
materialInterval = Iso8601.MAXIMUM_INTERVAL.clone();
materialInterval.data = materialToProcess;
composite.intervals.addInterval(materialInterval);
}
}
materialInterval = composite.intervals.findInterval(interval.start, interval.stop, interval.isStartIncluded, interval.isStopIncluded);
if (defined(materialInterval)) {
materialToProcess = materialInterval.data;
} else {
materialToProcess = new PolylineOutlineMaterialProperty();
materialInterval = interval.clone();
materialInterval.data = materialToProcess;
composite.intervals.addInterval(materialInterval);
}
} else if (!(materialToProcess instanceof PolylineOutlineMaterialProperty)) {
materialToProcess = new PolylineOutlineMaterialProperty();
path.material = materialToProcess;
}

processPacketData(Boolean, path, 'show', pathData.show, interval, sourceUri, dynamicObjectCollection);
processPacketData(Number, path, 'width', pathData.width, interval, sourceUri, dynamicObjectCollection);
processPacketData(Number, path, 'resolution', pathData.resolution, interval, sourceUri, dynamicObjectCollection);
processPacketData(Number, path, 'leadTime', pathData.leadTime, interval, sourceUri, dynamicObjectCollection);
processPacketData(Number, path, 'trailTime', pathData.trailTime, interval, sourceUri, dynamicObjectCollection);
processPacketData(Color, materialToProcess, 'color', pathData.color, interval, sourceUri, dynamicObjectCollection);
processPacketData(Color, materialToProcess, 'outlineColor', pathData.outlineColor, interval, sourceUri, dynamicObjectCollection);
processPacketData(Number, materialToProcess, 'outlineWidth', pathData.outlineWidth, interval, sourceUri, dynamicObjectCollection);
}

function processPoint(dynamicObject, packet, dynamicObjectCollection, sourceUri) {
Expand Down Expand Up @@ -1326,7 +1354,7 @@ define([
dynamicObject.polyline = polyline = new DynamicPolyline();
}

//Since CZML does not support PolylineOutlineMaterial, we map it's properties into one.
//Since CZML does not support PolylineOutlineMaterial, we map its properties into one.
var materialToProcess = polyline.material;
if (defined(interval)) {
var materialInterval;
Expand Down
36 changes: 7 additions & 29 deletions Source/DynamicScene/DynamicPath.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@ define([
* @constructor
*/
var DynamicPath = function() {
this._color = undefined;
this._colorSubscription = undefined;
this._outlineColor = undefined;
this._outlineColorSubscription = undefined;
this._outlineWidth = undefined;
this._outlineWidthSubscription = undefined;
this._material = undefined;
this._materialSubscription = undefined;
this._show = undefined;
this._showSubscription = undefined;
this._width = undefined;
Expand Down Expand Up @@ -56,25 +52,11 @@ define([
},

/**
* Gets or sets the {@link Color} {@link Property} specifying the the path's color.
* Gets or sets the {@link MaterialProperty} specifying the appearance of the path.
* @memberof DynamicPath.prototype
* @type {Property}
*/
color : createDynamicPropertyDescriptor('color'),

/**
* Gets or sets the {@link Color} {@link Property} specifying the the path's outline color.
* @memberof DynamicPath.prototype
* @type {Property}
*/
outlineColor : createDynamicPropertyDescriptor('outlineColor'),

/**
* Gets or sets the numeric {@link Property} specifying the the path's outline width.
* @memberof DynamicPath.prototype
* @type {Property}
* @type {MaterialProperty}
*/
outlineWidth : createDynamicPropertyDescriptor('outlineWidth'),
material : createDynamicPropertyDescriptor('material'),

/**
* Gets or sets the boolean {@link Property} specifying the path's visibility.
Expand Down Expand Up @@ -122,11 +104,9 @@ define([
if (!defined(result)) {
result = new DynamicPath();
}
result.color = this.color;
result.material = this.material;
result.width = this.width;
result.resolution = this.resolution;
result.outlineColor = this.outlineColor;
result.outlineWidth = this.outlineWidth;
result.show = this.show;
result.leadTime = this.leadTime;
result.trailTime = this.trailTime;
Expand All @@ -146,11 +126,9 @@ define([
}
//>>includeEnd('debug');

this.color = defaultValue(this.color, source.color);
this.material = defaultValue(this.material, source.material);
this.width = defaultValue(this.width, source.width);
this.resolution = defaultValue(this.resolution, source.resolution);
this.outlineColor = defaultValue(this.outlineColor, source.outlineColor);
this.outlineWidth = defaultValue(this.outlineWidth, source.outlineWidth);
this.show = defaultValue(this.show, source.show);
this.leadTime = defaultValue(this.leadTime, source.leadTime);
this.trailTime = defaultValue(this.trailTime, source.trailTime);
Expand Down
22 changes: 4 additions & 18 deletions Source/DynamicScene/DynamicPathVisualizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ define([
'../Scene/SceneMode',
'./CompositePositionProperty',
'./ConstantPositionProperty',
'./MaterialProperty',
'./SampledPositionProperty',
'./TimeIntervalCollectionPositionProperty'
], function(
Expand All @@ -33,6 +34,7 @@ define([
SceneMode,
CompositePositionProperty,
ConstantPositionProperty,
MaterialProperty,
SampledPositionProperty,
TimeIntervalCollectionPositionProperty) {
"use strict";
Expand Down Expand Up @@ -340,7 +342,6 @@ define([
return;
}

var uniforms;
if (!defined(pathVisualizerIndex)) {
var unusedIndexes = this._unusedIndexes;
var length = unusedIndexes.length;
Expand All @@ -360,13 +361,12 @@ define([
material = Material.fromType(Material.PolylineOutlineType);
polyline.material = material;
}
uniforms = material.uniforms;
var uniforms = material.uniforms;
Color.clone(Color.WHITE, uniforms.color);
Color.clone(Color.BLACK, uniforms.outlineColor);
uniforms.outlineWidth = 0;
} else {
polyline = this._polylineCollection.get(pathVisualizerIndex);
uniforms = polyline.material.uniforms;
}

polyline.show = true;
Expand All @@ -381,21 +381,7 @@ define([
}

polyline.positions = subSample(positionProperty, sampleStart, sampleStop, time, this._referenceFrame, maxStepSize, polyline.positions);

property = dynamicPath._color;
if (defined(property)) {
uniforms.color = property.getValue(time, uniforms.color);
}

property = dynamicPath._outlineColor;
if (defined(property)) {
uniforms.outlineColor = property.getValue(time, uniforms.outlineColor);
}

property = dynamicPath._outlineWidth;
if (defined(property)) {
uniforms.outlineWidth = property.getValue(time);
}
polyline.material = MaterialProperty.getValue(time, dynamicPath._material, polyline.material);

property = dynamicPath._width;
if (defined(property)) {
Expand Down
16 changes: 7 additions & 9 deletions Specs/DynamicScene/CzmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1307,11 +1307,11 @@ defineSuite([
var dynamicObject = dataSource.dynamicObjects.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.material.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.material.outlineColor.getValue(Iso8601.MINIMUM_VALUE)).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
expect(dynamicObject.path.material.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);
Expand Down Expand Up @@ -1344,19 +1344,17 @@ defineSuite([
var dynamicObject = dataSource.dynamicObjects.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.material.getValue(validTime).color).toEqual(new Color(0.1, 0.1, 0.1, 0.1));
expect(dynamicObject.path.material.getValue(validTime).outlineColor).toEqual(new Color(0.2, 0.2, 0.2, 0.2));
expect(dynamicObject.path.material.getValue(validTime).outlineWidth).toEqual(pathPacket.path.outlineWidth);

expect(dynamicObject.path.color.getValue(invalidTime)).toBeUndefined();
expect(dynamicObject.path.material.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();
Expand Down
36 changes: 10 additions & 26 deletions Specs/DynamicScene/DynamicPathSpec.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
/*global defineSuite*/
defineSuite([
'DynamicScene/DynamicPath',
'Core/Color',
'DynamicScene/ColorMaterialProperty',
'DynamicScene/ConstantProperty'
], function(
DynamicPath,
Color,
ColorMaterialProperty,
ConstantProperty) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/

it('merge assigns unassigned properties', function() {
var source = new DynamicPath();
source.color = new ConstantProperty(Color.WHITE);
source.material = new ColorMaterialProperty();
source.width = new ConstantProperty(1);
source.outlineColor = new ConstantProperty(Color.WHITE);
source.outlineWidth = new ConstantProperty(1);
source.show = new ConstantProperty(true);
source.leadTime = new ConstantProperty(1);
source.trailTime = new ConstantProperty(1);
source.resolution = new ConstantProperty(1);

var target = new DynamicPath();
target.merge(source);
expect(target.color).toBe(source.color);
expect(target.material).toBe(source.material);
expect(target.width).toBe(source.width);
expect(target.outlineColor).toBe(source.outlineColor);
expect(target.outlineWidth).toBe(source.outlineWidth);
expect(target.show).toBe(source.show);
expect(target.leadTime).toBe(source.leadTime);
expect(target.trailTime).toBe(source.trailTime);
Expand All @@ -35,39 +31,31 @@ defineSuite([

it('merge does not assign assigned properties', function() {
var source = new DynamicPath();
source.color = new ConstantProperty(Color.WHITE);
source.material = new ColorMaterialProperty();
source.width = new ConstantProperty(1);
source.outlineColor = new ConstantProperty(Color.WHITE);
source.outlineWidth = new ConstantProperty(1);
source.show = new ConstantProperty(true);
source.leadTime = new ConstantProperty(1);
source.trailTime = new ConstantProperty(1);
source.resolution = new ConstantProperty(1);

var color = new ConstantProperty(Color.WHITE);
var color = new ColorMaterialProperty();
var width = new ConstantProperty(1);
var outlineColor = new ConstantProperty(Color.WHITE);
var outlineWidth = new ConstantProperty(1);
var show = new ConstantProperty(true);
var leadTime = new ConstantProperty(1);
var trailTime = new ConstantProperty(1);
var resolution = new ConstantProperty(1);

var target = new DynamicPath();
target.color = color;
target.material = color;
target.width = width;
target.outlineColor = outlineColor;
target.outlineWidth = outlineWidth;
target.show = show;
target.leadTime = leadTime;
target.trailTime = trailTime;
target.resolution = resolution;

target.merge(source);
expect(target.color).toBe(color);
expect(target.material).toBe(color);
expect(target.width).toBe(width);
expect(target.outlineColor).toBe(outlineColor);
expect(target.outlineWidth).toBe(outlineWidth);
expect(target.show).toBe(show);
expect(target.leadTime).toBe(leadTime);
expect(target.trailTime).toBe(trailTime);
Expand All @@ -76,20 +64,16 @@ defineSuite([

it('clone works', function() {
var source = new DynamicPath();
source.color = new ConstantProperty(Color.WHITE);
source.material = new ColorMaterialProperty();
source.width = new ConstantProperty(1);
source.outlineColor = new ConstantProperty(Color.WHITE);
source.outlineWidth = new ConstantProperty(1);
source.show = new ConstantProperty(true);
source.leadTime = new ConstantProperty(1);
source.trailTime = new ConstantProperty(1);
source.resolution = new ConstantProperty(1);

var result = source.clone();
expect(result.color).toBe(source.color);
expect(result.material).toBe(source.material);
expect(result.width).toBe(source.width);
expect(result.outlineColor).toBe(source.outlineColor);
expect(result.outlineWidth).toBe(source.outlineWidth);
expect(result.show).toBe(source.show);
expect(result.leadTime).toBe(source.leadTime);
expect(result.trailTime).toBe(source.trailTime);
Expand Down
Loading

0 comments on commit fa40155

Please sign in to comment.