Skip to content

Commit 6ac6ba3

Browse files
committed
Merge pull request #2639 from AnalyticalGraphicsInc/wrapping-rect
Fix KML wrapping GroundOverlays
2 parents b9c122a + ced9b31 commit 6ac6ba3

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Source/DataSources/KmlDataSource.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1413,13 +1413,13 @@ define([
14131413
var north = queryNumericValue(latLonBox, 'north', namespaces.kml);
14141414

14151415
if (defined(west)) {
1416-
west = CesiumMath.convertLongitudeRange(CesiumMath.toRadians(west));
1416+
west = CesiumMath.negativePiToPi(CesiumMath.toRadians(west));
14171417
}
14181418
if (defined(south)) {
14191419
south = CesiumMath.negativePiToPi(CesiumMath.toRadians(south));
14201420
}
14211421
if (defined(east)) {
1422-
east = CesiumMath.convertLongitudeRange(CesiumMath.toRadians(east));
1422+
east = CesiumMath.negativePiToPi(CesiumMath.toRadians(east));
14231423
}
14241424
if (defined(north)) {
14251425
north = CesiumMath.negativePiToPi(CesiumMath.toRadians(north));

Specs/DataSources/KmlDataSourceSpec.js

+18
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,24 @@ defineSuite([
668668
});
669669
});
670670

671+
it('GroundOverlay: Handles wrapping longitude.', function() {
672+
var kml = '<?xml version="1.0" encoding="UTF-8"?>\
673+
<GroundOverlay>\
674+
<LatLonBox>\
675+
<west>-180</west>\
676+
<south>-90</south>\
677+
<east>180</east>\
678+
<north>90</north>\
679+
</LatLonBox>\
680+
</GroundOverlay>';
681+
682+
return KmlDataSource.load(parser.parseFromString(kml, "text/xml")).then(function(dataSource) {
683+
var entity = dataSource.entities.values[0];
684+
expect(entity.polygon).toBeUndefined();
685+
expect(entity.rectangle.coordinates.getValue()).toEqual(Rectangle.fromDegrees(-180, -90, 180, 90));
686+
});
687+
});
688+
671689
it('GroundOverlay: Sets polygon coordinates for gx:LatLonQuad', function() {
672690
var kml = '<?xml version="1.0" encoding="UTF-8"?>\
673691
<GroundOverlay xmlns="http://www.opengis.net/kml/2.2"\

0 commit comments

Comments
 (0)