Skip to content
Permalink
Browse files
Add widget for single band gray raster renderer
  • Loading branch information
mhugent committed Mar 5, 2012
1 parent a4f4f05 commit 8d415e5c080c6904cce55cf71c424277f52593c4
@@ -42,6 +42,7 @@
#include "qgsrasterrendererregistry.h"
#include "qgsmultibandcolorrendererwidget.h"
#include "qgspalettedrendererwidget.h"
#include "qgssinglebandgrayrendererwidget.h"
#include "qgssinglebandpseudocolorrendererwidget.h"

#include <QTableWidgetItem>
@@ -339,6 +340,7 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
QgsRasterRendererRegistry::instance()->insertWidgetFunction( "paletted", QgsPalettedRendererWidget::create );
QgsRasterRendererRegistry::instance()->insertWidgetFunction( "multibandcolor", QgsMultiBandColorRendererWidget::create );
QgsRasterRendererRegistry::instance()->insertWidgetFunction( "singlebandpseudocolor", QgsSingleBandPseudoColorRendererWidget::create );
QgsRasterRendererRegistry::instance()->insertWidgetFunction( "singlebandgray", QgsSingleBandGrayRendererWidget::create );

//fill available renderers into combo box
QList< QgsRasterRendererRegistryEntry > rendererEntries = QgsRasterRendererRegistry::instance()->entries();
@@ -18,6 +18,7 @@
#include "qgsrasterrendererregistry.h"
#include "qgsmultibandcolorrenderer.h"
#include "qgspalettedrasterrenderer.h"
#include "qgssinglebandgrayrenderer.h"
#include "qgssinglebandpseudocolorrenderer.h"

QgsRasterRendererRegistryEntry::QgsRasterRendererRegistryEntry( const QString& theName, const QString& theVisibleName,
@@ -50,24 +51,8 @@ QgsRasterRendererRegistry::QgsRasterRendererRegistry()
QgsMultiBandColorRenderer::create, 0 ) );
insert( QgsRasterRendererRegistryEntry( "singlebandpseudocolor", QObject::tr( "Singleband pseudocolor" ),
QgsSingleBandPseudoColorRenderer::create, 0 ) );

#if 0
//add entry for palleted renderer
QgsRasterRendererRegistryEntry palettedEntry;
palettedEntry.name = "paletted";
palettedEntry.visibleName = QObject::tr( "Paletted" );
palettedEntry.rendererCreateFunction = QgsPalettedRasterRenderer::create;
//widget function will be assigned later in raster properties dialog with QgsRasterRendererRegistry::insertWidgetFunction
palettedEntry.widgetCreateFunction = 0;
insert( palettedEntry );

QgsRasterRendererRegistryEntry multiBandColorEntry;
multiBandColorEntry.name = "multibandcolor";
multiBandColorEntry.visibleName = QObject::tr( "Multiband color" );
palettedEntry.rendererCreateFunction = QgsMultiBandColorRenderer::create;
multiBandColorEntry.widgetCreateFunction = 0;
insert( multiBandColorEntry );
#endif //0
insert( QgsRasterRendererRegistryEntry( "singlebandgray", QObject::tr( "Singleband gray" ),
QgsSingleBandGrayRenderer::create, 0 ) );
}

QgsRasterRendererRegistry::~QgsRasterRendererRegistry()
@@ -85,7 +70,6 @@ void QgsRasterRendererRegistry::insertWidgetFunction( const QString& rendererNam
{
return;
}

mEntries[rendererName].widgetCreateFunction = func;
}

@@ -3,6 +3,7 @@ SET(QGIS_GUI_SRCS

raster/qgsmultibandcolorrendererwidget.cpp
raster/qgspalettedrendererwidget.cpp
raster/qgssinglebandgrayrendererwidget.cpp
raster/qgssinglebandpseudocolorrendererwidget.cpp

symbology-ng/qgsbrushstylecombobox.cpp
@@ -86,6 +87,7 @@ SET(QGIS_GUI_MOC_HDRS

raster/qgspalettedrendererwidget.h
raster/qgsmultibandcolorrendererwidget.h
raster/qgssinglebandgrayrendererwidget.h
raster/qgssinglebandpseudocolorrendererwidget.h

symbology-ng/qgsdashspacedialog.h
@@ -0,0 +1,32 @@
/***************************************************************************
qgssinglebandgrayrendererwidget.h
---------------------------------
begin : March 2012
copyright : (C) 2012 by Marco Hugentobler
email : marco 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. *
* *
***************************************************************************/

#include "qgssinglebandgrayrendererwidget.h"

QgsSingleBandGrayRendererWidget::QgsSingleBandGrayRendererWidget( QgsRasterLayer* layer ): QgsRasterRendererWidget( layer )
{
setupUi( this );
}

QgsSingleBandGrayRendererWidget::~QgsSingleBandGrayRendererWidget()
{
}

QgsRasterRenderer* QgsSingleBandGrayRendererWidget::renderer()
{
return 0; //soon...
}
@@ -0,0 +1,36 @@
/***************************************************************************
qgssinglebandgrayrendererwidget.h
---------------------------------
begin : March 2012
copyright : (C) 2012 by Marco Hugentobler
email : marco 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 QGSSINGLEBANDGRAYRENDERERWIDGET_H
#define QGSSINGLEBANDGRAYRENDERERWIDGET_H

#include "qgsrasterrendererwidget.h"
#include "ui_qgssinglebandgrayrendererwidgetbase.h"

class QgsSingleBandGrayRendererWidget: public QgsRasterRendererWidget, private Ui::QgsSingleBandGrayRendererWidgetBase
{
Q_OBJECT
public:
QgsSingleBandGrayRendererWidget( QgsRasterLayer* layer );
~QgsSingleBandGrayRendererWidget();

static QgsRasterRendererWidget* create( QgsRasterLayer* layer ) { return new QgsSingleBandGrayRendererWidget( layer ); }

QgsRasterRenderer* renderer();
};

#endif // QGSSINGLEBANDGRAYRENDERERWIDGET_H
@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsSingleBandGrayRendererWidgetBase</class>
<widget class="QWidget" name="QgsSingleBandGrayRendererWidgetBase">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="mGrayBandLabel">
<property name="text">
<string>Gray band</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mGrayBandComboBox"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mContrastEnhancementLabel">
<property name="text">
<string>Contrast enhancement</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="mContrastEnhancementComboBox"/>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="mMinLabel">
<property name="text">
<string>Min</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mMinLineEdit"/>
</item>
<item>
<widget class="QLabel" name="mMaxLabel">
<property name="text">
<string>Max</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mMaxLineEdit"/>
</item>
</layout>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="mLoadMinMaxValuesGroupBox">
<property name="title">
<string>Load min-/max values</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QRadioButton" name="mEstimateRadioButton">
<property name="text">
<string>Estimate (faster)</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>254</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="mActualRadioButton">
<property name="text">
<string>Actual (slower)</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>254</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="mCurrentExtentRadioButton">
<property name="text">
<string>CurrentExtent</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>197</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="mLoadPushButton">
<property name="text">
<string>Load</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

0 comments on commit 8d415e5

Please sign in to comment.