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); }
// 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); }
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); }
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)); }
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); }
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); }
public string WmtsToUrl(Wmts request, DateTime time) { return(WmtsToUrl(request.row, request.col, request.zoom, time)); }
public void CreateTileAsync(GlobeTile parent, Wmts coords) { tileQueue.Enqueue(new TileCreationParams(parent, coords)); }
public TileCreationParams(GlobeTile parent, Wmts coords) { this.parent = parent; this.coords = coords; }