@@ -32,7 +32,7 @@ PDFWritableVectorDataset::PDFWritableVectorDataset()
3232
3333PDFWritableVectorDataset::~PDFWritableVectorDataset ()
3434{
35- PDFWritableVectorDataset::SyncToDisk ();
35+ PDFWritableVectorDataset::Close ();
3636
3737 CSLDestroy (papszOptions);
3838 for (int i = 0 ; i < nLayers; i++)
@@ -151,13 +151,22 @@ int PDFWritableVectorDataset::GetLayerCount() const
151151}
152152
153153/* ***********************************************************************/
154- /* SyncToDisk() */
154+ /* Close() */
155155/* ***********************************************************************/
156156
157- OGRErr PDFWritableVectorDataset::SyncToDisk ()
157+ CPLErr PDFWritableVectorDataset::Close ()
158+ {
159+ return PDFWritableVectorDataset::FlushCache (true );
160+ }
161+
162+ /* ***********************************************************************/
163+ /* FlushCache() */
164+ /* ***********************************************************************/
165+
166+ CPLErr PDFWritableVectorDataset::FlushCache (bool /* bAtClosing*/ )
158167{
159168 if (nLayers == 0 || !bModified)
160- return OGRERR_NONE ;
169+ return CE_None ;
161170
162171 bModified = FALSE ;
163172
@@ -177,7 +186,7 @@ OGRErr PDFWritableVectorDataset::SyncToDisk()
177186 {
178187 CPLError (CE_Failure, CPLE_AppDefined,
179188 " Cannot compute spatial extent of features" );
180- return OGRERR_FAILURE ;
189+ return CE_Failure ;
181190 }
182191
183192 double dfRatio = (sGlobalExtent .MaxY - sGlobalExtent .MinY ) /
@@ -192,7 +201,7 @@ OGRErr PDFWritableVectorDataset::SyncToDisk()
192201 if (dfHeight < 1 || dfHeight > INT_MAX || std::isnan (dfHeight))
193202 {
194203 CPLError (CE_Failure, CPLE_AppDefined, " Invalid image dimensions" );
195- return OGRERR_FAILURE ;
204+ return CE_Failure ;
196205 }
197206 nHeight = static_cast <int >(dfHeight);
198207 }
@@ -203,7 +212,7 @@ OGRErr PDFWritableVectorDataset::SyncToDisk()
203212 if (dfWidth < 1 || dfWidth > INT_MAX || std::isnan (dfWidth))
204213 {
205214 CPLError (CE_Failure, CPLE_AppDefined, " Invalid image dimensions" );
206- return OGRERR_FAILURE ;
215+ return CE_Failure ;
207216 }
208217 nWidth = static_cast <int >(dfWidth);
209218 }
@@ -222,7 +231,7 @@ OGRErr PDFWritableVectorDataset::SyncToDisk()
222231 {
223232 CPLError (CE_Failure, CPLE_AppDefined,
224233 " Cannot compute spatial extent of features" );
225- return OGRERR_FAILURE ;
234+ return CE_Failure ;
226235 }
227236
228237 PDFCompressMethod eStreamCompressMethod = COMPRESS_DEFLATE;
@@ -325,7 +334,7 @@ OGRErr PDFWritableVectorDataset::SyncToDisk()
325334 {
326335 CPLError (CE_Failure, CPLE_OpenFailed, " Unable to create PDF file %s.\n " ,
327336 GetDescription ());
328- return OGRERR_FAILURE ;
337+ return CE_Failure ;
329338 }
330339
331340 GDALPDFWriter oWriter (fp);
@@ -382,5 +391,5 @@ OGRErr PDFWritableVectorDataset::SyncToDisk()
382391
383392 delete poSrcDS;
384393
385- return OGRERR_NONE ;
394+ return CE_None ;
386395}
0 commit comments