QGIS API Documentation  master-6164ace
src/gui/raster/qgssinglebandpseudocolorrendererwidget.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgssinglebandpseudocolorrendererwidget.h
00003                          ----------------------------------------
00004     begin                : February 2012
00005     copyright            : (C) 2012 by Marco Hugentobler
00006     email                : marco at sourcepole dot ch
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef QGSSINGLEBANDCOLORRENDERERWIDGET_H
00019 #define QGSSINGLEBANDCOLORRENDERERWIDGET_H
00020 
00021 #include "qgsrasterminmaxwidget.h"
00022 #include "qgsrasterrendererwidget.h"
00023 #include "qgscolorrampshader.h"
00024 #include "ui_qgssinglebandpseudocolorrendererwidgetbase.h"
00025 
00026 class GUI_EXPORT QgsSingleBandPseudoColorRendererWidget: public QgsRasterRendererWidget,
00027       private Ui::QgsSingleBandPseudoColorRendererWidgetBase
00028 {
00029     Q_OBJECT
00030   public:
00031     enum Mode
00032     {
00033       Continuous = 1, // Using breaks from color palette
00034       EqualInterval = 2
00035     };
00036 
00037     QgsSingleBandPseudoColorRendererWidget( QgsRasterLayer* layer, const QgsRectangle &extent = QgsRectangle() );
00038     ~QgsSingleBandPseudoColorRendererWidget();
00039 
00040     static QgsRasterRendererWidget* create( QgsRasterLayer* layer, const QgsRectangle &theExtent ) { return new QgsSingleBandPseudoColorRendererWidget( layer, theExtent ); }
00041     QgsRasterRenderer* renderer();
00042 
00043     void setFromRenderer( const QgsRasterRenderer* r );
00044 
00045   public slots:
00046     void loadMinMax( int theBandNo, double theMin, double theMax, int theOrigin );
00047 
00048   private:
00049     void populateColormapTreeWidget( const QList<QgsColorRampShader::ColorRampItem>& colorRampItems );
00050 
00051   private slots:
00052     void on_mAddEntryButton_clicked();
00053     void on_mDeleteEntryButton_clicked();
00054     void on_mSortButton_clicked();
00055     void on_mClassifyButton_clicked();
00056     void on_mLoadFromBandButton_clicked();
00057     void on_mLoadFromFileButton_clicked();
00058     void on_mExportToFileButton_clicked();
00059     void on_mColormapTreeWidget_itemDoubleClicked( QTreeWidgetItem* item, int column );
00060     void on_mBandComboBox_currentIndexChanged( int index );
00061     void on_mMinLineEdit_textChanged( const QString & text ) { Q_UNUSED( text ); resetClassifyButton(); }
00062     void on_mMaxLineEdit_textChanged( const QString & text ) { Q_UNUSED( text ); resetClassifyButton(); }
00063     void on_mMinLineEdit_textEdited( const QString & text ) { Q_UNUSED( text ); mMinMaxOrigin = QgsRasterRenderer::MinMaxUser; showMinMaxOrigin(); }
00064     void on_mMaxLineEdit_textEdited( const QString & text ) { Q_UNUSED( text ); mMinMaxOrigin = QgsRasterRenderer::MinMaxUser; showMinMaxOrigin(); }
00065     void on_mClassificationModeComboBox_currentIndexChanged( int index );
00066     void on_mColorRampComboBox_currentIndexChanged( int index );
00067 
00068   private:
00069     void setLineEditValue( QLineEdit *theLineEdit, double theValue );
00070     double lineEditValue( const QLineEdit *theLineEdit ) const;
00071     void resetClassifyButton();
00072     void showMinMaxOrigin();
00073     QgsRasterMinMaxWidget * mMinMaxWidget;
00074     int mMinMaxOrigin;
00075 };
00076 
00077 #endif // QGSSINGLEBANDCOLORRENDERERWIDGET_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines