예제 #1
0
        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 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);
            }
            }
        }
예제 #3
0
        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);
            }
            }
        }
예제 #4
0
        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);
        }
예제 #5
0
        private void InitializeGrids()
        {
            vertexList           = new List <PositionTexture>();
            childTriangleList    = new List <Triangle> [4];
            childTriangleList[0] = new List <Triangle>();
            childTriangleList[1] = new List <Triangle>();
            childTriangleList[2] = new List <Triangle>();
            childTriangleList[3] = new List <Triangle>();

            bounds = new PositionTexture[9];

            if (Level > 0)
            {
                // Set in constuctor now
                //ToastTile parent = (ToastTile)TileCache.GetTile(level - 1, x / 2, y / 2, dataset, null);
                if (Parent == null)
                {
                    Parent = TileCache.GetTile(Level - 1, tileX / 2, tileY / 2, dataset, null);
                }

                PlotTile parent = (PlotTile)Parent;

                int xIndex = tileX % 2;
                int yIndex = tileY % 2;

                if (Level > 1)
                {
                    backslash = parent.backslash;
                }
                else
                {
                    backslash = xIndex == 1 ^ yIndex == 1;
                }


                bounds[0 + 3 * 0] = parent.bounds[xIndex + 3 * yIndex].Copy();
                bounds[1 + 3 * 0] = Midpoint(parent.bounds[xIndex + 3 * yIndex], parent.bounds[xIndex + 1 + 3 * yIndex]);
                bounds[2 + 3 * 0] = parent.bounds[xIndex + 1 + 3 * yIndex].Copy();
                bounds[0 + 3 * 1] = Midpoint(parent.bounds[xIndex + 3 * yIndex], parent.bounds[xIndex + 3 * (yIndex + 1)]);

                if (backslash)
                {
                    bounds[1 + 3 * 1] = Midpoint(parent.bounds[xIndex + 3 * yIndex], parent.bounds[xIndex + 1 + 3 * (yIndex + 1)]);
                }
                else
                {
                    bounds[1 + 3 * 1] = Midpoint(parent.bounds[xIndex + 1 + 3 * yIndex], parent.bounds[xIndex + 3 * (yIndex + 1)]);
                }

                bounds[2 + 3 * 1] = Midpoint(parent.bounds[xIndex + 1 + 3 * yIndex], parent.bounds[xIndex + 1 + 3 * (yIndex + 1)]);
                bounds[0 + 3 * 2] = parent.bounds[xIndex + 3 * (yIndex + 1)].Copy();
                bounds[1 + 3 * 2] = Midpoint(parent.bounds[xIndex + 3 * (yIndex + 1)], parent.bounds[xIndex + 1 + 3 * (yIndex + 1)]);
                bounds[2 + 3 * 2] = parent.bounds[xIndex + 1 + 3 * (yIndex + 1)].Copy();

                bounds[0 + 3 * 0].Tu = 0 * uvMultiple;
                bounds[0 + 3 * 0].Tv = 0 * uvMultiple;
                bounds[1 + 3 * 0].Tu = .5f * uvMultiple;
                bounds[1 + 3 * 0].Tv = 0 * uvMultiple;
                bounds[2 + 3 * 0].Tu = 1 * uvMultiple;
                bounds[2 + 3 * 0].Tv = 0 * uvMultiple;

                bounds[0 + 3 * 1].Tu = 0 * uvMultiple;
                bounds[0 + 3 * 1].Tv = .5f * uvMultiple;
                bounds[1 + 3 * 1].Tu = .5f * uvMultiple;
                bounds[1 + 3 * 1].Tv = .5f * uvMultiple;
                bounds[2 + 3 * 1].Tu = 1 * uvMultiple;
                bounds[2 + 3 * 1].Tv = .5f * uvMultiple;

                bounds[0 + 3 * 2].Tu = 0 * uvMultiple;
                bounds[0 + 3 * 2].Tv = 1 * uvMultiple;
                bounds[1 + 3 * 2].Tu = .5f * uvMultiple;
                bounds[1 + 3 * 2].Tv = 1 * uvMultiple;
                bounds[2 + 3 * 2].Tu = 1 * uvMultiple;
                bounds[2 + 3 * 2].Tv = 1 * uvMultiple;
            }
            else
            {
                bounds[0 + 3 * 0] = PositionTexture.Create(0, -1, 0, 0, 0);
                bounds[1 + 3 * 0] = PositionTexture.Create(0, 0, 1, .5f, 0);
                bounds[2 + 3 * 0] = PositionTexture.Create(0, -1, 0, 1, 0);
                bounds[0 + 3 * 1] = PositionTexture.Create(-1, 0, 0, 0, .5f);
                bounds[1 + 3 * 1] = PositionTexture.Create(0, 1, 0, .5f, .5f);
                bounds[2 + 3 * 1] = PositionTexture.Create(1, 0, 0, 1, .5f);
                bounds[0 + 3 * 2] = PositionTexture.Create(0, -1, 0, 0, 1);
                bounds[1 + 3 * 2] = PositionTexture.Create(0, 0, -1, .5f, 1);
                bounds[2 + 3 * 2] = PositionTexture.Create(0, -1, 0, 1, 1);


                // Setup default matrix of points.
            }
        }