Skip to content
Permalink
Browse files

Save as raster dialog

  • Loading branch information
mhugent committed Jul 11, 2012
1 parent 402baca commit b20cecbd5fbf7cf8369bd8f4b927691f1ef4e41c
@@ -161,6 +161,7 @@
#include "qgsrasterlayer.h"
#include "qgsrasterlayerproperties.h"
#include "qgsrasterrenderer.h"
#include "qgsrasterlayersaveasdialog.h"
#include "qgsrectangle.h"
#include "qgsrenderer.h"
#include "qgsscalecombobox.h"
@@ -898,7 +899,7 @@ void QgisApp::createActions()
connect( mActionOpenTable, SIGNAL( triggered() ), this, SLOT( attributeTable() ) );
connect( mActionToggleEditing, SIGNAL( triggered() ), this, SLOT( toggleEditing() ) );
connect( mActionSaveEdits, SIGNAL( triggered() ), this, SLOT( saveEdits() ) );
connect( mActionLayerSaveAs, SIGNAL( triggered() ), this, SLOT( saveAsVectorFile() ) );
connect( mActionLayerSaveAs, SIGNAL( triggered() ), this, SLOT( saveAsFile() ) );
connect( mActionLayerSelectionSaveAs, SIGNAL( triggered() ), this, SLOT( saveSelectionAsVectorFile() ) );
connect( mActionRemoveLayer, SIGNAL( triggered() ), this, SLOT( removeLayer() ) );
connect( mActionSetLayerCRS, SIGNAL( triggered() ), this, SLOT( setLayerCRS() ) );
@@ -3761,8 +3762,30 @@ void QgisApp::attributeTable()
// the dialog will be deleted by itself on close
}

void QgisApp::saveAsVectorFile()
void QgisApp::saveAsRasterFile()
{
QgsRasterLayer* rasterLayer = qobject_cast<QgsRasterLayer *>( activeLayer() );
if ( !rasterLayer )
{
return;
}

QgsRasterLayerSaveAsDialog d;
d.exec();
}

void QgisApp::saveAsFile()
{
QgsMapLayer* layer = activeLayer();
if ( layer )
{
QgsMapLayer::LayerType layerType = layer->type();
if ( layerType == QgsMapLayer::RasterLayer )
{
saveAsRasterFile();
}
return;
}
saveAsVectorFileGeneral( false );
}

@@ -6827,7 +6850,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer* layer )
mActionOpenTable->setEnabled( false );
mActionToggleEditing->setEnabled( false );
mActionSaveEdits->setEnabled( false );
mActionLayerSaveAs->setEnabled( false );
mActionLayerSaveAs->setEnabled( true );
mActionLayerSelectionSaveAs->setEnabled( false );
mActionAddFeature->setEnabled( false );
mActionDeleteSelected->setEnabled( false );
@@ -817,7 +817,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
void saveEdits( QgsMapLayer *layer );

//! save current vector layer
void saveAsVectorFile();
void saveAsFile();
void saveSelectionAsVectorFile();

//! show python console
@@ -955,6 +955,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow


void saveAsVectorFileGeneral( bool saveOnlySelection );
//! save current raster layer
void saveAsRasterFile();

/**Returns all annotation items in the canvas*/
QList<QgsAnnotationItem*> annotationItems();
@@ -75,6 +75,7 @@ qgsowssourceselect.cpp
qgsprojectbadlayerguihandler.cpp
qgsprojectionselector.cpp
qgsquickprint.cpp
qgsrasterlayersaveasdialog.cpp
qgsrubberband.cpp
qgsscalecombobox.cpp
qgstextannotationitem.cpp
@@ -0,0 +1,10 @@
#include "qgsrasterlayersaveasdialog.h"

QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QWidget* parent, Qt::WindowFlags f ): QDialog( parent, f )
{
setupUi( this );
}

QgsRasterLayerSaveAsDialog::~QgsRasterLayerSaveAsDialog()
{
}
@@ -0,0 +1,13 @@
#ifndef QGSRASTERLAYERSAVEASDIALOG_H
#define QGSRASTERLAYERSAVEASDIALOG_H

#include "ui_qgsrasterlayersaveasdialogbase.h"

class QgsRasterLayerSaveAsDialog: public QDialog, private Ui::QgsRasterLayerSaveAsDialogBase
{
public:
QgsRasterLayerSaveAsDialog( QWidget* parent = 0, Qt::WindowFlags f = 0 );
~QgsRasterLayerSaveAsDialog();
};

#endif // QGSRASTERLAYERSAVEASDIALOG_H
@@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsRasterLayerSaveAsDialogBase</class>
<widget class="QDialog" name="QgsRasterLayerSaveAsDialogBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>415</width>
<height>248</height>
</rect>
</property>
<property name="windowTitle">
<string>Save raster layer as...</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="mFormatLabel">
<property name="text">
<string>Format</string>
</property>
<property name="buddy">
<cstring>mFormatComboBox</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="mFormatComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mSaveAsLabel">
<property name="text">
<string>Save as</string>
</property>
<property name="buddy">
<cstring>mSaveAsLineEdit</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mSaveAsLineEdit">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="mBrowseButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="mColumnsLabel">
<property name="text">
<string>Columns</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mColumnsLineEdit"/>
</item>
<item>
<widget class="QLabel" name="mRowsLabel">
<property name="text">
<string>Rows</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mRowsLineEdit"/>
</item>
</layout>
</item>
<item row="3" column="0" colspan="3">
<widget class="QGroupBox" name="mTilesGroupBox">
<property name="title">
<string>Tiles</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLineEdit" name="mMaximumSizeXComboBox"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mMaximumSizeXLabel">
<property name="text">
<string>Maximum Size X:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mMaximumSizeYLineEdit"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mMaximumSizeYLabel">
<property name="text">
<string>Maximum size Y:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="mTileModeCheckBox">
<property name="text">
<string>One output file per tile</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>QgsRasterLayerSaveAsDialogBase</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>QgsRasterLayerSaveAsDialogBase</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

0 comments on commit b20cecb

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