/// <summary> /// Converts a MultiLineString to <MultiLineString Tagged /// Text> format, then Appends it to the writer. /// </summary> /// <param name="multiLineString">The MultiLineString to process</param> /// <param name="writer">The output stream writer to Append to.</param> protected void AppendMultiLineStringTaggedText( MultiLineString multiLineString, TextWriter writer ) { AppendPath(writer); AppendMultiLineStringText(multiLineString, writer); AppendEndPath(writer); }
/// <summary> /// Converts a MultiLineString to <MultiLineString Text> /// format, then Appends it to the writer. /// </summary> /// <param name="multiLineString">The MultiLineString to process.</param> /// <param name="writer">The output stream writer to Append to.</param> protected void AppendMultiLineStringText(MultiLineString multiLineString, TextWriter writer) { if (multiLineString.IsEmpty()) { writer.Write("EMPTY"); } else { for (int i = 0; i < multiLineString.GetNumGeometries(); i++) { if (i > 0) { writer.Write(", "); } //AppendLineStringText((LineString) multiLineString.GetGeometryN(i), level2, doIndent, writer); AppendLineStringText((LineString) multiLineString.GetGeometryN(i), writer); } //writer.Write(")"); } }
/// <summary> /// Converts a MultiLineString to <MultiLineString Text> /// format, then Appends it to the writer. /// </summary> /// <param name="multiLineString">The MultiLineString to process.</param> /// <param name="level"></param> /// <param name="indentFirst"></param> /// <param name="writer">The output stream writer to Append to.</param> protected void AppendMultiLineStringText(MultiLineString multiLineString, int level, bool indentFirst, StringWriter writer) { if ( multiLineString.IsEmpty() ) { writer.Write("EMPTY"); } else { int level2 = level; bool doIndent = indentFirst; writer.Write("("); for (int i = 0; i < multiLineString.GetNumGeometries(); i++) { if (i > 0) { writer.Write(", "); level2 = level + 1; doIndent = true; } //AppendLineStringText((LineString) multiLineString.GetGeometryN(i), level2, doIndent, writer); AppendLineStringText((LineString) multiLineString.GetGeometryN(i), level2, doIndent, writer); } writer.Write(")"); } }
private MultiPolygon CreateMP1() { Polygon[] polygons = new Polygon[2]; LineString[] rings = new LineString[2]; Coordinates coords = new Coordinates(); Coordinate coord = new Coordinate(5, 1); coords.Add(coord); coord = new Coordinate(6, 2); coords.Add(coord); coord = new Coordinate(7, 3); coords.Add(coord); coord = new Coordinate(6, 4); coords.Add(coord); coord = new Coordinate(5, 5); coords.Add(coord); coord = new Coordinate(4, 4); coords.Add(coord); coord = new Coordinate(3, 3); coords.Add(coord); coord = new Coordinate(4, 2); coords.Add(coord); coord = new Coordinate(5, 1); coords.Add(coord); GeometryFactory gf = new GeometryFactory(_precMod, _sRID); LinearRing exterior1 = gf.CreateLinearRing(coords); polygons[0] = gf.CreatePolygon(exterior1); rings[0] = exterior1 as LineString; coords = new Coordinates(); coord = new Coordinate(5, 1); coords.Add(coord); coord = new Coordinate(6, 2); coords.Add(coord); coord = new Coordinate(7, 3); coords.Add(coord); coord = new Coordinate(6, 4); coords.Add(coord); coord = new Coordinate(5, 5); coords.Add(coord); coord = new Coordinate(4, 4); coords.Add(coord); coord = new Coordinate(3, 3); coords.Add(coord); coord = new Coordinate(4, 2); coords.Add(coord); coord = new Coordinate(5, 1); coords.Add(coord); LinearRing exterior2 = gf.CreateLinearRing(coords); polygons[1] = gf.CreatePolygon(exterior2); rings[1] = exterior2; _mls1 = gf.CreateMultiLineString(rings); return gf.CreateMultiPolygon(polygons); }
/// <summary> /// Converts a MultiLineString to <MultiLineString Tagged /// Text> format, then Appends it to the writer. /// </summary> /// <param name="multiLineString">The MultiLineString to process</param> /// <param name="level"></param> /// <param name="writer">The output stream writer to Append to.</param> protected void AppendMultiLineStringTaggedText( MultiLineString multiLineString, int level, StringWriter writer ) { writer.Write("MULTILINESTRING "); AppendMultiLineStringText(multiLineString, level, false, writer); }
/// <summary> /// Tests if MultiLineString is simple. /// </summary> /// <param name="geometry">Geometry to test. Must be of type MultiLineString.</param> /// <returns>Returns True if geometry is simple.</returns> public bool IsSimple( MultiLineString geometry ) { return IsSimpleLinearGeometry( geometry ); }
/// <summary> /// Writes a multilinestring. /// </summary> /// <param name="mls">The multilinestring to be written.</param> private void WriteMultiLineString(MultiLineString mls, byte format) { //Get the number of linestrings in this multilinestring. int numLineStrings = mls.GetNumGeometries(); //Write the number of linestrings. _bWriter.Write(numLineStrings); //Loop on the number of linestrings. for(int i = 0; i < numLineStrings; i++) { //Write each linestring. WriteLineString((LineString)mls[i], format); } }
/// <summary> /// Converts the List to an array. /// </summary> /// <param name="multiLineStrings">The List to convert.</param> /// <returns>The List in array format.</returns> public static MultiLineString[] ToMultiLineStringArray(ArrayList multiLineStrings) { MultiLineString[] multiLineStringArray = new MultiLineString[multiLineStrings.Count]; return (MultiLineString[]) multiLineStrings.ToArray(typeof(MultiLineString)); }
/// <summary> /// Converts the List to an array. /// </summary> /// <param name="multiLineStrings">The List to convert.</param> /// <returns>The List in array format.</returns> public static MultiLineString[] ToMultiLineStringArray(ArrayList multiLineStrings) { MultiLineString[] multiLineStringArray = new MultiLineString[multiLineStrings.Count]; return((MultiLineString[])multiLineStrings.ToArray(typeof(MultiLineString))); }