示例#1
0
        public static Feature ReadPolygon(TextReader reader)
        {
            string             str             = reader.ReadLine();
            LineairRing        outline         = PolyFileConverter.ReadRing(reader);
            LineairRing        lineairRing     = PolyFileConverter.ReadRing(reader);
            List <LineairRing> lineairRingList = new List <LineairRing>();

            for (; lineairRing != null; lineairRing = PolyFileConverter.ReadRing(reader))
            {
                lineairRingList.Add(lineairRing);
            }
            return(new Feature((Geometry) new Polygon(outline, (IEnumerable <LineairRing>)lineairRingList), (GeometryAttributeCollection) new SimpleGeometryAttributeCollection((IEnumerable <GeometryAttribute>) new GeometryAttribute[1]
            {
                new GeometryAttribute()
                {
                    Key = "name",
                    Value = (object)str
                }
            })));
        }
示例#2
0
        /// <summary>
        /// Reads a polygon from a text stream.
        /// </summary>
        /// <returns></returns>
        public static Feature ReadPolygon(TextReader reader)
        {
            var name   = reader.ReadLine();
            var outer  = PolyFileConverter.ReadRing(reader);
            var inner  = PolyFileConverter.ReadRing(reader);
            var inners = new List <LineairRing>();

            while (inner != null)
            {
                inners.Add(inner);
                inner = PolyFileConverter.ReadRing(reader);
            }
            return(new Feature(new Polygon(outer, inners), new SimpleGeometryAttributeCollection(
                                   new GeometryAttribute[] {
                new GeometryAttribute()
                {
                    Key = "name",
                    Value = name
                }
            })));
        }
示例#3
0
 /// <summary>
 /// Reads a polygon from a stream.
 /// </summary>
 /// <returns></returns>
 public static Feature ReadPolygon(Stream stream)
 {
     return(PolyFileConverter.ReadPolygon(
                new StreamReader(stream)));
 }
示例#4
0
 /// <summary>
 /// Reads a polygon from a string.
 /// </summary>
 /// <returns></returns>
 public static Feature ReadPolygon(string poly)
 {
     return(PolyFileConverter.ReadPolygon(
                new StringReader(poly)));
 }