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

Fix updating Polyline.distanceDisplayCondition #5283

Merged
merged 2 commits into from
May 6, 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
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Change Log
==========

### 1.34 - 2017-06-01

* Fix issue where polylines in a `PolylineCollection` would ignore the far distance when updating the distance display condition. [#5283](https://github.com/AnalyticalGraphicsInc/cesium/pull/5283)

### 1.33 - 2017-05-01

* Breaking changes
Expand Down
10 changes: 5 additions & 5 deletions Source/Scene/PolylineCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ define([
Cesium.Cartographic.fromDegrees(-77.02, 38.53)]),
* width : 1
* });
*
*
* @see PolylineCollection#remove
* @see PolylineCollection#removeAll
* @see PolylineCollection#update
Expand Down Expand Up @@ -276,7 +276,7 @@ define([
* @example
* var p = polylines.add(...);
* polylines.remove(p); // Returns true
*
*
* @see PolylineCollection#add
* @see PolylineCollection#removeAll
* @see PolylineCollection#update
Expand Down Expand Up @@ -313,7 +313,7 @@ define([
* polylines.add(...);
* polylines.add(...);
* polylines.removeAll();
*
*
* @see PolylineCollection#add
* @see PolylineCollection#remove
* @see PolylineCollection#update
Expand Down Expand Up @@ -502,7 +502,7 @@ define([
var distanceDisplayCondition = polyline.distanceDisplayCondition;
if (defined(distanceDisplayCondition)) {
nearFarCartesian.x = distanceDisplayCondition.near;
nearFarCartesian.x = distanceDisplayCondition.far;
nearFarCartesian.y = distanceDisplayCondition.far;
}

this._batchTable.setBatchedAttribute(polyline._index, 4, nearFarCartesian);
Expand Down Expand Up @@ -735,7 +735,7 @@ define([
*
* @example
* polylines = polylines && polylines.destroy();
*
*
* @see PolylineCollection#isDestroyed
*/
PolylineCollection.prototype.destroy = function() {
Expand Down
36 changes: 36 additions & 0 deletions Specs/Scene/PolylineCollectionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,42 @@ defineSuite([
expect(scene).toRender([0, 0, 0, 255]);
});

it('renders with a distance display condition after creation', function() {
var near = 100.0;
var far = 10000.0;

var line = polylines.add({
positions : [{
x : 10.0,
y : -10.0,
z : 0.0
}, {
x : 10.0,
y : 10.0,
z : 0.0
}],
width : 7
});

scene.primitives.add(polylines);
scene.renderForSpecs();

line.distanceDisplayCondition = new DistanceDisplayCondition(near, far);

var boundingSphere = line._boundingVolumeWC;
var center = boundingSphere.center;
var radius = boundingSphere.radius;

scene.camera.lookAt(center, new HeadingPitchRange(0.0, -CesiumMath.PI_OVER_TWO, radius + near - 10.0));
expect(scene).toRender([0, 0, 0, 255]);

scene.camera.lookAt(center, new HeadingPitchRange(0.0, -CesiumMath.PI_OVER_TWO, radius + near + 1.0));
expect(scene).notToRender([0, 0, 0, 255]);

scene.camera.lookAt(center, new HeadingPitchRange(0.0, -CesiumMath.PI_OVER_TWO, radius + far + 10.0));
expect(scene).toRender([0, 0, 0, 255]);
});

it('changes polyline position size recreates vertex arrays', function() {
var positions = [];
for(var i = 0; i < 20; ++i){
Expand Down