Deep analysis of Bmng constructor function
First, the main class diagram
Second, the main function:
1) Bmng class
The Bmng class adds the root node of all the rendered images with the theme "Blue Marble" to the list of available objects in the current planet, including 12 images in the "\data\earth\bmngbathy\" directory, with the source code published, Layered tiled images downloaded from the NASA server. The root node m_renderablelist is primarily used to store the following three renderableobjectlist types of objects: M_bluemarblelist, M_shadedlist, and M_shadedbathylist. which
(1) m_bluemarblelist, named Blue Marble, contains 2 members, respectively, Quadtileset of type m_bluemarblebase and m_bluemarbletiled of Imagelayer type.
(2) M_shadedlist, named Bmng, contains 12 members, each element is Renderableobjectlist type Object m_renderablelayers[0, I], each m_renderablelayers[0, I ] also contains two members, respectively, the Imagelayer type of m_imagelayers[0, I] and quadtileset type m_quadtilelayers[0, I].
(3) M_shadedbathylist, named Bmng (bathymetry), contains 12 members, each element is a Renderableobjectlist type Object m_renderablelayers[0, I], each m_ Renderablelayers[0, I] also contains two members, respectively, the m_imagelayers[1 of the Imagelayer type, I] and the Quadtileset type m_quadtilelayers[1, I].
2) Bmngloader class
The Bmngloader class inherits the plug-in base class Pluginengine.plugin from the plug-in engine and overloads the parent class's method load () and unload (), which exists as a concrete plug-in object that implements the Bmng class with the "Blue Marble" The image is downloaded from a local file or a remote server and rendered onto a three-dimensional digital Earth, and the following code is called in the overloaded Method load ():
M_bmngform = new Bmng (Parentapplication.worldwindow, M_menuitem).
III. Structural Process Analysis
1) Initialize the construction component;
2) Read the values in the \plugins\bluemarble\settings.txt file to set the selected index value of the Bule marble version used in the combo box;
3) Set the display form for all the rendered layers of the "Blue Marble" theme;
4) Iterate through the contained sub-render objects of the current rendered form m_ WorldWindow.CurrentWorld.RenderableObjects.ChildObjects, if it is found that there are child-rendered objects belonging to the Renderableobjectlist type, and the child-rendered object is named " Images ", the list of rendered objects named" The Blue Marble "is added to the root node in the list of objects named" Images ", if no list of objects with the name" Images "is found. The newly created M_renderablelist object list object is added directly to the list of available objects in the current planet.
5) The main process of constructing a BMNG image layer in a class constructor is illustrated by a diagram;
6) Get the current month of the operating system to set the current display value of the slider bar;
7) Define Timer Timer object, bind processing method Timer_tick,timer at 1 second interval to listen and get the month value selected by the user on the slider "Blue Marble next-generation Plugin v1.0" control, Next Call Method Tu Rnofflayers () Sets the render state ISON for each sub-render object in the list m_renderablelayers of the rendered object to False, and then lists the list of objects that are available for the current month based on the currently selected month value M_ The render state ISON of the corresponding sub-render object in Renderablelayers is set to true.
8) Finally, the original blue Marble image is displayed on the digital Earth when the selectedindex=2 of the combo box, that is, "Blue Marble (Original)" is selected, when the combo box is selectedindex=0 or 1, that is, the selection is BMN G or BMNG (bathymetry), the list of available objects that store both types of images M_shadedlist and M_shadedbathylist Property ISON is set to true.
Figure 1 The Bmng class constructor constructs the main process for rendering an image layer
WorldWind Source Code Analysis series: BMNG class constructors in-depth analysis