OGR: ogr_gensql.h Source File

# ogr_gensql.h

    00001 /******************************************************************************
    00002  * $Id: ogr_gensql.h 10645 2007-01-18 02:22:39Z warmerdam $
    00003  *
    00004  * Project:  OpenGIS Simple Features Reference Implementation
    00005  * Purpose:  Classes related to generic implementation of ExecuteSQL().
    00006  * Author:   Frank Warmerdam, warmerdam@pobox.com
    00007  *
    00008  ******************************************************************************
    00009  * Copyright (c) 2002, Frank Warmerdam
    00010  *
    00011  * Permission is hereby granted, free of charge, to any person obtaining a
    00012  * copy of this software and associated documentation files (the "Software"),
    00013  * to deal in the Software without restriction, including without limitation
    00014  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
    00015  * and/or sell copies of the Software, and to permit persons to whom the
    00016  * Software is furnished to do so, subject to the following conditions:
    00017  *
    00018  * The above copyright notice and this permission notice shall be included
    00019  * in all copies or substantial portions of the Software.
    00020  *
    00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
    00022  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00023  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    00024  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00025  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    00026  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    00027  * DEALINGS IN THE SOFTWARE.
    00028  ****************************************************************************/
    00029
    00030 #ifndef _OGR_GENSQL_H_INCLUDED
    00031 #define _OGR_GENSQL_H_INCLUDED
    00032
    00033 #include "ogrsf_frmts.h"
    00034
    00035 /************************************************************************/
    00036 /*                        OGRGenSQLResultsLayer                         */
    00037 /************************************************************************/
    00038
    00039 class CPL_DLL OGRGenSQLResultsLayer : public OGRLayer
    00040 {
    00041   private:
    00042     OGRDataSource *poSrcDS;
    00043     OGRLayer    *poSrcLayer;
    00044     void        *pSelectInfo;
    00045
    00046     OGRLayer   **papoTableLayers;
    00047
    00048     OGRFeatureDefn *poDefn;
    00049
    00050     int         PrepareSummary();
    00051
    00052     int         nIndexSize;
    00053     long       *panFIDIndex;
    00054
    00055     int         nNextIndexFID;
    00056     OGRFeature  *poSummaryFeature;
    00057
    00058     int         iFIDFieldIndex;
    00059
    00060     OGRField    *pasOrderByIndex;
    00061
    00062     int         nExtraDSCount;
    00063     OGRDataSource **papoExtraDS;
    00064
    00065     OGRFeature *TranslateFeature( OGRFeature * );
    00066     void        CreateOrderByIndex();
    00067     void        SortIndexSection( OGRField *pasIndexFields,
    00068                                   int nStart, int nEntries );
    00069     int         Compare( OGRField *pasFirst, OGRField *pasSecond );
    00070
    00071     void        ClearFilters();
    00072
    00073   public:
    00074                 OGRGenSQLResultsLayer( OGRDataSource *poSrcDS,
    00075                                        void *pSelectInfo,
    00076                                        OGRGeometry *poSpatFilter );
    00077     virtual     ~OGRGenSQLResultsLayer();
    00078
    00079     virtual OGRGeometry *GetSpatialFilter();
    00080
    00081     virtual void        ResetReading();
    00082     virtual OGRFeature *GetNextFeature();
    00083     virtual OGRErr      SetNextByIndex( long nIndex );
    00084     virtual OGRFeature *GetFeature( long nFID );
    00085
    00086     virtual OGRFeatureDefn *GetLayerDefn();
    00087
    00088     virtual OGRSpatialReference *GetSpatialRef();
    00089
    00090     virtual int         GetFeatureCount( int bForce = TRUE );
    00091     virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
    00092
    00093     virtual int         TestCapability( const char * );
    00094 };
    00095
    00096 #endif /* ndef _OGR_GENSQL_H_INCLUDED */
    00097

Generated for GDAL by 1.5.9.