From 0ed0a97249e4314b1763311381069d646a0f5dc8 Mon Sep 17 00:00:00 2001 From: Kangning Li Date: Mon, 21 May 2018 17:37:47 -0400 Subject: [PATCH 1/3] fix classification type not getting propagated properly for dynamic entities on terrain --- Apps/Sandcastle/gallery/Rectangle.html | 3 ++- Source/DataSources/DynamicGeometryUpdater.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Apps/Sandcastle/gallery/Rectangle.html b/Apps/Sandcastle/gallery/Rectangle.html index 1acdbf0c99c0..cf3b11fc4dec 100644 --- a/Apps/Sandcastle/gallery/Rectangle.html +++ b/Apps/Sandcastle/gallery/Rectangle.html @@ -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 } }); diff --git a/Source/DataSources/DynamicGeometryUpdater.js b/Source/DataSources/DynamicGeometryUpdater.js index 163eaaab442f..b7e35b66d0fc 100644 --- a/Source/DataSources/DynamicGeometryUpdater.js +++ b/Source/DataSources/DynamicGeometryUpdater.js @@ -124,7 +124,8 @@ define([ geometryInstances : this._geometryUpdater.createFillGeometryInstance(time), appearance : appearance, asynchronous : false, - shadows : shadows + shadows : shadows, + classificationType : this._geometryUpdater.classificationTypeProperty.getValue(time) })); } else { options.vertexFormat = appearance.vertexFormat; From 4eebb9c98e6aff99650dc0ba80fe57d139739c8e Mon Sep 17 00:00:00 2001 From: Kangning Li Date: Tue, 22 May 2018 14:33:33 -0400 Subject: [PATCH 2/3] add test for DynamicGeometryUpdater propagating classification type --- .../CorridorGeometryUpdaterSpec.js | 3 +++ .../DataSources/EllipseGeometryUpdaterSpec.js | 3 +++ .../DataSources/PolygonGeometryUpdaterSpec.js | 3 +++ .../RectangleGeometryUpdaterSpec.js | 3 +++ ...reateGeometryUpdaterGroundGeometrySpecs.js | 20 +++++++++++++++++++ 5 files changed, 32 insertions(+) diff --git a/Specs/DataSources/CorridorGeometryUpdaterSpec.js b/Specs/DataSources/CorridorGeometryUpdaterSpec.js index 940a2718d92b..06d5136b8c90 100644 --- a/Specs/DataSources/CorridorGeometryUpdaterSpec.js +++ b/Specs/DataSources/CorridorGeometryUpdaterSpec.js @@ -12,6 +12,7 @@ defineSuite([ 'DataSources/SampledPositionProperty', 'DataSources/SampledProperty', 'DataSources/TimeIntervalCollectionProperty', + 'Scene/ClassificationType', 'Scene/PrimitiveCollection', 'Specs/createDynamicGeometryUpdaterSpecs', 'Specs/createDynamicProperty', @@ -32,6 +33,7 @@ defineSuite([ SampledPositionProperty, SampledProperty, TimeIntervalCollectionProperty, + ClassificationType, PrimitiveCollection, createDynamicGeometryUpdaterSpecs, createDynamicProperty, @@ -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; diff --git a/Specs/DataSources/EllipseGeometryUpdaterSpec.js b/Specs/DataSources/EllipseGeometryUpdaterSpec.js index a429a8dd859a..a67c570d41c8 100644 --- a/Specs/DataSources/EllipseGeometryUpdaterSpec.js +++ b/Specs/DataSources/EllipseGeometryUpdaterSpec.js @@ -9,6 +9,7 @@ defineSuite([ 'DataSources/Entity', 'DataSources/SampledPositionProperty', 'DataSources/SampledProperty', + 'Scene/ClassificationType', 'Scene/PrimitiveCollection', 'Specs/createDynamicGeometryUpdaterSpecs', 'Specs/createDynamicProperty', @@ -26,6 +27,7 @@ defineSuite([ Entity, SampledPositionProperty, SampledProperty, + ClassificationType, PrimitiveCollection, createDynamicGeometryUpdaterSpecs, createDynamicProperty, @@ -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)); diff --git a/Specs/DataSources/PolygonGeometryUpdaterSpec.js b/Specs/DataSources/PolygonGeometryUpdaterSpec.js index 1e87f87d4d5a..9599b61228d7 100644 --- a/Specs/DataSources/PolygonGeometryUpdaterSpec.js +++ b/Specs/DataSources/PolygonGeometryUpdaterSpec.js @@ -10,6 +10,7 @@ defineSuite([ 'DataSources/PropertyArray', 'DataSources/SampledPositionProperty', 'DataSources/SampledProperty', + 'Scene/ClassificationType', 'Scene/GroundPrimitive', 'Scene/PrimitiveCollection', 'Specs/createDynamicGeometryUpdaterSpecs', @@ -29,6 +30,7 @@ defineSuite([ PropertyArray, SampledPositionProperty, SampledProperty, + ClassificationType, GroundPrimitive, PrimitiveCollection, createDynamicGeometryUpdaterSpecs, @@ -80,6 +82,7 @@ defineSuite([ 1, 1, 0, 1 ]))); + polygon.classificationType = ClassificationType.BOTH; // default TERRAIN var entity = new Entity(); entity.polygon = polygon; return entity; diff --git a/Specs/DataSources/RectangleGeometryUpdaterSpec.js b/Specs/DataSources/RectangleGeometryUpdaterSpec.js index 2608b931511f..5f8c6039185b 100644 --- a/Specs/DataSources/RectangleGeometryUpdaterSpec.js +++ b/Specs/DataSources/RectangleGeometryUpdaterSpec.js @@ -8,6 +8,7 @@ defineSuite([ 'DataSources/Entity', 'DataSources/RectangleGraphics', 'DataSources/SampledProperty', + 'Scene/ClassificationType', 'Scene/PrimitiveCollection', 'Specs/createDynamicGeometryUpdaterSpecs', 'Specs/createDynamicProperty', @@ -24,6 +25,7 @@ defineSuite([ Entity, RectangleGraphics, SampledProperty, + ClassificationType, PrimitiveCollection, createDynamicGeometryUpdaterSpecs, createDynamicProperty, @@ -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)); diff --git a/Specs/createGeometryUpdaterGroundGeometrySpecs.js b/Specs/createGeometryUpdaterGroundGeometrySpecs.js index 3edb17520cb7..c2e15b26c139 100644 --- a/Specs/createGeometryUpdaterGroundGeometrySpecs.js +++ b/Specs/createGeometryUpdaterGroundGeometrySpecs.js @@ -4,6 +4,7 @@ define([ 'DataSources/ColorMaterialProperty', 'DataSources/ConstantProperty', 'DataSources/SampledProperty', + 'Scene/ClassificationType', 'Scene/GroundPrimitive', 'Scene/PrimitiveCollection' ], function( @@ -12,6 +13,7 @@ define([ ColorMaterialProperty, ConstantProperty, SampledProperty, + ClassificationType, GroundPrimitive, PrimitiveCollection) { 'use strict'; @@ -154,6 +156,24 @@ define([ dynamicUpdater.destroy(); updater.destroy(); }); + + it('dynamic updater on terrain propagates classification type', function() { + var entity = createDynamicEntity(); + + 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; From f6b7a785496471456b504e9a63a9540b0d715bec Mon Sep 17 00:00:00 2001 From: Kangning Li Date: Tue, 22 May 2018 16:25:05 -0400 Subject: [PATCH 3/3] PR feedback --- Specs/DataSources/CorridorGeometryUpdaterSpec.js | 3 --- Specs/DataSources/EllipseGeometryUpdaterSpec.js | 3 --- Specs/DataSources/PolygonGeometryUpdaterSpec.js | 3 --- Specs/DataSources/RectangleGeometryUpdaterSpec.js | 3 --- Specs/createGeometryUpdaterGroundGeometrySpecs.js | 1 + 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/Specs/DataSources/CorridorGeometryUpdaterSpec.js b/Specs/DataSources/CorridorGeometryUpdaterSpec.js index 06d5136b8c90..940a2718d92b 100644 --- a/Specs/DataSources/CorridorGeometryUpdaterSpec.js +++ b/Specs/DataSources/CorridorGeometryUpdaterSpec.js @@ -12,7 +12,6 @@ defineSuite([ 'DataSources/SampledPositionProperty', 'DataSources/SampledProperty', 'DataSources/TimeIntervalCollectionProperty', - 'Scene/ClassificationType', 'Scene/PrimitiveCollection', 'Specs/createDynamicGeometryUpdaterSpecs', 'Specs/createDynamicProperty', @@ -33,7 +32,6 @@ defineSuite([ SampledPositionProperty, SampledProperty, TimeIntervalCollectionProperty, - ClassificationType, PrimitiveCollection, createDynamicGeometryUpdaterSpecs, createDynamicProperty, @@ -84,7 +82,6 @@ defineSuite([ 0, 1 ])); corridor.width = new ConstantProperty(1); - corridor.classificationType = ClassificationType.BOTH; // default TERRAIN var entity = new Entity(); entity.corridor = corridor; return entity; diff --git a/Specs/DataSources/EllipseGeometryUpdaterSpec.js b/Specs/DataSources/EllipseGeometryUpdaterSpec.js index a67c570d41c8..a429a8dd859a 100644 --- a/Specs/DataSources/EllipseGeometryUpdaterSpec.js +++ b/Specs/DataSources/EllipseGeometryUpdaterSpec.js @@ -9,7 +9,6 @@ defineSuite([ 'DataSources/Entity', 'DataSources/SampledPositionProperty', 'DataSources/SampledProperty', - 'Scene/ClassificationType', 'Scene/PrimitiveCollection', 'Specs/createDynamicGeometryUpdaterSpecs', 'Specs/createDynamicProperty', @@ -27,7 +26,6 @@ defineSuite([ Entity, SampledPositionProperty, SampledProperty, - ClassificationType, PrimitiveCollection, createDynamicGeometryUpdaterSpecs, createDynamicProperty, @@ -70,7 +68,6 @@ 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)); diff --git a/Specs/DataSources/PolygonGeometryUpdaterSpec.js b/Specs/DataSources/PolygonGeometryUpdaterSpec.js index 9599b61228d7..1e87f87d4d5a 100644 --- a/Specs/DataSources/PolygonGeometryUpdaterSpec.js +++ b/Specs/DataSources/PolygonGeometryUpdaterSpec.js @@ -10,7 +10,6 @@ defineSuite([ 'DataSources/PropertyArray', 'DataSources/SampledPositionProperty', 'DataSources/SampledProperty', - 'Scene/ClassificationType', 'Scene/GroundPrimitive', 'Scene/PrimitiveCollection', 'Specs/createDynamicGeometryUpdaterSpecs', @@ -30,7 +29,6 @@ defineSuite([ PropertyArray, SampledPositionProperty, SampledProperty, - ClassificationType, GroundPrimitive, PrimitiveCollection, createDynamicGeometryUpdaterSpecs, @@ -82,7 +80,6 @@ defineSuite([ 1, 1, 0, 1 ]))); - polygon.classificationType = ClassificationType.BOTH; // default TERRAIN var entity = new Entity(); entity.polygon = polygon; return entity; diff --git a/Specs/DataSources/RectangleGeometryUpdaterSpec.js b/Specs/DataSources/RectangleGeometryUpdaterSpec.js index 5f8c6039185b..2608b931511f 100644 --- a/Specs/DataSources/RectangleGeometryUpdaterSpec.js +++ b/Specs/DataSources/RectangleGeometryUpdaterSpec.js @@ -8,7 +8,6 @@ defineSuite([ 'DataSources/Entity', 'DataSources/RectangleGraphics', 'DataSources/SampledProperty', - 'Scene/ClassificationType', 'Scene/PrimitiveCollection', 'Specs/createDynamicGeometryUpdaterSpecs', 'Specs/createDynamicProperty', @@ -25,7 +24,6 @@ defineSuite([ Entity, RectangleGraphics, SampledProperty, - ClassificationType, PrimitiveCollection, createDynamicGeometryUpdaterSpecs, createDynamicProperty, @@ -63,7 +61,6 @@ 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)); diff --git a/Specs/createGeometryUpdaterGroundGeometrySpecs.js b/Specs/createGeometryUpdaterGroundGeometrySpecs.js index c2e15b26c139..b0ed38ab479c 100644 --- a/Specs/createGeometryUpdaterGroundGeometrySpecs.js +++ b/Specs/createGeometryUpdaterGroundGeometrySpecs.js @@ -159,6 +159,7 @@ define([ it('dynamic updater on terrain propagates classification type', function() { var entity = createDynamicEntity(); + entity[geometryPropertyName].classificationType = ClassificationType.BOTH; var updater = new Updater(entity, getScene()); var primitives = new PrimitiveCollection();