WorldWind Series 11: Virtual Earth Plug-in Learning

Source: Internet
Author: User

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;
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.