Planet World represents the universal planet class, as it may be necessary to draw planets other than Earth, such as the Moon and Mars. The class diagram for this class is as follows.
It should be stated that the rendering of the planetary spheres in WorldWind and the rendering of the graticule grids are plotted separately. The rendering process of the graticule grid is described in the article "WorldWind Source Analysis series: The mapping of the planet's latitude and longitude grid", which is activated, refreshed and drawn through the Form.onpaint () function. The rendering process of planetary spheres is described in the article "WorldWind Source Analysis series: the loading and rendering of planetary spheres". Planet World is a class that is constructed from reading parameters in the XML configuration file during the drawing process to represent the planet.
Planet World contains the main fields, properties, and methods as follows:
public static Worldsettings Settings = new Worldsettings ();//Planet Setting parameters
Double Equatorialradius; The equatorial radius of the planet
Const double flattening = 6378.135; Equatorial radius of the planet, unit: km
Const double Semimajoraxis = 6378137.0; Length of the planet's short half axis, unit: M
Const double Semiminoraxis = 6356752.31425; Length of the planet's long half axis, unit: M
Terrainaccessor _terrainaccessor; Planet's terrain accessor
Renderableobjectlist _renderableobjects; List of objects that can be rendered to the planet
Private System.Collections.IList onscreenmessages; Message list of the planet
Private DateTime lastelevationupdate = System.DateTime.Now; Elevation last update time
Worldsurfacerenderer m_worldsurfacerenderer = null; Planet's surface Renderer
public bool isearth//This property is used to determine whether the currently rendered planet is Earth
Projectedvectorrenderer m_projectedvectorrenderer = null; Vector renderer after planet projection
Public Atmosphericscatteringsphere M_outersphere = atmospheric scattering ball outside planet null;//
Sprite M_sprite = Null;//direct3d Elf class
Texture m_suntexture = null; Texture classes for Direct3D
Surfacedescription m_sunsurfacedescription; Surface Description Class of Direct3D
int m_sunwidth = 72;
int m_sunheight = 72;
Static constructors No functionality is currently implemented by the passive World (). Non-static constructor public world (string name, Vector3 position, quaternion orientation, double equatorialradius,string Cachedirectory,terrainaccessor Terrainaccessor) Instantiates a planetary object with the specified planet name, center position, direction four, equatorial radius, buffer directory, and corresponding terrain accessor. The constructor is called by the static function load () of the loader class to construct and return a planetary object, as shown in the following code:
WorldWind.ConfigurationLoader.Load (Worldxmldescriptorfile.fullname, Worldwindow.cache);
public void Setlayeropacity (string category, string name, float opacity) and private void setlayeropacity (Renderableobject Ro, string category, string name, float opacity) method is used to set the opacity of the layer.
The private static string getrenderablepathstring (Renderableobject renderable) method is used to get a rendered path string that internally recursively calls itself.
The public static void LoadSettings () method is used to deserialize the Worldsettings object from the default path location for the generation of the planet setting class. The public static void LoadSettings (String directory) method is used to deserialize a Worldsettings object from the specified path location to the generated planet settings class.
The public override void Initialize (Drawargs Drawargs) method initializes the planet object and its associated list of rendered sub-objects with the specified drawing parameter object Drawargs.
The private void Drawaxis (Drawargs Drawargs) method is used to draw the axis
public override void Update (Drawargs Drawargs) method to update the current scene
The public override bool Performselectionaction (Drawargs Drawargs) method is a function that overloads the parent class with the same name. Internally called is an overloaded function with the same name as the Renderableobjectlist object list class, which in turn calls an overloaded function with the same name that can render the object class Renderableobject. Because of the abstract function of the root class's Renderableobject function, the final invocation is to derive the various render subclasses derived from the Renderableobject object class, and finally to implement the function of "pick operation".
The private void Rendersun (Drawargs Drawargs) method paints the sun with the specified drawing parameter object Drawargs.
The public override void Render (Drawargs Drawargs) method overloads the parent class with the same name function. A list of objects that are drawn and their associated rendered sub-objects are implemented by invoking functions that draw a class of elements.
The private void Renderstars (Drawargs drawargs,renderableobject renderable) method draws the star with the specified drawing parameter object Drawargs.
private void Render (WorldWind.Renderable.RenderableObject renderable, WorldWind.Renderable.RenderPriority priority, The Drawargs Drawargs) method is used to draw a subclass object that inherits from the renderableobject of the rendered object class.
The private void Saverenderablestate (Renderableobject ro) method is used to hold the state of a single object that can be rendered.
The private void Saverenderablestates (Renderableobjectlist rol) method is used to hold the state of multiple objects contained in a list of objects that can be rendered.
public static Angle approxangulardistance (Angle LatA, Angle Lona, Angle LATB, Angle lonb) calculates the large circle distance between two pairs of points.
Public double approxdistance (Angle LatA, Angle Lona, Angle LATB, Angle lonb) calculates the distance in meters between two pairs of points, calling the function above
public static void Intermediategcpoint (float f, Angle Lat1, Angle lon1, Angle lat2, Angle lon2, Angle d,out Angle lat, out Angle Lon) and public Vector3 intermediategcpoint (float F, Angle Lat1, Angle lon1, Angle lat2, Angle Lon2, Angle D) method to calculate the spherical large circle The coordinate of the midpoint of two points on the arc is different from the return mode, the former is returned in the form of an output parameter, and the latter is returned as a vector.
WorldWind Source Analysis Series: Planet World