World Wind v1.4 API Specification

Key Interfaces that will be defined in the Plugin API namespace WorldWindSDK {	/// 	/// Interface for which all Non-GUI Renderable elements must derive. /// 	public interface IRenderable {		#region Methods /// 		/// Disposes this instance. /// 		void Dispose; /// 		/// Initializes this instance. /// 		void Initialize; /// 		/// Renders the IRenderable with the specified camera. /// 		/// Camera. void Render(ICamera camera); #endregion

#region Properties /// 		/// Gets or sets the child renderables. /// 		/// 		IRenderableCollection ChildRenderables{get;set;} /// 		/// Gets a value indicating whether this  is disposed. /// 		/// 		/// 	true if disposed; otherwise, false. /// 		bool Disposed{get;} /// 		/// Gets a value indicating whether this  is initialized. /// 		/// 		/// 	true if initialized; otherwise, false. /// 		bool Initialized{get;} /// 		/// Gets or sets the meta data. /// 		/// 		Hashtable MetaData{get;set;} /// 		/// Gets or sets the Id. /// 		/// 		string Id{get;set;} /// 		/// Gets or sets the opacity. 0 = Transparent, 255 = Fully Opaque /// 		/// 		byte Opacity{get;set;} /// 		/// Gets or sets the orientation. /// 		/// 		Quaternion Orientation{get;set;} /// 		/// Gets or sets the parent renderable. /// 		/// 		IRenderable ParentRenderable{get;set;} /// 		/// Gets or sets the position. /// 		/// 		Vector3 Position{get;set;} /// 		/// Gets or sets a value indicating whether this is visible. /// 		/// 		/// 	true if visible; otherwise, false. /// 		bool Visible{get;set;} #endregion }

/// 	/// Collection of IRenderable objects /// 	public interface IRenderableCollection {		#region Methods /// 		/// Adds the specified renderable. /// 		/// Renderable. void Add(IRenderable renderable); /// 		/// Removes all IRenderables in this IRenderableList. /// 		void Clear; /// 		/// Inserts IRenderable at specified index. /// 		/// Index. /// Renderable. void Insert(int index, IRenderable renderable); /// 		/// Removes IRenderable at specified index. /// 		/// Index. /// 		IRenderable RemoveAt(int index); /// 		/// Removes the IRenderable with specified Id. /// 		/// Id. /// 		IRenderable RemoveId(string Id); #endregion

#region Properties /// 		/// Gets the count of IRenderables in the list. /// 		/// 		int Count{get;} /// 		/// Gets or sets the parent renderable list. /// 		/// 		IRenderableCollection ParentRenderableCollection{get;set;} /// 		/// Gets or sets a value indicating whether make the collection act as a Radio Button style group in which only one object may be Visible at once. /// 		/// 		/// 	true</c> if [show only one layer]; otherwise, false</c>. /// 		bool ShowOnlyOneLayer{get;set;} #endregion

#region Indexers /// 		/// Gets or sets the <see cref="IRenderable"/> at the specified index. /// 		/// 		IRenderable this[int index] {get;set;} #endregion }

/// 	/// Interface must be implemented in order to recieve user input. Can be used by IRenderables and IWidgets. /// 	public interface IInteractive {		#region Methods bool OnKeyDown(KeyEventArgs e); bool OnKeyUp(KeyEventArgs e); bool OnMouseDown(MouseEventArgs e); bool OnMouseEnter(EventArgs e); bool OnMouseLeave(EventArgs e); bool OnMouseMove(MouseEventArgs e); bool OnMouseUp(MouseEventArgs e); bool OnMouseWheel(MouseEventArgs e); #endregion }

public delegate void CameraEvent(object sender, System.EventArgs e); public interface ICamera {		#region Methods /// 		/// Setups the camera, includes the setup of the View, World, and Projection matrices /// 		/// <param name="appContext">App context. void SetupCamera(IAppContext appContext); #endregion

#region Events /// 		/// Event triggers when the camera changes position or orientation /// 		event CameraEvent OnCameraMove; #endregion

#region Properties /// 		/// Gets or sets the eye position. /// 		/// 		Vector3 Eye{get;set;} /// 		/// Gets or sets the look at position. /// 		/// 		Vector3 LookAt{get;set;} /// 		/// Gets or sets the up vector. /// 		/// 		Vector3 Up{get;set;} //could be just {0, 0, 1} with Quaternion rotations applied afterwards /// 		/// Gets or sets the eye orientation. /// 		/// 		Quaternion EyeOrientation{get;set;} // Bank, Heading, and Tilt should be calculated from this /// 		/// Gets or sets the look at orientation. /// 		/// 		Quaternion LookAtOrientation{get;set;} // Heading and Tilt should should be calculated from this /// 		/// Gets or sets the field-of-view of the projection matrix. /// 		/// 		Angle Fov{get;set;} #endregion }

public interface ITerrainAccessor {		#region Methods /// 		/// Gets the elevation at a given Latitude, Longitude, and resolution accuracy in the latitude/longitude geographic frame of reference. /// 		/// Latitude. /// Longitude. /// <param name="targetSamplesPerDegree">Target samples per degree. /// 		double GetElevationAt(double latitude, double longitude, double targetSamplesPerDegree); /// 		/// Gets the elevation array for given geographic bounding box and resolution. /// 		/// North. /// South. /// West. /// East. /// Samples. double[,] GetElevationArray(double north, double south, double west, double east, int samples); #endregion }

public interface IWorld {		#region Methods /// 		/// Gets the latitude from cartesian. /// 		/// <param name="cartesianPoint">Cartesian point. /// 		Angle GetLatitudeFromCartesian(Vector3 cartesianPoint); /// 		/// Gets the longitude from cartesian. /// 		/// <param name="cartesianPoint">Cartesian point. /// 		Angle GetLongitudeFromCartesian(Vector3 cartesianPoint); /// 		/// Gets the altitude above sea level from cartesian. /// 		/// <param name="cartesianPoint">Cartesian point. /// 		double GetAltitudeAboveSeaLevelFromCartesian(Vector3 cartesianPoint); /// 		/// Gets the view range from cartesian. /// 		/// <param name="cartesianPoint">Cartesian point. /// 		Angle GetViewRangeFromCartesian(Vector3 cartesianPoint); /// 		/// Gets the cartesian point from geographic coordinate space. /// 		/// Latitude. /// Longitude. /// <param name="altitudeAboveSeaLevel">Altitude above sea level in meters. /// 		Vector3 GetCartesianPointFromGeographic(Angle latitude, Angle longitude, double altitudeAboveSeaLevel); #endregion

#region Properties /// 		/// Gets or sets the terrain accessor. /// 		/// 		ITerrainAccessor TerrainAccessor{get;set;} #endregion }

public interface ICameraCollection {		#region Methods /// 		/// Adds the camera. /// 		/// Camera. void AddCamera(ICamera camera); /// 		/// Removes the camera. /// 		/// Index. /// 		ICamera RemoveCamera(int index); #endregion

#region Events /// 		/// Occurs when a camera in the collection triggers an OnCameraMove event /// 		event CameraEvent OnCameraMove; #endregion

#region Properties /// 		/// Gets the count of cameras in the collection. /// 		/// 		int Count{get;} #endregion

#region Indexers /// 		/// Gets the <see cref="ICamera"/> at the specified index. /// 		/// 		ICamera this[int index] {get;} #endregion }

/// 	/// Base interface for the application context that contains persistant objects accessible by anywhere in the application, such as directx devices /// 	public interface IAppContext {		#region Properties /// 		/// Gets the device3d. /// 		/// 		Microsoft.DirectX.Direct3D.Device Device3d{get;} /// 		/// Gets the device sound. /// 		/// 		Microsoft.DirectX.DirectSound.Device DeviceSound{get;} /// 		/// Gets or sets the default drawing font. /// 		/// 		Microsoft.DirectX.Direct3D.Font DefaultDrawingFont{get;set;} /// 		/// Gets or sets the root renderable. /// 		/// 		IRenderable RootRenderable{get;set;}  //top level IRenderable for which all IRenderables will be children of		/// /// Gets or sets the camera manager. /// 		/// 		ICameraCollection CameraCollection{get;set;}  //all IRenderables dependant on camera view position and angles should subscribe to the OnCameraMove event /// 		/// Gets the parent control. /// 		/// 		System.Windows.Forms.Control ParentControl{get;} /// 		/// Gets the root widget. /// 		/// 		IWidget RootWidget{get;} /// 		/// Gets or sets the extendable objects. This can be used to save custom objects that can be used by other elements of the program with access to IAppContext. /// 		/// 		Hashtable ExtendableObjects {get;set;} #endregion }

/// 	/// Base Interface for DirectX GUI Widgets /// 	public interface IWidget {		#region Methods void Render; #endregion

#region Properties IWidgetCollection ChildWidgets{get;set;} IWidget ParentWidget{get;set;} System.Drawing.Point Location{get;set;} System.Drawing.Size Size{get;set;} int Left{get;} int Top{get;} int Right{get;} int Bottom{get;} int Width{get;set;} int Height{get;set;} bool Enabled{get;set;} bool Visible{get;set;} object Tag{get;set;} #endregion }

/// 	/// Collection of IWidgets /// 	public interface IWidgetCollection {		#region Methods void BringToFront(int index); void BringToFront(IWidget widget); void Add(IWidget widget); void Clear; void Insert(IWidget widget, int index); IWidget RemoveAt(int index); #endregion

#region Properties int Count{get;} #endregion

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

}

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