World Wind v1.4 API Specification

From World Wind Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 19:43, 22 June 2005 (edit)
143.232.86.153 (Talk)

← Previous diff
Revision as of 20:04, 22 June 2005 (edit) (undo)
143.232.86.153 (Talk)

Next diff →
Line 1: Line 1:
'''Key Interfaces that will be defined in the Plugin API''' '''Key Interfaces that will be defined in the Plugin API'''
-*'''namespace WorldWindSDK'''+<pre>namespace WorldWindSDK
-**'''public interface IRenderable'''+{
-***'''Methods'''+ public interface IRenderable
-****void Dispose();+ {
-****void Initialize();+ #region Methods
-****void Render(ICamera camera);+ void Dispose();
-***'''Properties'''+ void Initialize();
-****IRenderableList ChildRenderables{get;set;}+ void Render(ICamera camera);
-****bool Disposed{get;}+ #endregion
-****bool Initialized{get;}+ 
-****Hashtable MetaData{get;set;}+ #region Properties
-****string Id{get;set;}+ IRenderableList ChildRenderables{get;set;}
-****byte Opacity{get;set;}+ bool Disposed{get;}
-****Quaternion Orientation{get;set;}+ bool Initialized{get;}
-****IRenderable ParentRenderable{get;set;}+ Hashtable MetaData{get;set;}
-****Vector3 Position{get;set;}+ string Id{get;set;}
-****bool Visible{get;set;} //used to be "IsOn"+ byte Opacity{get;set;}
-**'''public interface IRenderableList'''+ Quaternion Orientation{get;set;}
-***'''Methods'''+ IRenderable ParentRenderable{get;set;}
-****void Add(IRenderable renderable);+ Vector3 Position{get;set;}
-****void Clear();+ bool Visible{get;set;} //used to be "IsOn"
-****void Insert(int index, IRenderable renderable);+ #endregion
-****IRenderable RemoveAt(int index);+ }
-****IRenderable RemoveId(string Id);+ 
-***'''Properties'''+ public interface IRenderableList
-****int Count{get;}+ {
-****IRenderableList ParentRenderableList{get;set;}+ #region Methods
-****bool ShowOnlyOneLayer{get;set;}+ void Add(IRenderable renderable);
-***'''Indexers'''+ void Clear();
-****IRenderable this[int index] {get;set;}+ void Insert(int index, IRenderable renderable);
-**'''public interface IInteractive''' //perhaps there are interfaces in .Net already for this...similar to JAVA KeyListener and MouseListener ?+ IRenderable RemoveAt(int index);
-***'''Methods'''+ IRenderable RemoveId(string Id);
-****void OnKeyDown(KeyEventArgs e);+ #endregion
-****void OnKeyUp(KeyEventArgs e);+ 
-****void OnMouseDown(MouseEventArgs e);+ #region Properties
-****void OnMouseEnter(EventArgs e);+ int Count{get;}
-****void OnMouseLeave(EventArgs e);+ IRenderableList ParentRenderableList{get;set;}
-****void OnMouseMove(MouseEventArgs e);+ bool ShowOnlyOneLayer{get;set;}
-****void OnMouseUp(MouseEventArgs e);+ #endregion
-****void OnMouseWheel(MouseEventArgs e);+ 
-**public delegate void CameraEvent(object sender, System.EventArgs e);+ #region Indexers
-**'''public interface ICamera'''+ IRenderable this[int index] {get;set;}
-***'''Methods'''+ #endregion
-****void SetupCamera(IAppContext appContext);+ }
-***'''Events'''+ 
-****event CameraEvent OnCameraMove;+ public interface IInteractive //perhaps there are interfaces in .Net already for this...similar to JAVA KeyListener and MouseListener ?
-***'''Properties'''+ {
-****Vector3 Eye{get;set;}+ #region Methods
-****Vector3 LookAt{get;set;}+ void OnKeyDown(KeyEventArgs e);
-****Vector3 Up{get;set;} //could be just {0, 0, 1} with Quaternion rotations applied afterwards+ void OnKeyUp(KeyEventArgs e);
-****Quaternion EyeOrientation{get;set;} // Bank, Heading, and Tilt should be calculated from this+ void OnMouseDown(MouseEventArgs e);
-****Quaternion LookAtOrientation{get;set;} // Heading and Tilt should should be calculated from this+ void OnMouseEnter(EventArgs e);
-****Angle Fov{get;set;} + void OnMouseLeave(EventArgs e);
-**'''public interface ITerrainAccessor'''+ void OnMouseMove(MouseEventArgs e);
-***'''Methods'''+ void OnMouseUp(MouseEventArgs e);
-****double GetElevationAt(double lat, double lon, double targetSamplesPerDegree);+ void OnMouseWheel(MouseEventArgs e);
-****double[,] GetElevationArray(double north, double south, double west, double east, int samples);+ #endregion
-**'''public interface IWorld'''+ }
-***'''Methods'''+ 
-****Angle GetLatitudeFromCartesian(Vector3 cartesianPoint);+ public delegate void CameraEvent(object sender, System.EventArgs e);
-****Angle GetLongitudeFromCartesian(Vector3 cartesianPoint);+
-****double GetAltitudeFromCartesian(Vector3 cartesianPoint);+ public interface ICamera
-****Angle GetViewRangeFromCartesian(Vector3 cartesianPoint);+ {
-***'''Properties'''+ #region Methods
-****double EquatorialRadius{get;}+ void SetupCamera(IAppContext appContext);
-****double Flattening{get;}+ #endregion
-****double PolarRadius{get;}+ 
-****ITerrainAccessor TerrainAccessor{get;}+ #region Events
-**'''public interface ICameraManager'''+ event CameraEvent OnCameraMove;
-***'''Methods'''+ #endregion
-****void AddCamera(ICamera camera);+ 
-****ICamera RemoveCamera(int index);+ #region Properties
-***'''Events'''+ Vector3 Eye{get;set;}
-****event CameraEvent OnCameraMove;+ Vector3 LookAt{get;set;}
-***'''Properties'''+ Vector3 Up{get;set;} //could be just {0, 0, 1} with Quaternion rotations applied afterwards
-****int Count{get;}+ Quaternion EyeOrientation{get;set;} // Bank, Heading, and Tilt should be calculated from this
-***'''Indexers'''+ Quaternion LookAtOrientation{get;set;} // Heading and Tilt should should be calculated from this
-****ICamera this[int index] {get;}+ Angle Fov{get;set;}
-**'''interface IAppContext'''+ #endregion
-***'''Properties'''+ }
-****bool Repaint{get;set;} //might be removed+ 
-****Microsoft.DirectX.Direct3D.Device Device3d{get;}+ public interface ITerrainAccessor
-****Microsoft.DirectX.DirectSound.Device DeviceSound{get;}+ {
-****Microsoft.DirectX.Direct3D.Font DefaultDrawingFont{get;set;}+ #region Methods
-****IRenderable RootRenderable{get;set;} //top level IRenderable for which all IRenderables will be children of+ double GetElevationAt(double lat, double lon, double targetSamplesPerDegree);
-****ICameraManager CameraManager{get;set;} //all IRenderables dependant on camera view position and angles should subscribe to the OnCameraMove event+ double[,] GetElevationArray(double north, double south, double west, double east, int samples);
-****System.Windows.Forms.Control ParentControl{get;} //might try using ParentControl.Invalidate() to signify a repaint+ #endregion
-****IWidget ParentWidget{get;} // top-level frame for all GUI Widgets+ }
-****Hashtable ExtendableObjects {get;set;} //use to save "objects" that are not explicitly defined in IAppContext+ 
-**'''public interface IWidget'''+ public interface IWorld
-***'''Methods'''+ {
-**** Under Construction+ #region Methods
-***'''Properties'''+ Angle GetLatitudeFromCartesian(Vector3 cartesianPoint);
-**** Under Construction+ Angle GetLongitudeFromCartesian(Vector3 cartesianPoint);
-**'''public interface IWigdetCollection'''+ double GetAltitudeFromCartesian(Vector3 cartesianPoint);
-***'''Methods'''+ Angle GetViewRangeFromCartesian(Vector3 cartesianPoint);
-**** Under Construction+ #endregion
-***'''Properties'''+ 
-**** Under Construction+ #region Properties
 + double EquatorialRadius{get;}
 + double Flattening{get;}
 + double PolarRadius{get;}
 + ITerrainAccessor TerrainAccessor{get;}
 + #endregion
 + }
 + 
 + public interface ICameraManager
 + {
 + #region Methods
 + void AddCamera(ICamera camera);
 + ICamera RemoveCamera(int index);
 + #endregion
 + 
 + #region Events
 + event CameraEvent OnCameraMove;
 + #endregion
 + 
 + #region Properties
 + int Count{get;}
 + #endregion
 + 
 + #region Indexers
 + ICamera this[int index] {get;}
 + #endregion
 + }
 + 
 + /// <summary>
 + /// Base interface for the application context that contains persistant objects accessible by anywhere in the application, such as directx devices
 + /// </summary>
 + public interface IAppContext
 + {
 + #region Properties
 + Microsoft.DirectX.Direct3D.Device Device3d{get;}
 + Microsoft.DirectX.DirectSound.Device DeviceSound{get;}
 + Microsoft.DirectX.Direct3D.Font DefaultDrawingFont{get;set;}
 + IRenderable RootRenderable{get;set;} //top level IRenderable for which all IRenderables will be children of
 + ICameraManager CameraManager{get;set;} //all IRenderables dependant on camera view position and angles should subscribe to the OnCameraMove event
 + System.Windows.Forms.Control ParentControl{get;}
 + IWidget ParentWidget{get;}
 + Hashtable ExtendableObjects {get;set;} //use to save "objects" that are not explicitly defined in IAppContext
 + #endregion
 + }
 + 
 + /// <summary>
 + /// Base Interface for DirectX GUI Widgets
 + /// </summary>
 + public interface IWidget
 + {
 + #region Methods
 +
 + 
 + #endregion
 + 
 + #region Properties
 +
 + #endregion
 + }
 + 
 + /// <summary>
 + /// Collection of IControls
 + /// </summary>
 + public interface IWigdetCollection
 + {
 + //still working on this
 + }
 +}</pre>
WorldWindow will contain an IAppContext object, which contains the persistant objects necessary for the construction of the WorldWindow environment. Among the DirectX devices, there is also a RootRenderable, a CameraManager, and a ParentWidget for which all GUI elements will reside under. IRenderables will need to subscribe to the CameraManager events to be able to update themselves as the camera moves around the environment. There is no longer an infinite updating loop, nor an infinite rendering loop. All DirectX-based GUI elements must derive the IWidget interface and add themselves to the ParentWidget. This allows a fully customizeable DX-based GUI. Also, the cameras are now free floating, meaning that they aren't necessary tied to any object, and thus, in order to get their Lat/Lon/Position, you'll need to calculate it from the Eye or Look vectors with respect to the "World" that you'd like a Lat/Lon/Distance of. It's not tough, just different. Then again, in making a camera class, it's always possible to define it so those attributes are always available, but it's just not going to be in the ICamera interface. WorldWindow will contain an IAppContext object, which contains the persistant objects necessary for the construction of the WorldWindow environment. Among the DirectX devices, there is also a RootRenderable, a CameraManager, and a ParentWidget for which all GUI elements will reside under. IRenderables will need to subscribe to the CameraManager events to be able to update themselves as the camera moves around the environment. There is no longer an infinite updating loop, nor an infinite rendering loop. All DirectX-based GUI elements must derive the IWidget interface and add themselves to the ParentWidget. This allows a fully customizeable DX-based GUI. Also, the cameras are now free floating, meaning that they aren't necessary tied to any object, and thus, in order to get their Lat/Lon/Position, you'll need to calculate it from the Eye or Look vectors with respect to the "World" that you'd like a Lat/Lon/Distance of. It's not tough, just different. Then again, in making a camera class, it's always possible to define it so those attributes are always available, but it's just not going to be in the ICamera interface.

Revision as of 20:04, 22 June 2005

Key Interfaces that will be defined in the Plugin API

namespace WorldWindSDK
{
	public interface IRenderable
	{
		#region Methods
		void Dispose();
		void Initialize();
		void Render(ICamera camera);
		#endregion

		#region Properties
		IRenderableList ChildRenderables{get;set;}
		bool Disposed{get;}
		bool Initialized{get;}
		Hashtable MetaData{get;set;}
		string Id{get;set;}
		byte Opacity{get;set;}
		Quaternion Orientation{get;set;}
		IRenderable ParentRenderable{get;set;}
		Vector3 Position{get;set;}
		bool Visible{get;set;} //used to be "IsOn"
		#endregion
	}

	public interface IRenderableList
	{
		#region Methods
		void Add(IRenderable renderable);
		void Clear();
		void Insert(int index, IRenderable renderable);
		IRenderable RemoveAt(int index);
		IRenderable RemoveId(string Id);
		#endregion

		#region Properties
		int Count{get;}
		IRenderableList ParentRenderableList{get;set;}
		bool ShowOnlyOneLayer{get;set;}
		#endregion

		#region Indexers
		IRenderable this[int index] {get;set;}
		#endregion
	}

	public interface IInteractive //perhaps there are interfaces in .Net already for this...similar to JAVA KeyListener and MouseListener ?
	{
		#region Methods
		void OnKeyDown(KeyEventArgs e);
		void OnKeyUp(KeyEventArgs e);
		void OnMouseDown(MouseEventArgs e);
		void OnMouseEnter(EventArgs e);
		void OnMouseLeave(EventArgs e);
		void OnMouseMove(MouseEventArgs e);
		void OnMouseUp(MouseEventArgs e);
		void OnMouseWheel(MouseEventArgs e);
		#endregion
	}

	public delegate void CameraEvent(object sender, System.EventArgs e);
	
	public interface ICamera
	{
		#region Methods
		void SetupCamera(IAppContext appContext);
		#endregion

		#region Events
		event CameraEvent OnCameraMove;
		#endregion

		#region Properties
		Vector3 Eye{get;set;}
		Vector3 LookAt{get;set;}
		Vector3 Up{get;set;} //could be just {0, 0, 1} with Quaternion rotations applied afterwards
		Quaternion EyeOrientation{get;set;} // Bank, Heading, and Tilt should be calculated from this
		Quaternion LookAtOrientation{get;set;} // Heading and Tilt should should be calculated from this
		Angle Fov{get;set;} 
		#endregion
	}

	public interface ITerrainAccessor
	{
		#region Methods
		double GetElevationAt(double lat, double lon, double targetSamplesPerDegree);
		double[,] GetElevationArray(double north, double south, double west, double east, int samples);
		#endregion
	}

	public interface IWorld
	{
		#region Methods
		Angle GetLatitudeFromCartesian(Vector3 cartesianPoint);
		Angle GetLongitudeFromCartesian(Vector3 cartesianPoint);
		double GetAltitudeFromCartesian(Vector3 cartesianPoint);
		Angle GetViewRangeFromCartesian(Vector3 cartesianPoint);
		#endregion

		#region Properties
		double EquatorialRadius{get;}
		double Flattening{get;}
		double PolarRadius{get;}
		ITerrainAccessor TerrainAccessor{get;}
		#endregion
	}

	public interface ICameraManager
	{
		#region Methods
		void AddCamera(ICamera camera);
		ICamera RemoveCamera(int index);
		#endregion

		#region Events
		event CameraEvent OnCameraMove;
		#endregion

		#region Properties
		int Count{get;}
		#endregion

		#region Indexers
		ICamera this[int index] {get;}
		#endregion
	}

	/// <summary>
	/// Base interface for the application context that contains persistant objects accessible by anywhere in the application, such as directx devices
	/// </summary>
	public interface IAppContext
	{
		#region Properties
		Microsoft.DirectX.Direct3D.Device Device3d{get;}
		Microsoft.DirectX.DirectSound.Device DeviceSound{get;}
		Microsoft.DirectX.Direct3D.Font DefaultDrawingFont{get;set;}
		IRenderable RootRenderable{get;set;}  //top level IRenderable for which all IRenderables will be children of
		ICameraManager CameraManager{get;set;}  //all IRenderables dependant on camera view position and angles should subscribe to the OnCameraMove event
		System.Windows.Forms.Control ParentControl{get;}
		IWidget ParentWidget{get;}
		Hashtable ExtendableObjects {get;set;} //use to save "objects" that are not explicitly defined in IAppContext
		#endregion
	}

	/// <summary>
	/// Base Interface for DirectX GUI Widgets
	/// </summary>
	public interface IWidget
	{
		#region Methods
		

		#endregion

		#region Properties
		
		#endregion
	}

	/// <summary>
	///	Collection of IControls
	/// </summary>
	public interface IWigdetCollection
	{
		//still working on this
	}
}

WorldWindow will contain an IAppContext object, which contains the persistant objects necessary for the construction of the WorldWindow environment. Among the DirectX devices, there is also a RootRenderable, a CameraManager, and a ParentWidget for which all GUI elements will reside under. IRenderables will need to subscribe to the CameraManager events to be able to update themselves as the camera moves around the environment. There is no longer an infinite updating loop, nor an infinite rendering loop. All DirectX-based GUI elements must derive the IWidget interface and add themselves to the ParentWidget. This allows a fully customizeable DX-based GUI. Also, the cameras are now free floating, meaning that they aren't necessary tied to any object, and thus, in order to get their Lat/Lon/Position, you'll need to calculate it from the Eye or Look vectors with respect to the "World" that you'd like a Lat/Lon/Distance of. It's not tough, just different. Then again, in making a camera class, it's always possible to define it so those attributes are always available, but it's just not going to be in the ICamera interface.

Solutions:

  • WorldWindSDK
    • produces API (version specific) DLLs
    • the idea is that this doesn't change often and should more or less be left alone.
  • WorldWindow
    • produces WorldWindow.dll
    • uses WorldWindSDK DLLs as base interfaces
  • WorldWind
    • produces WorldWind.exe
    • uses WorldWindow.dll

-- More to come...Feel free to comment

Personal tools