【问题标题】:Restrict Camera View in WorldWind Java在 WorldWind Java 中限制相机视图
【发布时间】:2012-11-25 03:15:52
【问题描述】:

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

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

【问题讨论】:

    标签: java camera worldwind


    【解决方案1】:

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

    可以将WorldWindowGLCanvas 的视图转换为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);
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2012-06-14
      • 2014-09-20
      • 2019-04-01
      • 1970-01-01
      • 1970-01-01
      • 2018-01-31
      • 1970-01-01
      • 2011-03-27
      • 1970-01-01
      相关资源
      最近更新 更多