private IEnumerator SpawnManholeObjects() { SewerManholes.Feature sewerManholeFeature; for (int i = 0; i < sewerManholes.features.Length; i++) { //Speedy way to check if the string is not a 'Knikpunt' if (sewerManholes.features[i].properties.objectsoort.Length == 8) { continue; } if ((i % maxSpawnsPerFrame) == 0) { yield return(new WaitForEndOfFrame()); } sewerManholeFeature = sewerManholes.features[i]; sewerManholeSpawner.CreateManhole( CoordConvert.WGS84toUnity(new Vector3WGS( sewerManholeFeature.geometry.coordinates[0], sewerManholeFeature.geometry.coordinates[1], (float.Parse(sewerManholeFeature.properties.putdekselhoogte, CultureInfo.InvariantCulture) + napOffset) ) ) ); } CombineSewerage(); yield return(null); }
/// <summary> /// Parse a tree from a string line to a new List item containing the following ; seperated fields: /// OBJECTNUMMER;Soortnaam_NL;Boomnummer;Soortnaam_WTS;Boomtype;Boomhoogte;Plantjaar;Eigenaar;Beheerder;Categorie;SOORT_KORT;SDVIEW;RADIUS;WKT_LNG_LAT;WKT_LAT_LNG;LNG;LAT; /// </summary> /// <param name="line">Text line matching the same fields as the header</param> private void ParseTree(string line) { string[] cell = line.Split(';'); Tree newTree = new Tree() { OBJECTNUMMER = cell[0], Soortnaam_NL = cell[1], Boomnummer = cell[2], Soortnaam_WTS = cell[3], Boomtype = cell[4], Boomhoogte = cell[5], Plantjaar = int.Parse(cell[6]), Eigenaar = cell[7], Beheerder = cell[8], Categorie = cell[9], SOORT_KORT = cell[10], SDVIEW = cell[11], RADIUS = cell[12], WKT_LNG_LAT = cell[13], WKT_LAT_LNG = cell[14], LNG = double.Parse(cell[15]), LAT = double.Parse(cell[16]) }; //Extra generated tree data newTree.RD = CoordConvert.WGS84toRD(newTree.LNG, newTree.LAT); newTree.position = CoordConvert.WGS84toUnity(newTree.LNG, newTree.LAT); newTree.averageTreeHeight = EstimateTreeHeight(newTree.Boomhoogte); newTree.prefab = FindClosestPrefabTypeByName(newTree.Soortnaam_NL); trees.Add(newTree); }
/// <summary> /// Used from Javascript to move the camera to a specific WGS84 (gps) location based on the hash # in the url /// </summary> /// <param name="latitudeLongitude">Comma seperated lat,long string</param> public void ChangedPointFromUrl(string latitudeLongitude) { string[] coordinates = latitudeLongitude.Split(','); var latitude = double.Parse(coordinates[0]); var longitude = double.Parse(coordinates[1]); var convertedCoordinate = CoordConvert.WGS84toUnity(longitude, latitude); currentCamera.transform.position = new Vector3(convertedCoordinate.x, this.transform.position.y, convertedCoordinate.z); }
public Vector3 GetUnityPoint(double x, double y, double z) { if (Config.activeConfiguration.sewerageApiType == SewerageApiType.Amsterdam) { return(CoordConvert.WGS84toUnity(new Vector3WGS(x, y, z + Config.activeConfiguration.zeroGroundLevelY))); } else { return(CoordConvert.RDtoUnity(new Vector3RD(x, y, z + Config.activeConfiguration.zeroGroundLevelY))); } }
/// <summary> /// Splits an unsupported multidimensional array into a Vector3 array. /// </summary> /// <param name="coordinates">The string containing the multidimensional array</param> /// <returns>An array of unity coordinates</returns> private Vector3[] SplitToCoordinatesArray(string coordinates, string startHeight, string endHeight) { splitArray = coordinates.Split(new string[] { "],[" }, StringSplitOptions.None); newVector2Array.Clear(); //Convert string with RD coordinates into unity coordinates for (int i = 0; i < splitArray.Length; i++) { vector2String = splitArray[i].Split(','); Vector3WGS newWGSVector3 = new Vector3WGS( double.Parse(vector2String[0], CultureInfo.InvariantCulture), double.Parse(vector2String[1], CultureInfo.InvariantCulture), (i == 0) ? double.Parse(startHeight, CultureInfo.InvariantCulture) + napOffset : double.Parse(endHeight, CultureInfo.InvariantCulture) + napOffset ); Vector3 unityCoordinate = CoordConvert.WGS84toUnity(newWGSVector3); newVector2Array.Add(unityCoordinate); } return(newVector2Array.ToArray()); }