public static void AreEqual(XmlNode node, LinearRing ring) { var pointNodes = node.SelectNodes("PNT"); var points = ring.Points; for (int i = 0; i < pointNodes.Count; i++) { PointAssert.AreEqual(pointNodes[i], points[i]); } }
private IEnumerable<LSG> Map(LinearRing ring, LSGA ringType) { var isoLineStrings = new List<LSG> { new LSG { A = ringType, Items = ring.Points.Select(Map).ToArray() } }; return isoLineStrings; }
private static void WriteRing(XmlWriter writer, LinearRing ring, bool isExterior) { if (ring.Points == null || ring.Points.Count == 0) return; writer.WriteStartElement("LSG"); writer.WriteXmlAttribute("A", isExterior ? "1" : "2"); for (int i = 0; i < ring.Points.Count; i++) { var pointLabel = i == 0 ? "start" : i == ring.Points.Count - 1 ? "end" : ""; WritePoint(writer, ring.Points[i], pointLabel); } writer.WriteEndElement(); }
public void GivenLinearRingWhenCreatedThenTypeShouldBeLinearRing() { var shape = new LinearRing(); Assert.AreEqual(ShapeTypeEnum.LinearRing, shape.Type); }
private static LinearRing LoadRing(XmlNode lineNode, out bool exteriorRing) { exteriorRing = false; var lineType = lineNode.GetXmlNodeValue("@A"); if (string.IsNullOrEmpty(lineType)) return null; exteriorRing = string.Equals(lineType, "1", StringComparison.OrdinalIgnoreCase); var line = new LinearRing { Points = new List<Point>() }; var pointNodes = lineNode.SelectNodes("PNT"); foreach (XmlNode pointNode in pointNodes) { var point = LoadPoint(pointNode); if (point == null) return null; line.Points.Add(point); } return line; }