我一直在搜索文档和示例,但没有看到任何好的演示向我展示我想做的事情:
如何将 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/