GDAL

- Main Page
- Related Pages
- Classes
- Files

- File List
- File Members

ogreditablelayer.h
1 /******************************************************************************
2 * $Id: ogreditablelayer.h 33714 2016-03-13 05:42:13Z goatbar $
3 *
4 * Project: OpenGIS Simple Features Reference Implementation
5 * Purpose: Defines OGREditableLayer class
6 * Author: Even Rouault <even.rouault at spatialys.com>
7 *
8 ******************************************************************************
9 * Copyright (c) 2015, Even Rouault <even.rouault at spatialys.com>
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 ****************************************************************************/
29
30 #ifndef OGREDITABLELAYER_H_INCLUDED
31 #define OGREDITABLELAYER_H_INCLUDED
32
33 #include "ogrlayerdecorator.h"
34 #include <set>
35
36 class CPL_DLL IOGREditableLayerSynchronizer
37 {
38 public:
39 virtual ~IOGREditableLayerSynchronizer();
40
41 virtual OGRErr EditableSyncToDisk(OGRLayer* poEditableLayer,
42 OGRLayer** ppoDecoratedLayer) = 0;
43 };
44
45 class CPL_DLL OGREditableLayer : public OGRLayerDecorator
46 {
47 protected:
48
49 IOGREditableLayerSynchronizer *m_poSynchronizer;
50 bool m_bTakeOwnershipSynchronizer;
51 OGRFeatureDefn *m_poEditableFeatureDefn;
52 GIntBig m_nNextFID;
53 std::set<GIntBig> m_oSetCreated;
54 std::set<GIntBig> m_oSetEdited;
55 std::set<GIntBig> m_oSetDeleted;
56 std::set<GIntBig>::iterator m_oIter;
57 std::set<CPLString> m_oSetDeletedFields;
58 OGRLayer *m_poMemLayer;
59 bool m_bStructureModified;
60 bool m_bSupportsCreateGeomField;
61 bool m_bSupportsCurveGeometries;
62
63 OGRFeature *Translate(OGRFeatureDefn* poTargetDefn,
64 OGRFeature* poSrcFeature,
65 bool bCanStealSrcFeature,
66 bool bHideDeletedFields);
67 void DetectNextFID();
68 int GetSrcGeomFieldIndex(int iGeomField);
69
70 public:
71
72 OGREditableLayer(OGRLayer* poDecoratedLayer,
73 bool bTakeOwnershipDecoratedLayer,
74 IOGREditableLayerSynchronizer* poSynchronizer,
75 bool bTakeOwnershipSynchronizer);
76 virtual ~OGREditableLayer();
77
78 void SetNextFID(GIntBig nNextFID);
79 void SetSupportsCreateGeomField(bool SupportsCreateGeomField);
80 void SetSupportsCurveGeometries(bool bSupportsCurveGeometries);
81
82 virtual OGRGeometry *GetSpatialFilter();
83 virtual void SetSpatialFilter( OGRGeometry * );
84 virtual void SetSpatialFilterRect( double dfMinX, double dfMinY,
85 double dfMaxX, double dfMaxY );
86 virtual void SetSpatialFilter( int iGeomField, OGRGeometry * );
87 virtual void SetSpatialFilterRect( int iGeomField, double dfMinX, double dfMinY,
88 double dfMaxX, double dfMaxY );
89
90 virtual OGRErr SetAttributeFilter( const char * );
91
92 virtual void ResetReading();
93 virtual OGRFeature *GetNextFeature();
94 virtual OGRErr SetNextByIndex( GIntBig nIndex );
95 virtual OGRFeature *GetFeature( GIntBig nFID );
96 virtual OGRErr ISetFeature( OGRFeature *poFeature );
97 virtual OGRErr ICreateFeature( OGRFeature *poFeature );
98 virtual OGRErr DeleteFeature( GIntBig nFID );
99
100 virtual OGRwkbGeometryType GetGeomType();
101 virtual OGRFeatureDefn *GetLayerDefn();
102
103 virtual OGRSpatialReference *GetSpatialRef();
104
105 virtual GIntBig GetFeatureCount( int bForce = TRUE );
106 virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent, int bForce = TRUE);
107 virtual OGRErr GetExtent(OGREnvelope *psExtent, int bForce = TRUE);
108
109 virtual int TestCapability( const char * );
110
111 virtual OGRErr CreateField( OGRFieldDefn *poField,
112 int bApproxOK = TRUE );
113 virtual OGRErr DeleteField( int iField );
114 virtual OGRErr ReorderFields( int* panMap );
115 virtual OGRErr AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn, int nFlags );
116
117 virtual OGRErr CreateGeomField( OGRGeomFieldDefn *poField,
118 int bApproxOK = TRUE );
119
120 virtual OGRErr SyncToDisk();
121
122 virtual OGRErr StartTransaction();
123 virtual OGRErr CommitTransaction();
124 virtual OGRErr RollbackTransaction();
125
126 virtual const char *GetGeometryColumn();
127 };
128
129 #endif // OGREDITABLELAYER_H_INCLUDED
OGRLayerDecorator::SetSpatialFilterRect
virtual void SetSpatialFilterRect(double dfMinX, double dfMinY, double dfMaxX, double dfMaxY)
Set a new rectangular spatial filter.
Definition: ogrlayerdecorator.cpp:68
OGREditableLayer
Definition: ogreditablelayer.h:45
OGRLayerDecorator::ResetReading
virtual void ResetReading()
Reset feature reading to start on the first feature.
Definition: ogrlayerdecorator.cpp:88
OGRLayerDecorator::SetNextByIndex
virtual OGRErr SetNextByIndex(GIntBig nIndex)
Move read cursor to the nIndex'th feature in the current resultset.
Definition: ogrlayerdecorator.cpp:100
OGRLayerDecorator::DeleteFeature
virtual OGRErr DeleteFeature(GIntBig nFID)
Delete feature from layer.
Definition: ogrlayerdecorator.cpp:124
OGRLayerDecorator::GetExtent
virtual OGRErr GetExtent(int iGeomField, OGREnvelope *psExtent, int bForce=TRUE)
Fetch the extent of this layer, on the specified geometry field.
Definition: ogrlayerdecorator.cpp:166
OGRLayerDecorator::TestCapability
virtual int TestCapability(const char *)
Test if this layer supported the named capability.
Definition: ogrlayerdecorator.cpp:172
OGRGeomFieldDefn
Definition of a geometry field of an OGRFeatureDefn.
Definition: ogr_feature.h:143
OGRLayerDecorator::GetSpatialRef
virtual OGRSpatialReference * GetSpatialRef()
Fetch the spatial reference system for this layer.
Definition: ogrlayerdecorator.cpp:148
OGRLayerDecorator::CreateField
virtual OGRErr CreateField(OGRFieldDefn *poField, int bApproxOK=TRUE)
Create a new field on a layer.
Definition: ogrlayerdecorator.cpp:178
OGRLayerDecorator::CreateGeomField
virtual OGRErr CreateGeomField(OGRGeomFieldDefn *poField, int bApproxOK=TRUE)
Create a new geometry field on a layer.
Definition: ogrlayerdecorator.cpp:203
OGRLayerDecorator
Definition: ogrlayerdecorator.h:35
OGRLayerDecorator::GetFeature
virtual OGRFeature * GetFeature(GIntBig nFID)
Fetch a feature by its identifier.
Definition: ogrlayerdecorator.cpp:106
OGRFeatureDefn
Definition of a feature class or feature layer.
Definition: ogr_feature.h:206
IOGREditableLayerSynchronizer
Definition: ogreditablelayer.h:36
OGRFieldDefn
Definition of an attribute of an OGRFeatureDefn.
Definition: ogr_feature.h:62
OGRLayerDecorator::DeleteField
virtual OGRErr DeleteField(int iField)
Delete an existing field on a layer.
Definition: ogrlayerdecorator.cpp:185
OGRLayerDecorator::GetLayerDefn
virtual OGRFeatureDefn * GetLayerDefn()
Fetch the schema information for this layer.
Definition: ogrlayerdecorator.cpp:142
OGRwkbGeometryType
OGRwkbGeometryType
List of well known binary geometry types.
Definition: ogr_core.h:333
OGRGeometry
Abstract base class for all geometry classes.
Definition: ogr_geometry.h:104
OGRLayerDecorator::AlterFieldDefn
virtual OGRErr AlterFieldDefn(int iField, OGRFieldDefn *poNewFieldDefn, int nFlags)
Alter the definition of an existing field on a layer.
Definition: ogrlayerdecorator.cpp:197
OGRLayerDecorator::GetFeatureCount
virtual GIntBig GetFeatureCount(int bForce=TRUE)
Fetch the feature count in this layer.
Definition: ogrlayerdecorator.cpp:154
OGRLayerDecorator::GetGeometryColumn
virtual const char * GetGeometryColumn()
This method returns the name of the underlying database column being used as the geometry column...
Definition: ogrlayerdecorator.cpp:258
OGRLayerDecorator::ReorderFields
virtual OGRErr ReorderFields(int *panMap)
Reorder all the fields of a layer.
Definition: ogrlayerdecorator.cpp:191
OGRSpatialReference
This class represents an OpenGIS Spatial Reference System, and contains methods for converting betwee...
Definition: ogr_spatialref.h:129
OGRLayerDecorator::GetNextFeature
virtual OGRFeature * GetNextFeature()
Fetch the next available feature from this layer.
Definition: ogrlayerdecorator.cpp:94
OGREnvelope
Simple container for a bounding region.
Definition: ogr_core.h:48
OGRLayerDecorator::ICreateFeature
virtual OGRErr ICreateFeature(OGRFeature *poFeature)
Create and write a new feature within a layer.
Definition: ogrlayerdecorator.cpp:118
OGRLayer
This class represents a layer of simple features, with access methods.
Definition: ogrsf_frmts.h:66
OGRFeature
A simple feature, including geometry and attributes.
Definition: ogr_feature.h:274
OGRLayerDecorator::GetGeomType
virtual OGRwkbGeometryType GetGeomType()
Return the layer geometry type.
Definition: ogrlayerdecorator.cpp:136
OGRLayerDecorator::SetAttributeFilter
virtual OGRErr SetAttributeFilter(const char *)
Set a new attribute query.
Definition: ogrlayerdecorator.cpp:82
OGRLayerDecorator::GetSpatialFilter
virtual OGRGeometry * GetSpatialFilter()
This method returns the current spatial filter for this layer.
Definition: ogrlayerdecorator.cpp:50
OGRLayerDecorator::ISetFeature
virtual OGRErr ISetFeature(OGRFeature *poFeature)
Rewrite an existing feature.
Definition: ogrlayerdecorator.cpp:112
OGRLayerDecorator::SyncToDisk
virtual OGRErr SyncToDisk()
Flush pending changes to disk.
Definition: ogrlayerdecorator.cpp:210
OGRLayerDecorator::SetSpatialFilter
virtual void SetSpatialFilter(OGRGeometry *)
Set a new spatial filter.
Definition: ogrlayerdecorator.cpp:56

Generated for GDAL by 1.8.8.