Class PgSphereTranslator.PgSphereGeometryParser

  • Enclosing class:
    PgSphereTranslator

    protected static class PgSphereTranslator.PgSphereGeometryParser
    extends java.lang.Object

    Let parse a geometry serialized with the PgSphere syntax.

    There is one function parseXxx(String) for each supported geometry. These functions always return a STCS.Region object, which is the object representation of an STC region.

    Only the following geometries are supported:

    • spoint => Position
    • scircle => Circle
    • sbox => Box
    • spoly => Polygon

    This parser supports all the known PgSphere representations of an angle. However, it always returns angle (coordinates, radius, width and height) in degrees.

    Since:
    1.3
    Version:
    1.3 (11/2014)
    Author:
    Grégory Mantelet (ARI)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      STCS.Region parseBox​(java.lang.String pgsphereExpr)
      Parse the given PgSphere geometry as a box.
      STCS.Region parseCircle​(java.lang.String pgsphereExpr)
      Parse the given PgSphere geometry as a circle.
      STCS.Region parsePoint​(java.lang.String pgsphereExpr)
      Parse the given PgSphere geometry as a point.
      STCS.Region parsePolygon​(java.lang.String pgsphereExpr)
      Parse the given PgSphere geometry as a point.
      • Methods inherited from class java.lang.Object

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

      • PgSphereGeometryParser

        public PgSphereGeometryParser()
        Build the PgSphere parser.
    • Method Detail

      • parsePoint

        public STCS.Region parsePoint​(java.lang.String pgsphereExpr)
                               throws ParseException
        Parse the given PgSphere geometry as a point.
        Parameters:
        pgsphereExpr - The PgSphere expression to parse as a point.
        Returns:
        A STCS.Region implementing a STC Position region.
        Throws:
        ParseException - If the PgSphere syntax of the given expression is wrong or does not correspond to a point.
      • parseCircle

        public STCS.Region parseCircle​(java.lang.String pgsphereExpr)
                                throws ParseException
        Parse the given PgSphere geometry as a circle.
        Parameters:
        pgsphereExpr - The PgSphere expression to parse as a circle.
        Returns:
        A STCS.Region implementing a STC Circle region.
        Throws:
        ParseException - If the PgSphere syntax of the given expression is wrong or does not correspond to a circle.
      • parseBox

        public STCS.Region parseBox​(java.lang.String pgsphereExpr)
                             throws ParseException
        Parse the given PgSphere geometry as a box.
        Parameters:
        pgsphereExpr - The PgSphere expression to parse as a box.
        Returns:
        A STCS.Region implementing a STC Box region.
        Throws:
        ParseException - If the PgSphere syntax of the given expression is wrong or does not correspond to a box.
      • parsePolygon

        public STCS.Region parsePolygon​(java.lang.String pgsphereExpr)
                                 throws ParseException
        Parse the given PgSphere geometry as a point.
        Parameters:
        pgsphereExpr - The PgSphere expression to parse as a point.
        Returns:
        A STCS.Region implementing a STC Position region.
        Throws:
        ParseException - If the PgSphere syntax of the given expression is wrong or does not correspond to a point.