public override bool CreateDemFromParent() { MercatorTile parent = Parent as MercatorTile; if (parent == null || parent.DemData == null) { return(false); } int offsetX = ((tileX % 2) == 1 ? 16 : 0); int offsetY = ((tileY % 2) == 1 ? 16 : 0); DemData = new float[demSize]; // Interpolate accross for (int y = 0; y < 33; y += 2) { bool copy = true; for (int x = 0; x < 33; x++) { if (copy) { DemData[(32 - y) * 33 + x] = parent.GetDemSample((x / 2) + offsetX, (y / 2) + offsetY); } else { DemData[(32 - y) * 33 + x] = ( ( parent.GetDemSample((x / 2) + offsetX, (y / 2) + offsetY) + parent.GetDemSample(((x / 2) + offsetX) + 1, (y / 2) + offsetY) ) / 2); } copy = !copy; } } // Interpolate down for (int y = 1; y < 33; y += 2) { for (int x = 0; x < 33; x++) { DemData[(32 - y) * 33 + x] = ( ( GetDemSample(x, y - 1) + GetDemSample(x, y + 1) ) / 2); } } foreach (float sample in DemData) { demAverage += sample; } demAverage /= DemData.Length; DemReady = true; return(true); }
public static Tile GetNewTile(Imageset imageset, int level, int x, int y, Tile parent) { switch (imageset.Projection) { case ProjectionType.Mercator: { MercatorTile newTile = MercatorTile.Create(level, x, y, imageset, parent); return(newTile); } case ProjectionType.Equirectangular: { return(EquirectangularTile.Create(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(PlotTile.Create(level, x, y, imageset, parent)); } case ProjectionType.Healpix: { if (imageset.HipsProperties == null) { imageset.HipsProperties = new HipsProperties(imageset); } if (imageset.HipsProperties.DownloadComplete) { return(new HealpixTile(level, x, y, imageset, parent)); } else { return(null); } } case ProjectionType.Tangent: { TangentTile newTile = new TangentTile(level, x, y, imageset, parent); return(newTile); } } }
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); }
public static Tile GetNewTile(Imageset imageset, int level, int x, int y, Tile parent) { switch (imageset.Projection) { case ProjectionType.Mercator: { MercatorTile newTile = MercatorTile.Create(level, x, y, imageset, parent); return(newTile); } case ProjectionType.Equirectangular: { return(EquirectangularTile.Create(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(SkyImageTile.Create(level, x, y, imageset, parent)); } case ProjectionType.Plotted: { return(PlotTile.Create(level, x, y, imageset, parent)); } case ProjectionType.Healpix: { return(new HealpixTile(level, x, y, imageset, parent)); } case ProjectionType.Tangent: { TangentTile newTile = TangentTile.Create(level, x, y, imageset, parent); return(newTile); } } }
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; }