java - 在 WorldWind Java 中限制相机 View

标签 java camera worldwind

我一直在搜索文档和示例,但没有看到任何好的演示向我展示我想做的事情:

如何将 World Wind Java 中的 View 限制为特定区域?就像允许用户移动世界一样,但只能穿过一个小区域。在我的情况下,删除移动相机并将 View 设置到特定位置的功能是可行的,但这样做似乎浪费了 WWJ 令人难以置信的查看功能。

最佳答案

实际上在 gov.nasa.worldwindx.examples 中有一个如何执行此操作的示例(我只是浏览演示):ViewLimits。

可以将 WorldWindowGLCanvas 的 View 转换到 OrbitView。然后可以这样应用限制:

OrbitView viewbounds = (OrbitView)wwd.getView();
if (viewbounds != null)
{
    OrbitViewLimits limits = viewbounds.getOrbitViewLimits();
    if (limits != null)
    {
        viewLimit = new Sector();// Fill with appropriate bounds
        limits.setCenterLocationLimits(viewLimit);
        limits.setPitchLimits(Angle.fromDegrees(0), Angle.fromDegrees(90));
        //^in degrees downward from looking directly at the earth
        limits.setHeadingLimits(Angle.ZERO, Angle.ZERO);// rotation cw or ccw
        limits.setZoomLimits(minZoom, maxZoom);// in meters
        BasicOrbitViewLimits.applyLimits(viewbounds, limits);
    }
}

关于java - 在 WorldWind Java 中限制相机 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13754695/

相关文章:

objective-c - 在 iOS 的自定义相机中捕获图像而不在图库中保存图像

iOS 应用程序视频捕捉在低光下变慢

java - 从不同的 Activity 中获取相机后,是否有任何方法可以从不同的 Activity 中释放相机。?

java - 刷新 JFrame 中 JPanel 上的 JScrollPane JTable 数据

java - 为什么我的 bean 验证消息没有被接收到?

java - 尝试使用新包

java - RayCastingSupport.intersectRayWithTerrain 始终返回 null

java - 如何从世界风测量工具中删除选项卡式平移 View

java - Spring boot中ServletRegistrationBean和ControllerAdvice冲突

java - @事务性多次更新;提交每个查询