@@ -4,6 +4,7 @@ defineSuite([
4
4
'Core/arrayFill' ,
5
5
'Core/BoundingSphere' ,
6
6
'Core/Cartesian3' ,
7
+ 'Core/Cartographic' ,
7
8
'Core/Ellipsoid' ,
8
9
'Core/GeometryOffsetAttribute' ,
9
10
'Core/GeometryPipeline' ,
@@ -17,6 +18,7 @@ defineSuite([
17
18
arrayFill ,
18
19
BoundingSphere ,
19
20
Cartesian3 ,
21
+ Cartographic ,
20
22
Ellipsoid ,
21
23
GeometryOffsetAttribute ,
22
24
GeometryPipeline ,
@@ -1095,7 +1097,7 @@ defineSuite([
1095
1097
expect ( CesiumMath . toDegrees ( boundingRhumb . west ) ) . toEqualEpsilon ( - 90.0 , CesiumMath . EPSILON10 ) ;
1096
1098
} ) ;
1097
1099
1098
- it ( 'computes rectangles that cross the IDL' , function ( ) {
1100
+ it ( 'computes rectangles for rhumbline polygons that cross the IDL' , function ( ) {
1099
1101
var pRhumb = new PolygonGeometry ( {
1100
1102
vertexFormat : VertexFormat . POSITION_AND_ST ,
1101
1103
polygonHierarchy : {
@@ -1116,6 +1118,29 @@ defineSuite([
1116
1118
expect ( CesiumMath . toDegrees ( boundingRhumb . west ) ) . toEqualEpsilon ( 175.0 , CesiumMath . EPSILON10 ) ;
1117
1119
} ) ;
1118
1120
1121
+ it ( 'computes rectangles for geodesic polygons that cross the IDL' , function ( ) {
1122
+ var minLon = Cartographic . fromDegrees ( - 178 , 3 ) ;
1123
+ var minLat = Cartographic . fromDegrees ( - 179 , - 4 ) ;
1124
+ var maxLon = Cartographic . fromDegrees ( 178 , 3 ) ;
1125
+ var maxLat = Cartographic . fromDegrees ( 179 , 4 ) ;
1126
+ var cartesianArray = Ellipsoid . WGS84 . cartographicArrayToCartesianArray ( [ minLat , minLon , maxLat , maxLon ] ) ;
1127
+
1128
+ var pGeodesic = new PolygonGeometry ( {
1129
+ vertexFormat : VertexFormat . POSITION_AND_ST ,
1130
+ polygonHierarchy : {
1131
+ positions : cartesianArray
1132
+ } ,
1133
+ granularity : CesiumMath . RADIANS_PER_DEGREE ,
1134
+ arcType : ArcType . GEODESIC
1135
+ } ) ;
1136
+
1137
+ var boundingGeodesic = pGeodesic . rectangle ;
1138
+ expect ( boundingGeodesic . east ) . toEqualEpsilon ( minLon . longitude , CesiumMath . EPSILON10 ) ;
1139
+ expect ( boundingGeodesic . south ) . toEqualEpsilon ( minLat . latitude , CesiumMath . EPSILON10 ) ;
1140
+ expect ( boundingGeodesic . west ) . toEqualEpsilon ( maxLon . longitude , CesiumMath . EPSILON10 ) ;
1141
+ expect ( boundingGeodesic . north ) . toEqualEpsilon ( maxLat . latitude , CesiumMath . EPSILON10 ) ;
1142
+ } ) ;
1143
+
1119
1144
it ( 'computeRectangle' , function ( ) {
1120
1145
var options = {
1121
1146
vertexFormat : VertexFormat . POSITION_AND_ST ,
0 commit comments