예제 #1
0
 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]);
     }
 }
예제 #2
0
        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;
        }
예제 #3
0
        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();
        }
예제 #4
0
파일: ShapeTest.cs 프로젝트: ranec/ADAPT
        public void GivenLinearRingWhenCreatedThenTypeShouldBeLinearRing()
        {
            var shape = new LinearRing();

            Assert.AreEqual(ShapeTypeEnum.LinearRing, shape.Type);
        }
예제 #5
0
        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;
        }