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 classification type not getting propagated properly for dynamic entities on terrain #6608

Merged
merged 4 commits into from
May 22, 2018
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 2 additions & 1 deletion Apps/Sandcastle/gallery/Rectangle.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
coordinates: Cesium.Rectangle.fromDegrees(-92.0, 30.0, -76.0, 40.0),
material: '../images/Cesium_Logo_Color.jpg',
rotation: new Cesium.CallbackProperty(getRotationValue, false),
stRotation: new Cesium.CallbackProperty(getRotationValue, false)
stRotation: new Cesium.CallbackProperty(getRotationValue, false),
classificationType : Cesium.ClassificationType.TERRAIN
}
});

Expand Down
3 changes: 2 additions & 1 deletion Source/DataSources/DynamicGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ define([
geometryInstances : this._geometryUpdater.createFillGeometryInstance(time),
appearance : appearance,
asynchronous : false,
shadows : shadows
shadows : shadows,
classificationType : this._geometryUpdater.classificationTypeProperty.getValue(time)
}), Property.getValueOrUndefined(this._geometryUpdater.zIndex, time));
} else {
options.vertexFormat = appearance.vertexFormat;
Expand Down
3 changes: 3 additions & 0 deletions Specs/DataSources/CorridorGeometryUpdaterSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defineSuite([
'DataSources/SampledPositionProperty',
'DataSources/SampledProperty',
'DataSources/TimeIntervalCollectionProperty',
'Scene/ClassificationType',
'Scene/PrimitiveCollection',
'Specs/createDynamicGeometryUpdaterSpecs',
'Specs/createDynamicProperty',
Expand All @@ -32,6 +33,7 @@ defineSuite([
SampledPositionProperty,
SampledProperty,
TimeIntervalCollectionProperty,
ClassificationType,
PrimitiveCollection,
createDynamicGeometryUpdaterSpecs,
createDynamicProperty,
Expand Down Expand Up @@ -82,6 +84,7 @@ defineSuite([
0, 1
]));
corridor.width = new ConstantProperty(1);
corridor.classificationType = ClassificationType.BOTH; // default TERRAIN
var entity = new Entity();
entity.corridor = corridor;
return entity;
Expand Down
3 changes: 3 additions & 0 deletions Specs/DataSources/EllipseGeometryUpdaterSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ defineSuite([
'DataSources/Entity',
'DataSources/SampledPositionProperty',
'DataSources/SampledProperty',
'Scene/ClassificationType',
'Scene/PrimitiveCollection',
'Specs/createDynamicGeometryUpdaterSpecs',
'Specs/createDynamicProperty',
Expand All @@ -26,6 +27,7 @@ defineSuite([
Entity,
SampledPositionProperty,
SampledProperty,
ClassificationType,
PrimitiveCollection,
createDynamicGeometryUpdaterSpecs,
createDynamicProperty,
Expand Down Expand Up @@ -68,6 +70,7 @@ defineSuite([
var ellipse = new EllipseGraphics();
ellipse.semiMajorAxis = new ConstantProperty(2);
ellipse.semiMinorAxis = new ConstantProperty(1);
ellipse.classificationType = ClassificationType.BOTH; // default TERRAIN

var entity = new Entity();
entity.position = new ConstantPositionProperty(Cartesian3.fromDegrees(0, 0, 0));
Expand Down
3 changes: 3 additions & 0 deletions Specs/DataSources/PolygonGeometryUpdaterSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ defineSuite([
'DataSources/PropertyArray',
'DataSources/SampledPositionProperty',
'DataSources/SampledProperty',
'Scene/ClassificationType',
'Scene/GroundPrimitive',
'Scene/PrimitiveCollection',
'Specs/createDynamicGeometryUpdaterSpecs',
Expand All @@ -29,6 +30,7 @@ defineSuite([
PropertyArray,
SampledPositionProperty,
SampledProperty,
ClassificationType,
GroundPrimitive,
PrimitiveCollection,
createDynamicGeometryUpdaterSpecs,
Expand Down Expand Up @@ -80,6 +82,7 @@ defineSuite([
1, 1,
0, 1
])));
polygon.classificationType = ClassificationType.BOTH; // default TERRAIN
var entity = new Entity();
entity.polygon = polygon;
return entity;
Expand Down
3 changes: 3 additions & 0 deletions Specs/DataSources/RectangleGeometryUpdaterSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ defineSuite([
'DataSources/Entity',
'DataSources/RectangleGraphics',
'DataSources/SampledProperty',
'Scene/ClassificationType',
'Scene/PrimitiveCollection',
'Specs/createDynamicGeometryUpdaterSpecs',
'Specs/createDynamicProperty',
Expand All @@ -24,6 +25,7 @@ defineSuite([
Entity,
RectangleGraphics,
SampledProperty,
ClassificationType,
PrimitiveCollection,
createDynamicGeometryUpdaterSpecs,
createDynamicProperty,
Expand Down Expand Up @@ -61,6 +63,7 @@ defineSuite([

function createBasicRectangleWithoutHeight() {
var rectangle = new RectangleGraphics();
rectangle.classificationType = ClassificationType.BOTH; // default TERRAIN
var entity = new Entity();
entity.rectangle = rectangle;
entity.rectangle.coordinates = new ConstantProperty(new Rectangle(0, 0, 1, 1));
Expand Down
20 changes: 20 additions & 0 deletions Specs/createGeometryUpdaterGroundGeometrySpecs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ define([
'DataSources/ColorMaterialProperty',
'DataSources/ConstantProperty',
'DataSources/SampledProperty',
'Scene/ClassificationType',
'Scene/GroundPrimitive',
'Scene/PrimitiveCollection'
], function(
Expand All @@ -12,6 +13,7 @@ define([
ColorMaterialProperty,
ConstantProperty,
SampledProperty,
ClassificationType,
GroundPrimitive,
PrimitiveCollection) {
'use strict';
Expand Down Expand Up @@ -154,6 +156,24 @@ define([
dynamicUpdater.destroy();
updater.destroy();
});

it('dynamic updater on terrain propagates classification type', function() {
var entity = createDynamicEntity();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting classificationType in each of the XXXGeometryUpdaterSpec files, do entity[geometryPropertyName].classificationType = ClassificationType.BOTH in this file


var updater = new Updater(entity, getScene());
var primitives = new PrimitiveCollection();
var groundPrimitives = new PrimitiveCollection();
var dynamicUpdater = updater.createDynamicUpdater(primitives, groundPrimitives);

dynamicUpdater.update(time);

if (GroundPrimitive.isSupported(getScene())) {
expect(groundPrimitives.get(0).classificationType).toEqual(ClassificationType.BOTH);
}

dynamicUpdater.destroy();
updater.destroy();
});
}

return createGeometryUpdaterGroundGeometrySpecs;
Expand Down