1 : /******************************************************************************
2 : * $Id: ogrlayerdecorator.cpp 24633 2012-07-01 14:37:25Z rouault $
3 : *
4 : * Project: OpenGIS Simple Features Reference Implementation
5 : * Purpose: Implements OGRLayerDecorator class
6 : * Author: Even Rouault, even dot rouault at mines dash paris dot org
7 : *
8 : ******************************************************************************
9 : * Copyright (c) 2012, Even Rouault <even dot rouault at mines dash paris dot org>
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 : #include "ogrlayerdecorator.h"
31 :
32 : CPL_CVSID("$Id: ogrlayerdecorator.cpp 24633 2012-07-01 14:37:25Z rouault $");
33 :
34 11 : OGRLayerDecorator::OGRLayerDecorator(OGRLayer* poDecoratedLayer,
35 : int bTakeOwnership) :
36 : m_poDecoratedLayer(poDecoratedLayer),
37 11 : m_bHasOwnership(bTakeOwnership)
38 : {
39 11 : CPLAssert(poDecoratedLayer != NULL);
40 11 : }
41 :
42 11 : OGRLayerDecorator::~OGRLayerDecorator()
43 : {
44 11 : if( m_bHasOwnership )
45 11 : delete m_poDecoratedLayer;
46 11 : }
47 :
48 :
49 1 : OGRGeometry *OGRLayerDecorator::GetSpatialFilter()
50 : {
51 1 : return m_poDecoratedLayer->GetSpatialFilter();
52 : }
53 :
54 0 : void OGRLayerDecorator::SetSpatialFilter( OGRGeometry * poGeom )
55 : {
56 0 : m_poDecoratedLayer->SetSpatialFilter(poGeom);
57 0 : }
58 :
59 0 : void OGRLayerDecorator::SetSpatialFilterRect( double dfMinX, double dfMinY,
60 : double dfMaxX, double dfMaxY )
61 : {
62 0 : m_poDecoratedLayer->SetSpatialFilterRect(dfMinX, dfMinY, dfMaxX, dfMaxY);
63 0 : }
64 :
65 29 : OGRErr OGRLayerDecorator::SetAttributeFilter( const char * poAttrFilter )
66 : {
67 29 : return m_poDecoratedLayer->SetAttributeFilter(poAttrFilter);
68 : }
69 :
70 47 : void OGRLayerDecorator::ResetReading()
71 : {
72 47 : m_poDecoratedLayer->ResetReading();
73 47 : }
74 :
75 0 : OGRFeature *OGRLayerDecorator::GetNextFeature()
76 : {
77 0 : return m_poDecoratedLayer->GetNextFeature();
78 : }
79 :
80 4 : OGRErr OGRLayerDecorator::SetNextByIndex( long nIndex )
81 : {
82 4 : return m_poDecoratedLayer->SetNextByIndex(nIndex);
83 : }
84 :
85 0 : OGRFeature *OGRLayerDecorator::GetFeature( long nFID )
86 : {
87 0 : return m_poDecoratedLayer->GetFeature(nFID);
88 : }
89 :
90 0 : OGRErr OGRLayerDecorator::SetFeature( OGRFeature *poFeature )
91 : {
92 0 : return m_poDecoratedLayer->SetFeature(poFeature);
93 : }
94 :
95 0 : OGRErr OGRLayerDecorator::CreateFeature( OGRFeature *poFeature )
96 : {
97 0 : return m_poDecoratedLayer->CreateFeature(poFeature);
98 : }
99 :
100 0 : OGRErr OGRLayerDecorator::DeleteFeature( long nFID )
101 : {
102 0 : return m_poDecoratedLayer->DeleteFeature(nFID);
103 : }
104 :
105 119 : const char *OGRLayerDecorator::GetName()
106 : {
107 119 : return m_poDecoratedLayer->GetName();
108 : }
109 :
110 1 : OGRwkbGeometryType OGRLayerDecorator::GetGeomType()
111 : {
112 1 : return m_poDecoratedLayer->GetGeomType();
113 : }
114 :
115 54 : OGRFeatureDefn *OGRLayerDecorator::GetLayerDefn()
116 : {
117 54 : return m_poDecoratedLayer->GetLayerDefn();
118 : }
119 :
120 0 : OGRSpatialReference *OGRLayerDecorator::GetSpatialRef()
121 : {
122 0 : return m_poDecoratedLayer->GetSpatialRef();
123 : }
124 :
125 1 : int OGRLayerDecorator::GetFeatureCount( int bForce )
126 : {
127 1 : return m_poDecoratedLayer->GetFeatureCount(bForce);
128 : }
129 :
130 0 : OGRErr OGRLayerDecorator::GetExtent(OGREnvelope *psExtent, int bForce)
131 : {
132 0 : return m_poDecoratedLayer->GetExtent(psExtent, bForce);
133 : }
134 :
135 0 : int OGRLayerDecorator::TestCapability( const char * pszCapability )
136 : {
137 0 : return m_poDecoratedLayer->TestCapability(pszCapability);
138 : }
139 :
140 0 : OGRErr OGRLayerDecorator::CreateField( OGRFieldDefn *poField,
141 : int bApproxOK )
142 : {
143 0 : return m_poDecoratedLayer->CreateField(poField, bApproxOK);
144 : }
145 :
146 0 : OGRErr OGRLayerDecorator::DeleteField( int iField )
147 : {
148 0 : return m_poDecoratedLayer->DeleteField(iField);
149 : }
150 :
151 0 : OGRErr OGRLayerDecorator::ReorderFields( int* panMap )
152 : {
153 0 : return m_poDecoratedLayer->ReorderFields(panMap);
154 : }
155 :
156 0 : OGRErr OGRLayerDecorator::AlterFieldDefn( int iField, OGRFieldDefn* poNewFieldDefn, int nFlags )
157 : {
158 0 : return m_poDecoratedLayer->AlterFieldDefn(iField, poNewFieldDefn, nFlags);
159 : }
160 :
161 1 : OGRErr OGRLayerDecorator::SyncToDisk()
162 : {
163 1 : return m_poDecoratedLayer->SyncToDisk();
164 : }
165 :
166 0 : OGRStyleTable *OGRLayerDecorator::GetStyleTable()
167 : {
168 0 : return m_poDecoratedLayer->GetStyleTable();
169 : }
170 :
171 0 : void OGRLayerDecorator::SetStyleTableDirectly( OGRStyleTable *poStyleTable )
172 : {
173 0 : return m_poDecoratedLayer->SetStyleTableDirectly(poStyleTable);
174 : }
175 :
176 0 : void OGRLayerDecorator::SetStyleTable(OGRStyleTable *poStyleTable)
177 : {
178 0 : return m_poDecoratedLayer->SetStyleTable(poStyleTable);
179 : }
180 :
181 0 : OGRErr OGRLayerDecorator::StartTransaction()
182 : {
183 0 : return m_poDecoratedLayer->StartTransaction();
184 : }
185 :
186 0 : OGRErr OGRLayerDecorator::CommitTransaction()
187 : {
188 0 : return m_poDecoratedLayer->CommitTransaction();
189 : }
190 :
191 0 : OGRErr OGRLayerDecorator::RollbackTransaction()
192 : {
193 0 : return m_poDecoratedLayer->RollbackTransaction();
194 : }
195 :
196 0 : const char *OGRLayerDecorator::GetFIDColumn()
197 : {
198 0 : return m_poDecoratedLayer->GetFIDColumn();
199 : }
200 :
201 0 : const char *OGRLayerDecorator::GetGeometryColumn()
202 : {
203 0 : return m_poDecoratedLayer->GetGeometryColumn();
204 : }
205 :
206 18 : OGRErr OGRLayerDecorator::SetIgnoredFields( const char **papszFields )
207 : {
208 18 : return m_poDecoratedLayer->SetIgnoredFields(papszFields);
209 : }
|