-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Enable terrain by default in CesiumViewer #6198
Conversation
@hpinkos, thanks for the pull request! Maintainers, we have a signed CLA from @hpinkos, so you can review this at any time.
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
I think we should update CHANGES.md for this. |
@pjcozzi done |
Apps/CesiumViewer/CesiumViewer.js
Outdated
@@ -58,6 +60,12 @@ define([ | |||
scene3DOnly : endUserOptions.scene3DOnly, | |||
requestRenderMode : true | |||
}); | |||
|
|||
viewer.terrainProvider = new CesiumTerrainProvider({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes the BaseLayerPicker to still think Ellipsoid is selected. To fix that, you need to tell it to use terrain as configured by the picker. Because there's a chance we might not have the baseLayer picker (because of the imagery provider options), we need to handle both cases. Basically this code becomes:
var baseLayerPicker = viewer.baseLayerPicker;
if (defined(baseLayerPicker)) {
var viewModel = baseLayerPicker.viewModel;
viewModel.selectedTerrain = viewModel.terrainProviderViewModels[1];
} else {
viewer.terrainProvider = new CesiumTerrainProvider({
url: 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
requestWaterMask: true,
requestVertexNormals: true
});
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an aside, we can probably get rid of the imagery provider option, but for this PR I wouldn't worry about it.
Thanks @mramato, fixed |
Thanks @hpinkos! |
Fixes #6192
@mramato is there anything else I had to do to enable clamping for the data sources? We were already passing in
clampToGround
forGeoJsonDataSource
and forCzmlDataSource
it's something you enable in the CZML, right?