/// <summary> /// /// </summary> /// <param name="reader"></param> /// <returns></returns> private MultiPolygon ReadMultiPolygon(XmlReader reader) { string strSRID = null; string strGID = null; int nSRID = -1; if (reader.Name == GeometryGml2.GmlMultiPolygon && reader.HasAttributes) { ReadGeometryAttributes(reader, ref strSRID, ref strGID); if (strSRID != null && strSRID.Length > 0) { nSRID = Convert.ToInt32(strSRID); } } GeometryList polygons = null; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (reader.Name == GeometryGml2.GmlMultiPolygon) { if (reader.HasAttributes) { ReadGeometryAttributes(reader, ref strSRID, ref strGID); if (strSRID != null && strSRID.Length > 0) { nSRID = Convert.ToInt32(strSRID); } } } else if (reader.Name == GeometryGml2.GmlPolygonMember) { if (polygons == null) { polygons = new GeometryList(); } Polygon polygon = ReadPolygon(reader); if (polygon != null) { polygons.Add(polygon); } } } else if (reader.NodeType == XmlNodeType.EndElement) { if (reader.Name == GeometryGml2.GmlMultiPolygon) { break; } } } if (polygons != null && polygons.Count > 0) { MultiPolygon geometry = m_objFactory.CreateMultiPolygon( polygons.ToPolygonArray()); if (nSRID > 0 || (strGID != null && strGID.Length > 0)) { geometry.CreateProperties(); if (nSRID > 0) { geometry.Properties.Add("SRID", nSRID); } if (strGID != null && strGID.Length > 0) { geometry.Properties.Add("GID", strGID); } } return(geometry); } return(null); }