@@ -6,6 +6,10 @@ defineSuite([
6
6
'Core/GeometryOffsetAttribute' ,
7
7
'Core/JulianDate' ,
8
8
'Core/Math' ,
9
+ 'Core/CoplanarPolygonGeometry' ,
10
+ 'Core/CoplanarPolygonOutlineGeometry' ,
11
+ 'Core/PolygonGeometry' ,
12
+ 'Core/PolygonOutlineGeometry' ,
9
13
'Core/PolygonHierarchy' ,
10
14
'Core/TimeIntervalCollection' ,
11
15
'DataSources/ConstantProperty' ,
@@ -29,6 +33,10 @@ defineSuite([
29
33
GeometryOffsetAttribute ,
30
34
JulianDate ,
31
35
CesiumMath ,
36
+ CoplanarPolygonGeometry ,
37
+ CoplanarPolygonOutlineGeometry ,
38
+ PolygonGeometry ,
39
+ PolygonOutlineGeometry ,
32
40
PolygonHierarchy ,
33
41
TimeIntervalCollection ,
34
42
ConstantProperty ,
@@ -78,6 +86,19 @@ defineSuite([
78
86
return entity ;
79
87
}
80
88
89
+ function createVerticalPolygon ( ) {
90
+ var polygon = new PolygonGraphics ( ) ;
91
+ polygon . hierarchy = new ConstantProperty ( new PolygonHierarchy ( Cartesian3 . fromDegreesArrayHeights ( [
92
+ - 1.0 , 1.0 , 0.0 ,
93
+ - 2.0 , 1.0 , 0.0 ,
94
+ - 2.0 , 1.0 , 0.0
95
+ ] ) ) ) ;
96
+ polygon . perPositionHeight = true ;
97
+ var entity = new Entity ( ) ;
98
+ entity . polygon = polygon ;
99
+ return entity ;
100
+ }
101
+
81
102
function createDynamicPolygon ( ) {
82
103
var entity = createBasicPolygon ( ) ;
83
104
entity . polygon . extrudedHeight = createDynamicProperty ( 2 ) ;
@@ -231,6 +252,7 @@ defineSuite([
231
252
var geometry ;
232
253
instance = updater . createFillGeometryInstance ( time ) ;
233
254
geometry = instance . geometry ;
255
+ expect ( geometry ) . toBeInstanceOf ( PolygonGeometry ) ;
234
256
expect ( geometry . _stRotation ) . toEqual ( options . stRotation ) ;
235
257
expect ( geometry . _height ) . toEqual ( options . height ) ;
236
258
expect ( geometry . _granularity ) . toEqual ( options . granularity ) ;
@@ -241,13 +263,37 @@ defineSuite([
241
263
242
264
instance = updater . createOutlineGeometryInstance ( time ) ;
243
265
geometry = instance . geometry ;
266
+ expect ( geometry ) . toBeInstanceOf ( PolygonOutlineGeometry ) ;
244
267
expect ( geometry . _height ) . toEqual ( options . height ) ;
245
268
expect ( geometry . _granularity ) . toEqual ( options . granularity ) ;
246
269
expect ( geometry . _extrudedHeight ) . toEqual ( options . extrudedHeight ) ;
247
270
expect ( geometry . _perPositionHeight ) . toEqual ( options . perPositionHeight ) ;
248
271
expect ( geometry . _offsetAttribute ) . toBeUndefined ( ) ;
249
272
} ) ;
250
273
274
+ it ( 'Creates coplanar polygon' , function ( ) {
275
+ var stRotation = 12 ;
276
+
277
+ var entity = createVerticalPolygon ( ) ;
278
+
279
+ var polygon = entity . polygon ;
280
+ polygon . outline = true ;
281
+ polygon . stRotation = new ConstantProperty ( stRotation ) ;
282
+
283
+ var updater = new PolygonGeometryUpdater ( entity , scene ) ;
284
+
285
+ var instance ;
286
+ var geometry ;
287
+ instance = updater . createFillGeometryInstance ( time ) ;
288
+ geometry = instance . geometry ;
289
+ expect ( geometry ) . toBeInstanceOf ( CoplanarPolygonGeometry ) ;
290
+ expect ( geometry . _stRotation ) . toEqual ( stRotation ) ;
291
+
292
+ instance = updater . createOutlineGeometryInstance ( time ) ;
293
+ geometry = instance . geometry ;
294
+ expect ( geometry ) . toBeInstanceOf ( CoplanarPolygonOutlineGeometry ) ;
295
+ } ) ;
296
+
251
297
it ( 'Checks that a polygon with per position heights isn\'t on terrain' , function ( ) {
252
298
var entity = createBasicPolygon ( ) ;
253
299
entity . polygon . height = undefined ;
0 commit comments