Ejemplo n.º 1
0
        public GlobeTile CreateTile(Transform parent, Wmts coords)
        {
            GameObject tileGo = Instantiate(tileTemplate);

            tileGo.transform.SetParentClearRelativeTransform(parent);
            tileGo.name = coords.ToString();

            GlobeTile tile = tileGo.GetComponent <GlobeTile>();

            tile.coords = coords;
            tile.globe  = globe;
            tile.bBox   = Layer.Wmts2DefaultBbox(coords);
            tile.SetVisible(false);
            return(tile);
        }
Ejemplo n.º 2
0
        // TODO should use TileFactory
        private GlobeTile CreateTile(Transform parent, Wmts coords)
        {
            GameObject tileGo = Instantiate(tileTemplate);

            // high level tile mesh needs to be scaled for radius of globe -pete
            tileGo.transform.SetParentClearRelativeTransform(parent.transform, Vector3.zero, Quaternion.identity, Vector3.one * 0.5f);
            tileGo.name = coords.ToString();

            GlobeTile tile = tileGo.GetComponent <GlobeTile>();

            tile.coords = coords;
            tile.globe  = this;
            tile.bBox   = CurrentLayer.Wmts2Bbox(coords);

            return(tile);
        }
Ejemplo n.º 3
0
        private void CreateTile(GlobeTile parent, Wmts coords)
        {
            GameObject tileGo = Instantiate(tileTemplate);

            tileGo.transform.SetParentClearRelativeTransform(parent.transform);
            tileGo.name = coords.ToString();

            GlobeTile tile = tileGo.GetComponent <GlobeTile>();

            tile.coords = coords;
            tile.globe  = globe;
            tile.bBox   = globe.CurrentLayer.Wmts2Bbox(coords);

            tile.SetVisible(false);

            parent.AddChild(tile);
        }
Ejemplo n.º 4
0
        public LatLonBoundingBox Wmts2Bbox(Wmts request)
        {
            TileMatrix currentMatrix    = tileMatrixSet[request.zoom];
            decimal    scaleDenominator = currentMatrix.scaleDenominator;

            decimal size = tilesize * 2 * scaleDenominator / units * (pixelsize / 2);

            //decimal topLeftMaxx = -180 + size;
            //decimal topLeftMiny = 90 - size;

            decimal requestMinx = topLeftMinx + request.col * size;
            decimal requestMiny = topLeftMaxy - request.row * size - size;
            decimal requestMaxx = topLeftMinx + request.col * size + size;
            decimal requestMaxy = topLeftMaxy - request.row * size;

            return(new LatLonBoundingBox((float)requestMiny, (float)requestMaxy, (float)requestMinx,
                                         (float)requestMaxx));
        }
Ejemplo n.º 5
0
        public static LatLonBoundingBox Wmts2DefaultBbox(Wmts request)
        {
            decimal scaleDenominator = TileMatrix.defaultTileMatrix.scaleDenominator / (decimal)Math.Pow(2.0, request.zoom - 1);

            decimal size = tilesize * 2 * scaleDenominator / units * (pixelsize / 2);

            //decimal topLeftMaxx = -180 + size;
            //decimal topLeftMiny = 90 - size;

            decimal requestMinx = topLeftMinx + request.col * size;
            decimal requestMiny = topLeftMaxy - request.row * size - size;
            decimal requestMaxx = topLeftMinx + request.col * size + size;
            decimal requestMaxy = topLeftMaxy - request.row * size;

            LatLonBoundingBox bbox = new LatLonBoundingBox((float)requestMiny, (float)requestMaxy, (float)requestMinx, (float)requestMaxx);

            return(bbox);
        }
Ejemplo n.º 6
0
        public Wmts BBox2Wmts(LatLonBoundingBox bboxTemp)
        {
            // calculate additional top_left values for reference
            //decimal topLeftMaxx = topLeftMinx + (int)bboxTemp.DeltaLon;
            decimal topLeftMiny = topLeftMaxy - (int)bboxTemp.DeltaLat;

            // calculate col and row
            decimal col = Math.Abs(((decimal)bboxTemp.minLon - topLeftMinx) / (int)bboxTemp.DeltaLon);
            decimal row = Math.Abs(((decimal)bboxTemp.minLat - topLeftMiny) / (int)bboxTemp.DeltaLat);

            // calculate scale denominator for reference
            decimal    scaleDenominator = (decimal)bboxTemp.DeltaLon * 2 / pixelsize * units / (tilesize * 2);
            TileMatrix currentMatrix    = tileMatrixSet.Find(item => Truncate(item.scaleDenominator) == Truncate(scaleDenominator));
            int        zoom             = int.Parse(currentMatrix.identifier);

            Wmts request = new Wmts {
                row = (int)row, col = (int)col, zoom = zoom
            };

            return(request);
        }
Ejemplo n.º 7
0
 public string WmtsToUrl(Wmts request, DateTime time)
 {
     return(WmtsToUrl(request.row, request.col, request.zoom, time));
 }
Ejemplo n.º 8
0
 public void CreateTileAsync(GlobeTile parent, Wmts coords)
 {
     tileQueue.Enqueue(new TileCreationParams(parent, coords));
 }
Ejemplo n.º 9
0
 public TileCreationParams(GlobeTile parent, Wmts coords)
 {
     this.parent = parent;
     this.coords = coords;
 }