简体   繁体   English

如何使用Cesium缩放实体/数据源?

[英]How to zoom entities/datasources with Cesium?

I tried: 我试过了:

czmlDataSource.load(czmlurl).then(function(){
                                viewer.dataSources.add(czmlDataSource).then(function(){
                                    viewer.flyTo(viewer.dataSources,offset);
                                });
                          });

This: 这个:

czmlDataSource.load(czmlurl).then(function(){
                                viewer.dataSources.add(czmlDataSource).then(function(){
                                    viewer.zoomTo(viewer.dataSources,offset);
                                });
                          });

And this: 还有这个:

czmlDataSource.load(czmlurl).then(function(){
                                viewer.dataSources.add(czmlDataSource);
                                viewer.flyTo(viewer.dataSources,offset);
                          });

And its .zoomTo equivalent without success. 而它的.zoomTo等同于没有成功。 What to do now? 现在做什么?

Edit: The answer that works is: viewer.flyTo(czmlDataSource) I thought I had to use the viewer's data source as in viewer.DataSources, which was my mistake, that did not work. 编辑:有效的答案是:viewer.flyTo(czmlDataSource)我以为我必须使用viewer.DataSources中的查看器数据源,这是我的错误,但是没有用。

Stack overflow has become so stale people waste their time correcting grammar and spelling on 3 year old posts. 堆栈溢出已经变得如此陈旧,人们浪费时间纠正3岁帖子上的语法和拼写。

Give this a try: 尝试一下:

viewer.dataSources.add(czmlDataSource);
czmlDataSource.load(czmlurl).then(function() {
    viewer.flyTo(czmlDataSource, options);
});

See also: viewer.flyTo for the available options . 另请参阅: viewer.flyTo了解可用options

Also remember to check the web console for any errors, and include them with your question if they are relevant. 还要记得检查Web控制台是否有任何错误,如果相关,请将它们包含在您的问题中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM