Class SVGWriter


  • public class SVGWriter
    extends java.lang.Object
    Writes the Well-Known Text representation of a Geometry. The Well-Known Text format is defined in the OGC Simple Features Specification for SQL. See WKTReader for a formal specification of the format syntax.

    The WKTWriter outputs coordinates rounded to the precision model. Only the maximum number of decimal places necessary to represent the ordinates to the required precision will be output.

    The SFS WKT spec does not define a special tag for LinearRings. Under the spec, rings are output as LINESTRINGs. In order to allow precisely specifying constructed geometries, JTS also supports a non-standard LINEARRING tag which is used to output LinearRings.

    Version:
    1.7
    See Also:
    WKTReader
    • Constructor Summary

      Constructors 
      Constructor Description
      SVGWriter()
      Creates a new SVGWriter with default settings
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String stringOfChar​(char ch, int count)
      Returns a String of repeated characters.
      java.lang.String write​(Geometry geometry)
      Converts a Geometry to its Well-known Text representation.
      void write​(Geometry geometry, java.io.Writer writer)
      Converts a Geometry to its Well-known Text representation.
      java.lang.String writeFormatted​(Geometry geometry)
      Same as write, but with newlines and spaces to make the well-known text more readable.
      void writeFormatted​(Geometry geometry, java.io.Writer writer)
      Same as write, but with newlines and spaces to make the well-known text more readable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SVGWriter

        public SVGWriter()
        Creates a new SVGWriter with default settings
    • Method Detail

      • stringOfChar

        public static java.lang.String stringOfChar​(char ch,
                                                    int count)
        Returns a String of repeated characters.
        Parameters:
        ch - the character to repeat
        count - the number of times to repeat the character
        Returns:
        a String of characters
      • write

        public java.lang.String write​(Geometry geometry)
        Converts a Geometry to its Well-known Text representation.
        Parameters:
        geometry - a Geometry to process
        Returns:
        a string (see the OpenGIS Simple Features Specification)
      • write

        public void write​(Geometry geometry,
                          java.io.Writer writer)
                   throws java.io.IOException
        Converts a Geometry to its Well-known Text representation.
        Parameters:
        geometry - a Geometry to process
        Throws:
        java.io.IOException
      • writeFormatted

        public java.lang.String writeFormatted​(Geometry geometry)
        Same as write, but with newlines and spaces to make the well-known text more readable.
        Parameters:
        geometry - a Geometry to process
        Returns:
        a string (see the OpenGIS Simple Features Specification), with newlines and spaces
      • writeFormatted

        public void writeFormatted​(Geometry geometry,
                                   java.io.Writer writer)
                            throws java.io.IOException
        Same as write, but with newlines and spaces to make the well-known text more readable.
        Parameters:
        geometry - a Geometry to process
        Throws:
        java.io.IOException