WorldWind的WorldWindow控件包含只读属性DrawArgs
public DrawArgs DrawArgs { get { return this.drawArgs; } }
DrawArgs渲染参数对象,负责记录当前渲染的各个参数
WorldWindow的CurrentWorld属性赋值时也给drawArgs的CurrentWorld赋值。
View Code
1 public World CurrentWorld 2 { 3 get 4 { 5 return m_World; 6 } 7 set 8 { 9 m_World = value;10 if(m_World != null)11 {12 MomentumCamera camera = new MomentumCamera(m_World.Position, m_World.EquatorialRadius );13 if(!World.Settings.CameraResetsAtStartup)14 {15 camera.SetPosition(16 World.Settings.CameraLatitude.Degrees,17 World.Settings.CameraLongitude.Degrees,18 World.Settings.CameraHeading.Degrees, 19 World.Settings.CameraAltitude,20 World.Settings.CameraTilt.Degrees,21 022 );23 }24 this.drawArgs.WorldCamera = camera;25 26 this.drawArgs.CurrentWorld = value;27 this.layerManagerButton = new LayerManagerButton(28 Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), @"Data\Icons\Interface\layer-manager2.png"),29 m_World);30 31 this._menuBar.AddToolsMenuButton( this.layerManagerButton, 0 );32 this._menuBar.AddToolsMenuButton( new PositionMenuButton( Path.GetDirectoryName(Application.ExecutablePath) + "\\Data\\Icons\\Interface\\coordinates.png"), 1);33 this._menuBar.AddToolsMenuButton( new LatLonMenuButton( Path.GetDirectoryName(Application.ExecutablePath) + "\\Data\\Icons\\Interface\\lat-long.png", m_World), 2);34 this.layerManagerButton.SetPushed(World.Settings.ShowLayerManager);35 36 // TODO: Decide how to load grids37 m_World.RenderableObjects.Add(new Renderable.LatLongGrid(m_World));38 }39 }40 }
drawArgs的WorldCamera属性,注意DrawArgs类的public static CameraBase Camera = null;Camera是一个静态对象,具有缓存相机的作用。