public static void readWRdataLine(String lines) { List <String> cache1 = new List <String>(); List <String> cache2 = new List <String>(); List <String> data = new List <String>(); data = lines.Split(";").ToList(); cache1 = (data[1].Replace("(", "").Replace(")", "").Replace("LINESTRING ", "")).Split(",").ToList(); List <Punt> points = new List <Punt>(); foreach (String pline in cache1) { String temp = pline; if (pline.StartsWith(" ")) { temp = pline.Substring(1); cache2.Add(temp); } } foreach (String da in cache2) { Double x = Double.Parse(da.Split(" ")[0].Replace(".", ",")); Double y = Double.Parse(da.Split(" ")[1].Replace(".", ",")); Punt punt = new Punt(x, y); points.Add(punt); } Knoop start = new Knoop(int.Parse(data[4]), points.First()); Knoop end = new Knoop(int.Parse(data[5]), points.Last()); Segment segment = new Segment(int.Parse(data[0]), start, end, points); int straat1 = int.Parse(data[6]); int straat2 = int.Parse(data[7]); if (straat1 != -9) { addGraaf(straat1, segment); } if (straat2 != -9) { addGraaf(straat2, segment); } }
public Knoop(int id, Punt punt) { this.id = id; this.punt = punt; }