Class ShapefileFeatureJGeom


  • public class ShapefileFeatureJGeom
    extends java.lang.Object
    This class helps to create features from a shapefile.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String[] reservedWords  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Hashtable fromRecordToFeature​(DBFReaderJGeom dbf, ShapefileReaderJGeom sfr, byte[] fieldTypes, int numFields, int row, int srid)
      Convert .dbf columns and .shp bytes into Feature instance.
      static java.util.Hashtable fromRecordToFeature​(DBFReaderJGeom dbf, ShapefileReaderJGeom sfr, java.lang.String[] fieldNames, int[] fieldIndexes, byte[] fieldTypes, int row, int srid)
      Convert .dbf columns and .shp bytes into Feature instance.
      static java.util.Map<java.lang.String,​java.lang.Object> fromRecordToFeatureFast​(DBFReaderJGeom dbf, ShapefileReaderJGeom sfr, byte[] fieldTypes, java.lang.String[] fieldNames, int row, int srid)
      Converts .dbf columns and .shp bytes into Feature instance.
      static java.lang.String getDimArray​(int shpDims, java.lang.String m_tolerance, java.lang.String min_x, java.lang.String max_x, java.lang.String min_y, java.lang.String max_y, double min_z, double max_z, double min_m, double max_m)  
      static java.lang.String[] getOraFieldNames​(DBFReaderJGeom dbf, byte[] fieldTypes, int numFields)  
      static java.lang.String[] getOraFieldNames​(DBFReaderJGeom dbf, byte[] fieldTypes, int[] fieldIndexes)  
      static java.lang.String getRelSchema​(DBFReaderJGeom dbf)  
      static java.lang.String getRelSchema​(DBFReaderJGeom dbf, java.lang.String gidName)  
      static void insertFeatures​(oracle.jdbc.OracleConnection conn, DBFReaderJGeom dbfr, ShapefileReaderJGeom sfh, java.lang.String m_tableName, int m_commit_interval, int m_srid, java.lang.String dimArrayMig)  
      static void insertFeatures​(oracle.jdbc.OracleConnection conn, DBFReaderJGeom dbfr, ShapefileReaderJGeom sfh, java.lang.String m_tableName, java.lang.String m_idName, int m_start_id, int m_commit_interval, int m_println_interval, int m_srid, java.lang.String dimArrayMig)  
      static boolean isGeodetic​(oracle.jdbc.OracleConnection conn, int m_srid)  
      static boolean isReservedWord​(java.lang.String word)
      From jpaiva MapBuilder Returns if input word is an Oracle SQL reserved word or an ANSI reserved word.
      static boolean isReservedWord​(oracle.jdbc.OracleConnection conn, java.lang.String word, java.lang.String m_keyword_table)  
      static void prepareTableForData​(oracle.jdbc.OracleConnection conn, DBFReaderJGeom dbfr, java.lang.String m_tableName, java.lang.String m_idName, java.lang.String m_geom, int m_srid, java.lang.String dimArray)  
      static void prepareTableForData​(oracle.jdbc.OracleConnection conn, DBFReaderJGeom dbfr, java.lang.String m_tableName, java.lang.String m_idName, java.lang.String m_geom, int m_srid, java.lang.String dimArray, java.lang.String m_keyword_table)  
      static boolean validateMvalue​(ShapefileReaderJGeom sfr, int srid)  
      • Methods inherited from class java.lang.Object

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

      • reservedWords

        protected static java.lang.String[] reservedWords
    • Constructor Detail

      • ShapefileFeatureJGeom

        public ShapefileFeatureJGeom()
    • Method Detail

      • isReservedWord

        public static boolean isReservedWord​(java.lang.String word)
        From jpaiva MapBuilder Returns if input word is an Oracle SQL reserved word or an ANSI reserved word.
        Parameters:
        word -
        Returns:
        boolean
      • isReservedWord

        public static boolean isReservedWord​(oracle.jdbc.OracleConnection conn,
                                             java.lang.String word,
                                             java.lang.String m_keyword_table)
      • validateMvalue

        public static boolean validateMvalue​(ShapefileReaderJGeom sfr,
                                             int srid)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getRelSchema

        public static java.lang.String getRelSchema​(DBFReaderJGeom dbf)
      • getRelSchema

        public static java.lang.String getRelSchema​(DBFReaderJGeom dbf,
                                                    java.lang.String gidName)
      • getOraFieldNames

        public static java.lang.String[] getOraFieldNames​(DBFReaderJGeom dbf,
                                                          byte[] fieldTypes,
                                                          int numFields)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • getOraFieldNames

        public static java.lang.String[] getOraFieldNames​(DBFReaderJGeom dbf,
                                                          byte[] fieldTypes,
                                                          int[] fieldIndexes)
                                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • fromRecordToFeature

        public static java.util.Hashtable fromRecordToFeature​(DBFReaderJGeom dbf,
                                                              ShapefileReaderJGeom sfr,
                                                              byte[] fieldTypes,
                                                              int numFields,
                                                              int row,
                                                              int srid)
                                                       throws java.io.IOException
        Convert .dbf columns and .shp bytes into Feature instance.
        Throws:
        java.io.IOException
      • fromRecordToFeatureFast

        public static java.util.Map<java.lang.String,​java.lang.Object> fromRecordToFeatureFast​(DBFReaderJGeom dbf,
                                                                                                     ShapefileReaderJGeom sfr,
                                                                                                     byte[] fieldTypes,
                                                                                                     java.lang.String[] fieldNames,
                                                                                                     int row,
                                                                                                     int srid)
                                                                                              throws java.io.IOException
        Converts .dbf columns and .shp bytes into Feature instance. This is the same as fromRecordToFeature(DBFReaderJGeom, ShapefileReaderJGeom, byte[], int, int, int) except that runs faster and that it returns a Map instead of Hashtable.

        Other than the return type, everything else is exactly the same as the fromRecordToFeature method, including the thrown exceptions

        Parameters:
        dbf - a DBFReaderJGeom initialized instance.
        sfr - a ShapefileFeatureJGeom initialized instance.
        fieldTypes - attribute types to be processed. Must have same length as fieldNames array.
        fieldNames - attribute names to be processed. Must have same length as fieldTypes array.
        row - the record number to be processed.
        srid - the SRID to use.
        Returns:
        a Map with the processed record fields, which keys are the field names and the values are the record field value. If a geometry is present in the record, a "geometry" key is included in the resulting map along with its JGeometry repesenting value.
        Throws:
        java.io.IOException - if any IO error occurs while processing the record
        java.lang.IllegalArgumentException - if fieldTypes and fieldNames arrays have different length
        java.lang.RuntimeException - if any of the field types is undefined
      • fromRecordToFeature

        public static java.util.Hashtable fromRecordToFeature​(DBFReaderJGeom dbf,
                                                              ShapefileReaderJGeom sfr,
                                                              java.lang.String[] fieldNames,
                                                              int[] fieldIndexes,
                                                              byte[] fieldTypes,
                                                              int row,
                                                              int srid)
                                                       throws java.io.IOException
        Convert .dbf columns and .shp bytes into Feature instance.
        Parameters:
        dbf -
        sfr -
        fieldNames - attribute names to be processed (not necessarily all)
        fieldIndexes - attribute index position on original attribute list
        fieldTypes - attribute types
        Throws:
        java.io.IOException
      • isGeodetic

        public static boolean isGeodetic​(oracle.jdbc.OracleConnection conn,
                                         int m_srid)
                                  throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getDimArray

        public static java.lang.String getDimArray​(int shpDims,
                                                   java.lang.String m_tolerance,
                                                   java.lang.String min_x,
                                                   java.lang.String max_x,
                                                   java.lang.String min_y,
                                                   java.lang.String max_y,
                                                   double min_z,
                                                   double max_z,
                                                   double min_m,
                                                   double max_m)
      • prepareTableForData

        public static void prepareTableForData​(oracle.jdbc.OracleConnection conn,
                                               DBFReaderJGeom dbfr,
                                               java.lang.String m_tableName,
                                               java.lang.String m_idName,
                                               java.lang.String m_geom,
                                               int m_srid,
                                               java.lang.String dimArray)
                                        throws java.io.IOException,
                                               java.sql.SQLException
        Throws:
        java.io.IOException
        java.sql.SQLException
      • prepareTableForData

        public static void prepareTableForData​(oracle.jdbc.OracleConnection conn,
                                               DBFReaderJGeom dbfr,
                                               java.lang.String m_tableName,
                                               java.lang.String m_idName,
                                               java.lang.String m_geom,
                                               int m_srid,
                                               java.lang.String dimArray,
                                               java.lang.String m_keyword_table)
                                        throws java.io.IOException,
                                               java.sql.SQLException
        Throws:
        java.io.IOException
        java.sql.SQLException
      • insertFeatures

        public static void insertFeatures​(oracle.jdbc.OracleConnection conn,
                                          DBFReaderJGeom dbfr,
                                          ShapefileReaderJGeom sfh,
                                          java.lang.String m_tableName,
                                          java.lang.String m_idName,
                                          int m_start_id,
                                          int m_commit_interval,
                                          int m_println_interval,
                                          int m_srid,
                                          java.lang.String dimArrayMig)
                                   throws java.sql.SQLException,
                                          java.io.IOException
        Throws:
        java.sql.SQLException
        java.io.IOException
      • insertFeatures

        public static void insertFeatures​(oracle.jdbc.OracleConnection conn,
                                          DBFReaderJGeom dbfr,
                                          ShapefileReaderJGeom sfh,
                                          java.lang.String m_tableName,
                                          int m_commit_interval,
                                          int m_srid,
                                          java.lang.String dimArrayMig)
                                   throws java.sql.SQLException,
                                          java.io.IOException
        Throws:
        java.sql.SQLException
        java.io.IOException