Class RTreeIndexCoreExtension

    • Constructor Detail

      • RTreeIndexCoreExtension

        protected RTreeIndexCoreExtension​(GeoPackageCore geoPackage)
        Constructor
        Parameters:
        geoPackage - GeoPackage
      • RTreeIndexCoreExtension

        protected RTreeIndexCoreExtension​(GeoPackageCore geoPackage,
                                          boolean geodesic)
        Constructor
        Parameters:
        geoPackage - GeoPackage
        geodesic - index using geodesic bounds
        Since:
        6.6.7
    • Method Detail

      • isGeodesic

        public boolean isGeodesic()
        Geometries indexed using geodesic lines
        Returns:
        geodesic flag
        Since:
        6.6.7
      • setGeodesic

        public void setGeodesic​(boolean geodesic)
        Set the geodestic flag, true to index geodesic geometries
        Parameters:
        geodesic - index geodesic geometries flag
        Since:
        6.6.7
      • geodesicEnvelope

        protected GeometryEnvelope geodesicEnvelope​(GeometryEnvelope envelope,
                                                    int srsId)
        Expand the vertical bounds of a geometry envelope by geodesic bounds
        Parameters:
        envelope - geometry envelope
        srsId - spatial reference system id
        Returns:
        geometry envelope
        Since:
        6.6.7
      • getProjection

        protected Projection getProjection​(int srsId)
        Get the projection of the spatial reference system id
        Parameters:
        srsId - spatial reference system id
        Returns:
        projection
        Since:
        6.6.7
      • getOrCreate

        public Extensions getOrCreate​(FeatureTable featureTable)
        Get or create the extension
        Parameters:
        featureTable - feature table
        Returns:
        extension
      • getOrCreate

        public Extensions getOrCreate​(String tableName,
                                      String columnName)
        Get or create the extension
        Parameters:
        tableName - table name
        columnName - column name
        Returns:
        extension
      • has

        public boolean has​(FeatureTable featureTable)
        Determine if the GeoPackage feature table has the extension
        Parameters:
        featureTable - feature table
        Returns:
        true if has extension
      • has

        public boolean has​(String tableName,
                           String columnName)
        Determine if the GeoPackage table and column has the extension
        Overrides:
        has in class BaseExtension
        Parameters:
        tableName - table name
        columnName - column name
        Returns:
        true if has extension
      • has

        public boolean has​(String tableName)
        Determine if the GeoPackage table has the extension
        Overrides:
        has in class BaseExtension
        Parameters:
        tableName - table name
        Returns:
        true if has extension
        Since:
        3.2.0
      • has

        public boolean has()
        Determine if the GeoPackage has the extension for any table
        Returns:
        true if has extension
      • createFunctions

        public boolean createFunctions​(FeatureTable featureTable)
        Check if the feature table has the RTree extension and create the functions if needed
        Parameters:
        featureTable - feature table
        Returns:
        true if has extension and functions created
      • createFunctions

        public boolean createFunctions​(String tableName,
                                       String columnName)
        Check if the table and column has the RTree extension and create the functions if needed
        Parameters:
        tableName - table name
        columnName - column name
        Returns:
        true if has extension and functions created
      • createFunctions

        public boolean createFunctions()
        Check if the GeoPackage has the RTree extension and create the functions if needed
        Returns:
        true if has extension and functions created
      • create

        public Extensions create​(FeatureTable featureTable)
        Create the RTree Index extension for the feature table. Creates the SQL functions, loads the tree, and creates the triggers.
        Parameters:
        featureTable - feature table
        Returns:
        extension
      • create

        public Extensions create​(String tableName,
                                 String geometryColumnName,
                                 String idColumnName)
        Create the RTree Index extension for the feature table, geometry column, and id column. Creates the SQL functions, loads the tree, and creates the triggers.
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
        Returns:
        extension
      • createRTreeIndex

        public void createRTreeIndex​(FeatureTable featureTable)
        Create the RTree Index Virtual Table
        Parameters:
        featureTable - feature table
      • createRTreeIndex

        public void createRTreeIndex​(String tableName,
                                     String geometryColumnName)
        Create the RTree Index Virtual Table
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • createAllFunctions

        public void createAllFunctions()
        Create all connection SQL Functions for min x, max x, min y, max y, and is empty
      • createMinXFunction

        public abstract void createMinXFunction()
        Create the min x SQL function
      • createMaxXFunction

        public abstract void createMaxXFunction()
        Create the max x SQL function
      • createMinYFunction

        public abstract void createMinYFunction()
        Create the min y SQL function
      • createMaxYFunction

        public abstract void createMaxYFunction()
        Create the max y SQL function
      • createIsEmptyFunction

        public abstract void createIsEmptyFunction()
        Create the is empty SQL function
      • loadRTreeIndex

        public void loadRTreeIndex​(FeatureTable featureTable)
        Load the RTree Spatial Index Values
        Parameters:
        featureTable - feature table
      • loadRTreeIndex

        public void loadRTreeIndex​(String tableName,
                                   String geometryColumnName,
                                   String idColumnName)
        Load the RTree Spatial Index Values
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • createAllTriggers

        public void createAllTriggers​(FeatureTable featureTable)
        Create Triggers to Maintain Spatial Index Values
        Parameters:
        featureTable - feature table
      • createAllTriggers

        public void createAllTriggers​(String tableName,
                                      String geometryColumnName,
                                      String idColumnName)
        Create Triggers to Maintain Spatial Index Values
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • createInsertTrigger

        public void createInsertTrigger​(String tableName,
                                        String geometryColumnName,
                                        String idColumnName)
        Create insert trigger
         Conditions: Insertion of non-empty geometry
         Actions   : Insert record into R-tree
         
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • createUpdate1Trigger

        public void createUpdate1Trigger​(String tableName,
                                         String geometryColumnName,
                                         String idColumnName)
        Deprecated.
        replaced by update6 and update7
        Create update 1 trigger
         Conditions: Update of geometry column to non-empty geometry
                     No row ID change
         Actions   : Update record in R-tree
         
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • createUpdate2Trigger

        public void createUpdate2Trigger​(String tableName,
                                         String geometryColumnName,
                                         String idColumnName)
        Create update 2 trigger
         Conditions: Update of geometry column to empty geometry
                     No row ID change
         Actions   : Remove record from R-tree
         
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • createUpdate3Trigger

        public void createUpdate3Trigger​(String tableName,
                                         String geometryColumnName,
                                         String idColumnName)
        Deprecated.
        replaced by update5
        Create update 3 trigger
         Conditions: Update of any column
                     Row ID change
                     Non-empty geometry
         Actions   : Remove record from R-tree for old <i>
                     Insert record into R-tree for new <i>
         
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • createUpdate4Trigger

        public void createUpdate4Trigger​(String tableName,
                                         String geometryColumnName,
                                         String idColumnName)
        Create update 4 trigger
         Conditions: Update of any column
                     Row ID change
                     Empty geometry
         Actions   : Remove record from R-tree for old and new <i>
         
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • createUpdate5Trigger

        public void createUpdate5Trigger​(String tableName,
                                         String geometryColumnName,
                                         String idColumnName)
        Create update 5 trigger
         Conditions: Update of any column
                     Row ID change
                     Non-empty geometry
         Actions   : Remove record from R-tree for old <i>
                     Insert record into R-tree for new <i>
         
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • createUpdate6Trigger

        public void createUpdate6Trigger​(String tableName,
                                         String geometryColumnName,
                                         String idColumnName)
        Create update 6 trigger
         Conditions: Update a non-empty geometry with another non-empty geometry
         Actions   : Replace record from R-tree for <i>
         
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • createUpdate7Trigger

        public void createUpdate7Trigger​(String tableName,
                                         String geometryColumnName,
                                         String idColumnName)
        Create update 7 trigger
         Conditions: Update a null/empty geometry with a non-empty geometry
         Actions   : Insert record into R-tree for new <i>
         
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • createDeleteTrigger

        public void createDeleteTrigger​(String tableName,
                                        String geometryColumnName,
                                        String idColumnName)
        Create delete trigger
         Conditions: Row deleted
         Actions   : Remove record from R-tree for old <i>
         
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        idColumnName - id column name
      • delete

        public void delete​(FeatureTable featureTable)
        Delete the RTree Index extension for the feature table. Drops the triggers, RTree table, and deletes the extension.
        Parameters:
        featureTable - feature table
      • delete

        public void delete​(String tableName,
                           String geometryColumnName)
        Delete the RTree Index extension for the table and geometry column. Drops the triggers, RTree table, and deletes the extension.
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • delete

        public void delete​(String tableName)
        Delete all RTree Index extensions for the table. Drops the triggers, RTree tables, and deletes the extensions.
        Parameters:
        tableName - table name
        Since:
        3.2.0
      • deleteAll

        public void deleteAll()
        Delete all RTree Index extensions. Drops the triggers, RTree tables, and deletes the extensions.
        Since:
        3.2.0
      • drop

        public void drop​(FeatureTable featureTable)
        Drop the the triggers and RTree table for the feature table
        Parameters:
        featureTable - feature table
      • drop

        public void drop​(String tableName,
                         String geometryColumnName)
        Drop the the triggers and RTree table for the table and geometry column
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropRTreeIndex

        public void dropRTreeIndex​(FeatureTable featureTable)
        Drop the RTree Index Virtual Table
        Parameters:
        featureTable - feature table
      • dropRTreeIndex

        public void dropRTreeIndex​(String tableName,
                                   String geometryColumnName)
        Drop the RTree Index Virtual Table
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropTriggers

        public void dropTriggers​(FeatureTable featureTable)
        Check if the feature table has the RTree extension and if found, drop the triggers
        Parameters:
        featureTable - feature table
      • dropTriggers

        public boolean dropTriggers​(String tableName,
                                    String columnName)
        Check if the table and column has the RTree extension and if found, drop the triggers
        Parameters:
        tableName - table name
        columnName - column name
        Returns:
        true if dropped
      • dropAllTriggers

        public void dropAllTriggers​(FeatureTable featureTable)
        Drop Triggers that Maintain Spatial Index Values
        Parameters:
        featureTable - feature table
      • dropAllTriggers

        public void dropAllTriggers​(String tableName,
                                    String geometryColumnName)
        Drop Triggers that Maintain Spatial Index Values
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropInsertTrigger

        public void dropInsertTrigger​(String tableName,
                                      String geometryColumnName)
        Drop insert trigger
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropUpdate1Trigger

        public void dropUpdate1Trigger​(String tableName,
                                       String geometryColumnName)
        Drop update 1 trigger
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropUpdate2Trigger

        public void dropUpdate2Trigger​(String tableName,
                                       String geometryColumnName)
        Drop update 2 trigger
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropUpdate3Trigger

        public void dropUpdate3Trigger​(String tableName,
                                       String geometryColumnName)
        Drop update 3 trigger
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropUpdate4Trigger

        public void dropUpdate4Trigger​(String tableName,
                                       String geometryColumnName)
        Drop update 4 trigger
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropUpdate5Trigger

        public void dropUpdate5Trigger​(String tableName,
                                       String geometryColumnName)
        Drop update 5 trigger
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropUpdate6Trigger

        public void dropUpdate6Trigger​(String tableName,
                                       String geometryColumnName)
        Drop update 6 trigger
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropUpdate7Trigger

        public void dropUpdate7Trigger​(String tableName,
                                       String geometryColumnName)
        Drop update 7 trigger
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropDeleteTrigger

        public void dropDeleteTrigger​(String tableName,
                                      String geometryColumnName)
        Drop delete trigger
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
      • dropTrigger

        public void dropTrigger​(String tableName,
                                String geometryColumnName,
                                String triggerName)
        Drop the trigger for the table, geometry column, and trigger name
        Parameters:
        tableName - table name
        geometryColumnName - geometry column name
        triggerName - trigger name
      • executeSQL

        protected void executeSQL​(String sql,
                                  boolean trigger)
        Execute the SQL statement
        Parameters:
        sql - SQL statement
        trigger - true if a trigger statement
        Since:
        3.1.0
      • getEnvelope

        protected GeometryEnvelope getEnvelope​(GeoPackageGeometryData data)
        Get or build a geometry envelope from the Geometry Data
        Parameters:
        data - geometry data
        Returns:
        geometry envelope
      • getRTreeTable

        protected UserCustomTable getRTreeTable​(FeatureTable featureTable)
        Get the RTree Table
        Parameters:
        featureTable - feature table
        Returns:
        RTree table