Learning WorldWind for a long time, theoretical study is basically completed. I realize that WW learning is mainly divided into two major strides: WW Framework Learning and WW plug-in learning. Learn the WW plug-in gradually in-depth, must first learn Direct3D programming, this is my experience. Today Virtual Earth Plug-in learning complete, but also marks I can from WW theory to WW practice. Although I summed up the introduction of Virtual Earth plug-ins, but hope that users read the following content before, it is best to learn Direct3D programming, BMNG and globe icon Plug-ins of the bottom rendering, these are learning Virtual Earth Foundation.
Virtual Earth Plug-ins include the following classes:
Virtualearthform Form Class
Virtualearthplugin plug-in class, inherited from plugin (important)
Vereprojecttileslayer render object class, inherited from Renderable object (important)
Vetile Tile object Class (which really implements most of the functionality) (important)
Projection projection transformation Class (important)
Search class
Pushpin Class
Let's take a look at Virtualearthplugin, all plug-in classes must inherit from Plugin.cs, and the load () and unload () methods must be overridden. The two methods implement the loading and unloading of the plug-in respectively.
The Load () method is generally implemented to add menus and add tool buttons, similar to the previous introduction plug-ins, the development of their own plug-ins to imitate the writing on the line.
public override void Load ()
{
Try
{
//judging the current world as an ear Th (Note: Other stars can be judged by name)
if (ParentApplication.WorldWindow.CurrentWorld.IsEarth)
{//early Initialization ve plug-in control form
M_form = new Virtualearthform (parentapplication);
M_form.owner = parentapplication;
//Add ve plugin menu
M_menuitem = new MenuItem ("MicroSoft VirtualEarth");
M_menuitem.click + = new EventHandler (menuitemclicked);
ParentApplication.PluginsMenu.MenuItems.Add (M_menuitem);
//#if DEBUG
String imgpath = Path.getdirectoryname (System.Windows.Forms . Application.executablepath) + "\\Plugins\\VirtualEarth\\VirtualEarthPlugin.png";
//#else
//_plugindir = this. Plugindirectory;
//String Imgpath = this. Plugindirectory + @ "\virtualearthplugin.png";
//#endif
if (file.exists (Imgpath) = False)
{ br> Utility.Log.Write (New Exception ("Imgpath not Found" + Imgpath));
}
///Add Tool button, the toolbar will appear
M_toolbaritem = new Worldwind.windo Wscontrolmenubutton (
MicroSoft VirtualEarth,
Imgpath,
M_form);
ParentApplication.WorldWindow.MenuBar.AddToolsMenuButton (M_toolbaritem);
Base. Load ();
}
}
catch (Exception ex)
{
U Tility. Log.write (ex);
Throw;
}
}