Skip to content

Commit e34d7c5

Browse files
author
hpinkos
committed
specs and CHANGES.md
1 parent ce145b5 commit e34d7c5

9 files changed

+227
-8
lines changed

CHANGES.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ Change Log
2929
* `Credit` has been modified to take an HTML string as the credit content [#6331](https://github.com/AnalyticalGraphicsInc/cesium/pull/6331)
3030
* Added support for ordering in `DataSourceCollection` [#6316](https://github.com/AnalyticalGraphicsInc/cesium/pull/6316)
3131
* 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.
32-
* Use `DataSourceCollection.raise`, `DataSourceCollection.lower`, `DataSourceCollection.raiseToTop` and `DataSourceCollection.lowerToBottom` functions to change the ordering of a `DataSource` in the collection.
32+
* Use `DataSourceCollection.raise`, `DataSourceCollection.lower`, `DataSourceCollection.raiseToTop` and `DataSourceCollection.lowerToBottom` functions to change the ordering of a `DataSource` in the collection.
33+
* Added `zIndex` support for static `Corridor`, `Ellipse`, `Polygon` and `Rectangle` entities [#6362](https://github.com/AnalyticalGraphicsInc/cesium/pull/6362)
3334

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

43-
4444
### 1.43 - 2018-03-01
4545

4646
##### Major Announcements :loudspeaker:

Source/DataSources/KmlDataSource.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1883,7 +1883,7 @@ define([
18831883

18841884
var ellipsoid = dataSource._ellipsoid;
18851885
var positions = readCoordinates(queryFirstNode(groundOverlay, 'LatLonQuad', namespaces.gx), ellipsoid);
1886-
var zIndex = queryFirstNode(groundOverlay, 'drawOrder', namespaces.kml);
1886+
var zIndex = queryNumericValue(groundOverlay, 'drawOrder', namespaces.kml);
18871887
if (defined(positions)) {
18881888
geometry = createDefaultPolygon();
18891889
geometry.hierarchy = new PolygonHierarchy(positions);

Specs/DataSources/CorridorGraphicsSpec.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ defineSuite([
3838
cornerType : CornerType.BEVELED,
3939
shadows : ShadowMode.DISABLED,
4040
distanceDisplayCondition : new DistanceDisplayCondition(10.0, 100.0),
41-
classificationType : ClassificationType.TERRAIN
41+
classificationType : ClassificationType.TERRAIN,
42+
zIndex: 3
4243
};
4344

4445
var corridor = new CorridorGraphics(options);
@@ -57,6 +58,7 @@ defineSuite([
5758
expect(corridor.shadows).toBeInstanceOf(ConstantProperty);
5859
expect(corridor.distanceDisplayCondition).toBeInstanceOf(ConstantProperty);
5960
expect(corridor.classificationType).toBeInstanceOf(ConstantProperty);
61+
expect(corridor.zIndex).toBeInstanceOf(ConstantProperty);
6062

6163
expect(corridor.material.color.getValue()).toEqual(options.material);
6264
expect(corridor.positions.getValue()).toEqual(options.positions);
@@ -73,6 +75,7 @@ defineSuite([
7375
expect(corridor.shadows.getValue()).toEqual(options.shadows);
7476
expect(corridor.distanceDisplayCondition.getValue()).toEqual(options.distanceDisplayCondition);
7577
expect(corridor.classificationType.getValue()).toEqual(options.classificationType);
78+
expect(corridor.zIndex.getValue()).toEqual(options.zIndex);
7679
});
7780

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

96100
var target = new CorridorGraphics();
97101
target.merge(source);
@@ -111,6 +115,7 @@ defineSuite([
111115
expect(target.shadows).toBe(source.shadows);
112116
expect(target.distanceDisplayCondition).toBe(source.distanceDisplayCondition);
113117
expect(target.classificationType).toBe(source.classificationType);
118+
expect(target.zIndex).toBe(source.zIndex);
114119
});
115120

116121
it('merge does not assign assigned properties', function() {
@@ -131,6 +136,7 @@ defineSuite([
131136
var shadows = new ConstantProperty();
132137
var distanceDisplayCondition = new ConstantProperty();
133138
var classificationType = new ConstantProperty();
139+
var zIndex = new ConstantProperty();
134140

135141
var target = new CorridorGraphics();
136142
target.material = material;
@@ -148,6 +154,7 @@ defineSuite([
148154
target.shadows = shadows;
149155
target.distanceDisplayCondition = distanceDisplayCondition;
150156
target.classificationType = classificationType;
157+
target.zIndex = zIndex;
151158

152159
target.merge(source);
153160

@@ -166,6 +173,7 @@ defineSuite([
166173
expect(target.shadows).toBe(shadows);
167174
expect(target.distanceDisplayCondition).toBe(distanceDisplayCondition);
168175
expect(target.classificationType).toBe(classificationType);
176+
expect(target.zIndex).toBe(zIndex);
169177
});
170178

171179
it('clone works', function() {
@@ -185,6 +193,7 @@ defineSuite([
185193
source.shadows = new ConstantProperty();
186194
source.distanceDisplayCondition = new ConstantProperty();
187195
source.classificationType = new ConstantProperty();
196+
source.zIndex = new ConstantProperty();
188197

189198
var result = source.clone();
190199
expect(result.material).toBe(source.material);
@@ -202,6 +211,7 @@ defineSuite([
202211
expect(result.shadows).toBe(source.shadows);
203212
expect(result.distanceDisplayCondition).toBe(source.distanceDisplayCondition);
204213
expect(result.classificationType).toBe(source.classificationType);
214+
expect(result.zIndex).toBe(source.zIndex);
205215
});
206216

207217
it('merge throws if source undefined', function() {
@@ -228,5 +238,6 @@ defineSuite([
228238
testDefinitionChanged(property, 'shadows', ShadowMode.ENABLED, ShadowMode.DISABLED);
229239
testDefinitionChanged(property, 'distanceDisplayCondition', new DistanceDisplayCondition(), new DistanceDisplayCondition(10.0, 100.0));
230240
testDefinitionChanged(property, 'classificationType', ClassificationType.TERRAIN, ClassificationType.BOTH);
241+
testDefinitionChanged(property, 'zIndex', 3, 0);
231242
});
232243
});

Specs/DataSources/EllipseGraphicsSpec.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ defineSuite([
3838
outlineWidth : 9,
3939
shadows : ShadowMode.DISABLED,
4040
distanceDisplayCondition : new DistanceDisplayCondition(),
41-
classificationType : ClassificationType.TERRAIN
41+
classificationType : ClassificationType.TERRAIN,
42+
zIndex: 3
4243
};
4344

4445
var ellipse = new EllipseGraphics(options);
@@ -59,6 +60,7 @@ defineSuite([
5960
expect(ellipse.shadows).toBeInstanceOf(ConstantProperty);
6061
expect(ellipse.distanceDisplayCondition).toBeInstanceOf(ConstantProperty);
6162
expect(ellipse.classificationType).toBeInstanceOf(ConstantProperty);
63+
expect(ellipse.zIndex).toBeInstanceOf(ConstantProperty);
6264

6365
expect(ellipse.material.color.getValue()).toEqual(options.material);
6466
expect(ellipse.show.getValue()).toEqual(options.show);
@@ -77,6 +79,7 @@ defineSuite([
7779
expect(ellipse.shadows.getValue()).toEqual(options.shadows);
7880
expect(ellipse.distanceDisplayCondition.getValue()).toEqual(options.distanceDisplayCondition);
7981
expect(ellipse.classificationType.getValue()).toEqual(options.classificationType);
82+
expect(ellipse.zIndex.getValue()).toEqual(options.zIndex);
8083
});
8184

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

102106
var target = new EllipseGraphics();
103107
target.merge(source);
@@ -119,6 +123,7 @@ defineSuite([
119123
expect(target.shadows).toBe(source.shadows);
120124
expect(target.distanceDisplayCondition).toBe(source.distanceDisplayCondition);
121125
expect(target.classificationType).toBe(source.classificationType);
126+
expect(target.zIndex).toBe(source.zIndex);
122127
});
123128

124129
it('merge does not assign assigned properties', function() {
@@ -141,6 +146,7 @@ defineSuite([
141146
var shadows = new ConstantProperty();
142147
var distanceDisplayCondition = new ConstantProperty();
143148
var classificationType = new ConstantProperty();
149+
var zIndex = new ConstantProperty();
144150

145151
var target = new EllipseGraphics();
146152
target.material = material;
@@ -160,6 +166,7 @@ defineSuite([
160166
target.shadows = shadows;
161167
target.distanceDisplayCondition = distanceDisplayCondition;
162168
target.classificationType = classificationType;
169+
target.zIndex = zIndex;
163170

164171
target.merge(source);
165172

@@ -180,6 +187,7 @@ defineSuite([
180187
expect(target.shadows).toBe(shadows);
181188
expect(target.distanceDisplayCondition).toBe(distanceDisplayCondition);
182189
expect(target.classificationType).toBe(classificationType);
190+
expect(target.zIndex).toBe(zIndex);
183191
});
184192

185193
it('clone works', function() {
@@ -201,6 +209,7 @@ defineSuite([
201209
source.shadows = new ConstantProperty();
202210
source.distanceDisplayCondition = new ConstantProperty();
203211
source.classificationType = new ConstantProperty();
212+
source.zIndex = new ConstantProperty();
204213

205214
var result = source.clone();
206215
expect(result.material).toBe(source.material);
@@ -220,6 +229,7 @@ defineSuite([
220229
expect(result.shadows).toBe(source.shadows);
221230
expect(result.distanceDisplayCondition).toBe(source.distanceDisplayCondition);
222231
expect(result.classificationType).toBe(source.classificationType);
232+
expect(result.zIndex).toBe(source.zIndex);
223233
});
224234

225235
it('merge throws if source undefined', function() {
@@ -248,5 +258,6 @@ defineSuite([
248258
testDefinitionChanged(property, 'shadows', ShadowMode.ENABLED, ShadowMode.DISABLED);
249259
testDefinitionChanged(property, 'distanceDisplayCondition', new DistanceDisplayCondition(), new DistanceDisplayCondition(10.0, 100.0));
250260
testDefinitionChanged(property, 'classificationType', ClassificationType.TERRAIN, ClassificationType.BOTH);
261+
testDefinitionChanged(property, 'zIndex', 4, 0);
251262
});
252263
});

Specs/DataSources/GeometryVisualizerSpec.js

+112
Original file line numberDiff line numberDiff line change
@@ -554,9 +554,121 @@ defineSuite([
554554
expect(visualizer.update(time)).toBe(true);
555555
scene.render(time);
556556
expect(scene.primitives.length).toBe(0);
557+
expect(scene.groundPrimitives.length).toBe(1);
557558
visualizer.destroy();
558559
});
559560

561+
it('Creates and removes static color geometry on terrain', function() {
562+
scene.groundPrimitives.removeAll();
563+
var objects = new EntityCollection();
564+
var visualizer = new GeometryVisualizer(scene, objects, scene.primitives, scene.groundPrimitives);
565+
566+
var ellipse = new EllipseGraphics();
567+
ellipse.semiMajorAxis = new ConstantProperty(2);
568+
ellipse.semiMinorAxis = new ConstantProperty(1);
569+
ellipse.material = new ColorMaterialProperty();
570+
571+
var entity = new Entity();
572+
entity.position = new ConstantPositionProperty(new Cartesian3(1234, 5678, 9101112));
573+
entity.ellipse = ellipse;
574+
objects.add(entity);
575+
576+
return pollToPromise(function() {
577+
scene.initializeFrame();
578+
var isUpdated = visualizer.update(time);
579+
scene.render(time);
580+
return isUpdated;
581+
}).then(function() {
582+
var primitive = scene.groundPrimitives.get(0).get(0).get(0);
583+
var attributes = primitive.getGeometryInstanceAttributes(entity);
584+
expect(attributes).toBeDefined();
585+
expect(attributes.show).toEqual(ShowGeometryInstanceAttribute.toValue(true));
586+
expect(attributes.color).toEqual(ColorGeometryInstanceAttribute.toValue(Color.WHITE));
587+
588+
objects.remove(entity);
589+
590+
return pollToPromise(function() {
591+
scene.initializeFrame();
592+
expect(visualizer.update(time)).toBe(true);
593+
scene.render(time);
594+
return scene.groundPrimitives.get(0).get(0).length === 0;
595+
}).then(function(){
596+
visualizer.destroy();
597+
expect(scene.groundPrimitives.length).toBe(0);
598+
});
599+
});
600+
});
601+
602+
it('Users zIndex to order static color geometry on terrain', function() {
603+
scene.groundPrimitives.removeAll();
604+
var objects = new EntityCollection();
605+
var visualizer = new GeometryVisualizer(scene, objects, scene.primitives, scene.groundPrimitives);
606+
607+
var ellipse = new EllipseGraphics();
608+
ellipse.semiMajorAxis = new ConstantProperty(2);
609+
ellipse.semiMinorAxis = new ConstantProperty(1);
610+
ellipse.material = new ColorMaterialProperty(Color.GREEN);
611+
ellipse.zIndex = 0;
612+
var entity1 = new Entity();
613+
entity1.position = new ConstantPositionProperty(new Cartesian3(1234, 5678, 9101112));
614+
entity1.ellipse = ellipse;
615+
objects.add(entity1);
616+
617+
var entity2 = new Entity();
618+
ellipse = new EllipseGraphics();
619+
ellipse.semiMajorAxis = new ConstantProperty(2);
620+
ellipse.semiMinorAxis = new ConstantProperty(1);
621+
ellipse.material = new ColorMaterialProperty(Color.RED);
622+
ellipse.zIndex = 3;
623+
entity2.position = new ConstantPositionProperty(new Cartesian3(1234, 5678, 9101112));
624+
entity2.ellipse = ellipse;
625+
objects.add(entity2);
626+
627+
var entity3 = new Entity();
628+
ellipse = new EllipseGraphics();
629+
ellipse.semiMajorAxis = new ConstantProperty(2);
630+
ellipse.semiMinorAxis = new ConstantProperty(1);
631+
ellipse.material = new ColorMaterialProperty(Color.BLUE);
632+
ellipse.zIndex = 2;
633+
entity3.position = new ConstantPositionProperty(new Cartesian3(1234, 5678, 9101112));
634+
entity3.ellipse = ellipse;
635+
objects.add(entity3);
636+
637+
return pollToPromise(function() {
638+
scene.initializeFrame();
639+
var isUpdated = visualizer.update(time);
640+
scene.render(time);
641+
return isUpdated;
642+
}).then(function() {
643+
var layer = scene.groundPrimitives.get(0);
644+
expect(layer.length).toBe(3);
645+
var primitive = layer.get(0).get(0);
646+
var attributes = primitive.getGeometryInstanceAttributes(entity1);
647+
expect(attributes).toBeDefined();
648+
expect(attributes.show).toEqual(ShowGeometryInstanceAttribute.toValue(true));
649+
expect(attributes.color).toEqual(ColorGeometryInstanceAttribute.toValue(Color.GREEN));
650+
651+
primitive = layer.get(1).get(0);
652+
attributes = primitive.getGeometryInstanceAttributes(entity3);
653+
expect(attributes).toBeDefined();
654+
expect(attributes.show).toEqual(ShowGeometryInstanceAttribute.toValue(true));
655+
expect(attributes.color).toEqual(ColorGeometryInstanceAttribute.toValue(Color.BLUE));
656+
657+
primitive = layer.get(2).get(0);
658+
attributes = primitive.getGeometryInstanceAttributes(entity2);
659+
expect(attributes).toBeDefined();
660+
expect(attributes.show).toEqual(ShowGeometryInstanceAttribute.toValue(true));
661+
expect(attributes.color).toEqual(ColorGeometryInstanceAttribute.toValue(Color.RED));
662+
663+
objects.remove(entity1);
664+
objects.remove(entity2);
665+
objects.remove(entity3);
666+
667+
visualizer.destroy();
668+
expect(scene.groundPrimitives.length).toBe(0);
669+
});
670+
});
671+
560672
it('Constructor throws without scene', function() {
561673
var objects = new EntityCollection();
562674
expect(function() {

0 commit comments

Comments
 (0)