Skip to content

Commit

Permalink
Merge pull request #2639 from AnalyticalGraphicsInc/wrapping-rect
Browse files Browse the repository at this point in the history
Fix KML wrapping GroundOverlays
  • Loading branch information
pjcozzi committed Apr 16, 2015
2 parents b9c122a + ced9b31 commit 6ac6ba3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -1413,13 +1413,13 @@ define([
var north = queryNumericValue(latLonBox, 'north', namespaces.kml);

if (defined(west)) {
west = CesiumMath.convertLongitudeRange(CesiumMath.toRadians(west));
west = CesiumMath.negativePiToPi(CesiumMath.toRadians(west));
}
if (defined(south)) {
south = CesiumMath.negativePiToPi(CesiumMath.toRadians(south));
}
if (defined(east)) {
east = CesiumMath.convertLongitudeRange(CesiumMath.toRadians(east));
east = CesiumMath.negativePiToPi(CesiumMath.toRadians(east));
}
if (defined(north)) {
north = CesiumMath.negativePiToPi(CesiumMath.toRadians(north));
Expand Down
18 changes: 18 additions & 0 deletions Specs/DataSources/KmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,24 @@ defineSuite([
});
});

it('GroundOverlay: Handles wrapping longitude.', function() {
var kml = '<?xml version="1.0" encoding="UTF-8"?>\
<GroundOverlay>\
<LatLonBox>\
<west>-180</west>\
<south>-90</south>\
<east>180</east>\
<north>90</north>\
</LatLonBox>\
</GroundOverlay>';

return KmlDataSource.load(parser.parseFromString(kml, "text/xml")).then(function(dataSource) {
var entity = dataSource.entities.values[0];
expect(entity.polygon).toBeUndefined();
expect(entity.rectangle.coordinates.getValue()).toEqual(Rectangle.fromDegrees(-180, -90, 180, 90));
});
});

it('GroundOverlay: Sets polygon coordinates for gx:LatLonQuad', function() {
var kml = '<?xml version="1.0" encoding="UTF-8"?>\
<GroundOverlay xmlns="http://www.opengis.net/kml/2.2"\
Expand Down

0 comments on commit 6ac6ba3

Please sign in to comment.