mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Make QgsVectorLayerImport use QgsCoordinateReferenceSystem
references, not pointers
This commit is contained in:
parent
e683101b10
commit
a2efab0485
@ -41,6 +41,15 @@ objects are implicitly shared, returning a copy helps simplify and make code mor
|
||||
only affects third party c++ providers, and does not affect PyQGIS scripts.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsVectorLayerImport QgsVectorLayerImport
|
||||
|
||||
<ul>
|
||||
<li>QgsVectorLayerImport now takes references instead of pointers to QgsCoordinateReferenceSystem objects. Since
|
||||
QgsCoordinateReferenceSystem is now implicitly shared, using references to QgsCoordinateReferenceSystem rather than
|
||||
pointers makes for more robust, safer code. Use an invalid (default constructed) QgsCoordinateReferenceSystem
|
||||
in code which previously passed a null pointer to QgsVectorLayerImport.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsVectorFileWriter QgsVectorFileWriter
|
||||
|
||||
<ul>
|
||||
|
@ -31,27 +31,50 @@ class QProgressDialog;
|
||||
ErrUserCancelled, /*!< User cancelled the import*/
|
||||
};
|
||||
|
||||
/** Write contents of vector layer to a different datasource */
|
||||
/**
|
||||
* Writes the contents of vector layer to a different datasource.
|
||||
* @param layer source layer
|
||||
* @param uri URI for destination data source
|
||||
* @param providerKey string key for destination data provider
|
||||
* @param destCRS destination CRS, or an invalid (default constructed) CRS if
|
||||
* not available
|
||||
* @param onlySelected set to true to export only selected features
|
||||
* @param errorMessage if non-null, will be set to any error messages
|
||||
* @param skipAttributeCreation set to true to skip exporting feature attributes
|
||||
* @param options optional provider dataset options
|
||||
* @param progress optional progress dialog to show progress of export
|
||||
* @returns NoError for a successful export, or encountered error
|
||||
*/
|
||||
static ImportError importLayer( QgsVectorLayer* layer,
|
||||
const QString& uri,
|
||||
const QString& providerKey,
|
||||
const QgsCoordinateReferenceSystem *destCRS,
|
||||
const QgsCoordinateReferenceSystem& destCRS,
|
||||
bool onlySelected = false,
|
||||
QString *errorMessage /Out/ = 0,
|
||||
QString *errorMessage /Out/ = nullptr,
|
||||
bool skipAttributeCreation = false,
|
||||
QMap<QString, QVariant> *options = 0,
|
||||
QProgressDialog *progress = 0
|
||||
QMap<QString, QVariant> *options = nullptr,
|
||||
QProgressDialog *progress = nullptr
|
||||
);
|
||||
|
||||
/** Create a empty layer and add fields to it */
|
||||
/** Constructor for QgsVectorLayerImport.
|
||||
* @param uri URI for destination data source
|
||||
* @param provider string key for destination data provider
|
||||
* @param fields fields to include in created layer
|
||||
* @param geometryType destination geometry type
|
||||
* @param crs desired CRS, or an invalid (default constructed) CRS if
|
||||
* not available
|
||||
* @param overwrite set to true to overwrite any existing data source
|
||||
* @param options optional provider dataset options
|
||||
* @param progress optional progress dialog to show progress of export
|
||||
*/
|
||||
QgsVectorLayerImport( const QString &uri,
|
||||
const QString &provider,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType geometryType,
|
||||
const QgsCoordinateReferenceSystem* crs,
|
||||
const QgsCoordinateReferenceSystem& crs,
|
||||
bool overwrite = false,
|
||||
const QMap<QString, QVariant> *options = 0,
|
||||
QProgressDialog *progress = 0
|
||||
const QMap<QString, QVariant> *options = nullptr,
|
||||
QProgressDialog *progress = nullptr
|
||||
);
|
||||
|
||||
/** Checks whether there were any errors */
|
||||
|
@ -34,7 +34,7 @@ typedef QgsVectorLayerImport::ImportError createEmptyLayer_t(
|
||||
const QString &uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType geometryType,
|
||||
const QgsCoordinateReferenceSystem *destCRS,
|
||||
const QgsCoordinateReferenceSystem &destCRS,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdx,
|
||||
QString *errorMessage,
|
||||
@ -46,7 +46,7 @@ QgsVectorLayerImport::QgsVectorLayerImport( const QString &uri,
|
||||
const QString &providerKey,
|
||||
const QgsFields& fields,
|
||||
QGis::WkbType geometryType,
|
||||
const QgsCoordinateReferenceSystem* crs,
|
||||
const QgsCoordinateReferenceSystem& crs,
|
||||
bool overwrite,
|
||||
const QMap<QString, QVariant> *options,
|
||||
QProgressDialog *progress )
|
||||
@ -206,21 +206,21 @@ QgsVectorLayerImport::ImportError
|
||||
QgsVectorLayerImport::importLayer( QgsVectorLayer* layer,
|
||||
const QString& uri,
|
||||
const QString& providerKey,
|
||||
const QgsCoordinateReferenceSystem *destCRS,
|
||||
const QgsCoordinateReferenceSystem& destCRS,
|
||||
bool onlySelected,
|
||||
QString *errorMessage,
|
||||
bool skipAttributeCreation,
|
||||
QMap<QString, QVariant> *options,
|
||||
QProgressDialog *progress )
|
||||
{
|
||||
const QgsCoordinateReferenceSystem* outputCRS;
|
||||
QgsCoordinateReferenceSystem outputCRS;
|
||||
QgsCoordinateTransform* ct = nullptr;
|
||||
bool shallTransform = false;
|
||||
|
||||
if ( !layer )
|
||||
return ErrInvalidLayer;
|
||||
|
||||
if ( destCRS && destCRS->isValid() )
|
||||
if ( destCRS.isValid() )
|
||||
{
|
||||
// This means we should transform
|
||||
outputCRS = destCRS;
|
||||
@ -229,7 +229,7 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer,
|
||||
else
|
||||
{
|
||||
// This means we shouldn't transform, use source CRS as output (if defined)
|
||||
outputCRS = &layer->crs();
|
||||
outputCRS = layer->crs();
|
||||
}
|
||||
|
||||
|
||||
@ -314,8 +314,8 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer,
|
||||
const QgsFeatureIds& ids = layer->selectedFeaturesIds();
|
||||
|
||||
// Create our transform
|
||||
if ( destCRS )
|
||||
ct = new QgsCoordinateTransform( layer->crs(), *destCRS );
|
||||
if ( destCRS.isValid() )
|
||||
ct = new QgsCoordinateTransform( layer->crs(), destCRS );
|
||||
|
||||
// Check for failure
|
||||
if ( !ct )
|
||||
|
@ -51,11 +51,24 @@ class CORE_EXPORT QgsVectorLayerImport
|
||||
ErrUserCancelled, /*!< User cancelled the import*/
|
||||
};
|
||||
|
||||
/** Write contents of vector layer to a different datasource */
|
||||
/**
|
||||
* Writes the contents of vector layer to a different datasource.
|
||||
* @param layer source layer
|
||||
* @param uri URI for destination data source
|
||||
* @param providerKey string key for destination data provider
|
||||
* @param destCRS destination CRS, or an invalid (default constructed) CRS if
|
||||
* not available
|
||||
* @param onlySelected set to true to export only selected features
|
||||
* @param errorMessage if non-null, will be set to any error messages
|
||||
* @param skipAttributeCreation set to true to skip exporting feature attributes
|
||||
* @param options optional provider dataset options
|
||||
* @param progress optional progress dialog to show progress of export
|
||||
* @returns NoError for a successful export, or encountered error
|
||||
*/
|
||||
static ImportError importLayer( QgsVectorLayer* layer,
|
||||
const QString& uri,
|
||||
const QString& providerKey,
|
||||
const QgsCoordinateReferenceSystem *destCRS,
|
||||
const QgsCoordinateReferenceSystem& destCRS,
|
||||
bool onlySelected = false,
|
||||
QString *errorMessage = nullptr,
|
||||
bool skipAttributeCreation = false,
|
||||
@ -63,12 +76,22 @@ class CORE_EXPORT QgsVectorLayerImport
|
||||
QProgressDialog *progress = nullptr
|
||||
);
|
||||
|
||||
/** Create a empty layer and add fields to it */
|
||||
/** Constructor for QgsVectorLayerImport.
|
||||
* @param uri URI for destination data source
|
||||
* @param provider string key for destination data provider
|
||||
* @param fields fields to include in created layer
|
||||
* @param geometryType destination geometry type
|
||||
* @param crs desired CRS, or an invalid (default constructed) CRS if
|
||||
* not available
|
||||
* @param overwrite set to true to overwrite any existing data source
|
||||
* @param options optional provider dataset options
|
||||
* @param progress optional progress dialog to show progress of export
|
||||
*/
|
||||
QgsVectorLayerImport( const QString &uri,
|
||||
const QString &provider,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType geometryType,
|
||||
const QgsCoordinateReferenceSystem* crs,
|
||||
const QgsCoordinateReferenceSystem& crs,
|
||||
bool overwrite = false,
|
||||
const QMap<QString, QVariant> *options = nullptr,
|
||||
QProgressDialog *progress = nullptr
|
||||
|
@ -270,14 +270,14 @@ QString QgsNewVectorLayerDialog::runAndCreateLayer( QWidget* parent, QString* pE
|
||||
QgsDebugMsg( "ogr provider loaded" );
|
||||
|
||||
typedef bool ( *createEmptyDataSourceProc )( const QString&, const QString&, const QString&, QGis::WkbType,
|
||||
const QList< QPair<QString, QString> >&, const QgsCoordinateReferenceSystem * );
|
||||
const QList< QPair<QString, QString> >&, const QgsCoordinateReferenceSystem & );
|
||||
createEmptyDataSourceProc createEmptyDataSource = ( createEmptyDataSourceProc ) cast_to_fptr( myLib->resolve( "createEmptyDataSource" ) );
|
||||
if ( createEmptyDataSource )
|
||||
{
|
||||
if ( geometrytype != QGis::WKBUnknown )
|
||||
{
|
||||
QgsCoordinateReferenceSystem srs = QgsCRSCache::instance()->crsBySrsId( crsId );
|
||||
if ( !createEmptyDataSource( fileName, fileformat, enc, geometrytype, attributes, &srs ) )
|
||||
if ( !createEmptyDataSource( fileName, fileformat, enc, geometrytype, attributes, srs ) )
|
||||
{
|
||||
return QString::null;
|
||||
}
|
||||
|
@ -245,13 +245,13 @@ bool QgsGeometryCheckerResultTab::exportErrorsDo( const QString& file )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
typedef bool ( *createEmptyDataSourceProc )( const QString&, const QString&, const QString&, QGis::WkbType, const QList< QPair<QString, QString> >&, const QgsCoordinateReferenceSystem * );
|
||||
typedef bool ( *createEmptyDataSourceProc )( const QString&, const QString&, const QString&, QGis::WkbType, const QList< QPair<QString, QString> >&, const QgsCoordinateReferenceSystem& );
|
||||
createEmptyDataSourceProc createEmptyDataSource = ( createEmptyDataSourceProc ) cast_to_fptr( ogrLib.resolve( "createEmptyDataSource" ) );
|
||||
if ( !createEmptyDataSource )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( !createEmptyDataSource( file, "ESRI Shapefile", mFeaturePool->getLayer()->dataProvider()->encoding(), QGis::WKBPoint, attributes, &mFeaturePool->getLayer()->crs() ) )
|
||||
if ( !createEmptyDataSource( file, "ESRI Shapefile", mFeaturePool->getLayer()->dataProvider()->encoding(), QGis::WKBPoint, attributes, mFeaturePool->getLayer()->crs() ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -361,7 +361,7 @@ bool QgsDb2ConnectionItem::handleDrop( const QMimeData* data, const QString& toS
|
||||
|
||||
QgsVectorLayerImport::ImportError err;
|
||||
QString importError;
|
||||
err = QgsVectorLayerImport::importLayer( srcLayer, uri, "DB2", &srcLayer->crs(), false, &importError, false, nullptr, progress );
|
||||
err = QgsVectorLayerImport::importLayer( srcLayer, uri, "DB2", srcLayer->crs(), false, &importError, false, nullptr, progress );
|
||||
if ( err == QgsVectorLayerImport::NoError )
|
||||
{
|
||||
importResults.append( tr( "%1: OK!" ).arg( u.name ) );
|
||||
|
@ -1263,15 +1263,14 @@ bool QgsDb2Provider::changeGeometryValues( const QgsGeometryMap &geometry_map )
|
||||
return true;
|
||||
}
|
||||
|
||||
QgsVectorLayerImport::ImportError QgsDb2Provider::createEmptyLayer(
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
const QMap<QString, QVariant> *options )
|
||||
QgsVectorLayerImport::ImportError QgsDb2Provider::createEmptyLayer( const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem& srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
const QMap<QString, QVariant> *options )
|
||||
{
|
||||
Q_UNUSED( options );
|
||||
|
||||
@ -1297,8 +1296,8 @@ QgsVectorLayerImport::ImportError QgsDb2Provider::createEmptyLayer(
|
||||
// srs->posgisSrid() seems to return the authority id which is
|
||||
// most often the EPSG id. Hopefully DB2 has defined an SRS using this
|
||||
// value as the srid / srs_id. If not, we are out of luck.
|
||||
QgsDebugMsg( "srs: " + srs->toWkt() );
|
||||
long srid = srs->postgisSrid();
|
||||
QgsDebugMsg( "srs: " + srs.toWkt() );
|
||||
long srid = srs.postgisSrid();
|
||||
QgsDebugMsg( QString( "srid: %1" ).arg( srid ) );
|
||||
if ( srid >= 0 )
|
||||
{
|
||||
@ -1740,7 +1739,7 @@ QGISEXTERN QgsVectorLayerImport::ImportError createEmptyLayer(
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
const QgsCoordinateReferenceSystem &srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
|
@ -124,7 +124,7 @@ class QgsDb2Provider : public QgsVectorDataProvider
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
const QgsCoordinateReferenceSystem& srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage = nullptr,
|
||||
|
@ -426,7 +426,7 @@ bool QgsMssqlConnectionItem::handleDrop( const QMimeData* data, const QString& t
|
||||
|
||||
QgsVectorLayerImport::ImportError err;
|
||||
QString importError;
|
||||
err = QgsVectorLayerImport::importLayer( srcLayer, uri, "mssql", &srcLayer->crs(), false, &importError, false, nullptr, progress );
|
||||
err = QgsVectorLayerImport::importLayer( srcLayer, uri, "mssql", srcLayer->crs(), false, &importError, false, nullptr, progress );
|
||||
if ( err == QgsVectorLayerImport::NoError )
|
||||
importResults.append( tr( "%1: OK!" ).arg( u.name ) );
|
||||
else if ( err == QgsVectorLayerImport::ErrUserCancelled )
|
||||
|
@ -1650,15 +1650,14 @@ QGis::WkbType QgsMssqlProvider::getWkbType( const QString& geometryType, int dim
|
||||
}
|
||||
|
||||
|
||||
QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer(
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
const QMap<QString, QVariant> *options )
|
||||
QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer( const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem& srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
const QMap<QString, QVariant> *options )
|
||||
{
|
||||
Q_UNUSED( options );
|
||||
|
||||
@ -1758,23 +1757,23 @@ QgsVectorLayerImport::ImportError QgsMssqlProvider::createEmptyLayer(
|
||||
|
||||
// set up spatial reference id
|
||||
int srid = 0;
|
||||
if ( srs->isValid() )
|
||||
if ( srs.isValid() )
|
||||
{
|
||||
srid = srs->srsid();
|
||||
srid = srs.srsid();
|
||||
QString auth_srid = "null";
|
||||
QString auth_name = "null";
|
||||
QStringList sl = srs->authid().split( ':' );
|
||||
QStringList sl = srs.authid().split( ':' );
|
||||
if ( sl.length() == 2 )
|
||||
{
|
||||
auth_name = '\'' + sl[0] + '\'';
|
||||
auth_srid = sl[1];
|
||||
}
|
||||
sql = QString( "IF NOT EXISTS (SELECT * FROM spatial_ref_sys WHERE srid=%1) INSERT INTO spatial_ref_sys (srid, auth_name, auth_srid, srtext, proj4text) VALUES (%1, %2, %3, '%4', '%5')" )
|
||||
.arg( srs->srsid() )
|
||||
.arg( srs.srsid() )
|
||||
.arg( auth_name,
|
||||
auth_srid,
|
||||
srs->toWkt(),
|
||||
srs->toProj4() );
|
||||
srs.toWkt(),
|
||||
srs.toProj4() );
|
||||
if ( !q.exec( sql ) )
|
||||
{
|
||||
if ( errorMessage )
|
||||
@ -1958,7 +1957,7 @@ QGISEXTERN QgsVectorLayerImport::ImportError createEmptyLayer(
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
const QgsCoordinateReferenceSystem &srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
|
@ -192,7 +192,7 @@ class QgsMssqlProvider : public QgsVectorDataProvider
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
const QgsCoordinateReferenceSystem &srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage = nullptr,
|
||||
|
@ -196,15 +196,14 @@ void QgsOgrProvider::repack()
|
||||
}
|
||||
|
||||
|
||||
QgsVectorLayerImport::ImportError QgsOgrProvider::createEmptyLayer(
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
const QMap<QString, QVariant> *options )
|
||||
QgsVectorLayerImport::ImportError QgsOgrProvider::createEmptyLayer( const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem& srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
const QMap<QString, QVariant> *options )
|
||||
{
|
||||
QString encoding;
|
||||
QString driverName = "ESRI Shapefile";
|
||||
@ -2438,7 +2437,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
|
||||
const QString &encoding,
|
||||
QGis::WkbType vectortype,
|
||||
const QList< QPair<QString, QString> > &attributes,
|
||||
const QgsCoordinateReferenceSystem *srs = nullptr )
|
||||
const QgsCoordinateReferenceSystem& srs = QgsCoordinateReferenceSystem() )
|
||||
{
|
||||
QgsDebugMsg( QString( "Creating empty vector layer with format: %1" ).arg( format ) );
|
||||
|
||||
@ -2493,9 +2492,9 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
|
||||
OGRSpatialReferenceH reference = nullptr;
|
||||
|
||||
QgsCoordinateReferenceSystem mySpatialRefSys;
|
||||
if ( srs )
|
||||
if ( srs.isValid() )
|
||||
{
|
||||
mySpatialRefSys = *srs;
|
||||
mySpatialRefSys = srs;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3335,7 +3334,7 @@ QGISEXTERN QgsVectorLayerImport::ImportError createEmptyLayer(
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
const QgsCoordinateReferenceSystem &srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
|
@ -54,7 +54,7 @@ class QgsOgrProvider : public QgsVectorDataProvider
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
const QgsCoordinateReferenceSystem &srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage = nullptr,
|
||||
|
@ -233,7 +233,7 @@ bool QgsPGConnectionItem::handleDrop( const QMimeData * data, QString toSchema )
|
||||
|
||||
QgsVectorLayerImport::ImportError err;
|
||||
QString importError;
|
||||
err = QgsVectorLayerImport::importLayer( srcLayer, uri.uri( false ), "postgres", &srcLayer->crs(), false, &importError, false, nullptr, progress );
|
||||
err = QgsVectorLayerImport::importLayer( srcLayer, uri.uri( false ), "postgres", srcLayer->crs(), false, &importError, false, nullptr, progress );
|
||||
if ( err == QgsVectorLayerImport::NoError )
|
||||
importResults.append( tr( "%1: OK!" ).arg( u.name ) );
|
||||
else if ( err == QgsVectorLayerImport::ErrUserCancelled )
|
||||
|
@ -3462,15 +3462,14 @@ bool QgsPostgresProvider::convertField( QgsField &field, const QMap<QString, QVa
|
||||
return true;
|
||||
}
|
||||
|
||||
QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
const QMap<QString, QVariant> *options )
|
||||
QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer( const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem& srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
const QMap<QString, QVariant> *options )
|
||||
{
|
||||
// populate members from the uri structure
|
||||
QgsDataSourceURI dsUri( uri );
|
||||
@ -3615,7 +3614,7 @@ QgsVectorLayerImport::ImportError QgsPostgresProvider::createEmptyLayer(
|
||||
|
||||
// get geometry type, dim and srid
|
||||
int dim = 2;
|
||||
long srid = srs->postgisSrid();
|
||||
long srid = srs.postgisSrid();
|
||||
|
||||
QgsPostgresConn::postgisWkbType( wkbType, geometryType, dim );
|
||||
|
||||
@ -3854,7 +3853,7 @@ QGISEXTERN QgsVectorLayerImport::ImportError createEmptyLayer(
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
const QgsCoordinateReferenceSystem& srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
|
@ -58,7 +58,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
const QgsCoordinateReferenceSystem &srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage = nullptr,
|
||||
|
@ -232,7 +232,7 @@ bool QgsSLConnectionItem::handleDrop( const QMimeData * data, Qt::DropAction )
|
||||
QgsDebugMsg( "URI " + destUri.uri() );
|
||||
QgsVectorLayerImport::ImportError err;
|
||||
QString importError;
|
||||
err = QgsVectorLayerImport::importLayer( srcLayer, destUri.uri(), "spatialite", &srcLayer->crs(), false, &importError, false, nullptr, progress );
|
||||
err = QgsVectorLayerImport::importLayer( srcLayer, destUri.uri(), "spatialite", srcLayer->crs(), false, &importError, false, nullptr, progress );
|
||||
if ( err == QgsVectorLayerImport::NoError )
|
||||
importResults.append( tr( "%1: OK!" ).arg( u.name ) );
|
||||
else if ( err == QgsVectorLayerImport::ErrUserCancelled )
|
||||
|
@ -93,15 +93,14 @@ bool QgsSpatiaLiteProvider::convertField( QgsField &field )
|
||||
|
||||
|
||||
QgsVectorLayerImport::ImportError
|
||||
QgsSpatiaLiteProvider::createEmptyLayer(
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
const QMap<QString, QVariant> *options )
|
||||
QgsSpatiaLiteProvider::createEmptyLayer( const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem& srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
const QMap<QString, QVariant> *options )
|
||||
{
|
||||
Q_UNUSED( options );
|
||||
|
||||
@ -224,7 +223,7 @@ QgsSpatiaLiteProvider::createEmptyLayer(
|
||||
|
||||
// get geometry type, dim and srid
|
||||
int dim = 2;
|
||||
long srid = srs->postgisSrid();
|
||||
long srid = srs.postgisSrid();
|
||||
|
||||
switch ( wkbType )
|
||||
{
|
||||
@ -5075,7 +5074,7 @@ QGISEXTERN QgsVectorLayerImport::ImportError createEmptyLayer(
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
const QgsCoordinateReferenceSystem& srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage,
|
||||
|
@ -59,7 +59,7 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
|
||||
const QString& uri,
|
||||
const QgsFields &fields,
|
||||
QGis::WkbType wkbType,
|
||||
const QgsCoordinateReferenceSystem *srs,
|
||||
const QgsCoordinateReferenceSystem& srs,
|
||||
bool overwrite,
|
||||
QMap<int, int> *oldToNewAttrIdxMap,
|
||||
QString *errorMessage = nullptr,
|
||||
|
Loading…
x
Reference in New Issue
Block a user