Пример #1
0
        /// <summary>
        /// Reads an XML Position From An Existing DOM
        /// </summary>
        /// <param name="rootnode">Node Containing the GML Position</param>
        public override void ReadXML(XmlNode rootnode)
        {
            if (rootnode.LocalName == "Polygon")
            {
                GMLLinearRing tempring;
                this.ReadXMLBase(rootnode);
                foreach (XmlNode childnode in rootnode.ChildNodes)
                {
                    if (string.IsNullOrEmpty(childnode.InnerText))
                    {
                        continue;
                    }

                    switch (childnode.LocalName)
                    {
                    case "exterior":
                        if (childnode.ChildNodes.Count != 1)
                        {
                            throw new ArgumentException("Unexpected Number of gml:exterior child nodes in GMLPolygon");
                        }

                        this.exterior.ReadXML(childnode.FirstChild);
                        break;

                    case "interior":
                        if (childnode.ChildNodes.Count != 1)
                        {
                            throw new ArgumentException("Unexpected Number of gml:interior child nodes in GMLPolygon");
                        }

                        tempring = new GMLLinearRing();
                        tempring.ReadXML(childnode.FirstChild);
                        this.interior.Add(tempring);
                        break;

                    case "#comment":
                        break;

                    default:
                        throw new ArgumentException("Unexpected Child Node Name: " + childnode.Name + " in GMLPolygon");
                    }
                }
            }
            else
            {
                throw new ArgumentException("Unexpected Node Name: " + rootnode.Name + " in GMLPolycon");
            }
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the GMLPolygon class
 /// Default Constructor - Initializes Objects
 /// </summary>
 public GMLPolygon()
 {
     this.exterior = new GMLLinearRing();
     this.interior = new List <GMLLinearRing>();
 }