Skip to content
Permalink
Browse files

[FEATURE] allow OGR save as without attributes (for eg. DGN/DXF)

git-svn-id: http://svn.osgeo.org/qgis/trunk@14562 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Nov 12, 2010
1 parent fab2b0f commit 917f57c41b8909f050f84a57df0b94120ea7a5a2
@@ -44,7 +44,9 @@ public:
bool onlySelected = FALSE,
QString *errorMessage = 0,
const QStringList &datasourceOptions = QStringList(),
const QStringList &layerOptions = QStringList() );
const QStringList &layerOptions = QStringList(),
bool skipAttributeCreation = FALSE // added in 1.7
);

/** create shapefile and initialize it */
QgsVectorFileWriter(const QString& vectorFileName,
@@ -26,15 +26,15 @@
#include <QTextCodec>

QgsVectorLayerSaveAsDialog::QgsVectorLayerSaveAsDialog( QWidget* parent, Qt::WFlags fl )
: QDialog( parent, fl )
, mCRS( -1 )
: QDialog( parent, fl )
, mCRS( -1 )
{
setupUi( this );

QSettings settings;
QMap<QString, QString> map = QgsVectorFileWriter::ogrDriverList();
mFormatComboBox->blockSignals( true );
for ( QMap< QString, QString>::const_iterator it = map.constBegin(); it != map.constEnd(); ++it )
for( QMap< QString, QString>::const_iterator it = map.constBegin(); it != map.constEnd(); ++it )
{
mFormatComboBox->addItem( it.key(), it.value() );
}
@@ -47,7 +47,7 @@ QgsVectorLayerSaveAsDialog::QgsVectorLayerSaveAsDialog( QWidget* parent, Qt::WFl

QString enc = settings.value( "/UI/encoding", QString( "System" ) ).toString();
int idx = mEncodingComboBox->findText( enc );
if ( idx < 0 )
if( idx < 0 )
{
mEncodingComboBox->insertItem( 0, enc );
idx = 0;
@@ -77,7 +77,7 @@ void QgsVectorLayerSaveAsDialog::on_mFormatComboBox_currentIndexChanged( int idx
browseFilename->setEnabled( true );
leFilename->setEnabled( true );

if ( format() == "KML" )
if( format() == "KML" )
{
mEncodingComboBox->setCurrentIndex( mEncodingComboBox->findText( "UTF-8" ) );
mEncodingComboBox->setDisabled( true );
@@ -94,7 +94,7 @@ void QgsVectorLayerSaveAsDialog::on_browseFilename_clicked()
QString dirName = leFilename->text().isEmpty() ? settings.value( "/UI/lastVectorFileFilterDir", "." ).toString() : leFilename->text();
QString filterString = QgsVectorFileWriter::filterForDriver( format() );
QString outputFile = QFileDialog::getSaveFileName( 0, tr( "Save layer as..." ), dirName, filterString );
if ( !outputFile.isNull() )
if( !outputFile.isNull() )
{
leFilename->setText( outputFile );
}
@@ -103,12 +103,12 @@ void QgsVectorLayerSaveAsDialog::on_browseFilename_clicked()
void QgsVectorLayerSaveAsDialog::on_browseCRS_clicked()
{
QgsGenericProjectionSelector * mySelector = new QgsGenericProjectionSelector();
if ( mCRS >= 0 )
if( mCRS >= 0 )
mySelector->setSelectedCrsId( mCRS );
mySelector->setMessage( tr( "Select the coordinate reference system for the vector file. "
"The data points will be transformed from the layer coordinate reference system." ) );

if ( mySelector->exec() )
if( mySelector->exec() )
{
QgsCoordinateReferenceSystem srs( mySelector->selectedCrsId(), QgsCoordinateReferenceSystem::InternalCrsId );
mCRS = srs.srsid();
@@ -147,3 +147,8 @@ QStringList QgsVectorLayerSaveAsDialog::layerOptions() const
{
return mOgrLayerOptions->toPlainText().split( "\n" );
}

bool QgsVectorLayerSaveAsDialog::skipAttributeCreation() const
{
return mSkipAttributeCreation->isChecked();
}
@@ -40,6 +40,7 @@ class QgsVectorLayerSaveAsDialog : public QDialog, private Ui::QgsVectorLayerSav
QStringList datasourceOptions() const;
QStringList layerOptions() const;
long crs() const;
bool skipAttributeCreation() const;

private slots:
void on_mFormatComboBox_currentIndexChanged( int idx );

0 comments on commit 917f57c

Please sign in to comment.
You can’t perform that action at this time.