Skip to content

Commit

Permalink
specs and CHANGES.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hpinkos committed Mar 22, 2018
1 parent ce145b5 commit e34d7c5
Show file tree
Hide file tree
Showing 9 changed files with 227 additions and 8 deletions.
4 changes: 2 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Change Log
* `Credit` has been modified to take an HTML string as the credit content [#6331](https://github.com/AnalyticalGraphicsInc/cesium/pull/6331)
* Added support for ordering in `DataSourceCollection` [#6316](https://github.com/AnalyticalGraphicsInc/cesium/pull/6316)
* All ground geometry from one `DataSource` will render in front of all ground geometry from another `DataSource` in the same collection with a lower index.
* Use `DataSourceCollection.raise`, `DataSourceCollection.lower`, `DataSourceCollection.raiseToTop` and `DataSourceCollection.lowerToBottom` functions to change the ordering of a `DataSource` in the collection.
* Use `DataSourceCollection.raise`, `DataSourceCollection.lower`, `DataSourceCollection.raiseToTop` and `DataSourceCollection.lowerToBottom` functions to change the ordering of a `DataSource` in the collection.
* Added `zIndex` support for static `Corridor`, `Ellipse`, `Polygon` and `Rectangle` entities [#6362](https://github.com/AnalyticalGraphicsInc/cesium/pull/6362)

##### Fixes :wrench:
* Fixed support of glTF-supplied tangent vectors. [#6302](https://github.com/AnalyticalGraphicsInc/cesium/pull/6302)
Expand All @@ -40,7 +41,6 @@ Change Log
* Fixed rendering vector tiles when using `invertClassification`. [#6349](https://github.com/AnalyticalGraphicsInc/cesium/pull/6349)
* Fixed animation for glTF models with missing animation targets. [#6351](https://github.com/AnalyticalGraphicsInc/cesium/pull/6351)


### 1.43 - 2018-03-01

##### Major Announcements :loudspeaker:
Expand Down
2 changes: 1 addition & 1 deletion Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ define([

var ellipsoid = dataSource._ellipsoid;
var positions = readCoordinates(queryFirstNode(groundOverlay, 'LatLonQuad', namespaces.gx), ellipsoid);
var zIndex = queryFirstNode(groundOverlay, 'drawOrder', namespaces.kml);
var zIndex = queryNumericValue(groundOverlay, 'drawOrder', namespaces.kml);
if (defined(positions)) {
geometry = createDefaultPolygon();
geometry.hierarchy = new PolygonHierarchy(positions);
Expand Down
13 changes: 12 additions & 1 deletion Specs/DataSources/CorridorGraphicsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ defineSuite([
cornerType : CornerType.BEVELED,
shadows : ShadowMode.DISABLED,
distanceDisplayCondition : new DistanceDisplayCondition(10.0, 100.0),
classificationType : ClassificationType.TERRAIN
classificationType : ClassificationType.TERRAIN,
zIndex: 3
};

var corridor = new CorridorGraphics(options);
Expand All @@ -57,6 +58,7 @@ defineSuite([
expect(corridor.shadows).toBeInstanceOf(ConstantProperty);
expect(corridor.distanceDisplayCondition).toBeInstanceOf(ConstantProperty);
expect(corridor.classificationType).toBeInstanceOf(ConstantProperty);
expect(corridor.zIndex).toBeInstanceOf(ConstantProperty);

expect(corridor.material.color.getValue()).toEqual(options.material);
expect(corridor.positions.getValue()).toEqual(options.positions);
Expand All @@ -73,6 +75,7 @@ defineSuite([
expect(corridor.shadows.getValue()).toEqual(options.shadows);
expect(corridor.distanceDisplayCondition.getValue()).toEqual(options.distanceDisplayCondition);
expect(corridor.classificationType.getValue()).toEqual(options.classificationType);
expect(corridor.zIndex.getValue()).toEqual(options.zIndex);
});

it('merge assigns unassigned properties', function() {
Expand All @@ -92,6 +95,7 @@ defineSuite([
source.shadows = new ConstantProperty(ShadowMode.ENABLED);
source.distanceDisplayCondition = new ConstantProperty(new DistanceDisplayCondition(10.0, 100.0));
source.classificationType = new ConstantProperty(ClassificationType.TERRAIN);
source.zIndex = new ConstantProperty(3);

var target = new CorridorGraphics();
target.merge(source);
Expand All @@ -111,6 +115,7 @@ defineSuite([
expect(target.shadows).toBe(source.shadows);
expect(target.distanceDisplayCondition).toBe(source.distanceDisplayCondition);
expect(target.classificationType).toBe(source.classificationType);
expect(target.zIndex).toBe(source.zIndex);
});

it('merge does not assign assigned properties', function() {
Expand All @@ -131,6 +136,7 @@ defineSuite([
var shadows = new ConstantProperty();
var distanceDisplayCondition = new ConstantProperty();
var classificationType = new ConstantProperty();
var zIndex = new ConstantProperty();

var target = new CorridorGraphics();
target.material = material;
Expand All @@ -148,6 +154,7 @@ defineSuite([
target.shadows = shadows;
target.distanceDisplayCondition = distanceDisplayCondition;
target.classificationType = classificationType;
target.zIndex = zIndex;

target.merge(source);

Expand All @@ -166,6 +173,7 @@ defineSuite([
expect(target.shadows).toBe(shadows);
expect(target.distanceDisplayCondition).toBe(distanceDisplayCondition);
expect(target.classificationType).toBe(classificationType);
expect(target.zIndex).toBe(zIndex);
});

it('clone works', function() {
Expand All @@ -185,6 +193,7 @@ defineSuite([
source.shadows = new ConstantProperty();
source.distanceDisplayCondition = new ConstantProperty();
source.classificationType = new ConstantProperty();
source.zIndex = new ConstantProperty();

var result = source.clone();
expect(result.material).toBe(source.material);
Expand All @@ -202,6 +211,7 @@ defineSuite([
expect(result.shadows).toBe(source.shadows);
expect(result.distanceDisplayCondition).toBe(source.distanceDisplayCondition);
expect(result.classificationType).toBe(source.classificationType);
expect(result.zIndex).toBe(source.zIndex);
});

it('merge throws if source undefined', function() {
Expand All @@ -228,5 +238,6 @@ defineSuite([
testDefinitionChanged(property, 'shadows', ShadowMode.ENABLED, ShadowMode.DISABLED);
testDefinitionChanged(property, 'distanceDisplayCondition', new DistanceDisplayCondition(), new DistanceDisplayCondition(10.0, 100.0));
testDefinitionChanged(property, 'classificationType', ClassificationType.TERRAIN, ClassificationType.BOTH);
testDefinitionChanged(property, 'zIndex', 3, 0);
});
});
13 changes: 12 additions & 1 deletion Specs/DataSources/EllipseGraphicsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ defineSuite([
outlineWidth : 9,
shadows : ShadowMode.DISABLED,
distanceDisplayCondition : new DistanceDisplayCondition(),
classificationType : ClassificationType.TERRAIN
classificationType : ClassificationType.TERRAIN,
zIndex: 3
};

var ellipse = new EllipseGraphics(options);
Expand All @@ -59,6 +60,7 @@ defineSuite([
expect(ellipse.shadows).toBeInstanceOf(ConstantProperty);
expect(ellipse.distanceDisplayCondition).toBeInstanceOf(ConstantProperty);
expect(ellipse.classificationType).toBeInstanceOf(ConstantProperty);
expect(ellipse.zIndex).toBeInstanceOf(ConstantProperty);

expect(ellipse.material.color.getValue()).toEqual(options.material);
expect(ellipse.show.getValue()).toEqual(options.show);
Expand All @@ -77,6 +79,7 @@ defineSuite([
expect(ellipse.shadows.getValue()).toEqual(options.shadows);
expect(ellipse.distanceDisplayCondition.getValue()).toEqual(options.distanceDisplayCondition);
expect(ellipse.classificationType.getValue()).toEqual(options.classificationType);
expect(ellipse.zIndex.getValue()).toEqual(options.zIndex);
});

it('merge assigns unassigned properties', function() {
Expand All @@ -98,6 +101,7 @@ defineSuite([
source.shadows = new ConstantProperty(ShadowMode.ENABLED);
source.distanceDisplayCondition = new ConstantProperty(new DistanceDisplayCondition(10.0, 100.0));
source.classificationType = new ConstantProperty(ClassificationType.TERRAIN);
source.zIndex = new ConstantProperty(3);

var target = new EllipseGraphics();
target.merge(source);
Expand All @@ -119,6 +123,7 @@ defineSuite([
expect(target.shadows).toBe(source.shadows);
expect(target.distanceDisplayCondition).toBe(source.distanceDisplayCondition);
expect(target.classificationType).toBe(source.classificationType);
expect(target.zIndex).toBe(source.zIndex);
});

it('merge does not assign assigned properties', function() {
Expand All @@ -141,6 +146,7 @@ defineSuite([
var shadows = new ConstantProperty();
var distanceDisplayCondition = new ConstantProperty();
var classificationType = new ConstantProperty();
var zIndex = new ConstantProperty();

var target = new EllipseGraphics();
target.material = material;
Expand All @@ -160,6 +166,7 @@ defineSuite([
target.shadows = shadows;
target.distanceDisplayCondition = distanceDisplayCondition;
target.classificationType = classificationType;
target.zIndex = zIndex;

target.merge(source);

Expand All @@ -180,6 +187,7 @@ defineSuite([
expect(target.shadows).toBe(shadows);
expect(target.distanceDisplayCondition).toBe(distanceDisplayCondition);
expect(target.classificationType).toBe(classificationType);
expect(target.zIndex).toBe(zIndex);
});

it('clone works', function() {
Expand All @@ -201,6 +209,7 @@ defineSuite([
source.shadows = new ConstantProperty();
source.distanceDisplayCondition = new ConstantProperty();
source.classificationType = new ConstantProperty();
source.zIndex = new ConstantProperty();

var result = source.clone();
expect(result.material).toBe(source.material);
Expand All @@ -220,6 +229,7 @@ defineSuite([
expect(result.shadows).toBe(source.shadows);
expect(result.distanceDisplayCondition).toBe(source.distanceDisplayCondition);
expect(result.classificationType).toBe(source.classificationType);
expect(result.zIndex).toBe(source.zIndex);
});

it('merge throws if source undefined', function() {
Expand Down Expand Up @@ -248,5 +258,6 @@ defineSuite([
testDefinitionChanged(property, 'shadows', ShadowMode.ENABLED, ShadowMode.DISABLED);
testDefinitionChanged(property, 'distanceDisplayCondition', new DistanceDisplayCondition(), new DistanceDisplayCondition(10.0, 100.0));
testDefinitionChanged(property, 'classificationType', ClassificationType.TERRAIN, ClassificationType.BOTH);
testDefinitionChanged(property, 'zIndex', 4, 0);
});
});
112 changes: 112 additions & 0 deletions Specs/DataSources/GeometryVisualizerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,121 @@ defineSuite([
expect(visualizer.update(time)).toBe(true);
scene.render(time);
expect(scene.primitives.length).toBe(0);
expect(scene.groundPrimitives.length).toBe(1);
visualizer.destroy();
});

it('Creates and removes static color geometry on terrain', function() {
scene.groundPrimitives.removeAll();
var objects = new EntityCollection();
var visualizer = new GeometryVisualizer(scene, objects, scene.primitives, scene.groundPrimitives);

var ellipse = new EllipseGraphics();
ellipse.semiMajorAxis = new ConstantProperty(2);
ellipse.semiMinorAxis = new ConstantProperty(1);
ellipse.material = new ColorMaterialProperty();

var entity = new Entity();
entity.position = new ConstantPositionProperty(new Cartesian3(1234, 5678, 9101112));
entity.ellipse = ellipse;
objects.add(entity);

return pollToPromise(function() {
scene.initializeFrame();
var isUpdated = visualizer.update(time);
scene.render(time);
return isUpdated;
}).then(function() {
var primitive = scene.groundPrimitives.get(0).get(0).get(0);
var attributes = primitive.getGeometryInstanceAttributes(entity);
expect(attributes).toBeDefined();
expect(attributes.show).toEqual(ShowGeometryInstanceAttribute.toValue(true));
expect(attributes.color).toEqual(ColorGeometryInstanceAttribute.toValue(Color.WHITE));

objects.remove(entity);

return pollToPromise(function() {
scene.initializeFrame();
expect(visualizer.update(time)).toBe(true);
scene.render(time);
return scene.groundPrimitives.get(0).get(0).length === 0;
}).then(function(){
visualizer.destroy();
expect(scene.groundPrimitives.length).toBe(0);
});
});
});

it('Users zIndex to order static color geometry on terrain', function() {
scene.groundPrimitives.removeAll();
var objects = new EntityCollection();
var visualizer = new GeometryVisualizer(scene, objects, scene.primitives, scene.groundPrimitives);

var ellipse = new EllipseGraphics();
ellipse.semiMajorAxis = new ConstantProperty(2);
ellipse.semiMinorAxis = new ConstantProperty(1);
ellipse.material = new ColorMaterialProperty(Color.GREEN);
ellipse.zIndex = 0;
var entity1 = new Entity();
entity1.position = new ConstantPositionProperty(new Cartesian3(1234, 5678, 9101112));
entity1.ellipse = ellipse;
objects.add(entity1);

var entity2 = new Entity();
ellipse = new EllipseGraphics();
ellipse.semiMajorAxis = new ConstantProperty(2);
ellipse.semiMinorAxis = new ConstantProperty(1);
ellipse.material = new ColorMaterialProperty(Color.RED);
ellipse.zIndex = 3;
entity2.position = new ConstantPositionProperty(new Cartesian3(1234, 5678, 9101112));
entity2.ellipse = ellipse;
objects.add(entity2);

var entity3 = new Entity();
ellipse = new EllipseGraphics();
ellipse.semiMajorAxis = new ConstantProperty(2);
ellipse.semiMinorAxis = new ConstantProperty(1);
ellipse.material = new ColorMaterialProperty(Color.BLUE);
ellipse.zIndex = 2;
entity3.position = new ConstantPositionProperty(new Cartesian3(1234, 5678, 9101112));
entity3.ellipse = ellipse;
objects.add(entity3);

return pollToPromise(function() {
scene.initializeFrame();
var isUpdated = visualizer.update(time);
scene.render(time);
return isUpdated;
}).then(function() {
var layer = scene.groundPrimitives.get(0);
expect(layer.length).toBe(3);
var primitive = layer.get(0).get(0);
var attributes = primitive.getGeometryInstanceAttributes(entity1);
expect(attributes).toBeDefined();
expect(attributes.show).toEqual(ShowGeometryInstanceAttribute.toValue(true));
expect(attributes.color).toEqual(ColorGeometryInstanceAttribute.toValue(Color.GREEN));

primitive = layer.get(1).get(0);
attributes = primitive.getGeometryInstanceAttributes(entity3);
expect(attributes).toBeDefined();
expect(attributes.show).toEqual(ShowGeometryInstanceAttribute.toValue(true));
expect(attributes.color).toEqual(ColorGeometryInstanceAttribute.toValue(Color.BLUE));

primitive = layer.get(2).get(0);
attributes = primitive.getGeometryInstanceAttributes(entity2);
expect(attributes).toBeDefined();
expect(attributes.show).toEqual(ShowGeometryInstanceAttribute.toValue(true));
expect(attributes.color).toEqual(ColorGeometryInstanceAttribute.toValue(Color.RED));

objects.remove(entity1);
objects.remove(entity2);
objects.remove(entity3);

visualizer.destroy();
expect(scene.groundPrimitives.length).toBe(0);
});
});

it('Constructor throws without scene', function() {
var objects = new EntityCollection();
expect(function() {
Expand Down
Loading

0 comments on commit e34d7c5

Please sign in to comment.