private static void AreEqual(XmlNode polygonNode, Polygon polygon)
        {
            var lineNodes = polygonNode.SelectNodes("LSG");
            var exteriorNode = GetExteriorNode(lineNodes);
            var interiorNodes = GetInteriorNodes(lineNodes);
            var exteriorRing = polygon.ExteriorRing;
            var interiorRings = polygon.InteriorRings;

            RingAssert.AreEqual(exteriorNode, exteriorRing);
            RingAssert.AreEqual(interiorNodes, interiorRings);
        }
Exemple #2
0
        public static void WritePolygon(XmlWriter writer, Polygon polygon)
        {
            if (polygon.ExteriorRing == null)
                return;

            writer.WriteStartElement("PLN");
            writer.WriteXmlAttribute("A", "1");

            WriteRing(writer, polygon.ExteriorRing, true);
            if (polygon.InteriorRings != null)
            {
                foreach (var ring in polygon.InteriorRings)
                {
                    WriteRing(writer, ring, false);
                }
            }

            writer.WriteEndElement();
        }
Exemple #3
0
        private static Polygon LoadPolygon(XmlNode polygonNode)
        {
            var polygon = new Polygon { InteriorRings = new List<LinearRing>() };

            var lineNodes = polygonNode.SelectNodes("LSG");
            foreach (XmlNode lineNode in lineNodes)
            {
                bool exteriorRing;
                var line = LoadRing(lineNode, out exteriorRing);
                if (line == null)
                    return null;

                if (exteriorRing)
                    polygon.ExteriorRing = line;
                else
                    polygon.InteriorRings.Add(line);
            }

            return polygon;
        }
Exemple #4
0
        public void GivenPolygonWhenCreatedThenTypeShouldBePolygon()
        {
            var shape = new Polygon();

            Assert.AreEqual(ShapeTypeEnum.Polygon, shape.Type);
        }