private IEnumerator AddMap(Place place) { // Store current place this._place = place; // Convert lat/long to Google/Bing/AGOL tile. var tile = this._place.Location.ToTile(this._place.Level); // Get children. //var children = tile.GetChildren(CHILDREN_LEVEL); var children = tile.GetNeighbor(CHILDREN_LEVEL); // Elevation and texture variables. Texture2D[] textures = new Texture2D[children.Length]; yield return(null); // Retrieve imagery. foreach (var child in children) { this.StartCoroutine(Imagery.GetTexture(child, currentStyle, texture => { textures[Array.IndexOf(children, child)] = texture; if (textures.All(t => t != null)) { this.StartCoroutine(this.BuildMap(textures, children)); } })); } }
private IEnumerator AddTerrain(Place place) { // Store current place this._place = place; // Convert lat/long to Google/Bing/AGOL tile. var tile = this._place.Location.ToTile(this._place.Level); // Get children. var children = tile.GetChildren(CHILDREN_LEVEL); // Elevation and texture variables. ElevationData el = null; Texture2D[] textures = new Texture2D[children.Length]; yield return(null); // Retrieve elevation. this.StartCoroutine(Elevation.GetHeights(tile, elevation => { el = elevation; // Construct terrain if both elevation and textures downloaded. if (textures.All(t => t != null)) { this.StartCoroutine(this.BuildTerrain(el, textures)); } })); yield return(null); // Retrieve imagery. foreach (var child in children) { this.StartCoroutine(Imagery.GetTexture(child, texture => { textures[Array.IndexOf(children, child)] = texture; // Construct terrain if both elevation and textures downloaded. if (el != null && textures.All(t => t != null)) { this.StartCoroutine(this.BuildTerrain(el, textures)); } })); } }
private IEnumerator AddTerrain(Place place) { // Store current place this._place = place; // Convert lat/long to Google/Bing/AGOL tile. var tile = this._place.Location.ToTile(this._place.Level); // Get children. //var children = tile.GetChildren(CHILDREN_LEVEL); var children = tile.GetNeighbor(CHILDREN_LEVEL); // Elevation and texture variables. ElevationData el = null; Texture2D[] textures = new Texture2D[children.Length]; yield return(null); // Retrieve elevation. if (currentDimension == "3D") { this.StartCoroutine(Elevation.GetHeights(tile, elevation => { el = elevation; // Construct terrain if both elevation and textures downloaded. if (textures.All(t => t != null)) { this.StartCoroutine(this.BuildTerrain(el, textures)); } })); yield return(null); } // Retrieve imagery. foreach (var child in children) { this.StartCoroutine(Imagery.GetTexture(child, currentStyle, texture => { textures[Array.IndexOf(children, child)] = texture; // Construct terrain if both elevation and textures downloaded. //if (el != null && textures.All(t => t != null)) if (textures.All(t => t != null)) { this.StartCoroutine(this.BuildTerrain(el, textures)); } })); } //add 2 /* * if (needupdate) * { * this.StartCoroutine(this.Updatemap(updateURL)); * //destroy all exist building,erase the items form * GameObject[] gameObjects = GameObject.FindGameObjectsWithTag("Rotate"); * for (var i = 0; i < gameObjects.Length; i++) * { * Destroy(gameObjects[i]); * } * //StartCoroutine(Eraseitems(queryURL)); * } */ }