-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for terrainProvider in Cesium (#1684)
* Support for terrainProvider in Cesium - Now we can configure a terrainProvider - Support to intercept correct ray from camera to clicked point in feature info - defaultMapOptions added to localConfig as default. If present, it will be used to setup the mapOptions for the map. - Added to localConfig of product the demo terrainProvider - Throttling for mouse hover events in cesium map * added terrainProvider to the example
- Loading branch information
1 parent
4a95c8f
commit 2d60dc0
Showing
6 changed files
with
143 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var Cesium = require('../../libs/cesium'); | ||
const getCartesian = function(viewer, event) { | ||
if (event.position !== null) { | ||
const scene = viewer.scene; | ||
const ellipsoid = scene._globe.ellipsoid; | ||
const cartesian = scene._camera.pickEllipsoid(event.position, ellipsoid); | ||
return cartesian; | ||
} | ||
}; | ||
const getMouseXYZ = (viewer, event) => { | ||
var scene = viewer.scene; | ||
if (!event.position) { | ||
return null; | ||
} | ||
const ray = viewer.camera.getPickRay(event.position); | ||
const position = viewer.scene.globe.pick(ray, viewer.scene); | ||
const ellipsoid = scene._globe.ellipsoid; | ||
if (Cesium.defined(position)) { | ||
const cartographic = ellipsoid.cartesianToCartographic(position); | ||
// const height = cartographic.height; | ||
const cartesian = getCartesian(viewer, event); | ||
if (cartesian) { | ||
cartographic.height = scene._globe.getHeight(cartographic); | ||
cartographic.cartesian = cartesian; | ||
cartographic.position = position; | ||
} | ||
return cartographic; | ||
} | ||
return null; | ||
}; | ||
|
||
const getMouseTile = (viewer, event) => { | ||
const scene = viewer.scene; | ||
if (!event.position) { | ||
return null; | ||
} | ||
const ray = viewer.camera.getPickRay(event.position); | ||
return viewer.scene.globe.pickTile(ray, scene); | ||
}; | ||
|
||
module.exports = { | ||
getMouseXYZ, | ||
getMouseTile | ||
}; |