2010-10-28 06:43:12 +00:00
|
|
|
/***************************************************************************
|
|
|
|
qgsrastercalcdialog.h - description
|
|
|
|
---------------------
|
|
|
|
begin : September 28th, 2010
|
|
|
|
copyright : (C) 2010 by Marco Hugentobler
|
|
|
|
email : marco dot hugentobler at sourcepole dot ch
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef QGSRASTERCALCDIALOG_H
|
|
|
|
#define QGSRASTERCALCDIALOG_H
|
|
|
|
|
|
|
|
#include "ui_qgsrastercalcdialogbase.h"
|
|
|
|
#include "qgsrastercalculator.h"
|
2017-08-24 12:24:32 +02:00
|
|
|
#include "qgshelp.h"
|
2017-01-04 12:05:04 +01:00
|
|
|
#include "qgis_app.h"
|
2010-10-28 06:43:12 +00:00
|
|
|
|
2016-10-25 09:17:39 +10:00
|
|
|
//! A dialog to enter a raster calculation expression
|
2013-09-06 22:07:42 +02:00
|
|
|
class APP_EXPORT QgsRasterCalcDialog: public QDialog, private Ui::QgsRasterCalcDialogBase
|
2010-10-28 06:43:12 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2017-12-12 11:44:10 +10:00
|
|
|
QgsRasterCalcDialog( QWidget *parent = nullptr, Qt::WindowFlags f = nullptr );
|
2017-12-15 08:57:22 +10:00
|
|
|
~QgsRasterCalcDialog() override;
|
2010-10-28 06:43:12 +00:00
|
|
|
|
|
|
|
QString formulaString() const;
|
|
|
|
QString outputFile() const;
|
|
|
|
QString outputFormat() const;
|
2015-06-08 14:10:39 +10:00
|
|
|
QgsCoordinateReferenceSystem outputCrs() const;
|
2010-10-28 06:43:12 +00:00
|
|
|
bool addLayerToProject() const;
|
|
|
|
|
2016-10-25 09:17:39 +10:00
|
|
|
//! Bounding box for output raster
|
2010-10-28 06:43:12 +00:00
|
|
|
QgsRectangle outputRectangle() const;
|
2016-10-25 09:17:39 +10:00
|
|
|
//! Number of pixels in x-direction
|
2010-10-28 06:43:12 +00:00
|
|
|
int numberOfColumns() const;
|
2016-10-25 09:17:39 +10:00
|
|
|
//! Number of pixels in y-direction
|
2010-10-28 06:43:12 +00:00
|
|
|
int numberOfRows() const;
|
|
|
|
|
|
|
|
QVector<QgsRasterCalculatorEntry> rasterEntries() const;
|
|
|
|
|
|
|
|
private slots:
|
2017-10-09 08:48:23 +10:00
|
|
|
void mOutputLayerPushButton_clicked();
|
|
|
|
void mRasterBandsListWidget_itemDoubleClicked( QListWidgetItem *item );
|
|
|
|
void mButtonBox_accepted();
|
|
|
|
void mCurrentLayerExtentButton_clicked();
|
|
|
|
void mExpressionTextEdit_textChanged();
|
|
|
|
void mOutputLayerLineEdit_textChanged( const QString &text );
|
2017-07-02 21:17:54 +02:00
|
|
|
//! Enables OK button if calculator expression is valid and output file path exists
|
2010-10-28 06:43:12 +00:00
|
|
|
void setAcceptButtonState();
|
2017-08-24 12:24:32 +02:00
|
|
|
void showHelp();
|
2010-10-28 06:43:12 +00:00
|
|
|
|
|
|
|
//calculator buttons
|
2017-10-09 08:48:23 +10:00
|
|
|
void mPlusPushButton_clicked();
|
|
|
|
void mMinusPushButton_clicked();
|
|
|
|
void mMultiplyPushButton_clicked();
|
|
|
|
void mDividePushButton_clicked();
|
|
|
|
void mSqrtButton_clicked();
|
|
|
|
void mCosButton_clicked();
|
|
|
|
void mSinButton_clicked();
|
|
|
|
void mASinButton_clicked();
|
|
|
|
void mExpButton_clicked();
|
|
|
|
void mLnButton_clicked();
|
|
|
|
void mLogButton_clicked();
|
|
|
|
void mNotEqualButton_clicked();
|
|
|
|
void mTanButton_clicked();
|
|
|
|
void mACosButton_clicked();
|
|
|
|
void mATanButton_clicked();
|
|
|
|
void mOpenBracketPushButton_clicked();
|
|
|
|
void mCloseBracketPushButton_clicked();
|
|
|
|
void mLessButton_clicked();
|
|
|
|
void mGreaterButton_clicked();
|
|
|
|
void mEqualButton_clicked();
|
|
|
|
void mLesserEqualButton_clicked();
|
|
|
|
void mGreaterEqualButton_clicked();
|
|
|
|
void mAndButton_clicked();
|
|
|
|
void mOrButton_clicked();
|
2010-10-28 06:43:12 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
//insert available GDAL drivers that support the create() option
|
|
|
|
void insertAvailableOutputFormats();
|
2016-10-25 09:17:39 +10:00
|
|
|
//! Accesses the available raster layers/bands from the layer registry
|
2010-10-28 06:43:12 +00:00
|
|
|
void insertAvailableRasterBands();
|
|
|
|
|
2016-10-25 09:17:39 +10:00
|
|
|
//! Returns true if raster calculator expression has valid syntax
|
2010-10-28 06:43:12 +00:00
|
|
|
bool expressionValid() const;
|
2016-10-25 09:17:39 +10:00
|
|
|
//! Returns true if output file directory exists
|
2010-10-28 06:43:12 +00:00
|
|
|
bool filePathValid() const;
|
|
|
|
|
2017-03-03 08:42:00 +01:00
|
|
|
static QString quoteBandEntry( const QString &layerName );
|
2013-07-31 13:42:46 +02:00
|
|
|
|
2016-10-25 09:17:39 +10:00
|
|
|
//! Stores relation between driver name and extension
|
2010-10-28 06:43:12 +00:00
|
|
|
QMap<QString, QString> mDriverExtensionMap;
|
|
|
|
|
|
|
|
QList<QgsRasterCalculatorEntry> mAvailableRasterBands;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // QGSRASTERCALCDIALOG_H
|