Skip to content

Instantly share code, notes, and snippets.

@astrojuanlu
Created October 22, 2019 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astrojuanlu/f5c163c689195f9ae26afd58a289def8 to your computer and use it in GitHub Desktop.
Save astrojuanlu/f5c163c689195f9ae26afd58a289def8 to your computer and use it in GitHub Desktop.
var czml = [{"id": "document", "version": "1.0", "name": "My FC"}, {"id": "6c8c4104-a676-4299-b04a-9890d455b8fe", "name": "line_0", "description": "line_0", "polyline": {"positions": {"cartographicDegrees": [0.0, 0.0, 660.0, 10.0, 10.0, 660.0]}, "material": {"solidColor": {"color": {"rgba": [0, 255, 0, 255]}}}}}, {"id": "f7e06f54-5712-46d1-a019-db2e1f296f5b", "name": "point_0", "description": "point_0", "position": {"cartographicDegrees": [10.0, 10.0, 660.0]}, "point": {"pixelSize": 5, "color": {"rgba": [255, 0, 0, 255]}}}, {"id": "584c3140-74c5-4e6b-bf33-91c44ac8b985", "name": "polygon_0", "description": "polygon_0", "polygon": {"positions": {"cartographicDegrees": [10.0, 10.0, 660.0, 10.0, 5.0, 660.0, 15.0, 5.0, 660.0, 10.0, 10.0, 660.0]}, "material": {"solidColor": {"color": {"rgba": [255, 210, 0, 170]}}}}}];
var viewer = new Cesium.Viewer('cesiumContainer', {
shouldAnimate : true
});
// To have an inertial (ICRF) view
function icrf(scene, time) {
var icrfToFixed = Cesium.Transforms.computeIcrfToFixedMatrix(time);
if (Cesium.defined(icrfToFixed)) {
var camera = viewer.camera;
var offset = Cesium.Cartesian3.clone(camera.position);
var transform = Cesium.Matrix4.fromRotationTranslation(icrfToFixed);
camera.lookAtTransform(transform, offset);
}
}
viewer.scene.postUpdate.addEventListener(icrf);
viewer.camera.flyHome(0);
viewer.scene.globe.enableLighting = true;
viewer.dataSources.add(Cesium.CzmlDataSource.load(czml));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment