internal override Collection<Geometry> CreateGeometries(Features features)
{
IPathNode polygonNode = new PathNode(Gmlns, "Polygon", (NameTable) XmlReader.NameTable);
IPathNode outerBoundaryNode = new PathNode(Gmlns, "outerBoundaryIs", (NameTable) XmlReader.NameTable);
IPathNode exteriorNode = new PathNode(Gmlns, "exterior", (NameTable) XmlReader.NameTable);
IPathNode outerBoundaryNodeAlt = new AlternativePathNodesCollection(outerBoundaryNode, exteriorNode);
IPathNode innerBoundaryNode = new PathNode(Gmlns, "innerBoundaryIs", (NameTable) XmlReader.NameTable);
IPathNode interiorNode = new PathNode(Gmlns, "interior", (NameTable) XmlReader.NameTable);
IPathNode innerBoundaryNodeAlt = new AlternativePathNodesCollection(innerBoundaryNode, interiorNode);
IPathNode linearRingNode = new PathNode(Gmlns, "LinearRing", (NameTable) XmlReader.NameTable);
var labelValue = new string[1];
bool geomFound = false;
try
{
// Reading the entire feature's node makes it possible to collect label values that may appear before or after the geometry property
while ((FeatureReader = GetSubReaderOf(XmlReader, null, FeatureNode)) != null)
{
while ((GeomReader = GetSubReaderOf(FeatureReader, labelValue, polygonNode)) != null)
{
var polygon = new Polygon();
XmlReader outerBoundaryReader;
if (
(outerBoundaryReader =
GetSubReaderOf(GeomReader, null, outerBoundaryNodeAlt, linearRingNode, CoordinatesNode)) !=
null)
polygon.ExteriorRing = new LinearRing(ParseCoordinates(outerBoundaryReader));
XmlReader innerBoundariesReader;
while (
(innerBoundariesReader =
GetSubReaderOf(GeomReader, null, innerBoundaryNodeAlt, linearRingNode, CoordinatesNode)) !=
null)
polygon.InteriorRings.Add(new LinearRing(ParseCoordinates(innerBoundariesReader)));
Geoms.Add(polygon);
geomFound = true;
}
if (geomFound) features.Add(CreateFeature(Geoms[Geoms.Count - 1], FeatureTypeInfo.LableField, labelValue[0]));
geomFound = false;
}
}
catch (Exception ex)
{
Trace.TraceError("An exception occured while parsing a polygon geometry: " + ex.Message);
throw;
}
return Geoms;
}