/// <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> /// uses CameraExtent /// updates the variable viewrange /// updates the variable cameraPositionRD /// updates the variable cameraPosition /// </summary> private Vector4 GetViewRange(ICameraExtents cameraExtents) { var bottomLeft = CoordConvert.WGS84toRD(cameraExtents.GetExtent().MinX, cameraExtents.GetExtent().MinY); var topRight = CoordConvert.WGS84toRD(cameraExtents.GetExtent().MaxX, cameraExtents.GetExtent().MaxY); Vector4 viewRange = new Vector4(); viewRange.x = (float)bottomLeft.x; viewRange.y = (float)bottomLeft.y; viewRange.z = (float)(topRight.x - bottomLeft.x); viewRange.w = (float)(topRight.y - bottomLeft.y); return(viewRange); }