public void OpenMap(string filename) { string[] paths = File.ReadAllLines(filename); for (int i = 0; i < paths.Length; i++) { string[] splitResult = paths[i].Split(' '); switch (splitResult[0]) { case "Point": PointLayer pointLayer = new PointLayer(); pointLayer.OpenLayer(splitResult[1]); pointLayer.Id = i; layers.Add(pointLayer); break; case "Line": LineLayer lineLayer = new LineLayer(); lineLayer.OpenLayer(splitResult[1]); lineLayer.Id = i; layers.Add(lineLayer); break; case "Polygon": PolygonLayer polygonLayer = new PolygonLayer(); polygonLayer.OpenLayer(splitResult[1]); polygonLayer.Id = i; layers.Add(polygonLayer); break; default: break; } } }