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); }
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); }
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; }
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); }
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(); }
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; }