Exemplo n.º 1
0
        /// <summary>
        /// This method produces instances of type <see cref="MultiPoint"/>.
        /// </summary>
        /// <returns>The created geometries</returns>
        internal override Collection <Geometry> CreateGeometries(List <IFeature> features)
        {
            IPathNode multiPointNode  = new PathNode(Gmlns, "MultiPoint", (NameTable)XmlReader.NameTable);
            IPathNode pointMemberNode = new PathNode(Gmlns, "pointMember", (NameTable)XmlReader.NameTable);
            var       labelValues     = new Dictionary <string, string>();
            var       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, labelValues, multiPointNode, pointMemberNode)) !=
                        null)
                    {
                        using GeometryFactory geomFactory = new PointFactory(GeomReader, FeatureTypeInfo)
                              {
                                  AxisOrder = AxisOrder
                              };;
                        var points = geomFactory.CreateGeometries(features).Cast <Point>();
                        Geoms.Add(new MultiPoint(points.ToArray()));
                        geomFound = true;
                    }
                    if (geomFound)
                    {
                        features.Add(AddLabel(labelValues, Geoms[Geoms.Count - 1]));
                    }
                    geomFound = false;
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("An exception occured while parsing a multi-point geometry: " + ex.Message);
                throw;
            }

            return(Geoms);
        }