示例#1
0
        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);
        }
示例#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();
        }
示例#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;
        }
示例#4
0
文件: ShapeTest.cs 项目: ranec/ADAPT
        public void GivenPolygonWhenCreatedThenTypeShouldBePolygon()
        {
            var shape = new Polygon();

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