2012-12-06 33 views
2

我經歷過的文檔和例子搜索,但我看不到任何好的演示給我看,我想做些什麼:限制攝像機視圖在世界風的Java

如何限制在世界風視圖Java到特定的區域?就像允許用戶移動世界一樣,但只能通過一個小區域。移除攝像機並將視圖設置到特定位置的能力對我來說是行得通的,但它似乎浪費了WWJ不可思議的觀看功能。

回答

3

實際上有一個如何在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); 
    } 
}