Class SvmShapefileVertexReader

    • Constructor Detail

      • SvmShapefileVertexReader

        public SvmShapefileVertexReader​(File file)
                                 throws IOException
        Construct an instance for the specified Shapefile
        Parameters:
        file - a shapefile reference
        Throws:
        IOException - in the event of an unrecoverable I/O condition
    • Method Detail

      • setDbfFieldForZ

        public void setDbfFieldForZ​(String dbfFieldForZ)
        Sets the name of the field in the DBF file to use as a source for Z coordinates for data.
        Parameters:
        dbfFieldForZ - a valid string, or a null to use the Z coordinates from the shapefile geometry file (the 0shp file).
      • setVerticalCoordinateTransform

        public void setVerticalCoordinateTransform​(IVerticalCoordinateTransform verticalTransform)
        Sets the vertical coordinate transform to be used when reading the file (if any).
        Parameters:
        verticalTransform - a valid instance if a transform is to be applies; a null reference if no transform is required.
      • getXMin

        public double getXMin()
        Gets the minimum x coordinate in the sample
        Specified by:
        getXMin in interface IVertexReader
        Returns:
        a valid floating point value
      • getXMax

        public double getXMax()
        Gets the maximum x coordinate in the sample
        Specified by:
        getXMax in interface IVertexReader
        Returns:
        a valid floating point value
      • getYMin

        public double getYMin()
        Gets the minimum y coordinate in the sample
        Specified by:
        getYMin in interface IVertexReader
        Returns:
        a valid floating point value
      • getYMax

        public double getYMax()
        Gets the maximum y coordinate in the sample
        Specified by:
        getYMax in interface IVertexReader
        Returns:
        a valid floating point value
      • getZMin

        public double getZMin()
        Gets the minimum z coordinate in the sample
        Specified by:
        getZMin in interface IVertexReader
        Returns:
        a valid floating point value
      • getZMax

        public double getZMax()
        Gets the maximum z coordinate in the sample
        Specified by:
        getZMax in interface IVertexReader
        Returns:
        a valid floating point value
      • getTimeForLoad

        public double getTimeForLoad()
        Gets the total time to load a file (including the time required for pre-sort if enabled).
        Returns:
        a time in milliseconds
      • isSourceInGeographicCoordinates

        public boolean isSourceInGeographicCoordinates()
        Indicates whether the source data was in geographic coordinates
        Specified by:
        isSourceInGeographicCoordinates in interface IVertexReader
        Returns:
        true if the source data used geographic coordinates; otherwise, false.
      • read

        public List<Vertex> read​(IMonitorWithCancellation monitor)
                          throws IOException
        Read the records from the shapefile and use them to populate vertices. If the input shapefile is based on PolyLine features, this method assumes that it provides contours contours. In that case, the zero-depth contours are ignored and other valued contours are added to the linear constraint list.

        The loader has the option of loading the z coordinate from either the main shapefile itself (the SHP file) or from the associated DBF file. If you wish to use a field in the DBF file as a z coordinate, specify the name of the field as an argument. If you wish to use the z coordinate from the shapefile, specify a null or empty string. If a null or empty string is specified, and the shapefile does not contain a feature type that provides z coordinates, the z coordinates will be uniformly populated with zeroes.

        The index of the vertex is set to be the shapefile record number. Thus many vertices may be assigned with the same record number, particularly if the input is a polygon or line feature.

        Specified by:
        read in interface IVertexReader
        Parameters:
        monitor - an optional progress monitor, or null if not required.
        Returns:
        a valid, potentially empty list of vertices
        Throws:
        IOException - in the event of an unrecoverable I/O condition
      • getLinearUnits

        public LinearUnits getLinearUnits()
        Gets the linear units for the horizontal coordinate system from the shapefile. This value is typically obtained from the PRJ file associated with the shapefile.
        Returns:
        a valid enumeration instance
      • getVertices

        public List<Vertex> getVertices()
        Gets the list of vertices that were collected during the most recent read operation. The list may be empty if the input shapefile included no usable data.
        Returns:
        a valid, potentially empty, list of vertices.
      • getLinearConstraints

        public List<LinearConstraint> getLinearConstraints()
        Gets the list of constraints that were collected during the most recent read operation. The list will be populated only if the input shapefile contains PolyLine features (assumed to be contours).
        Returns:
        a valid, potentially empty, list of vertices.