From ab22df7008d6a3c6152ba3258016c1b655acbbf0 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Wed, 27 May 2015 16:51:19 -0400 Subject: [PATCH 1/3] Fix additional Entity.show issues for batched geometry 1. Geometry created by the Entity API was defaulting its show attribute to true, even when `entity.show` was false. 2. When new Entity geometry was added to an existing batch, the current show attribute was not properly migrated from the old Primitive instance to the new one. --- Source/DataSources/BoxGeometryUpdater.js | 4 +-- Source/DataSources/CorridorGeometryUpdater.js | 4 +-- Source/DataSources/CylinderGeometryUpdater.js | 4 +-- Source/DataSources/EllipseGeometryUpdater.js | 4 +-- .../DataSources/EllipsoidGeometryUpdater.js | 4 +-- Source/DataSources/PolygonGeometryUpdater.js | 4 +-- Source/DataSources/PolylineGeometryUpdater.js | 2 +- .../PolylineVolumeGeometryUpdater.js | 4 +-- .../DataSources/RectangleGeometryUpdater.js | 4 +-- .../DataSources/StaticGeometryColorBatch.js | 33 +++++++++++++++---- .../StaticGeometryPerMaterialBatch.js | 28 ++++++++++++++-- .../DataSources/StaticOutlineGeometryBatch.js | 32 ++++++++++++++---- Source/DataSources/WallGeometryUpdater.js | 4 +-- 13 files changed, 97 insertions(+), 34 deletions(-) diff --git a/Source/DataSources/BoxGeometryUpdater.js b/Source/DataSources/BoxGeometryUpdater.js index 14f4628e5691..294a7090d3ed 100644 --- a/Source/DataSources/BoxGeometryUpdater.js +++ b/Source/DataSources/BoxGeometryUpdater.js @@ -304,7 +304,7 @@ define([ var attributes; var color; - var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); + var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); if (this._materialProperty instanceof ColorMaterialProperty) { var currentColor = Color.WHITE; if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) { @@ -357,7 +357,7 @@ define([ geometry : BoxOutlineGeometry.fromDimensions(this._options), modelMatrix : entity._getModelMatrix(Iso8601.MINIMUM_VALUE), attributes : { - show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), + show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), color : ColorGeometryInstanceAttribute.fromColor(outlineColor) } }); diff --git a/Source/DataSources/CorridorGeometryUpdater.js b/Source/DataSources/CorridorGeometryUpdater.js index 43e08de143b8..d53c3dd1b044 100644 --- a/Source/DataSources/CorridorGeometryUpdater.js +++ b/Source/DataSources/CorridorGeometryUpdater.js @@ -312,7 +312,7 @@ define([ var attributes; var color; - var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); + var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); if (this._materialProperty instanceof ColorMaterialProperty) { var currentColor = Color.WHITE; if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) { @@ -363,7 +363,7 @@ define([ id : entity, geometry : new CorridorOutlineGeometry(this._options), attributes : { - show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), + show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), color : ColorGeometryInstanceAttribute.fromColor(outlineColor) } }); diff --git a/Source/DataSources/CylinderGeometryUpdater.js b/Source/DataSources/CylinderGeometryUpdater.js index ab66c94360e6..e64bf8c56da9 100644 --- a/Source/DataSources/CylinderGeometryUpdater.js +++ b/Source/DataSources/CylinderGeometryUpdater.js @@ -311,7 +311,7 @@ define([ var attributes; var color; - var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); + var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); if (this._materialProperty instanceof ColorMaterialProperty) { var currentColor = Color.WHITE; if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) { @@ -364,7 +364,7 @@ define([ geometry : new CylinderOutlineGeometry(this._options), modelMatrix : entity._getModelMatrix(Iso8601.MINIMUM_VALUE), attributes : { - show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), + show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), color : ColorGeometryInstanceAttribute.fromColor(outlineColor) } }); diff --git a/Source/DataSources/EllipseGeometryUpdater.js b/Source/DataSources/EllipseGeometryUpdater.js index 754a052ba329..9fb1587a23c7 100644 --- a/Source/DataSources/EllipseGeometryUpdater.js +++ b/Source/DataSources/EllipseGeometryUpdater.js @@ -315,7 +315,7 @@ define([ var attributes; var color; - var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); + var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); if (this._materialProperty instanceof ColorMaterialProperty) { var currentColor = Color.WHITE; if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) { @@ -366,7 +366,7 @@ define([ id : entity, geometry : new EllipseOutlineGeometry(this._options), attributes : { - show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), + show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), color : ColorGeometryInstanceAttribute.fromColor(outlineColor) } }); diff --git a/Source/DataSources/EllipsoidGeometryUpdater.js b/Source/DataSources/EllipsoidGeometryUpdater.js index fd030e46069c..366a1e6a5272 100644 --- a/Source/DataSources/EllipsoidGeometryUpdater.js +++ b/Source/DataSources/EllipsoidGeometryUpdater.js @@ -316,7 +316,7 @@ define([ var attributes; var color; - var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); + var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); if (this._materialProperty instanceof ColorMaterialProperty) { var currentColor = Color.WHITE; if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) { @@ -370,7 +370,7 @@ define([ geometry : new EllipsoidOutlineGeometry(this._options), modelMatrix : entity._getModelMatrix(Iso8601.MINIMUM_VALUE), attributes : { - show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), + show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), color : ColorGeometryInstanceAttribute.fromColor(outlineColor) } }); diff --git a/Source/DataSources/PolygonGeometryUpdater.js b/Source/DataSources/PolygonGeometryUpdater.js index f9ab20c0e8b4..0f15eff1e554 100644 --- a/Source/DataSources/PolygonGeometryUpdater.js +++ b/Source/DataSources/PolygonGeometryUpdater.js @@ -316,7 +316,7 @@ define([ var attributes; var color; - var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); + var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); if (this._materialProperty instanceof ColorMaterialProperty) { var currentColor = Color.WHITE; if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) { @@ -367,7 +367,7 @@ define([ id : entity, geometry : new PolygonOutlineGeometry(this._options), attributes : { - show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), + show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), color : ColorGeometryInstanceAttribute.fromColor(outlineColor) } }); diff --git a/Source/DataSources/PolylineGeometryUpdater.js b/Source/DataSources/PolylineGeometryUpdater.js index 3793cbdffb16..bbc6e779b713 100644 --- a/Source/DataSources/PolylineGeometryUpdater.js +++ b/Source/DataSources/PolylineGeometryUpdater.js @@ -277,7 +277,7 @@ define([ var attributes; var entity = this._entity; var isAvailable = entity.isAvailable(time); - var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time)); + var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time)); if (this._materialProperty instanceof ColorMaterialProperty) { var currentColor = Color.WHITE; diff --git a/Source/DataSources/PolylineVolumeGeometryUpdater.js b/Source/DataSources/PolylineVolumeGeometryUpdater.js index 03b28c993446..4c292971862a 100644 --- a/Source/DataSources/PolylineVolumeGeometryUpdater.js +++ b/Source/DataSources/PolylineVolumeGeometryUpdater.js @@ -307,7 +307,7 @@ define([ var attributes; var color; - var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); + var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); if (this._materialProperty instanceof ColorMaterialProperty) { var currentColor = Color.WHITE; if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) { @@ -358,7 +358,7 @@ define([ id : entity, geometry : new PolylineVolumeOutlineGeometry(this._options), attributes : { - show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), + show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), color : ColorGeometryInstanceAttribute.fromColor(outlineColor) } }); diff --git a/Source/DataSources/RectangleGeometryUpdater.js b/Source/DataSources/RectangleGeometryUpdater.js index 2e608b033427..f0a252813ec6 100644 --- a/Source/DataSources/RectangleGeometryUpdater.js +++ b/Source/DataSources/RectangleGeometryUpdater.js @@ -314,7 +314,7 @@ define([ var attributes; var color; - var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); + var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); if (this._materialProperty instanceof ColorMaterialProperty) { var currentColor = Color.WHITE; if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) { @@ -365,7 +365,7 @@ define([ id : entity, geometry : new RectangleOutlineGeometry(this._options), attributes : { - show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), + show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), color : ColorGeometryInstanceAttribute.fromColor(outlineColor) } }); diff --git a/Source/DataSources/StaticGeometryColorBatch.js b/Source/DataSources/StaticGeometryColorBatch.js index a3c5bf91b381..916c081b9d14 100644 --- a/Source/DataSources/StaticGeometryColorBatch.js +++ b/Source/DataSources/StaticGeometryColorBatch.js @@ -71,6 +71,9 @@ define([ var removedCount = 0; var primitive = this.primitive; var primitives = this.primitives; + var attributes; + var i; + if (this.createPrimitive) { if (defined(primitive)) { if (!defined(this.oldPrimitive)) { @@ -79,12 +82,28 @@ define([ primitives.remove(primitive); } } - this.attributes.removeAll(); - var geometry = this.geometry.values; - if (geometry.length > 0) { + + var geometries = this.geometry.values; + var geometriesLength = geometries.length; + if (geometriesLength > 0) { + for (i = 0; i < geometriesLength; i++) { + var geometryItem = geometries[i]; + var originalAttributes = geometryItem.attributes; + attributes = this.attributes.get(geometryItem.id.id); + + if (defined(attributes)) { + if (defined(originalAttributes.show)) { + originalAttributes.show.value = attributes.show; + } + if (defined(originalAttributes.color)) { + originalAttributes.color.value = attributes.color; + } + } + } + primitive = new Primitive({ asynchronous : true, - geometryInstances : geometry, + geometryInstances : geometries, appearance : new this.appearanceType({ translucent : this.translucent, closed : this.closed @@ -93,6 +112,8 @@ define([ primitives.add(primitive); isUpdated = false; } + + this.attributes.removeAll(); this.primitive = primitive; this.createPrimitive = false; } else if (defined(primitive) && primitive.ready) { @@ -102,11 +123,11 @@ define([ } var updatersWithAttributes = this.updatersWithAttributes.values; var length = updatersWithAttributes.length; - for (var i = 0; i < length; i++) { + for (i = 0; i < length; i++) { var updater = updatersWithAttributes[i]; var instance = this.geometry.get(updater.entity.id); - var attributes = this.attributes.get(instance.id.id); + attributes = this.attributes.get(instance.id.id); if (!defined(attributes)) { attributes = primitive.getGeometryInstanceAttributes(instance.id); this.attributes.set(instance.id.id, attributes); diff --git a/Source/DataSources/StaticGeometryPerMaterialBatch.js b/Source/DataSources/StaticGeometryPerMaterialBatch.js index b30d7b572512..0db6fa3fc24a 100644 --- a/Source/DataSources/StaticGeometryPerMaterialBatch.js +++ b/Source/DataSources/StaticGeometryPerMaterialBatch.js @@ -89,6 +89,9 @@ define([ var primitive = this.primitive; var primitives = this.primitives; var geometries = this.geometry.values; + var attributes; + var i; + if (this.createPrimitive) { if (defined(primitive)) { if (!defined(this.oldPrimitive)) { @@ -97,7 +100,24 @@ define([ primitives.remove(primitive); } } - if (geometries.length > 0) { + + var geometriesLength = geometries.length; + if (geometriesLength > 0) { + for (i = 0; i < geometriesLength; i++) { + var geometry = geometries[i]; + var originalAttributes = geometry.attributes; + attributes = this.attributes.get(geometry.id.id); + + if (defined(attributes)) { + if (defined(originalAttributes.show)) { + originalAttributes.show.value = attributes.show; + } + if (defined(originalAttributes.color)) { + originalAttributes.color.value = attributes.color; + } + } + } + this.material = MaterialProperty.getValue(time, this.materialProperty, this.material); primitive = new Primitive({ asynchronous : true, @@ -112,6 +132,8 @@ define([ primitives.add(primitive); isUpdated = false; } + + this.attributes.removeAll(); this.primitive = primitive; this.createPrimitive = false; } else if (defined(primitive) && primitive.ready) { @@ -125,12 +147,12 @@ define([ var updatersWithAttributes = this.updatersWithAttributes.values; var length = updatersWithAttributes.length; - for (var i = 0; i < length; i++) { + for (i = 0; i < length; i++) { var updater = updatersWithAttributes[i]; var entity = updater.entity; var instance = this.geometry.get(entity.id); - var attributes = this.attributes.get(instance.id.id); + attributes = this.attributes.get(instance.id.id); if (!defined(attributes)) { attributes = primitive.getGeometryInstanceAttributes(instance.id); this.attributes.set(instance.id.id, attributes); diff --git a/Source/DataSources/StaticOutlineGeometryBatch.js b/Source/DataSources/StaticOutlineGeometryBatch.js index 70139f622393..f4ec17c999ba 100644 --- a/Source/DataSources/StaticOutlineGeometryBatch.js +++ b/Source/DataSources/StaticOutlineGeometryBatch.js @@ -71,8 +71,10 @@ define([ var removedCount = 0; var primitive = this.primitive; var primitives = this.primitives; + var attributes; + var i; + if (this.createPrimitive) { - this.attributes.removeAll(); if (defined(primitive)) { if (!defined(this.oldPrimitive)) { this.oldPrimitive = primitive; @@ -80,11 +82,27 @@ define([ primitives.remove(primitive); } } - var geometry = this.geometry.values; - if (geometry.length > 0) { + var geometries = this.geometry.values; + var geometriesLength = geometries.length; + if (geometriesLength > 0) { + for (i = 0; i < geometriesLength; i++) { + var geometryItem = geometries[i]; + var originalAttributes = geometryItem.attributes; + attributes = this.attributes.get(geometryItem.id.id); + + if (defined(attributes)) { + if (defined(originalAttributes.show)) { + originalAttributes.show.value = attributes.show; + } + if (defined(originalAttributes.color)) { + originalAttributes.color.value = attributes.color; + } + } + } + primitive = new Primitive({ asynchronous : true, - geometryInstances : geometry, + geometryInstances : geometries, appearance : new PerInstanceColorAppearance({ flat : true, translucent : this.translucent, @@ -97,6 +115,8 @@ define([ primitives.add(primitive); isUpdated = false; } + + this.attributes.removeAll(); this.primitive = primitive; this.createPrimitive = false; } else if (defined(primitive) && primitive.ready) { @@ -107,11 +127,11 @@ define([ var updatersWithAttributes = this.updatersWithAttributes.values; var length = updatersWithAttributes.length; - for (var i = 0; i < length; i++) { + for (i = 0; i < length; i++) { var updater = updatersWithAttributes[i]; var instance = this.geometry.get(updater.entity.id); - var attributes = this.attributes.get(instance.id.id); + attributes = this.attributes.get(instance.id.id); if (!defined(attributes)) { attributes = primitive.getGeometryInstanceAttributes(instance.id); this.attributes.set(instance.id.id, attributes); diff --git a/Source/DataSources/WallGeometryUpdater.js b/Source/DataSources/WallGeometryUpdater.js index 68997bc9f415..5d270b433293 100644 --- a/Source/DataSources/WallGeometryUpdater.js +++ b/Source/DataSources/WallGeometryUpdater.js @@ -309,7 +309,7 @@ define([ var attributes; var color; - var show = new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); + var show = new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._fillProperty.getValue(time)); if (this._materialProperty instanceof ColorMaterialProperty) { var currentColor = Color.WHITE; if (defined(this._materialProperty.color) && (this._materialProperty.color.isConstant || isAvailable)) { @@ -360,7 +360,7 @@ define([ id : entity, geometry : new WallOutlineGeometry(this._options), attributes : { - show : new ShowGeometryInstanceAttribute(isAvailable && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), + show : new ShowGeometryInstanceAttribute(isAvailable && entity.isShowing && this._showProperty.getValue(time) && this._showOutlineProperty.getValue(time)), color : ColorGeometryInstanceAttribute.fromColor(outlineColor) } }); From 7729df7647d88bf42bfc1d46ea75c23192d25305 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Thu, 28 May 2015 10:25:25 -0400 Subject: [PATCH 2/3] Add tests for geometry obeying entity.show at creation time. --- Specs/DataSources/BoxGeometryUpdaterSpec.js | 20 +++++++++++++++++++ .../CorridorGeometryUpdaterSpec.js | 20 +++++++++++++++++++ .../CylinderGeometryUpdaterSpec.js | 20 +++++++++++++++++++ .../DataSources/EllipseGeometryUpdaterSpec.js | 20 +++++++++++++++++++ .../EllipsoidGeometryUpdaterSpec.js | 20 +++++++++++++++++++ .../DataSources/PolygonGeometryUpdaterSpec.js | 20 +++++++++++++++++++ .../PolylineGeometryUpdaterSpec.js | 10 ++++++++++ .../PolylineVolumeGeometryUpdaterSpec.js | 20 +++++++++++++++++++ .../RectangleGeometryUpdaterSpec.js | 20 +++++++++++++++++++ Specs/DataSources/WallGeometryUpdaterSpec.js | 20 +++++++++++++++++++ 10 files changed, 190 insertions(+) diff --git a/Specs/DataSources/BoxGeometryUpdaterSpec.js b/Specs/DataSources/BoxGeometryUpdaterSpec.js index a8115a85217d..386ca74e6b1a 100644 --- a/Specs/DataSources/BoxGeometryUpdaterSpec.js +++ b/Specs/DataSources/BoxGeometryUpdaterSpec.js @@ -275,6 +275,26 @@ defineSuite([ expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(outline.getValue(time2))); }); + it('createFillGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicBox(); + entity.show = false; + entity.box.fill = true; + var updater = new BoxGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + + it('createOutlineGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicBox(); + entity.show = false; + entity.box.outline = true; + var updater = new BoxGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + it('dynamic updater sets properties', function() { var entity = new Entity(); entity.position = new ConstantPositionProperty(Cartesian3.fromDegrees(0, 0, 0)); diff --git a/Specs/DataSources/CorridorGeometryUpdaterSpec.js b/Specs/DataSources/CorridorGeometryUpdaterSpec.js index a0441bfb3a9e..df8c92d256bb 100644 --- a/Specs/DataSources/CorridorGeometryUpdaterSpec.js +++ b/Specs/DataSources/CorridorGeometryUpdaterSpec.js @@ -362,6 +362,26 @@ defineSuite([ expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(outline.getValue(time2))); }); + it('createFillGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicCorridor(); + entity.show = false; + entity.corridor.fill = true; + var updater = new CorridorGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + + it('createOutlineGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicCorridor(); + entity.show = false; + entity.corridor.outline = true; + var updater = new CorridorGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + it('dynamic updater sets properties', function() { var corridor = new CorridorGraphics(); corridor.positions = createDynamicProperty(Cartesian3.fromRadiansArray([ diff --git a/Specs/DataSources/CylinderGeometryUpdaterSpec.js b/Specs/DataSources/CylinderGeometryUpdaterSpec.js index 52a5825b72b4..ad483a15b766 100644 --- a/Specs/DataSources/CylinderGeometryUpdaterSpec.js +++ b/Specs/DataSources/CylinderGeometryUpdaterSpec.js @@ -357,6 +357,26 @@ defineSuite([ expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(outline.getValue(time2))); }); + it('createFillGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicCylinder(); + entity.show = false; + entity.cylinder.fill = true; + var updater = new CylinderGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + + it('createOutlineGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicCylinder(); + entity.show = false; + entity.cylinder.outline = true; + var updater = new CylinderGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + it('dynamic updater sets properties', function() { var cylinder = new CylinderGraphics(); cylinder.show = createDynamicProperty(true); diff --git a/Specs/DataSources/EllipseGeometryUpdaterSpec.js b/Specs/DataSources/EllipseGeometryUpdaterSpec.js index 5f5fa040df80..873d4df400e2 100644 --- a/Specs/DataSources/EllipseGeometryUpdaterSpec.js +++ b/Specs/DataSources/EllipseGeometryUpdaterSpec.js @@ -411,6 +411,26 @@ defineSuite([ expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(outline.getValue(time2))); }); + it('createFillGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicEllipse(); + entity.show = false; + entity.ellipse.fill = true; + var updater = new EllipseGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + + it('createOutlineGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicEllipse(); + entity.show = false; + entity.ellipse.outline = true; + var updater = new EllipseGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + it('dynamic updater sets properties', function() { var ellipse = new EllipseGraphics(); ellipse.show = createDynamicProperty(true); diff --git a/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js b/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js index 32eb40ff2e58..ecc199402fe6 100644 --- a/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js +++ b/Specs/DataSources/EllipsoidGeometryUpdaterSpec.js @@ -345,6 +345,26 @@ defineSuite([ expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(outline.getValue(time2))); }); + it('createFillGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicEllipsoid(); + entity.show = false; + entity.ellipsoid.fill = true; + var updater = new EllipsoidGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + + it('createOutlineGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicEllipsoid(); + entity.show = false; + entity.ellipsoid.outline = true; + var updater = new EllipsoidGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + it('dynamic ellipsoid creates and updates', function() { var ellipsoid = new EllipsoidGraphics(); ellipsoid.show = createDynamicProperty(true); diff --git a/Specs/DataSources/PolygonGeometryUpdaterSpec.js b/Specs/DataSources/PolygonGeometryUpdaterSpec.js index 6e57d843ff59..35bad11b3e2a 100644 --- a/Specs/DataSources/PolygonGeometryUpdaterSpec.js +++ b/Specs/DataSources/PolygonGeometryUpdaterSpec.js @@ -357,6 +357,26 @@ defineSuite([ expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(outline.getValue(time2))); }); + it('createFillGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicPolygon(); + entity.show = false; + entity.polygon.fill = true; + var updater = new PolygonGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + + it('createOutlineGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicPolygon(); + entity.show = false; + entity.polygon.outline = true; + var updater = new PolygonGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + it('dynamic updater sets properties', function() { var polygon = new PolygonGraphics(); polygon.hierarchy = createDynamicProperty(new PolygonHierarchy(Cartesian3.fromRadiansArray([ diff --git a/Specs/DataSources/PolylineGeometryUpdaterSpec.js b/Specs/DataSources/PolylineGeometryUpdaterSpec.js index 281bf85856c5..58f38b6eda63 100644 --- a/Specs/DataSources/PolylineGeometryUpdaterSpec.js +++ b/Specs/DataSources/PolylineGeometryUpdaterSpec.js @@ -272,6 +272,16 @@ defineSuite([ expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(show.getValue(time2))); }); + it('createFillGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicPolyline(); + entity.show = false; + entity.polyline.fill = true; + var updater = new PolylineGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + it('dynamic updater sets properties', function() { var entity = new Entity(); var polyline = new PolylineGraphics(); diff --git a/Specs/DataSources/PolylineVolumeGeometryUpdaterSpec.js b/Specs/DataSources/PolylineVolumeGeometryUpdaterSpec.js index a66bacd65dfe..f180a6ffb9ec 100644 --- a/Specs/DataSources/PolylineVolumeGeometryUpdaterSpec.js +++ b/Specs/DataSources/PolylineVolumeGeometryUpdaterSpec.js @@ -320,6 +320,26 @@ defineSuite([ expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(outline.getValue(time2))); }); + it('createFillGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicPolylineVolume(); + entity.show = false; + entity.polylineVolume.fill = true; + var updater = new PolylineVolumeGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + + it('createOutlineGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicPolylineVolume(); + entity.show = false; + entity.polylineVolume.outline = true; + var updater = new PolylineVolumeGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + it('dynamic updater sets properties', function() { var polylineVolume = new PolylineVolumeGraphics(); polylineVolume.positions = createDynamicProperty(Cartesian3.fromRadiansArray([ diff --git a/Specs/DataSources/RectangleGeometryUpdaterSpec.js b/Specs/DataSources/RectangleGeometryUpdaterSpec.js index 150c3e62a511..19ae6874f446 100644 --- a/Specs/DataSources/RectangleGeometryUpdaterSpec.js +++ b/Specs/DataSources/RectangleGeometryUpdaterSpec.js @@ -368,6 +368,26 @@ defineSuite([ expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(outline.getValue(time2))); }); + it('createFillGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicRectangle(); + entity.show = false; + entity.rectangle.fill = true; + var updater = new RectangleGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + + it('createOutlineGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicRectangle(); + entity.show = false; + entity.rectangle.outline = true; + var updater = new RectangleGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + it('dynamic updater sets properties', function() { var rectangle = new RectangleGraphics(); rectangle.coordinates = createDynamicProperty(new Rectangle(0, 0, 1, 1)); diff --git a/Specs/DataSources/WallGeometryUpdaterSpec.js b/Specs/DataSources/WallGeometryUpdaterSpec.js index 7f4201ede4d2..8c694b8f856a 100644 --- a/Specs/DataSources/WallGeometryUpdaterSpec.js +++ b/Specs/DataSources/WallGeometryUpdaterSpec.js @@ -331,6 +331,26 @@ defineSuite([ expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(outline.getValue(time2))); }); + it('createFillGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicWall(); + entity.show = false; + entity.wall.fill = true; + var updater = new WallGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + + it('createOutlineGeometryInstance obeys Entity.show is false.', function() { + var entity = createBasicWall(); + entity.show = false; + entity.wall.outline = true; + var updater = new WallGeometryUpdater(entity, scene); + var instance = updater.createFillGeometryInstance(new JulianDate()); + var attributes = instance.attributes; + expect(attributes.show.value).toEqual(ShowGeometryInstanceAttribute.toValue(false)); + }); + it('dynamic updater sets properties', function() { var wall = new WallGraphics(); wall.positions = createDynamicProperty(Cartesian3.fromRadiansArray([0, 0, 1, 0, 1, 1, 0, 1])); From 4c746963d61bce534833c8d635d57238495734df Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Thu, 28 May 2015 10:27:48 -0400 Subject: [PATCH 3/3] Update CHANGES. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 0e99869b3f7f..5eb09b8be992 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -36,6 +36,7 @@ Change Log * Added support for the [CESIUM_binary_glTF](https://github.com/KhronosGroup/glTF/blob/new-extensions/extensions/CESIUM_binary_glTF/README.md) extension for loading binary blobs of glTF to `Model`. * Added support for the [CESIUM_RTC](https://github.com/KhronosGroup/glTF/blob/new-extensions/extensions/CESIUM_RTC/README.md) glTF extension for high-precision rendering to `Model`. * Fixed a bug where the sun was smeared when the skybox/stars was disabled. [#1829](https://github.com/AnalyticalGraphicsInc/cesium/issue/1829) +* Fixed a bug that sometimes caused `Entity` instances with `show` set to false to reappear when new `Entity` geometry is added. [#2686](https://github.com/AnalyticalGraphicsInc/cesium/issues/2686) ### 1.9 - 2015-05-01