ogreditablelayer.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef OGREDITABLELAYER_H_INCLUDED
00031 #define OGREDITABLELAYER_H_INCLUDED
00032
00033 #include "ogrlayerdecorator.h"
00034 #include <set>
00035
00036 class CPL_DLL IOGREditableLayerSynchronizer
00037 {
00038 public:
00039 virtual ~IOGREditableLayerSynchronizer();
00040
00041 virtual OGRErr EditableSyncToDisk(OGRLayer* poEditableLayer,
00042 OGRLayer** ppoDecoratedLayer) = 0;
00043 };
00044
00045 class CPL_DLL OGREditableLayer : public OGRLayerDecorator
00046 {
00047 protected:
00048
00049 IOGREditableLayerSynchronizer *m_poSynchronizer;
00050 bool m_bTakeOwnershipSynchronizer;
00051 OGRFeatureDefn *m_poEditableFeatureDefn;
00052 GIntBig m_nNextFID;
00053 std::set<GIntBig> m_oSetCreated;
00054 std::set<GIntBig> m_oSetEdited;
00055 std::set<GIntBig> m_oSetDeleted;
00056 std::set<GIntBig>::iterator m_oIter;
00057 std::set<CPLString> m_oSetDeletedFields;
00058 OGRLayer *m_poMemLayer;
00059 bool m_bStructureModified;
00060 bool m_bSupportsCreateGeomField;
00061 bool m_bSupportsCurveGeometries;
00062
00063 OGRFeature *Translate(OGRFeatureDefn* poTargetDefn,
00064 OGRFeature* poSrcFeature,
00065 bool bCanStealSrcFeature,
00066 bool bHideDeletedFields);
00067 void DetectNextFID();
00068 int GetSrcGeomFieldIndex(int iGeomField);
00069
00070 public:
00071
00072 OGREditableLayer(OGRLayer* poDecoratedLayer,
00073 bool bTakeOwnershipDecoratedLayer,
00074 IOGREditableLayerSynchronizer* poSynchronizer,
00075 bool bTakeOwnershipSynchronizer);
00076 virtual ~OGREditableLayer();
00077
00078 void SetNextFID(GIntBig nNextFID);
00079 void SetSupportsCreateGeomField(bool SupportsCreateGeomField);
00080 void SetSupportsCurveGeometries(bool bSupportsCurveGeometries);
00081
00082 virtual OGRGeometry *GetSpatialFilter();
00083 virtual void SetSpatialFilter( OGRGeometry * );
00084 virtual void SetSpatialFilterRect( double dfMinX, double dfMinY,
00085 double dfMaxX, double dfMaxY );
00086 virtual void SetSpatialFilter( int iGeomField, OGRGeometry * );
00087 virtual void SetSpatialFilterRect( int iGeomField, double dfMinX, double dfMinY,
00088 double dfMaxX, double dfMaxY );
00089
00090 virtual OGRErr SetAttributeFilter( const char * );
00091
00092 virtual void ResetReading();
00093 virtual OGRFeature *GetNextFeature();
00094 virtual OGRErr SetNextByIndex( GIntBig nIndex );
00095 virtual OGRFeature *GetFeature( GIntBig nFID );
00096 virtual OGRErr ISetFeature( OGRFeature *poFeature );
00097 virtual OGRErr ICreateFeature( OGRFeature *poFeature );
00098 virtual OGRErr DeleteFeature( GIntBig nFID );
00099
00100 virtual OGRwkbGeometryType GetGeomType();
00101 virtual OGRFeatureDefn *GetLayerDefn();
00102
00103 virtual OGRSpatialReference *GetSpatialRef();
00104
00105 virtual GIntBig GetFeatureCount( int bForce = TRUE );
00106 virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent, int bForce = TRUE);
00107 virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
00108
00109 virtual int TestCapability( const char * );
00110
00111 virtual OGRErr CreateField( OGRFieldDefn *poField,
00112 int bApproxOK = TRUE );
00113 virtual OGRErr DeleteField( int iField );
00114 virtual OGRErr ReorderFields( int* panMap );
00115 virtual OGRErr AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn, int nFlags );
00116
00117 virtual OGRErr CreateGeomField( OGRGeomFieldDefn *poField,
00118 int bApproxOK = TRUE );
00119
00120 virtual OGRErr SyncToDisk();
00121
00122 virtual OGRErr StartTransaction();
00123 virtual OGRErr CommitTransaction();
00124 virtual OGRErr RollbackTransaction();
00125
00126 virtual const char *GetGeometryColumn();
00127 };
00128
00129 #endif // OGREDITABLELAYER_H_INCLUDED