mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-01 00:46:20 -05:00
QgsVectorFileWriter: remove the deprecated private driverMetadata(driverName, multiple args) method and use the public one instead
This commit is contained in:
parent
8ee697bf2d
commit
222fa767c9
@ -200,6 +200,9 @@ void QgsVectorFileWriter::init( QString vectorFileName,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaData metadata;
|
||||||
|
bool metadataFound = driverMetadata( driverName, metadata );
|
||||||
|
|
||||||
if ( mOgrDriverName == "ESRI Shapefile" )
|
if ( mOgrDriverName == "ESRI Shapefile" )
|
||||||
{
|
{
|
||||||
if ( layerOptions.join( "" ).toUpper().indexOf( "ENCODING=" ) == -1 )
|
if ( layerOptions.join( "" ).toUpper().indexOf( "ENCODING=" ) == -1 )
|
||||||
@ -252,13 +255,9 @@ void QgsVectorFileWriter::init( QString vectorFileName,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QString longName;
|
if ( metadataFound )
|
||||||
QString trLongName;
|
|
||||||
QString glob;
|
|
||||||
QString exts;
|
|
||||||
if ( QgsVectorFileWriter::driverMetadata( driverName, longName, trLongName, glob, exts ) )
|
|
||||||
{
|
{
|
||||||
QStringList allExts = exts.split( ' ', QString::SkipEmptyParts );
|
QStringList allExts = metadata.ext.split( ' ', QString::SkipEmptyParts );
|
||||||
bool found = false;
|
bool found = false;
|
||||||
Q_FOREACH ( const QString& ext, allExts )
|
Q_FOREACH ( const QString& ext, allExts )
|
||||||
{
|
{
|
||||||
@ -2543,13 +2542,10 @@ QMap<QString, QString> QgsVectorFileWriter::ogrDriverList()
|
|||||||
|
|
||||||
Q_FOREACH ( const QString& drvName, writableDrivers )
|
Q_FOREACH ( const QString& drvName, writableDrivers )
|
||||||
{
|
{
|
||||||
QString longName;
|
MetaData metadata;
|
||||||
QString trLongName;
|
if ( driverMetadata( drvName, metadata ) && !metadata.trLongName.isEmpty() )
|
||||||
QString glob;
|
|
||||||
QString exts;
|
|
||||||
if ( QgsVectorFileWriter::driverMetadata( drvName, longName, trLongName, glob, exts ) && !trLongName.isEmpty() )
|
|
||||||
{
|
{
|
||||||
resultMap.insert( trLongName, drvName );
|
resultMap.insert( metadata.trLongName, drvName );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2573,14 +2569,11 @@ QString QgsVectorFileWriter::fileFilterString()
|
|||||||
|
|
||||||
QString QgsVectorFileWriter::filterForDriver( const QString& driverName )
|
QString QgsVectorFileWriter::filterForDriver( const QString& driverName )
|
||||||
{
|
{
|
||||||
QString longName;
|
MetaData metadata;
|
||||||
QString trLongName;
|
if ( !driverMetadata( driverName, metadata ) || metadata.trLongName.isEmpty() || metadata.glob.isEmpty() )
|
||||||
QString glob;
|
|
||||||
QString exts;
|
|
||||||
if ( !driverMetadata( driverName, longName, trLongName, glob, exts ) || trLongName.isEmpty() || glob.isEmpty() )
|
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return trLongName + " [OGR] (" + glob.toLower() + ' ' + glob.toUpper() + ')';
|
return metadata.trLongName + " [OGR] (" + metadata.glob.toLower() + ' ' + metadata.glob.toUpper() + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QgsVectorFileWriter::convertCodecNameForEncodingOption( const QString &codecName )
|
QString QgsVectorFileWriter::convertCodecNameForEncodingOption( const QString &codecName )
|
||||||
@ -2600,207 +2593,6 @@ QString QgsVectorFileWriter::convertCodecNameForEncodingOption( const QString &c
|
|||||||
return codecName;
|
return codecName;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QgsVectorFileWriter::driverMetadata( const QString& driverName, QString &longName, QString &trLongName, QString &glob, QString &ext )
|
|
||||||
{
|
|
||||||
if ( driverName.startsWith( "AVCE00" ) )
|
|
||||||
{
|
|
||||||
longName = "Arc/Info ASCII Coverage";
|
|
||||||
trLongName = QObject::tr( "Arc/Info ASCII Coverage" );
|
|
||||||
glob = "*.e00";
|
|
||||||
ext = "e00";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "BNA" ) )
|
|
||||||
{
|
|
||||||
longName = "Atlas BNA";
|
|
||||||
trLongName = QObject::tr( "Atlas BNA" );
|
|
||||||
glob = "*.bna";
|
|
||||||
ext = "bna";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "CSV" ) )
|
|
||||||
{
|
|
||||||
longName = "Comma Separated Value [CSV]";
|
|
||||||
trLongName = QObject::tr( "Comma Separated Value [CSV]" );
|
|
||||||
glob = "*.csv";
|
|
||||||
ext = "csv";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "ESRI" ) )
|
|
||||||
{
|
|
||||||
longName = "ESRI Shapefile";
|
|
||||||
trLongName = QObject::tr( "ESRI Shapefile" );
|
|
||||||
glob = "*.shp";
|
|
||||||
ext = "shp";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "DBF file" ) )
|
|
||||||
{
|
|
||||||
longName = "DBF File";
|
|
||||||
trLongName = QObject::tr( "DBF file" );
|
|
||||||
glob = "*.dbf";
|
|
||||||
ext = "dbf";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "FMEObjects Gateway" ) )
|
|
||||||
{
|
|
||||||
longName = "FMEObjects Gateway";
|
|
||||||
trLongName = QObject::tr( "FMEObjects Gateway" );
|
|
||||||
glob = "*.fdd";
|
|
||||||
ext = "fdd";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "GeoJSON" ) )
|
|
||||||
{
|
|
||||||
longName = "GeoJSON";
|
|
||||||
trLongName = QObject::tr( "GeoJSON" );
|
|
||||||
glob = "*.geojson";
|
|
||||||
ext = "geojson";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "GPKG" ) )
|
|
||||||
{
|
|
||||||
longName = "GeoPackage";
|
|
||||||
trLongName = QObject::tr( "GeoPackage" );
|
|
||||||
glob = "*.gpkg";
|
|
||||||
ext = "gpkg";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "GeoRSS" ) )
|
|
||||||
{
|
|
||||||
longName = "GeoRSS";
|
|
||||||
trLongName = QObject::tr( "GeoRSS" );
|
|
||||||
glob = "*.xml";
|
|
||||||
ext = "xml";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "GML" ) )
|
|
||||||
{
|
|
||||||
longName = "Geography Markup Language [GML]";
|
|
||||||
trLongName = QObject::tr( "Geography Markup Language [GML]" );
|
|
||||||
glob = "*.gml";
|
|
||||||
ext = "gml";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "GMT" ) )
|
|
||||||
{
|
|
||||||
longName = "Generic Mapping Tools [GMT]";
|
|
||||||
trLongName = QObject::tr( "Generic Mapping Tools [GMT]" );
|
|
||||||
glob = "*.gmt";
|
|
||||||
ext = "gmt";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "GPX" ) )
|
|
||||||
{
|
|
||||||
longName = "GPS eXchange Format [GPX]";
|
|
||||||
trLongName = QObject::tr( "GPS eXchange Format [GPX]" );
|
|
||||||
glob = "*.gpx";
|
|
||||||
ext = "gpx";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "Interlis 1" ) )
|
|
||||||
{
|
|
||||||
longName = "INTERLIS 1";
|
|
||||||
trLongName = QObject::tr( "INTERLIS 1" );
|
|
||||||
glob = "*.itf *.xml *.ili";
|
|
||||||
ext = "ili";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "Interlis 2" ) )
|
|
||||||
{
|
|
||||||
longName = "INTERLIS 2";
|
|
||||||
trLongName = QObject::tr( "INTERLIS 2" );
|
|
||||||
glob = "*.itf *.xml *.ili";
|
|
||||||
ext = "ili";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "KML" ) )
|
|
||||||
{
|
|
||||||
longName = "Keyhole Markup Language [KML]";
|
|
||||||
trLongName = QObject::tr( "Keyhole Markup Language [KML]" );
|
|
||||||
glob = "*.kml";
|
|
||||||
ext = "kml";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "MapInfo File" ) )
|
|
||||||
{
|
|
||||||
longName = "Mapinfo TAB";
|
|
||||||
trLongName = QObject::tr( "Mapinfo TAB" );
|
|
||||||
glob = "*.tab";
|
|
||||||
ext = "tab";
|
|
||||||
}
|
|
||||||
// 'MapInfo MIF' is internal QGIS addition to distinguish between MITAB and MIF
|
|
||||||
else if ( driverName.startsWith( "MapInfo MIF" ) )
|
|
||||||
{
|
|
||||||
longName = "Mapinfo MIF";
|
|
||||||
trLongName = QObject::tr( "Mapinfo MIF" );
|
|
||||||
glob = "*.mif";
|
|
||||||
ext = "mif";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "DGN" ) )
|
|
||||||
{
|
|
||||||
longName = "Microstation DGN";
|
|
||||||
trLongName = QObject::tr( "Microstation DGN" );
|
|
||||||
glob = "*.dgn";
|
|
||||||
ext = "dgn";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "S57" ) )
|
|
||||||
{
|
|
||||||
longName = "S-57 Base file";
|
|
||||||
trLongName = QObject::tr( "S-57 Base file" );
|
|
||||||
glob = "*.000";
|
|
||||||
ext = "000";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "SDTS" ) )
|
|
||||||
{
|
|
||||||
longName = "Spatial Data Transfer Standard [SDTS]";
|
|
||||||
trLongName = QObject::tr( "Spatial Data Transfer Standard [SDTS]" );
|
|
||||||
glob = "*catd.ddf";
|
|
||||||
ext = "ddf";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "SQLite" ) )
|
|
||||||
{
|
|
||||||
longName = "SQLite";
|
|
||||||
trLongName = QObject::tr( "SQLite" );
|
|
||||||
glob = "*.sqlite";
|
|
||||||
ext = "sqlite";
|
|
||||||
}
|
|
||||||
// QGIS internal addition for SpatialLite
|
|
||||||
else if ( driverName.startsWith( "SpatiaLite" ) )
|
|
||||||
{
|
|
||||||
longName = "SpatiaLite";
|
|
||||||
trLongName = QObject::tr( "SpatiaLite" );
|
|
||||||
glob = "*.sqlite";
|
|
||||||
ext = "sqlite";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "DXF" ) )
|
|
||||||
{
|
|
||||||
longName = "AutoCAD DXF";
|
|
||||||
trLongName = QObject::tr( "AutoCAD DXF" );
|
|
||||||
glob = "*.dxf";
|
|
||||||
ext = "dxf";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "Geoconcept" ) )
|
|
||||||
{
|
|
||||||
longName = "Geoconcept";
|
|
||||||
trLongName = QObject::tr( "Geoconcept" );
|
|
||||||
glob = "*.gxt *.txt";
|
|
||||||
ext = "gxt";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "FileGDB" ) )
|
|
||||||
{
|
|
||||||
longName = "ESRI FileGDB";
|
|
||||||
trLongName = QObject::tr( "ESRI FileGDB" );
|
|
||||||
glob = "*.gdb";
|
|
||||||
ext = "gdb";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "XLSX" ) )
|
|
||||||
{
|
|
||||||
longName = "MS Office Open XML spreadsheet [XLSX]";
|
|
||||||
trLongName = QObject::tr( "MS Office Open XML spreadsheet [XLSX]" );
|
|
||||||
glob = "*.xlsx";
|
|
||||||
ext = "xlsx";
|
|
||||||
}
|
|
||||||
else if ( driverName.startsWith( "ODS" ) )
|
|
||||||
{
|
|
||||||
longName = "Open Document Spreadsheet";
|
|
||||||
trLongName = QObject::tr( "Open Document Spreadsheet [ODS]" );
|
|
||||||
glob = "*.ods";
|
|
||||||
ext = "ods";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QgsVectorFileWriter::createSymbolLayerTable( QgsVectorLayer* vl, const QgsCoordinateTransform* ct, OGRDataSourceH ds )
|
void QgsVectorFileWriter::createSymbolLayerTable( QgsVectorLayer* vl, const QgsCoordinateTransform* ct, OGRDataSourceH ds )
|
||||||
{
|
{
|
||||||
if ( !vl || !ds )
|
if ( !vl || !ds )
|
||||||
|
@ -426,10 +426,6 @@ class CORE_EXPORT QgsVectorFileWriter
|
|||||||
QgsRenderContext mRenderContext;
|
QgsRenderContext mRenderContext;
|
||||||
|
|
||||||
static QMap<QString, MetaData> initMetaData();
|
static QMap<QString, MetaData> initMetaData();
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
*/
|
|
||||||
static bool driverMetadata( const QString& driverName, QString &longName, QString &trLongName, QString &glob, QString &ext );
|
|
||||||
void createSymbolLayerTable( QgsVectorLayer* vl, const QgsCoordinateTransform* ct, OGRDataSourceH ds );
|
void createSymbolLayerTable( QgsVectorLayer* vl, const QgsCoordinateTransform* ct, OGRDataSourceH ds );
|
||||||
OGRFeatureH createFeature( QgsFeature& feature );
|
OGRFeatureH createFeature( QgsFeature& feature );
|
||||||
bool writeFeature( OGRLayerH layer, OGRFeatureH feature );
|
bool writeFeature( OGRLayerH layer, OGRFeatureH feature );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user