Esempio n. 1
0
        /// <summary>
        /// MultiLineString from WK.
        /// </summary>
        /// <returns>The MultiLineString</returns>
        /// <param name="wkt">WKT.</param>
        static GeoMultiLineString WktToMultiLineString(string wkt)
        {
            MatchCollection      matches     = Regex.Matches(wkt, @"\(([^\)]+)\)");
            List <GeoLineString> linestrings = new List <GeoLineString>(matches.Count);

            for (int i = 0; i < matches.Count; i++)
            {
                GeoLineString linestring = WktToLineString(matches[i].Groups[1].Value);
                linestrings.Add(linestring);
            }

            return(new GeoMultiLineString(linestrings));
        }
Esempio n. 2
0
        /// <summary>
        /// GeoLineString from WK.
        /// </summary>
        /// <returns>The GeoLineString</returns>
        /// <param name="wkt">WKT.</param>
        static GeoLineString WktToLineString(string wkt)
        {
            string[]          terms = wkt.Split(',');
            string[]          values;
            List <IGeoEntity> positions = new List <IGeoEntity>(terms.Length);

            for (int i = 0; i < terms.Length; i++)
            {
                values = terms[i].Split(' ');
                string z      = (values.Length > 2 ? values[2] : null);
                var    geopos = new GeoEntity(values[1], values[0], z);
                positions.Add(geopos);
            }

            GeoLineString test = new GeoLineString(positions);

            return(test);
        }
Esempio n. 3
0
 protected bool Equals(GeoLineString other)
 {
     return(base.Equals(other) && Entities.SequenceEqual(other.Entities));
 }
Esempio n. 4
0
 static string GeometryToWkt(GeoLineString lineString)
 {
     return(string.Join(",", lineString.Entities.Select(GeometryToWkt)));
 }