GDAL
ogreditablelayer.h
00001 /******************************************************************************
00002  * $Id: ogreditablelayer.h 36501 2016-11-25 14:09:24Z rouault $
00003  *
00004  * Project:  OpenGIS Simple Features Reference Implementation
00005  * Purpose:  Defines OGREditableLayer class
00006  * Author:   Even Rouault <even.rouault at spatialys.com>
00007  *
00008  ******************************************************************************
00009  * Copyright (c) 2015, Even Rouault <even.rouault at spatialys.com>
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 OGREDITABLELAYER_H_INCLUDED
00031 #define OGREDITABLELAYER_H_INCLUDED
00032 
00034 #include "ogrlayerdecorator.h"
00035 #include <set>
00036 
00037 class CPL_DLL IOGREditableLayerSynchronizer
00038 {
00039     public:
00040         virtual ~IOGREditableLayerSynchronizer();
00041 
00042         virtual OGRErr EditableSyncToDisk(OGRLayer* poEditableLayer,
00043                                           OGRLayer** ppoDecoratedLayer) = 0;
00044 };
00045 
00046 class CPL_DLL OGREditableLayer : public OGRLayerDecorator
00047 {
00048   protected:
00049 
00050     IOGREditableLayerSynchronizer *m_poSynchronizer;
00051     bool                           m_bTakeOwnershipSynchronizer;
00052     OGRFeatureDefn                *m_poEditableFeatureDefn;
00053     GIntBig                        m_nNextFID;
00054     std::set<GIntBig>              m_oSetCreated;
00055     std::set<GIntBig>              m_oSetEdited;
00056     std::set<GIntBig>              m_oSetDeleted;
00057     std::set<GIntBig>::iterator    m_oIter;
00058     std::set<CPLString>            m_oSetDeletedFields;
00059     OGRLayer                      *m_poMemLayer;
00060     bool                           m_bStructureModified;
00061     bool                           m_bSupportsCreateGeomField;
00062     bool                           m_bSupportsCurveGeometries;
00063 
00064     OGRFeature                    *Translate(OGRFeatureDefn* poTargetDefn,
00065                                              OGRFeature* poSrcFeature,
00066                                              bool bCanStealSrcFeature,
00067                                              bool bHideDeletedFields);
00068     void                           DetectNextFID();
00069     int                            GetSrcGeomFieldIndex(int iGeomField);
00070 
00071   public:
00072 
00073                        OGREditableLayer(OGRLayer* poDecoratedLayer,
00074                                         bool bTakeOwnershipDecoratedLayer,
00075                                         IOGREditableLayerSynchronizer* poSynchronizer,
00076                                         bool bTakeOwnershipSynchronizer);
00077     virtual           ~OGREditableLayer();
00078 
00079     void                SetNextFID(GIntBig nNextFID);
00080     void                SetSupportsCreateGeomField(bool SupportsCreateGeomField);
00081     void                SetSupportsCurveGeometries(bool bSupportsCurveGeometries);
00082 
00083     virtual OGRGeometry *GetSpatialFilter() override;
00084     virtual void        SetSpatialFilter( OGRGeometry * ) override;
00085     virtual void        SetSpatialFilterRect( double dfMinX, double dfMinY,
00086                                               double dfMaxX, double dfMaxY ) override;
00087     virtual void        SetSpatialFilter( int iGeomField, OGRGeometry * ) override;
00088     virtual void        SetSpatialFilterRect( int iGeomField, double dfMinX, double dfMinY,
00089                                               double dfMaxX, double dfMaxY ) override;
00090 
00091     virtual OGRErr      SetAttributeFilter( const char * ) override;
00092 
00093     virtual void        ResetReading() override;
00094     virtual OGRFeature *GetNextFeature() override;
00095     virtual OGRErr      SetNextByIndex( GIntBig nIndex ) override;
00096     virtual OGRFeature *GetFeature( GIntBig nFID ) override;
00097     virtual OGRErr      ISetFeature( OGRFeature *poFeature ) override;
00098     virtual OGRErr      ICreateFeature( OGRFeature *poFeature ) override;
00099     virtual OGRErr      DeleteFeature( GIntBig nFID ) override;
00100 
00101     virtual OGRwkbGeometryType GetGeomType() override;
00102     virtual OGRFeatureDefn *GetLayerDefn() override;
00103 
00104     virtual OGRSpatialReference *GetSpatialRef() override;
00105 
00106     virtual GIntBig     GetFeatureCount( int bForce = TRUE ) override;
00107     virtual OGRErr      GetExtent(int iGeomField, OGREnvelope *psExtent, int bForce = TRUE) override;
00108     virtual OGRErr      GetExtent(OGREnvelope *psExtent, int bForce = TRUE) override;
00109 
00110     virtual int         TestCapability( const char * ) override;
00111 
00112     virtual OGRErr      CreateField( OGRFieldDefn *poField,
00113                                      int bApproxOK = TRUE ) override;
00114     virtual OGRErr      DeleteField( int iField ) override;
00115     virtual OGRErr      ReorderFields( int* panMap ) override;
00116     virtual OGRErr      AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn, int nFlags ) override;
00117 
00118     virtual OGRErr      CreateGeomField( OGRGeomFieldDefn *poField,
00119                                          int bApproxOK = TRUE ) override;
00120 
00121     virtual OGRErr      SyncToDisk() override;
00122 
00123     virtual OGRErr      StartTransaction() override;
00124     virtual OGRErr      CommitTransaction() override;
00125     virtual OGRErr      RollbackTransaction() override;
00126 
00127     virtual const char *GetGeometryColumn() override;
00128 };
00130 
00131 #endif // OGREDITABLELAYER_H_INCLUDED

Generated for GDAL by doxygen 1.7.6.1.