|
118 | 118 | #include "qgscustomization.h" |
119 | 119 | #include "qgscustomprojectiondialog.h" |
120 | 120 | #include "qgsdatasourceuri.h" |
| 121 | +#include "qgsdxfexport.h" |
| 122 | +#include "qgsdxfexportdialog.h" |
121 | 123 | #include "qgsdecorationcopyright.h" |
122 | 124 | #include "qgsdecorationnortharrow.h" |
123 | 125 | #include "qgsdecorationscalebar.h" |
@@ -947,6 +949,7 @@ void QgisApp::createActions() |
947 | 949 | connect( mActionNewPrintComposer, SIGNAL( triggered() ), this, SLOT( newPrintComposer() ) ); |
948 | 950 | connect( mActionShowComposerManager, SIGNAL( triggered() ), this, SLOT( showComposerManager() ) ); |
949 | 951 | connect( mActionExit, SIGNAL( triggered() ), this, SLOT( fileExit() ) ); |
| 952 | + connect( mActionDxfExport, SIGNAL( triggered() ), this, SLOT( dxfExport() ) ); |
950 | 953 |
|
951 | 954 | // Edit Menu Items |
952 | 955 |
|
@@ -1778,7 +1781,7 @@ void QgisApp::setTheme( QString theThemeName ) |
1778 | 1781 | mActionRotateFeature->setIcon( QgsApplication::getThemeIcon( "/mActionRotateFeature.png" ) ); |
1779 | 1782 | mActionReshapeFeatures->setIcon( QgsApplication::getThemeIcon( "/mActionReshape.png" ) ); |
1780 | 1783 | mActionSplitFeatures->setIcon( QgsApplication::getThemeIcon( "/mActionSplitFeatures.svg" ) ); |
1781 | | - mActionSplitParts->setIcon( QgsApplication::getThemeIcon( "/mActionSplitParts.svg" ) ); |
| 1784 | + mActionSplitParts->setIcon( QgsApplication::getThemeIcon( "/mActionSplitParts.svg" ) ); |
1782 | 1785 | mActionDeleteSelected->setIcon( QgsApplication::getThemeIcon( "/mActionDeleteSelected.svg" ) ); |
1783 | 1786 | mActionNodeTool->setIcon( QgsApplication::getThemeIcon( "/mActionNodeTool.png" ) ); |
1784 | 1787 | mActionSimplifyFeature->setIcon( QgsApplication::getThemeIcon( "/mActionSimplify.png" ) ); |
@@ -3797,6 +3800,33 @@ void QgisApp::fileSaveAs() |
3797 | 3800 | } |
3798 | 3801 | } // QgisApp::fileSaveAs |
3799 | 3802 |
|
| 3803 | +void QgisApp::dxfExport() |
| 3804 | +{ |
| 3805 | + QgsDxfExportDialog d( QgsMapLayerRegistry::instance()->mapLayers().keys() ); |
| 3806 | + if ( d.exec() == QDialog::Accepted ) |
| 3807 | + { |
| 3808 | + QgsDxfExport dxfExport; |
| 3809 | + |
| 3810 | + QList<QgsMapLayer*> layerList; |
| 3811 | + QList<QString> layerIdList = d.layers(); |
| 3812 | + QList<QString>::const_iterator layerIt = layerIdList.constBegin(); |
| 3813 | + for ( ; layerIt != layerIdList.constEnd(); ++layerIt ) |
| 3814 | + { |
| 3815 | + QgsMapLayer* l = QgsMapLayerRegistry::instance()->mapLayer( *layerIt ); |
| 3816 | + if ( l ) |
| 3817 | + { |
| 3818 | + layerList.append( l ); |
| 3819 | + } |
| 3820 | + } |
| 3821 | + |
| 3822 | + dxfExport.addLayers( layerList ); |
| 3823 | + dxfExport.setSymbologyScaleDenominator( d.symbologyScale() ); |
| 3824 | + dxfExport.setSymbologyExport( d.symbologyMode() ); |
| 3825 | + QFile dxfFile( d.saveFile() ); |
| 3826 | + dxfExport.writeToFile( &dxfFile ); |
| 3827 | + } |
| 3828 | +} |
| 3829 | + |
3800 | 3830 | // Open the project file corresponding to the |
3801 | 3831 | // path at the given index in mRecentProjectPaths |
3802 | 3832 | void QgisApp::openProject( QAction *action ) |
@@ -8873,27 +8903,27 @@ bool QgisApp::addRasterLayers( QStringList const &theFileNameQStringList, bool g |
8873 | 8903 | /////////////////////////////////////////////////////////////////// |
8874 | 8904 |
|
8875 | 8905 | #ifdef ANDROID |
8876 | | -void QgisApp::keyReleaseEvent(QKeyEvent *event) |
| 8906 | +void QgisApp::keyReleaseEvent( QKeyEvent *event ) |
8877 | 8907 | { |
8878 | | -static bool accepted=true; |
8879 | | - if (event->key()==Qt::Key_Close) |
| 8908 | + static bool accepted = true; |
| 8909 | + if ( event->key() == Qt::Key_Close ) |
| 8910 | + { |
| 8911 | + // do something useful here |
| 8912 | + int ret = QMessageBox::question( this, tr( "Exit QGIS" ), |
| 8913 | + tr( "Do you really want to quit QGIS?" ), |
| 8914 | + QMessageBox::Yes | QMessageBox::No ); |
| 8915 | + switch ( ret ) |
8880 | 8916 | { |
8881 | | - // do something useful here |
8882 | | - int ret = QMessageBox::question(this, tr("Exit QGIS"), |
8883 | | - tr("Do you really want to quit QGIS?"), |
8884 | | - QMessageBox::Yes | QMessageBox::No); |
8885 | | - switch(ret) |
8886 | | - { |
8887 | | - case QMessageBox::Yes: |
8888 | | - this->close(); |
8889 | | - break; |
| 8917 | + case QMessageBox::Yes: |
| 8918 | + this->close(); |
| 8919 | + break; |
8890 | 8920 |
|
8891 | | - case QMessageBox::No: |
8892 | | - break; |
8893 | | - } |
8894 | | - event->setAccepted(accepted); // dont't close my Top Level Widget ! |
8895 | | - accepted=false;// close the app next time when the user press back button |
| 8921 | + case QMessageBox::No: |
| 8922 | + break; |
8896 | 8923 | } |
| 8924 | + event->setAccepted( accepted ); // dont't close my Top Level Widget ! |
| 8925 | + accepted = false;// close the app next time when the user press back button |
| 8926 | + } |
8897 | 8927 | } |
8898 | 8928 | #endif |
8899 | 8929 |
|
|
0 commit comments