有没有人花时间从 Cesium 应用程序中提取时间轴小部件?我希望在没有 Dojo 依赖项的情况下使用时间轴小部件。我能够找到一个预告片说这是可能的,但时间线示例并不是最容易进行逆向工程的。有谁知道如何提取必要的库并删除 Dojo 依赖项?
最佳答案
时间线本身(在该演示应用程序之外)不使用 Dojo。以下是其工作原理的示例。你可以Run this demo on Sandcastle .
function onTimelineScrubfunction(e) {
var clock = e.clock;
clock.currentTime = e.timeJulian;
clock.shouldAnimate = false;
}
var timeControlsContainer = document.getElementById('timeControlsContainer');
var clock = new Cesium.Clock();
var clockViewModel = new Cesium.ClockViewModel(clock);
var animationContainer = document.createElement('div');
animationContainer.className = 'cesium-viewer-animationContainer';
timeControlsContainer.appendChild(animationContainer);
var animation = new Cesium.Animation(animationContainer, new Cesium.AnimationViewModel(clockViewModel));
var timelineContainer = document.createElement('div');
timelineContainer.className = 'cesium-viewer-timelineContainer';
timeControlsContainer.appendChild(timelineContainer);
var timeline = new Cesium.Timeline(timelineContainer, clock);
timeline.addEventListener('settime', onTimelineScrubfunction, false);
timeline.zoomTo(clock.startTime, clock.stopTime);
clockViewModel.shouldAnimate = true;
window.setInterval(function() {
clock.tick();
}, 32);
关于javascript - 独立的铯时间轴小部件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32338093/