WorldWind Source Analysis Series: Image Layer Class Imagelayer

Source: Internet
Author: User

Image Layer Class Imagelayer

The imagery layer class Imagelayer maps a single image to the surface of the planet as a texture. The source image must be a planar Cartesian coordinate system. The class diagram for this class is as follows.

The primary fields, properties, and methods provided by the imagery layer class Imagelayer are briefly described below:

Protected double layerradius;//the radius of the layer, actually the radius of the planet that added the image texture

protected double Minlat; Minimum latitude of a layer

protected double Maxlat; Maximum latitude of a layer

protected double Minlon; Minimum longitude of the layer

Protected maximum longitude of a double maxlon;//layer

Planet objects that are dependent on the world m_parentworld;//layer

Stream m_texturestream = Texture data stream contained by the null;//layer

protected bool _disablezbuffer;//whether to enable ZBuffer buffering for image texture layers

Protected customvertex.positionnormaltextured[] vertices;//the position coordinates of the normals and textures corresponding to the images when they are mapped to textures

protected static customvertex.transformedcolored[] Progressbaroutline = new CUSTOMVERTEX.TRANSFORMEDCOLORED[5];

protected static customvertex.transformedcolored[] ProgressBar = new Customvertex.transformedcolored[4];

Protected short[] indices;//use index cache to reduce memory usage and accelerate rendering

Protected Texture texture;//texture objects created from imagery

Protected device device;//rendering textures

protected string _imageurl; URL string for the texture image

protected string _imagepath; Path to the texture image

protected int meshpointcount = 64;//The dot density of the triangular lattice of the texture image

Protected Terrainaccessor _terrainaccessor;//image texture for terrain accessors

protected int progressbarbackcolor = SYSTEM.DRAWING.COLOR.FROMARGB (100, 255, 255, 255). ToArgb ();//Background color of progress bar

protected int progressbaroutlinecolor = SYSTEM.DRAWING.COLOR.SLATEGRAY.TOARGB ();//Outline color of progress bar

protected int textcolor = System.Drawing.Color.Black.ToArgb ();

protected float downloadpercent;//Download the percentage of arts and sciences images completed

Protected thread downloadthread;//downloading arts and sciences images

protected float verticalexaggeration;//vertical magnification of texture

Protected string m_legendimagepath;//legend image Path

protected Colorbar Legendcontrol; Color bar legend Control form

int m_transparentcolor = 0;//transparent area color

BOOL M_rendergrayscale = false;//whether grayscale rendering

TimeSpan cacheexpiration = timespan.maxvalue; buffer Expiration time period

System.Timers.Timer Refreshtimer = null;//Refresh Timer

float m_grayscalebrightness = 0.0f;//transparency of gray scale

static Effect Grayscaleeffect = null;//Enable Effect object

public override void Initialize(Drawargs Drawargs): Overloads the parent class method, creates a download thread based on the URL, creates a grid, and so on.

public override void update(Drawargs Drawargs): Overloads the parent class method to update the state based on the drawing parameters.

public override void render(Drawargs Drawargs): Overloads the parent class method to finish rendering the imagery layer based on the drawing parameters.

protected virtual void Createmesh (): Creates a collection of points required by the device to render the triangular polygon grid eventually, i.e. protected customvertex.positionnormaltextured[] Vertices, and specifies the vertex index (protected short[] indices for each vertex that makes up the triangular grid. Using both vertex and index caches, you can reduce memory usage and speed up rendering.

protected void Downloadimage (): a handler that is bound by the download thread, internally constructs the network download Webdownload object to initiate a network download, and specifies a handler for the object's downloading events in order to display the download percentage in the progress bar. Where _imagepath is empty, the downloaded file is placed in memory, and then the Imagehelper class is converted from the Stream object load to a texture object, and when _imagepath is not empty, the loaded file is saved to--imagepath, and then the update texture is loaded , and finally call Createmesh () to create the mesh.

private static string Getfilepathfromurl (string URL): Gets the file path from the URL string.

private void Calculate_normals (ref customvertex.positionnormaltextured[] vertices, short[] indices): Calculates the normals of the grid vertices, The normal is used in the light state.

WorldWind Source Analysis Series: Image Layer Class Imagelayer

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.