I am writing my own WorldWind plug-in, encountered a great setback, on the Saturday originally wanted to write a simple line of plug-ins, the cost of Dickens finally painted, how to draw the animation effect of the problem has not been resolved. Direct3D line is a simple thing, painting to the spherical surface is not difficult, but the practice tells me: I study WW, but also committed the Yangaoshoudi of the problem! Change people write good plug-in code is easy, but to the whole process of plug-ins to write their own, it is not easy to imagine, write code is not rigorous small problem will not say, my Saturday draw line of the main problem is Direct3D programming are floating in the surface, The relationship between the number of primitives and vertices in the primitivetype is not clear.
My own experience on the drawing line, let me decide to learn the measure plugin first. In addition, I always want to do a similar ve plugin, support to load ArcGIS Chettu way of image, I think for a long time, there are a few major puzzles unresolved: How to deal with different projection methods, as long as some of the image (how to calculate the number of rows), the central problem of Chettu (ve image is global, the center of the map is latitude (0°,0° ), and so on. So, the previous WW practice, let me very hit, blog is not in the mood to update it! Although the theory and practice still have a great distance, but the summary is very important!
Above all is the topic digression, starts to say measure the plug-in bar! The overall feeling measure plug-in is very powerful, if can make clear, on the spherical surface draw point, line, face is not difficult. (Prerequisite: To have a bit of DirectX programming Basics)
There are two large classes in MeasureTool.cs: Measuretool (Plug-in Class) and Measuretoollayer (Render object Class). The Measuretoollayer class also contains five internal classes: Measureline, Measuremultiline, Measurepropertiesdialog, Measurestate, Savemultiline (pictured below)
Measuretool as a plug-in class, you need to implement the load () and unload () method, unknown. Some events are registered in Load ().
Load code
public override void Load ()
{
//construct render object
Layer = new Measuretoollayer (
This,
ParentApplication.WorldWindow.DrawArgs);
//Set texture path
layer. Texturepath = Path.Combine (plugindirectory, "plugins\\measure");
ParentApplication.WorldWindow.CurrentWorld.RenderableObjects.Add (layer);
MenuItem = new MenuItem ("Measure\tm");
MenuItem.Click + = new EventHandler (menuitemclicked);
ParentApplication.ToolsMenu.MenuItems.Add (MenuItem);
//Subscribe Events Registered Event
ParentApplication.WorldWindow.MouseMove + = new Mouseeventhand Ler (layer. MouseMove);
ParentApplication.WorldWindow.MouseDown + = new MouseEventHandler (layer. MouseDown);
ParentApplication.WorldWindow.MouseUp + = new MouseEventHandler (layer. MOUSEUP);
ParentApplication.WorldWindow.KeyUp +=nEW Keyeventhandler (layer. KEYUP);
}