Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing entity properties to CZML. #5986

Merged
merged 2 commits into from
Nov 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Change Log

* Added ability to support touch event in Imagery Layers Split demo application. [#5948](https://github.com/AnalyticalGraphicsInc/cesium/pull/5948)
* Fixed `Invalid asm.js: Invalid member of stdlib` console error by recompiling crunch.js with latest emscripten toolchain. [#5847](https://github.com/AnalyticalGraphicsInc/cesium/issues/5847)
* Added CZML support for `polyline.depthFailMaterial`, `label.scaleByDistance`, `distanceDisplayCondition`, and `disableDepthTestDistance`. [#5986](https://github.com/AnalyticalGraphicsInc/cesium/pull/5986)

### 1.39 - 2017-11-01

Expand Down
76 changes: 68 additions & 8 deletions Source/Core/DistanceDisplayCondition.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
define([
'./defaultValue',
'./defined',
'./defineProperties'
'./defineProperties',
'./DeveloperError'
], function(
defaultValue,
defined,
defineProperties) {
defineProperties,
DeveloperError) {
'use strict';

/**
Expand Down Expand Up @@ -36,11 +38,11 @@ define([
* @type {Number}
* @default 0.0
*/
near : {
get : function() {
near: {
get: function() {
return this._near;
},
set : function(value) {
set: function(value) {
this._near = value;
}
},
Expand All @@ -50,16 +52,74 @@ define([
* @type {Number}
* @default Number.MAX_VALUE
*/
far : {
get : function() {
far: {
get: function() {
return this._far;
},
set : function(value) {
set: function(value) {
this._far = value;
}
}
});

/**
* The number of elements used to pack the object into an array.
* @type {Number}
*/
DistanceDisplayCondition.packedLength = 2;

/**
* Stores the provided instance into the provided array.
*
* @param {DistanceDisplayCondition} value The value to pack.
* @param {Number[]} array The array to pack into.
* @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.
*
* @returns {Number[]} The array that was packed into
*/
DistanceDisplayCondition.pack = function(value, array, startingIndex) {
//>>includeStart('debug', pragmas.debug);
if (!defined(value)) {
throw new DeveloperError('value is required');
}
if (!defined(array)) {
throw new DeveloperError('array is required');
}
//>>includeEnd('debug');

startingIndex = defaultValue(startingIndex, 0);

array[startingIndex++] = value.near;
array[startingIndex] = value.far;

return array;
};

/**
* Retrieves an instance from a packed array.
*
* @param {Number[]} array The packed array.
* @param {Number} [startingIndex=0] The starting index of the element to be unpacked.
* @param {DistanceDisplayCondition} [result] The object into which to store the result.
* @returns {DistanceDisplayCondition} The modified result parameter or a new DistanceDisplayCondition instance if one was not provided.
*/
DistanceDisplayCondition.unpack = function(array, startingIndex, result) {
//>>includeStart('debug', pragmas.debug);
if (!defined(array)) {
throw new DeveloperError('array is required');
}
//>>includeEnd('debug');

startingIndex = defaultValue(startingIndex, 0);

if (!defined(result)) {
result = new DistanceDisplayCondition();
}
result.near = array[startingIndex++];
result.far = array[startingIndex];
return result;
};

/**
* Determines if two distance display conditions are equal.
*
Expand Down
25 changes: 25 additions & 0 deletions Source/DataSources/CzmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ define([
'../Core/defined',
'../Core/defineProperties',
'../Core/DeveloperError',
'../Core/DistanceDisplayCondition',
'../Core/Ellipsoid',
'../Core/Event',
'../Core/ExtrapolationType',
Expand Down Expand Up @@ -101,6 +102,7 @@ define([
defined,
defineProperties,
DeveloperError,
DistanceDisplayCondition,
Ellipsoid,
Event,
ExtrapolationType,
Expand Down Expand Up @@ -522,6 +524,8 @@ define([
return Number;
} else if (czmlInterval.hasOwnProperty('nearFarScalar')) {
return NearFarScalar;
} else if (czmlInterval.hasOwnProperty('distanceDisplayCondition')) {
return DistanceDisplayCondition;
} else if (czmlInterval.hasOwnProperty('object') ||
czmlInterval.hasOwnProperty('value')) {
return Object;
Expand Down Expand Up @@ -581,6 +585,8 @@ define([
return defaultValue(czmlInterval.number, czmlInterval);
case NearFarScalar:
return czmlInterval.nearFarScalar;
case DistanceDisplayCondition:
return czmlInterval.distanceDisplayCondition;
case Object:
return defaultValue(defaultValue(czmlInterval.object, czmlInterval.value), czmlInterval);
case Quaternion:
Expand Down Expand Up @@ -1327,6 +1333,8 @@ define([
processPacketData(NearFarScalar, billboard, 'translucencyByDistance', billboardData.translucencyByDistance, interval, sourceUri, entityCollection, query);
processPacketData(NearFarScalar, billboard, 'pixelOffsetScaleByDistance', billboardData.pixelOffsetScaleByDistance, interval, sourceUri, entityCollection, query);
processPacketData(BoundingRectangle, billboard, 'imageSubRegion', billboardData.imageSubRegion, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, billboard, 'distanceDisplayCondition', billboardData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
processPacketData(Number, billboard, 'disableDepthTestDistance', billboardData.disableDepthTestDistance, interval, sourceUri, entityCollection, query);
}

function processBox(entity, packet, entityCollection, sourceUri, query) {
Expand Down Expand Up @@ -1355,6 +1363,7 @@ define([
processPacketData(Color, box, 'outlineColor', boxData.outlineColor, interval, sourceUri, entityCollection, query);
processPacketData(Number, box, 'outlineWidth', boxData.outlineWidth, interval, sourceUri, entityCollection, query);
processPacketData(ShadowMode, box, 'shadows', boxData.shadows, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, box, 'distanceDisplayCondition', boxData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
}

function processCorridor(entity, packet, entityCollection, sourceUri, query) {
Expand Down Expand Up @@ -1388,6 +1397,7 @@ define([
processPacketData(Color, corridor, 'outlineColor', corridorData.outlineColor, interval, sourceUri, entityCollection, query);
processPacketData(Number, corridor, 'outlineWidth', corridorData.outlineWidth, interval, sourceUri, entityCollection, query);
processPacketData(ShadowMode, corridor, 'shadows', corridorData.shadows, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, corridor, 'distanceDisplayCondition', corridorData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
}

function processCylinder(entity, packet, entityCollection, sourceUri, query) {
Expand Down Expand Up @@ -1420,6 +1430,7 @@ define([
processPacketData(Number, cylinder, 'numberOfVerticalLines', cylinderData.numberOfVerticalLines, interval, sourceUri, entityCollection, query);
processPacketData(Number, cylinder, 'slices', cylinderData.slices, interval, sourceUri, entityCollection, query);
processPacketData(ShadowMode, cylinder, 'shadows', cylinderData.shadows, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, cylinder, 'distanceDisplayCondition', cylinderData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
}

function processDocument(packet, dataSource) {
Expand Down Expand Up @@ -1500,6 +1511,7 @@ define([
processPacketData(Number, ellipse, 'outlineWidth', ellipseData.outlineWidth, interval, sourceUri, entityCollection, query);
processPacketData(Number, ellipse, 'numberOfVerticalLines', ellipseData.numberOfVerticalLines, interval, sourceUri, entityCollection, query);
processPacketData(ShadowMode, ellipse, 'shadows', ellipseData.shadows, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, ellipse, 'distanceDisplayCondition', ellipseData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
}

function processEllipsoid(entity, packet, entityCollection, sourceUri, query) {
Expand Down Expand Up @@ -1531,6 +1543,7 @@ define([
processPacketData(Number, ellipsoid, 'slicePartitions', ellipsoidData.slicePartitions, interval, sourceUri, entityCollection, query);
processPacketData(Number, ellipsoid, 'subdivisions', ellipsoidData.subdivisions, interval, sourceUri, entityCollection, query);
processPacketData(ShadowMode, ellipsoid, 'shadows', ellipsoidData.shadows, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, ellipsoid, 'distanceDisplayCondition', ellipsoidData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
}

function processLabel(entity, packet, entityCollection, sourceUri, query) {
Expand Down Expand Up @@ -1569,6 +1582,9 @@ define([
processPacketData(Number, label, 'outlineWidth', labelData.outlineWidth, interval, sourceUri, entityCollection, query);
processPacketData(NearFarScalar, label, 'translucencyByDistance', labelData.translucencyByDistance, interval, sourceUri, entityCollection, query);
processPacketData(NearFarScalar, label, 'pixelOffsetScaleByDistance', labelData.pixelOffsetScaleByDistance, interval, sourceUri, entityCollection, query);
processPacketData(NearFarScalar, label, 'scaleByDistance', labelData.scaleByDistance, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, label, 'distanceDisplayCondition', labelData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
processPacketData(Number, label, 'disableDepthTestDistance', labelData.disableDepthTestDistance, interval, sourceUri, entityCollection, query);
}

function processModel(entity, packet, entityCollection, sourceUri, query) {
Expand Down Expand Up @@ -1603,6 +1619,7 @@ define([
processPacketData(Color, model, 'color', modelData.color, interval, sourceUri, entityCollection, query);
processPacketData(ColorBlendMode, model, 'colorBlendMode', modelData.colorBlendMode, interval, sourceUri, entityCollection, query);
processPacketData(Number, model, 'colorBlendAmount', modelData.colorBlendAmount, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, model, 'distanceDisplayCondition', modelData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);

var nodeTransformationsData = modelData.nodeTransformations;
if (defined(nodeTransformationsData)) {
Expand Down Expand Up @@ -1687,6 +1704,7 @@ define([
processPacketData(Number, path, 'leadTime', pathData.leadTime, interval, sourceUri, entityCollection, query);
processPacketData(Number, path, 'trailTime', pathData.trailTime, interval, sourceUri, entityCollection, query);
processMaterialPacketData(path, 'material', pathData.material, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, path, 'distanceDisplayCondition', pathData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
}

function processPoint(entity, packet, entityCollection, sourceUri, query) {
Expand Down Expand Up @@ -1715,6 +1733,8 @@ define([
processPacketData(Number, point, 'outlineWidth', pointData.outlineWidth, interval, sourceUri, entityCollection, query);
processPacketData(NearFarScalar, point, 'scaleByDistance', pointData.scaleByDistance, interval, sourceUri, entityCollection, query);
processPacketData(NearFarScalar, point, 'translucencyByDistance', pointData.translucencyByDistance, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, point, 'distanceDisplayCondition', pointData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
processPacketData(Number, point, 'disableDepthTestDistance', pointData.disableDepthTestDistance, interval, sourceUri, entityCollection, query);
}

function processPolygon(entity, packet, entityCollection, sourceUri, query) {
Expand Down Expand Up @@ -1750,6 +1770,7 @@ define([
processPacketData(Boolean, polygon, 'closeTop', polygonData.closeTop, interval, sourceUri, entityCollection, query);
processPacketData(Boolean, polygon, 'closeBottom', polygonData.closeBottom, interval, sourceUri, entityCollection, query);
processPacketData(ShadowMode, polygon, 'shadows', polygonData.shadows, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, polygon, 'distanceDisplayCondition', polygonData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
}

function processPolyline(entity, packet, entityCollection, sourceUri, query) {
Expand All @@ -1775,8 +1796,10 @@ define([
processPacketData(Number, polyline, 'width', polylineData.width, interval, sourceUri, entityCollection, query);
processPacketData(Number, polyline, 'granularity', polylineData.granularity, interval, sourceUri, entityCollection, query);
processMaterialPacketData(polyline, 'material', polylineData.material, interval, sourceUri, entityCollection, query);
processMaterialPacketData(polyline, 'depthFailMaterial', polylineData.depthFailMaterial, interval, sourceUri, entityCollection, query);
processPacketData(Boolean, polyline, 'followSurface', polylineData.followSurface, interval, sourceUri, entityCollection, query);
processPacketData(ShadowMode, polyline, 'shadows', polylineData.shadows, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, polyline, 'distanceDisplayCondition', polylineData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
}

function processRectangle(entity, packet, entityCollection, sourceUri, query) {
Expand Down Expand Up @@ -1812,6 +1835,7 @@ define([
processPacketData(Boolean, rectangle, 'closeTop', rectangleData.closeTop, interval, sourceUri, entityCollection, query);
processPacketData(Boolean, rectangle, 'closeBottom', rectangleData.closeBottom, interval, sourceUri, entityCollection, query);
processPacketData(ShadowMode, rectangle, 'shadows', rectangleData.shadows, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, rectangle, 'distanceDisplayCondition', rectangleData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
}

function processWall(entity, packet, entityCollection, sourceUri, query) {
Expand Down Expand Up @@ -1843,6 +1867,7 @@ define([
processPacketData(Color, wall, 'outlineColor', wallData.outlineColor, interval, sourceUri, entityCollection, query);
processPacketData(Number, wall, 'outlineWidth', wallData.outlineWidth, interval, sourceUri, entityCollection, query);
processPacketData(ShadowMode, wall, 'shadows', wallData.shadows, interval, sourceUri, entityCollection, query);
processPacketData(DistanceDisplayCondition, wall, 'distanceDisplayCondition', wallData.distanceDisplayCondition, interval, sourceUri, entityCollection, query);
}

function processCzmlPacket(packet, entityCollection, updaterFunctions, sourceUri, dataSource, query) {
Expand Down
2 changes: 1 addition & 1 deletion Source/DataSources/PolylineGraphics.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ define([
* @param {Property} [options.width=1.0] A numeric Property specifying the width in pixels.
* @param {Property} [options.show=true] A boolean Property specifying the visibility of the polyline.
* @param {MaterialProperty} [options.material=Color.WHITE] A Property specifying the material used to draw the polyline.
* @param {MaterialProperty} [options.depthFailMaterial] A property specifiying the material to used to draw the polyline when it is below the terrain.
* @param {MaterialProperty} [options.depthFailMaterial] A property specifiying the material used to draw the polyline when it is below the terrain.
* @param {Property} [options.granularity=Cesium.Math.RADIANS_PER_DEGREE] A numeric Property specifying the angular distance between each latitude and longitude if followSurface is true.
* @param {Property} [options.shadows=ShadowMode.DISABLED] An enum Property specifying whether the polyline casts or receives shadows from each light source.
* @param {Property} [options.distanceDisplayCondition] A Property specifying at what distance from the camera that this polyline will be displayed.
Expand Down
8 changes: 6 additions & 2 deletions Specs/Core/DistanceDisplayConditionSpec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
defineSuite([
'Core/DistanceDisplayCondition'
'Core/DistanceDisplayCondition',
'Specs/createPackableSpecs'
], function(
DistanceDisplayCondition) {
DistanceDisplayCondition,
createPackableSpecs) {
'use strict';

it('default constructs', function() {
Expand Down Expand Up @@ -87,4 +89,6 @@ defineSuite([
var returnedResult = dc.clone(dc);
expect(dc).toBe(returnedResult);
});

createPackableSpecs(DistanceDisplayCondition, new DistanceDisplayCondition(1, 2), [1, 2]);
});
Loading