예제 #1
0
 internal static Geometries.MultiLineString ToSharpMapMultiLineString(MultiLineString multiLineString)
 {
     Geometries.MultiLineString collection = new Geometries.MultiLineString();
     foreach (LineString lineString in multiLineString.Geometries)
     {
         collection.LineStrings.Add(ToSharpMapLineString(lineString));
     }
     return(collection);
 }
예제 #2
0
        private static IMultiLineString ReadMultiLineString(JsonTextReader jreader)
        {
            if (jreader == null)
            {
                throw new ArgumentNullException("reader", "A valid JSON reader object is required.");
            }

            IMultiLineString lines = null;

            if (jreader.TokenClass == JsonTokenClass.Array)
            {
                jreader.ReadToken(JsonTokenClass.Array);
                List <ILineString> list = new List <ILineString>();
                while (jreader.TokenClass == JsonTokenClass.Array)
                {
                    list.Add(ReadLineString(jreader));
                }
                jreader.ReadToken(JsonTokenClass.EndArray);
                lines = new GisSharpBlog.NetTopologySuite.Geometries.MultiLineString(list.ToArray());
            }
            return(lines);
        }
예제 #3
0
        private static MultiLineString ReadMultiLineString(JsonTextReader jreader)
        {
            if (jreader == null)
                throw new ArgumentNullException("reader", "A valid JSON reader object is required.");

            MultiLineString lines = null;
            if (jreader.TokenClass == JsonTokenClass.Array)
            {
                jreader.ReadToken(JsonTokenClass.Array);
                    List<LineString> list = new List<LineString>();
                    while (jreader.TokenClass == JsonTokenClass.Array)
                    {
                        list.Add(ReadLineString(jreader));
                    }
                jreader.ReadToken(JsonTokenClass.EndArray);

                lines = new MultiLineString(list.ToArray());
            }
            return lines;
        }
예제 #4
0
        public static void Write(MultiLineString lines, TextWriter writer)
        {
            if (lines == null)
                return;
            if (writer == null)
                throw new ArgumentNullException("writer", "A valid text writer object is required.");

            JsonTextWriter jwriter = new JsonTextWriter(writer);
            Write(lines, jwriter);
        }
예제 #5
0
        public static void Write(MultiLineString lines, JsonTextWriter jwriter)
        {
            if (lines == null)
                return;
            if (jwriter == null)
                throw new ArgumentNullException("jwriter", "A valid JSON writer object is required.");

            jwriter.WriteStartObject();

                jwriter.WriteMember("type");
                jwriter.WriteString("MultiLineString");

                jwriter.WriteMember("coordinates");
                jwriter.WriteStartArray();
                    foreach (LineString line in lines.Geometries)
                    {
                        Write(line.Coordinates, jwriter);
                    }
                jwriter.WriteEndArray();

            jwriter.WriteEndObject();
        }
예제 #6
0
 internal static Geometries.MultiLineString ToSharpMapMultiLineString(MultiLineString multiLineString)
 {
     Geometries.MultiLineString collection = new Geometries.MultiLineString();
     foreach (LineString lineString in multiLineString.Geometries)
         collection.LineStrings.Add(ToSharpMapLineString(lineString));
     return collection;
 }