WorldWind Source Analysis Series: Four fork Tree Tile class Quadtile

Source: Internet
Author: User

Quadtree Tile Class Quadtile provides a four-fork tree access model for imagery and terrain data . The class diagram for this class is as follows.

Quad Tree Tile Class Quadtile The main fields, properties, and methods provided are briefly described below:

Public quadtileset quadtileset;//four Fork Tree Tile collection Class

Public double west;//the west boundary of the tile, the angle unit

Public double east;//The east border of the tile

Public double north;//North border of tile

Public double south;//The south border of the tile

Public Angle centerlatitude;//Tile Center latitude, radian units

Public Angle centerlongitude;//Tile Center Longitude

Public double latitudespan;//tile latitude range, Angle unit

Public double longitudespan;//tile longitude Range

Public Int. level; Tile owning level

public int Row; The tile belongs to the line number

public int Col; The tile belongs to the column number

Whether public bool isinitialized;//tiles are initialized

Public BoundingBox BoundingBox; The bounding box of the tile

Public Geospatialdownloadrequest downloadrequest; Download Request for Tiles

protected texture[] textures; Texture Array for Tiles

protected static int vertexcount = number of points in the 40;//sub-plane grid

protected static int vertexcountelevated = 40; Number of points in a sub-topographic grid

Protected quadtile northwestchild;//Northwest corner Tile

protected Quadtile Southwestchild; Southwest Corner Sub Tile

protected Quadtile Northeastchild; East of the north corner of the child tile

protected Quadtile Southeastchild; Southeast Corner Sub Tile

protected customvertex.positionnormaltextured[] northwestvertices;

protected customvertex.positionnormaltextured[] southwestvertices;

protected customvertex.positionnormaltextured[] northeastvertices;

protected customvertex.positionnormaltextured[] southeastvertices;

Protected short[] vertexindexes;//Vertex index Array

Protected Point3D Localorigin;//add This offset to get world coordinates

protected bool m_isresetingcache;//whether to reset buffer

protected float verticalexaggeration;//vertical magnification

protected bool isdownloadingterrain;//Whether you are downloading terrain data

public bool Waitingfordownload = false;//waiting for download

public bool Isdownloadingimage = false;//Whether the image data is being downloaded

Double Meshbaseradius = 0;. Grid Base RADIUS Size

protected byte m_currentopacity = 255;//Current Opacity

public string imagefilepath = path to null;//image texture

Protected customvertex.positioncolored[] Downloadrectangle = new customvertex.positioncolored[5];//A rectangular marker area of a downloaded image or terrain area

static Effect Grayscaleeffect = null;//directx 3D effect variable

The constructor public Quadtile (Double nan, double North, double west, double East, int. level, Quadtileset Quadtileset) uses four boundaries of east, west, south, and north, Tile hierarchy and the included four-fork tree tile collection to instantiate a tile object. Where you need to call double Radcoslat = radius * Math.Cos (Latradians), calculate the radius of the latitude circle at the latitude value of Latradians, call Mathengine.getrowfromlatitude ( South, North-south); Calculates the row number and column number of the tile based on the tile's starting boundary and tile size.

The public virtual void Resetcache () virtual function is used to reset the buffer.

Private Quadtile Computechild (double Childsouth, double Childnorth, double childwest, double childeast) The Quadtile method calculates the sub-quadtree tile according to the specified location, and the interior is actually called directly to the constructor to instantiate a Quadtree tile object and return it.

The public virtual void Computechildren (Drawargs Drawargs) method calculates sub-quadtree tiles based on the specific drawing parameters. The Computechild () function is called internally to accomplish the specific function.

The public virtual void update (Drawargs Drawargs) method updates the terrain and image tile data for the rendered scene according to the specific drawing parameters and internally recursively calls itself.

The public virtual void Createtilemesh () method constructs a flat grid and a topographic grid for the current grid. The interior is actually implemented using the overshoot Createelevatedmesh () and the Createflatmesh () method.

protected virtual void Createflatmesh () is used to construct a flat grid without terrain fluctuations.

protected virtual void Createelevatedmesh () is used to build terrain grids with topographic fluctuations. Internally actually by calling protected void Createelevatedmesh (Childlocation corner, customvertex.positionnormaltextured[] vertices, Double Meshbaseradius, float[,] heightdata) functions for specific functions.

private void Calculate_normals (ref customvertex.positionnormaltextured[] vertices, short[] indices) calculates the normals of the grid vertices to enable lighting.

Private Point3D projectonmeshbase (Point3D p) Private method is used to project point p to each tile datum plane.

The public virtual bool render (Drawargs Drawargs) method accomplishes the rendering and drawing of the scene based on the specific drawing parameters.

public void Renderdownloadrectangle (Drawargs drawargs, int color, Vector3 referencecenter) uses a colored rectangular area to mark the downloaded image or terrain area.

void render (device device, customvertex.positionnormaltextured[] Verts, Quadtile Child) method uses an optional download indexer to render a sub-tile of a quadtree tile, Called by the function bool Render (Drawargs Drawargs).

The void Device_devicereset (object sender, EventArgs e) method implements a DirectX 3D rendering that is a graphics-drawing device reset. Internal to invoke the virtual function of the Assembly class GetManifestResourceStream () to load the corresponding texture effect file and return a stream.

WorldWind Source Analysis Series: Four fork Tree Tile class Quadtile

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.