enabled the new method to create vectorlayers and put an ifdef around OGRSpatialReference->Release

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@4076 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2005-10-13 18:20:43 +00:00
parent 870497c998
commit 699ed3ecd0
2 changed files with 9 additions and 4 deletions

View File

@ -25,6 +25,7 @@ email : sherman at mrcc.com
#include <cfloat>
#include <cassert>
#include <gdal_version.h>
#include <ogrsf_frmts.h>
#include <ogr_geometry.h>
#include <ogr_spatialref.h>
@ -1344,7 +1345,7 @@ const std::list<std::pair<QString, QString> >& attributes)
}
OGRLayer* layer;
layer = dataSource->CreateLayer(uri, reference, (OGRwkbGeometryType)vectortype, NULL);
layer = dataSource->CreateLayer(NULL, reference, (OGRwkbGeometryType)vectortype, NULL);
if(layer == NULL)
{
return false;
@ -1386,10 +1387,14 @@ const std::list<std::pair<QString, QString> >& attributes)
}
OGRDataSource::DestroyDataSource(dataSource);
qWarning("GDAL Version number is: "+QString::number(GDAL_VERSION_NUM));
#if GDAL_VERSION_NUM >= 1310
if(reference)
{
reference->Release();
}
#endif //GDAL_VERSION_NUM
return true;
}

View File

@ -2025,7 +2025,6 @@ void QgisApp::newVectorLayer()
filename += ".shp";
}
#if 0
//try to create the new layer with OGRProvider instead of QgsVectorFileWriter
QgsProviderRegistry * pReg = QgsProviderRegistry::instance();
QString ogrlib = pReg->library("ogr");
@ -2070,9 +2069,9 @@ const std::list<std::pair<QString, QString> >&);
qWarning("Resolving newEmptyDataSource(...) failed");;
#endif
}
}
#endif //0
}
#if 0
//create the new layer with QgsVectorFileWriter
QgsVectorFileWriter* writer=0;
@ -2131,6 +2130,7 @@ const std::list<std::pair<QString, QString> >&);
}
}
delete writer;
#endif //0
//then add the layer to the view
QStringList filelist;