Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera fields may be undefined if it is still morphing #3868

Merged
merged 6 commits into from
Apr 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Change Log
* Fixed issue where `Camera.flyTo` does not go to the rectangle. [#3688](https://github.com/AnalyticalGraphicsInc/cesium/issues/3688)
* Fixed issue causing the fog to go dark and the atmosphere to flicker when the camera clips the globe. [#3178](https://github.com/AnalyticalGraphicsInc/cesium/issues/3178)
* Fixed a bug that caused an exception and rendering to stop when using `ArcGisMapServerImageryProvider` to connect to a MapServer specifying the Web Mercator projection and a fullExtent bigger than the valid extent of the projection. [#3854](https://github.com/AnalyticalGraphicsInc/cesium/pull/3854)
* Fixed issue causing an exception when switching scene modes with an active KML network link. [#3865](https://github.com/AnalyticalGraphicsInc/cesium/issues/3865)

### 1.20 - 2016-04-01

Expand Down
4 changes: 3 additions & 1 deletion Source/DataSources/KmlDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ define([
'../Core/TimeIntervalCollection',
'../Scene/HorizontalOrigin',
'../Scene/LabelStyle',
'../Scene/SceneMode',
'../ThirdParty/Autolinker',
'../ThirdParty/Uri',
'../ThirdParty/when',
Expand Down Expand Up @@ -91,6 +92,7 @@ define([
TimeIntervalCollection,
HorizontalOrigin,
LabelStyle,
SceneMode,
Autolinker,
Uri,
when,
Expand Down Expand Up @@ -1714,7 +1716,7 @@ define([
return value;
}

if (defined(camera)) {
if (defined(camera) && camera._mode !== SceneMode.MORPHING) {
var wgs84 = Ellipsoid.WGS84;
var centerCartesian;
var centerCartographic;
Expand Down
30 changes: 30 additions & 0 deletions Specs/DataSources/KmlDataSourceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ defineSuite([
'DataSources/ColorMaterialProperty',
'DataSources/EntityCollection',
'DataSources/ImageMaterialProperty',
'Scene/Camera',
'Scene/HorizontalOrigin',
'Scene/LabelStyle',
'Scene/SceneMode',
'Specs/createCamera',
'Specs/pollToPromise',
'ThirdParty/when'
], function(
Expand All @@ -47,8 +50,11 @@ defineSuite([
ColorMaterialProperty,
EntityCollection,
ImageMaterialProperty,
Camera,
HorizontalOrigin,
LabelStyle,
SceneMode,
createCamera,
pollToPromise,
when) {
"use strict";
Expand Down Expand Up @@ -3714,4 +3720,28 @@ defineSuite([
expect(console.log).toHaveBeenCalledWith('KML - refreshMode of onExpire requires the NetworkLinkControl to have an expires element');
});
});

it('NetworkLink: Heading and pitch can be undefined if the camera is in morphing mode', function() {
var kml = '<?xml version="1.0" encoding="UTF-8"?>\
<NetworkLink id="link">\
<Link>\
<href>./Data/KML/simple.kml</href>\
<refreshMode>onExpire</refreshMode>\
</Link>\
</NetworkLink>';

var camera = createCamera();
Camera.clone(options.camera, camera);

var kmlOptions = {
camera: camera,
canvas: options.canvas
};

camera._mode = SceneMode.MORPHING;

return KmlDataSource.load(parser.parseFromString(kml, "text/xml"), kmlOptions).then(function(dataSource) {
expect(dataSource.entities.values.length).toEqual(2);
});
});
});