Class SimplePolygonParser

  • All Implemented Interfaces:
    BundleStreamSource, Parser, StreamingParser

    public class SimplePolygonParser
    extends AbstractStreamingParser
    Parser to load polygon data (2D and 3D only) from a simple format. One record per line, points separated by whitespace, numbers separated by commas. Multiple polygons components can be separated using --.

    Unparseable parts will be treated as labels.

    Since:
    0.4.0
    Author:
    Erich Schubert
    • Field Detail

      • LOG

        private static final Logging LOG
        Class logger
      • COORD

        public static final java.util.regex.Pattern COORD
        Pattern to catch coordinates
      • POLYGON_SEPARATOR

        public static final java.lang.String POLYGON_SEPARATOR
        Polygon separator
        See Also:
        Constant Field Values
      • haslabels

        protected boolean haslabels
        Whether or not the data set has labels.
      • curlbl

        protected LabelList curlbl
        Current labels.
      • cureid

        protected ExternalID cureid
        Current external id.
      • coords

        private final java.util.List<double[]> coords
        (Reused) storage of coordinates.
      • polys

        private final java.util.List<Polygon> polys
        (Reused) storage of polygons.
      • labels

        private final java.util.ArrayList<java.lang.String> labels
        (Reused) store for labels.
    • Constructor Detail

      • SimplePolygonParser

        public SimplePolygonParser​(CSVReaderFormat format)
        Constructor.
        Parameters:
        format - Input format
    • Method Detail

      • buildMeta

        protected void buildMeta()
        Update the meta element.
      • data

        public java.lang.Object data​(int rnum)
        Description copied from interface: BundleStreamSource
        Access a particular object and representation.
        Parameters:
        rnum - Representation number
        Returns:
        Contained data
      • parseLine

        private boolean parseLine()
        Parse a single line.
        Returns:
        true if the line was read successful.