public FromPointList ( string name, string pointList ) : |
||
name | string | |
pointList | string | |
리턴 |
private Polygon ParsePolygon(string name, XElement pg, string ns, bool onlyOuter) { PolygonReader polyReader = new PolygonReader(); var outerBoundary = pg.Descendants(XName.Get("outerBoundaryIs", ns)).FirstOrDefault(); var innerPolygons = pg.Descendants(XName.Get("innerBoundaryIs", ns)).ToList(); if (outerBoundary == null) { //check if the linear ring has been added without outer/inner boundaries var linearRing = pg.Descendants(XName.Get("LinearRing", ns)).FirstOrDefault(); if (linearRing != null) { return polyReader.FromPointList(name, linearRing.Descendants(XName.Get("coordinates", ns)).First().Value); } return null; } Polygon p = polyReader.FromPointList(name, outerBoundary.Descendants(XName.Get("coordinates", ns)).First().Value); if (!onlyOuter) { foreach (var innerPolygon in innerPolygons) { var linearRings = innerPolygon.Descendants(XName.Get("LinearRing", ns)).ToList(); foreach (var ring in linearRings) { p.InnerPolygons.Add(polyReader.FromPointList(name, ring.Descendants(XName.Get("coordinates", ns)).First().Value)); } } } return p; }
private Polygon ParsePolygon(string name, XElement pg, string ns, bool onlyOuter) { PolygonReader polyReader = new PolygonReader(); var outerBoundary = pg.Descendants(XName.Get("outerBoundaryIs", ns)).FirstOrDefault(); var innerPolygons = pg.Descendants(XName.Get("innerBoundaryIs", ns)).ToList(); if (outerBoundary == null) { //check if the linear ring has been added without outer/inner boundaries var linearRing = pg.Descendants(XName.Get("LinearRing", ns)).FirstOrDefault(); if (linearRing != null) { return(polyReader.FromPointList(name, linearRing.Descendants(XName.Get("coordinates", ns)).First().Value)); } return(null); } Polygon p = polyReader.FromPointList(name, outerBoundary.Descendants(XName.Get("coordinates", ns)).First().Value); if (!onlyOuter) { foreach (var innerPolygon in innerPolygons) { var linearRings = innerPolygon.Descendants(XName.Get("LinearRing", ns)).ToList(); foreach (var ring in linearRings) { p.InnerPolygons.Add(polyReader.FromPointList(name, ring.Descendants(XName.Get("coordinates", ns)).First().Value)); } } } return(p); }