[Qgis-developer] empty ds/layer creation duplicated in QgsOgrProvider and QgsVectorFileWriter
Marco Hugentobler
marco.hugentobler at sourcepole.ch
Sun Jul 15 22:48:26 PDT 2012
Hi Giuseppe
createEmptyDataSource is the older method of those two, it was written
before QgsVectorFileWriter existed.
I agree it makes sens to remove it and replace with a call to the vector
file writer.
Regards,
Marco
Am 14.07.2012 15:40, schrieb Giuseppe Sucameli:
> Hi devs,
>
> today looking at the OGRProvider I've found some duplications:
>
> QGISEXTERN bool createEmptyDataSource(...)
> QGISEXTERN QgsVectorLayerImport::ImportError createEmptyLayer(...)
>
> Both accomplish the same task (empty LAYER creation), but
>
> createEmptyLayer() uses the QgsVectorFileWriter class,
>
> createEmptyDataSource() contains code pretty similar to the one
> within the QgsVectorFileWriter class (duplicated code).
>
> The createEmptyLayer is used by the ImportVectorLayer feature
> I developed for the GSoC the last year, so functions with the same
> name are also present in both the PG and SL providers.
> I don't know if the createEmptyDataSource() was already present at
> that time (my apologize if it was)...
>
> BTW having duplicated code between the provider and
> QgsVectorFileWriter class is not good.
> For this reason I called QgsVectorFileWriter methods from "my"
> createEmptyLayer(), waiting for the API break to move the code
> from QgsVectorFileWriter class to the OGR provider.
>
> Is it time to break API or should we just clean it up removing
> the createEmptyDataSource() function and replacing all its
> occurrences (it's used in src/gui/qgsnewvectorlayerdialog.cpp only)
> with the createEmptyLayer() function?
>
> Regards.
>
--
Dr. Marco Hugentobler
Sourcepole - Linux & Open Source Solutions
Weberstrasse 5, CH-8004 Zürich, Switzerland
marco.hugentobler at sourcepole.ch http://www.sourcepole.ch
Technical Advisor QGIS Project Steering Committee
More information about the Qgis-developer
mailing list