-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12194 from jfayot/feat_tracking_reference_frame
Added Entity.trackingReferenceFrame
- Loading branch information
Showing
11 changed files
with
4,286 additions
and
30 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,110 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" | ||
/> | ||
<meta | ||
name="description" | ||
content="Apply different tracking reference frames to tracked entities." | ||
/> | ||
<meta name="cesium-sandcastle-labels" content="Beginner, Showcases" /> | ||
<title>Cesium Demo</title> | ||
<script type="text/javascript" src="../Sandcastle-header.js"></script> | ||
<script | ||
type="text/javascript" | ||
src="../../../Build/CesiumUnminified/Cesium.js" | ||
nomodule | ||
></script> | ||
<script type="module" src="../load-cesium-es6.js"></script> | ||
</head> | ||
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html"> | ||
<style> | ||
@import url(../templates/bucket.css); | ||
</style> | ||
<div id="cesiumContainer" class="fullSize"></div> | ||
<div id="loadingOverlay"><h1>Loading...</h1></div> | ||
<div id="toolbar"></div> | ||
<script id="cesium_sandcastle_script"> | ||
window.startup = async function (Cesium) { | ||
"use strict"; | ||
//Sandcastle_Begin | ||
// This example illustrates the possible tracking reference frames | ||
// apllied to two different entities: a near surface slow moving | ||
// object and a satellite | ||
const viewer = new Cesium.Viewer("cesiumContainer", { | ||
terrain: Cesium.Terrain.fromWorldTerrain(), | ||
shouldAnimate: true, | ||
}); | ||
|
||
const startTime = Cesium.JulianDate.fromIso8601("2012-03-15T10:00:00Z"); | ||
|
||
const satelliteStopTime = Cesium.JulianDate.fromIso8601("2012-03-16T10:00:00Z"); | ||
|
||
const droneStopTime = Cesium.JulianDate.fromIso8601("2012-03-15T10:00:30Z"); | ||
|
||
const dataSource = await viewer.dataSources.add( | ||
Cesium.CzmlDataSource.load("../../SampleData/tracking.czml"), | ||
); | ||
|
||
const satellite = dataSource.entities.getById("Satellite/ISS"); | ||
const drone = dataSource.entities.getById("CesiumDrone"); | ||
|
||
satellite.viewFrom = new Cesium.Cartesian3(-300, 20, 100); | ||
drone.viewFrom = new Cesium.Cartesian3(-50, 0, 5); | ||
|
||
Sandcastle.addDefaultToolbarButton("Satellites", function () { | ||
viewer.clock.stopTime = satelliteStopTime; | ||
viewer.clock.currentTime = startTime; | ||
viewer.clock.multiplier = 30; | ||
viewer.timeline.zoomTo(startTime, satelliteStopTime); | ||
viewer.trackedEntity = satellite; | ||
}); | ||
|
||
Sandcastle.addToolbarButton("Drone", function () { | ||
viewer.clock.stopTime = droneStopTime; | ||
viewer.clock.currentTime = startTime; | ||
viewer.clock.multiplier = 1; | ||
viewer.timeline.zoomTo(startTime, droneStopTime); | ||
viewer.trackedEntity = drone; | ||
}); | ||
|
||
Sandcastle.addToolbarMenu([ | ||
{ | ||
text: "Tracking reference frame: Auto-detect", | ||
onselect: function () { | ||
satellite.trackingReferenceFrame = Cesium.TrackingReferenceFrame.AUTODETECT; | ||
drone.trackingReferenceFrame = Cesium.TrackingReferenceFrame.AUTODETECT; | ||
}, | ||
}, | ||
{ | ||
text: "Tracking reference frame: Inertial", | ||
onselect: function () { | ||
satellite.trackingReferenceFrame = Cesium.TrackingReferenceFrame.INERTIAL; | ||
drone.trackingReferenceFrame = Cesium.TrackingReferenceFrame.INERTIAL; | ||
}, | ||
}, | ||
{ | ||
text: "Tracking reference frame: Velocity", | ||
onselect: function () { | ||
satellite.trackingReferenceFrame = Cesium.TrackingReferenceFrame.VELOCITY; | ||
drone.trackingReferenceFrame = Cesium.TrackingReferenceFrame.VELOCITY; | ||
}, | ||
}, | ||
]); | ||
//Sandcastle_End | ||
}; | ||
if (typeof Cesium !== "undefined") { | ||
window.startupCalled = true; | ||
window.startup(Cesium).catch((error) => { | ||
"use strict"; | ||
console.error(error); | ||
}); | ||
Sandcastle.finishedLoading(); | ||
} | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,40 @@ | ||
/** | ||
* Constants for identifying well-known tracking reference frames. | ||
* | ||
* @enum {number} | ||
*/ | ||
const TrackingReferenceFrame = { | ||
/** | ||
* Auto-detect algorithm. The reference frame used to track the Entity will | ||
* be automatically selected based on its trajectory: near-surface slow moving | ||
* objects will be tracked in the entity's local east-north-up reference | ||
* frame, while faster objects like satellites will use VVLH (Vehicle Velocity, | ||
* Local Horizontal). | ||
* | ||
* @type {number} | ||
* @constant | ||
*/ | ||
AUTODETECT: 0, | ||
|
||
/** | ||
* The entity's inertial reference frame. If entity has no defined orientation | ||
* property, a {@link VelocityOrientationProperty} is used instead, thus | ||
* falling back to <code>TrackingReferenceFrame.VELOCITY</code>. | ||
* When selected, the auto-detect algorithm is overridden. | ||
* | ||
* @type {number} | ||
* @constant | ||
*/ | ||
INERTIAL: 1, | ||
|
||
/** | ||
* The entity's inertial reference frame with orientation fixed to its | ||
* {@link VelocityOrientationProperty}, ignoring its own orientation. | ||
* When selected, the auto-detect algorithm is overridden. | ||
* | ||
* @type {number} | ||
* @constant | ||
*/ | ||
VELOCITY: 2, | ||
}; | ||
export default Object.freeze(TrackingReferenceFrame); |
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
Oops, something went wrong.