public static PlotTile Create(int level, int xc, int yc, Imageset dataset, Tile parent) { PlotTile temp = new PlotTile(); temp.Parent = parent; temp.Level = level; temp.tileX = xc; temp.tileY = yc; temp.dataset = dataset; temp.topDown = !dataset.BottomsUp; if (temp.tileX != (int)xc) { Script.Literal("alert('bad')"); } //temp.ComputeQuadrant(); if (dataset.MeanRadius != 0) { temp.DemScaleFactor = dataset.MeanRadius; } else { if (dataset.DataSetType == ImageSetType.Earth) { temp.DemScaleFactor = 6371000; } else { temp.DemScaleFactor = 3396010; } } temp.ComputeBoundingSphere(); return temp; }
public static EquirectangularTile Create(int level, int x, int y, Imageset dataset, Tile parent) { EquirectangularTile temp = new EquirectangularTile(); temp.Parent = parent; temp.Level = level; temp.tileX = x; temp.tileY = y; temp.dataset = dataset; temp.topDown = !dataset.BottomsUp; temp.ComputeBoundingSphere(); return temp; }
public static SkyImageTile Create(int level, int x, int y, Imageset dataset, Tile parent) { SkyImageTile temp = new SkyImageTile(); temp.Parent = parent; temp.Level = level; temp.tileX = x; temp.tileY = y; temp.dataset = dataset; temp.GetParameters(); temp.ComputeMatrix(); temp.sphereCenter = temp.GeoTo3dTan(0, 0); temp.radius = 1.25f; return temp; }
public static bool AddTileToQueue(Tile tile) { int hitValue; hitValue = 256; if (!tile.Downloading && !tile.ReadyToRender) { if (queue.ContainsKey(tile.Key)) { (queue[tile.Key]).RequestHits += hitValue; } else { tile.RequestHits = hitValue; queue[tile.Key] = tile; } } return true; }
public static Tile GetNewTile(IImageSet imageset, int level, int x, int y, Tile parent) { switch (imageset.Projection) { //case ProjectionType.Mercator: // { // MercatorTile newTile = new MercatorTile(level, x, y, imageset, parent); // return newTile; // } //case ProjectionType.Equirectangular: // { // return new EquirectangularTile(level, x, y, imageset, parent); // } //case ProjectionType.Spherical: // { // return new SphericalTile(level, x, y, imageset, parent); // } default: case ProjectionType.Toast: { return ToastTile.Create(level, x, y, imageset, parent); } //case ProjectionType.SkyImage: // { // return new SkyImageTile(level, x, y, imageset, parent); // } //case ProjectionType.Plotted: // { // return new PlotTile(level, x, y, imageset, parent); // } //case ProjectionType.Tangent: // { // TangentTile newTile = new TangentTile(level, x, y, imageset, parent); // return newTile; // } } }
public static Tile GetCachedTile(int level, int x, int y, Imageset dataset, Tile parent) { if (level < dataset.BaseLevel) { return null; } Tile retTile = null; string tileKey = Imageset.GetTileKey(dataset, level, x, y); try { if (!tiles.ContainsKey(tileKey)) { return null; } else { retTile = tiles[tileKey]; } } catch { } return retTile; }
//internal static void AddTileToQueue(Tile tile) //{ // queue[tile.Key] = tile; //} public static Tile GetTile(int level, int x, int y, Imageset dataset, Tile parent) { Tile retTile = null; string tileKey = Imageset.GetTileKey(dataset, level, x, y); // try { if (!tiles.ContainsKey(tileKey)) { retTile = Imageset.GetNewTile(dataset, level, x, y, parent); tiles[tileKey] = retTile; } else { retTile = tiles[tileKey]; } } // catch { int p = 0; } return retTile; }
public void RemoveChild(Tile child) { for (int i = 0; i < 4; i++) { if (children[i] == child) { children[i] = null; return; } } }
public virtual void CleanUp(bool removeFromParent) { ReadyToRender = false; DemData = null; demFile = null; demDownloading = false; texReady = false; DemReady = false; errored = false; if (this.texture != null) { this.texture = null; } RenderTriangleLists = new List<RenderTriangle>[4]; GeometryCreated = false; if (removeFromParent && Parent != null ) { Parent.RemoveChild(this); Parent = null; } if (PrepDevice != null) { foreach (WebGLBuffer buf in IndexBuffers) { PrepDevice.deleteBuffer(buf); } IndexBuffers = new WebGLBuffer[4]; if (VertexBuffer != null) { PrepDevice.deleteBuffer(VertexBuffer); VertexBuffer = null; } if (texture2d != null) { PrepDevice.deleteTexture(texture2d); texture2d = null; } } }
public static MercatorTile Create(int level, int X, int Y, Imageset dataset, Tile parent) { MercatorTile temp = new MercatorTile(); temp.Parent = parent; temp.Level = level; temp.tileX = X; temp.tileY = Y; temp.dataset = dataset; temp.ComputeBoundingSphere(); return temp; }