10 changes: 5 additions & 5 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6446,25 +6446,25 @@ void QgisApp::options()

void QgisApp::fullHistogramStretch()
{
histogramStretch( false, QgsRasterLayer::ContrastEnhancementMinMax );
histogramStretch( false, QgsRaster::ContrastEnhancementMinMax );
}

void QgisApp::localHistogramStretch()
{
histogramStretch( true, QgsRasterLayer::ContrastEnhancementMinMax );
histogramStretch( true, QgsRaster::ContrastEnhancementMinMax );
}

void QgisApp::fullCumulativeCutStretch()
{
histogramStretch( false, QgsRasterLayer::ContrastEnhancementCumulativeCut );
histogramStretch( false, QgsRaster::ContrastEnhancementCumulativeCut );
}

void QgisApp::localCumulativeCutStretch()
{
histogramStretch( true, QgsRasterLayer::ContrastEnhancementCumulativeCut );
histogramStretch( true, QgsRaster::ContrastEnhancementCumulativeCut );
}

void QgisApp::histogramStretch( bool visibleAreaOnly, QgsRasterLayer::ContrastEnhancementLimits theLimits )
void QgisApp::histogramStretch( bool visibleAreaOnly, QgsRaster::ContrastEnhancementLimits theLimits )
{
QgsMapLayer * myLayer = mMapLegend->currentLayer();

Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
void createDecorations();

/**Do histogram stretch for singleband gray / multiband color rasters*/
void histogramStretch( bool visibleAreaOnly = false, QgsRasterLayer::ContrastEnhancementLimits theLimits = QgsRasterLayer::ContrastEnhancementMinMax );
void histogramStretch( bool visibleAreaOnly = false, QgsRaster::ContrastEnhancementLimits theLimits = QgsRaster::ContrastEnhancementMinMax );

/**Apply raster brightness
* @note Added in QGIS 2.0 */
Expand Down
18 changes: 9 additions & 9 deletions src/app/qgsidentifyresultsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
QgsDebugMsg( QString( "feature.isValid() = %1" ).arg( feature.isValid() ) );
QTreeWidgetItem *layItem = layerItem( layer );

QgsRasterDataProvider::IdentifyFormat currentFormat = QgsRasterDataProvider::identifyFormatFromName( layer->customProperty( "identify/format" ).toString() );
QgsRaster::IdentifyFormat currentFormat = QgsRasterDataProvider::identifyFormatFromName( layer->customProperty( "identify/format" ).toString() );

if ( layItem == 0 )
{
Expand All @@ -450,12 +450,12 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
// Add all supported formats, best first. HTML is considered the best because
// it usually holds most informations.
int capabilities = layer->dataProvider()->capabilities();
QList<QgsRasterDataProvider::IdentifyFormat> formats;
formats << QgsRasterDataProvider::IdentifyFormatHtml
<< QgsRasterDataProvider::IdentifyFormatFeature
<< QgsRasterDataProvider::IdentifyFormatText
<< QgsRasterDataProvider::IdentifyFormatValue;
foreach ( QgsRasterDataProvider::IdentifyFormat f, formats )
QList<QgsRaster::IdentifyFormat> formats;
formats << QgsRaster::IdentifyFormatHtml
<< QgsRaster::IdentifyFormatFeature
<< QgsRaster::IdentifyFormatText
<< QgsRaster::IdentifyFormatValue;
foreach ( QgsRaster::IdentifyFormat f, formats )
{
if ( !( QgsRasterDataProvider::identifyFormatToCapability( f ) & capabilities ) ) continue;
formatCombo->addItem( QgsRasterDataProvider::identifyFormatLabel( f ), f );
Expand Down Expand Up @@ -506,7 +506,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
}
}

if ( currentFormat == QgsRasterDataProvider::IdentifyFormatHtml )
if ( currentFormat == QgsRaster::IdentifyFormatHtml )
{
QgsIdentifyResultsWebViewItem *attrItem = new QgsIdentifyResultsWebViewItem( lstResults );
featItem->addChild( attrItem ); // before setHtml()!
Expand Down Expand Up @@ -1395,7 +1395,7 @@ void QgsIdentifyResultsDialog::formatChanged( int index )
QgsDebugMsg( "sender is not QComboBox" );
return;
}
QgsRasterDataProvider::IdentifyFormat format = ( QgsRasterDataProvider::IdentifyFormat ) combo->itemData( index, Qt::UserRole ).toInt();
QgsRaster::IdentifyFormat format = ( QgsRaster::IdentifyFormat ) combo->itemData( index, Qt::UserRole ).toInt();
QgsDebugMsg( QString( "format = %1" ).arg( format ) );
QgsRasterLayer *layer = ( QgsRasterLayer * )combo->itemData( index, Qt::UserRole + 1 ).value<void *>();
if ( !layer )
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsrasterlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ void QgsRasterLayerProperties::on_buttonBuildPyramids_clicked()
QString res = provider->buildPyramids(
myPyramidList,
cboResamplingMethod->itemData( cboResamplingMethod->currentIndex() ).toString(),
( QgsRasterDataProvider::RasterPyramidsFormat ) cbxPyramidsFormat->currentIndex() );
( QgsRaster::RasterPyramidsFormat ) cbxPyramidsFormat->currentIndex() );
QApplication::restoreOverrideCursor();
mPyramidProgress->setValue( 0 );
buttonBuildPyramids->setEnabled( false );
Expand Down Expand Up @@ -1447,7 +1447,7 @@ void QgsRasterLayerProperties::pixelSelected( const QgsPoint& canvasPoint )
int myWidth = mMapCanvas->extent().width() / mapUnitsPerPixel;
int myHeight = mMapCanvas->extent().height() / mapUnitsPerPixel;

QMap<int, QVariant> myPixelMap = mRasterLayer->dataProvider()->identify( myPoint, QgsRasterDataProvider::IdentifyFormatValue, myExtent, myWidth, myHeight ).results();
QMap<int, QVariant> myPixelMap = mRasterLayer->dataProvider()->identify( myPoint, QgsRaster::IdentifyFormatValue, myExtent, myWidth, myHeight ).results();

QList<int> bands = renderer->usesBands();

Expand Down
2 changes: 2 additions & 0 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ SET(QGIS_CORE_SRCS
pal/rtree.hpp

raster/qgscliptominmaxenhancement.cpp
raster/qgsraster.cpp
raster/qgsrasterblock.cpp
raster/qgscolorrampshader.cpp
raster/qgscontrastenhancement.cpp
Expand Down Expand Up @@ -455,6 +456,7 @@ SET(QGIS_CORE_HDRS
composer/qgslegendmodel.h
composer/qgscomposerlegenditem.h

raster/qgsraster.h
raster/qgsrasterblock.h
raster/qgsrasterdataprovider.h
raster/qgsrasterresamplefilter.h
Expand Down
4 changes: 2 additions & 2 deletions src/core/raster/qgscliptominmaxenhancement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ email : ersts@amnh.org

#include "qgscliptominmaxenhancement.h"

QgsClipToMinMaxEnhancement::QgsClipToMinMaxEnhancement( QgsContrastEnhancement::QgsRasterDataType theQgsRasterDataType, double theMinimumValue, double theMaximumValue ) : QgsContrastEnhancementFunction( theQgsRasterDataType, theMinimumValue, theMaximumValue )
QgsClipToMinMaxEnhancement::QgsClipToMinMaxEnhancement( QGis::DataType theQgsRasterDataType, double theMinimumValue, double theMaximumValue ) : QgsContrastEnhancementFunction( theQgsRasterDataType, theMinimumValue, theMaximumValue )
{
}

Expand All @@ -29,7 +29,7 @@ int QgsClipToMinMaxEnhancement::enhance( double theValue )
return -1;
}

if ( mQgsRasterDataType == QgsContrastEnhancement::QGS_Byte )
if ( mQgsRasterDataType == QGis::Byte )
{
return static_cast<int>( theValue );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgscliptominmaxenhancement.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CORE_EXPORT QgsClipToMinMaxEnhancement : public QgsContrastEnhancementFunc
{

public:
QgsClipToMinMaxEnhancement( QgsContrastEnhancement::QgsRasterDataType, double, double );
QgsClipToMinMaxEnhancement( QGis::DataType, double, double );

int enhance( double );

Expand Down
62 changes: 32 additions & 30 deletions src/core/raster/qgscontrastenhancement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz
#include <QDomDocument>
#include <QDomElement>

QgsContrastEnhancement::QgsContrastEnhancement( QgsRasterDataType theDataType )
QgsContrastEnhancement::QgsContrastEnhancement( QGis::DataType theDataType )
{
mLookupTable = 0;
mContrastEnhancementFunction = 0;
Expand Down Expand Up @@ -89,45 +89,46 @@ QgsContrastEnhancement::~QgsContrastEnhancement()
/**
Simple function to compute the maximum possible value for a data types.
*/
double QgsContrastEnhancement::maximumValuePossible( QgsRasterDataType theDataType )
double QgsContrastEnhancement::maximumValuePossible( QGis::DataType theDataType )
{
switch ( theDataType )
{
case QGS_Byte:
case QGis::Byte:
return std::numeric_limits<unsigned char>::max();
break;
case QGS_UInt16:
case QGis::UInt16:
return std::numeric_limits<unsigned short>::max();
break;
case QGS_Int16:
case QGis::Int16:
return std::numeric_limits<short>::max();
break;
case QGS_UInt32:
case QGis::UInt32:
return std::numeric_limits<unsigned int>::max();
break;
case QGS_Int32:
case QGis::Int32:
return std::numeric_limits<int>::max();
break;
case QGS_Float32:
case QGis::Float32:
return std::numeric_limits<float>::max();
break;
case QGS_Float64:
case QGis::Float64:
return std::numeric_limits<double>::max();
break;
case QGS_CInt16:
case QGis::CInt16:
return std::numeric_limits<short>::max();
break;
case QGS_CInt32:
case QGis::CInt32:
return std::numeric_limits<int>::max();
break;
case QGS_CFloat32:
case QGis::CFloat32:
return std::numeric_limits<float>::max();
break;
case QGS_CFloat64:
case QGis::CFloat64:
return std::numeric_limits<double>::max();
break;
case QGS_Unknown:
case QGS_TypeCount:
case QGis::ARGB32:
case QGis::ARGB32_Premultiplied:
case QGis::UnknownDataType:
// XXX - mloskot: not handled?
break;
}
Expand All @@ -137,45 +138,46 @@ double QgsContrastEnhancement::maximumValuePossible( QgsRasterDataType theDataTy
/**
Simple function to compute the minimum possible value for a data type.
*/
double QgsContrastEnhancement::minimumValuePossible( QgsRasterDataType theDataType )
double QgsContrastEnhancement::minimumValuePossible( QGis::DataType theDataType )
{
switch ( theDataType )
{
case QGS_Byte:
case QGis::Byte:
return std::numeric_limits<unsigned char>::min();
break;
case QGS_UInt16:
case QGis::UInt16:
return std::numeric_limits<unsigned short>::min();
break;
case QGS_Int16:
case QGis::Int16:
return std::numeric_limits<short>::min();
break;
case QGS_UInt32:
case QGis::UInt32:
return std::numeric_limits<unsigned int>::min();
break;
case QGS_Int32:
case QGis::Int32:
return std::numeric_limits<int>::min();
break;
case QGS_Float32:
case QGis::Float32:
return std::numeric_limits<float>::max() * -1.0;
break;
case QGS_Float64:
case QGis::Float64:
return std::numeric_limits<double>::max() * -1.0;
break;
case QGS_CInt16:
case QGis::CInt16:
return std::numeric_limits<short>::min();
break;
case QGS_CInt32:
case QGis::CInt32:
return std::numeric_limits<int>::min();
break;
case QGS_CFloat32:
case QGis::CFloat32:
return std::numeric_limits<float>::max() * -1.0;
break;
case QGS_CFloat64:
case QGis::CFloat64:
return std::numeric_limits<double>::max() * -1.0;
break;
case QGS_Unknown:
case QGS_TypeCount:
case QGis::ARGB32:
case QGis::ARGB32_Premultiplied:
case QGis::UnknownDataType:
// XXX - mloskot: not handled?
break;
}
Expand Down Expand Up @@ -224,7 +226,7 @@ bool QgsContrastEnhancement::generateLookupTable()
return false;
if ( NoEnhancement == mContrastEnhancementAlgorithm )
return false;
if ( QGS_Byte != mRasterDataType && QGS_UInt16 != mRasterDataType && QGS_Int16 != mRasterDataType )
if ( QGis::Byte != mRasterDataType && QGis::UInt16 != mRasterDataType && QGis::Int16 != mRasterDataType )
return false;
if ( !mLookupTable )
return false;
Expand Down
34 changes: 6 additions & 28 deletions src/core/raster/qgscontrastenhancement.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz

#include <limits>

#include "qgis.h"

class QgsContrastEnhancementFunction;
class QDomDocument;
class QDomElement;
Expand All @@ -48,31 +50,7 @@ class CORE_EXPORT QgsContrastEnhancement
UserDefinedEnhancement
};

/** These are exactly the same as GDAL pixel data types
** This was added so that the python bindings could be built,
** which initially was a problem because GDALDataType was passed
** around as an argument to numerous method, including the constructor.
**
** It seems like there should be a better way to do this...
*/
enum QgsRasterDataType
{
QGS_Unknown = 0,
/*! Eight bit unsigned integer */ QGS_Byte = 1,
/*! Sixteen bit unsigned integer */ QGS_UInt16 = 2,
/*! Sixteen bit signed integer */ QGS_Int16 = 3,
/*! Thirty two bit unsigned integer */ QGS_UInt32 = 4,
/*! Thirty two bit signed integer */ QGS_Int32 = 5,
/*! Thirty two bit floating point */ QGS_Float32 = 6,
/*! Sixty four bit floating point */ QGS_Float64 = 7,
/*! Complex Int16 */ QGS_CInt16 = 8,
/*! Complex Int32 */ QGS_CInt32 = 9,
/*! Complex Float32 */ QGS_CFloat32 = 10,
/*! Complex Float64 */ QGS_CFloat64 = 11,
QGS_TypeCount = 12 /* maximum type # + 1 */
};

QgsContrastEnhancement( QgsContrastEnhancement::QgsRasterDataType theDatatype = QGS_Byte );
QgsContrastEnhancement( QGis::DataType theDatatype = QGis::Byte );
QgsContrastEnhancement( const QgsContrastEnhancement& ce );
~QgsContrastEnhancement();

Expand All @@ -82,10 +60,10 @@ class CORE_EXPORT QgsContrastEnhancement
*
*/
/** \brief Helper function that returns the maximum possible value for a GDAL data type */
static double maximumValuePossible( QgsRasterDataType );
static double maximumValuePossible( QGis::DataType );

/** \brief Helper function that returns the minimum possible value for a GDAL data type */
static double minimumValuePossible( QgsRasterDataType );
static double minimumValuePossible( QGis::DataType );

/*
*
Expand Down Expand Up @@ -154,7 +132,7 @@ class CORE_EXPORT QgsContrastEnhancement
double mMaximumValue;

/** \brief Data type of the band */
QgsRasterDataType mRasterDataType;
QGis::DataType mRasterDataType;

/** \brief Maximum range of values for a given data type */
double mRasterDataTypeRange;
Expand Down
4 changes: 2 additions & 2 deletions src/core/raster/qgscontrastenhancementfunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ email : ersts@amnh.org

#include "qgscontrastenhancementfunction.h"

QgsContrastEnhancementFunction::QgsContrastEnhancementFunction( QgsContrastEnhancement::QgsRasterDataType theDataType, double theMinimumValue, double theMaximumValue )
QgsContrastEnhancementFunction::QgsContrastEnhancementFunction( QGis::DataType theDataType, double theMinimumValue, double theMaximumValue )
{
mQgsRasterDataType = theDataType;
mMaximumValue = theMaximumValue;
Expand All @@ -36,7 +36,7 @@ QgsContrastEnhancementFunction::QgsContrastEnhancementFunction( const QgsContras

int QgsContrastEnhancementFunction::enhance( double theValue )
{
if ( mQgsRasterDataType == QgsContrastEnhancement::QGS_Byte )
if ( mQgsRasterDataType == QGis::Byte )
{
return static_cast<int>( theValue );
}
Expand Down
5 changes: 3 additions & 2 deletions src/core/raster/qgscontrastenhancementfunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ email : ersts@amnh.org
#ifndef QGSCONTRASTENHANCEMENTFUNCTION_H
#define QGSCONTRASTENHANCEMENTFUNCTION_H

#include "qgis.h"
#include "qgscontrastenhancement.h"

/** \ingroup core
Expand All @@ -31,7 +32,7 @@ class CORE_EXPORT QgsContrastEnhancementFunction
{

public:
QgsContrastEnhancementFunction( QgsContrastEnhancement::QgsRasterDataType, double, double );
QgsContrastEnhancementFunction( QGis::DataType, double, double );
QgsContrastEnhancementFunction( const QgsContrastEnhancementFunction& f );
virtual ~QgsContrastEnhancementFunction() {}

Expand All @@ -58,7 +59,7 @@ class CORE_EXPORT QgsContrastEnhancementFunction
double mMinimumMaximumRange;

/** \brief Data type of the band */
QgsContrastEnhancement::QgsRasterDataType mQgsRasterDataType;
QGis::DataType mQgsRasterDataType;
};

#endif
2 changes: 1 addition & 1 deletion src/core/raster/qgslinearminmaxenhancement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ email : ersts@amnh.org

#include "qgslinearminmaxenhancement.h"

QgsLinearMinMaxEnhancement::QgsLinearMinMaxEnhancement( QgsContrastEnhancement::QgsRasterDataType theQgsRasterDataType, double theMinimumValue, double theMaximumValue ) : QgsContrastEnhancementFunction( theQgsRasterDataType, theMinimumValue, theMaximumValue )
QgsLinearMinMaxEnhancement::QgsLinearMinMaxEnhancement( QGis::DataType theQgsRasterDataType, double theMinimumValue, double theMaximumValue ) : QgsContrastEnhancementFunction( theQgsRasterDataType, theMinimumValue, theMaximumValue )
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgslinearminmaxenhancement.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CORE_EXPORT QgsLinearMinMaxEnhancement : public QgsContrastEnhancementFunc
{

public:
QgsLinearMinMaxEnhancement( QgsContrastEnhancement::QgsRasterDataType, double, double );
QgsLinearMinMaxEnhancement( QGis::DataType, double, double );

int enhance( double );

Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgslinearminmaxenhancementwithclip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ email : ersts@amnh.org

#include "qgslinearminmaxenhancementwithclip.h"

QgsLinearMinMaxEnhancementWithClip::QgsLinearMinMaxEnhancementWithClip( QgsContrastEnhancement::QgsRasterDataType theQgsRasterDataType, double theMinimumValue, double theMaximumValue ) : QgsContrastEnhancementFunction( theQgsRasterDataType, theMinimumValue, theMaximumValue )
QgsLinearMinMaxEnhancementWithClip::QgsLinearMinMaxEnhancementWithClip( QGis::DataType theQgsRasterDataType, double theMinimumValue, double theMaximumValue ) : QgsContrastEnhancementFunction( theQgsRasterDataType, theMinimumValue, theMaximumValue )
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgslinearminmaxenhancementwithclip.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CORE_EXPORT QgsLinearMinMaxEnhancementWithClip : public QgsContrastEnhance
{

public:
QgsLinearMinMaxEnhancementWithClip( QgsContrastEnhancement::QgsRasterDataType, double, double );
QgsLinearMinMaxEnhancementWithClip( QGis::DataType, double, double );

int enhance( double );

Expand Down
6 changes: 3 additions & 3 deletions src/core/raster/qgsmultibandcolorrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ QgsRasterRenderer* QgsMultiBandColorRenderer::create( const QDomElement& elem, Q
QDomElement redContrastElem = elem.firstChildElement( "redContrastEnhancement" );
if ( !redContrastElem.isNull() )
{
redContrastEnhancement = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )(
redContrastEnhancement = new QgsContrastEnhancement(( QGis::DataType )(
input->dataType( redBand ) ) );
redContrastEnhancement->readXML( redContrastElem );
}
Expand All @@ -103,7 +103,7 @@ QgsRasterRenderer* QgsMultiBandColorRenderer::create( const QDomElement& elem, Q
QDomElement greenContrastElem = elem.firstChildElement( "greenContrastEnhancement" );
if ( !greenContrastElem.isNull() )
{
greenContrastEnhancement = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )(
greenContrastEnhancement = new QgsContrastEnhancement(( QGis::DataType )(
input->dataType( greenBand ) ) );
greenContrastEnhancement->readXML( greenContrastElem );
}
Expand All @@ -112,7 +112,7 @@ QgsRasterRenderer* QgsMultiBandColorRenderer::create( const QDomElement& elem, Q
QDomElement blueContrastElem = elem.firstChildElement( "blueContrastEnhancement" );
if ( !blueContrastElem.isNull() )
{
blueContrastEnhancement = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )(
blueContrastEnhancement = new QgsContrastEnhancement(( QGis::DataType )(
input->dataType( blueBand ) ) );
blueContrastEnhancement->readXML( blueContrastElem );
}
Expand Down
56 changes: 56 additions & 0 deletions src/core/raster/qgsraster.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/***************************************************************************
qgsraster.cpp - Raster namespace
--------------------------------------
Date : Apr, 2013
Copyright : (C) 2013 by Radim Blazek
email : radim dot blazek at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* 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 "qgsraster.h"

QString QgsRaster::contrastEnhancementLimitsAsString( ContrastEnhancementLimits theLimits )
{
switch ( theLimits )
{
case QgsRaster::ContrastEnhancementMinMax:
return "MinMax";
break;
case QgsRaster::ContrastEnhancementStdDev:
return "StdDev";
break;
case QgsRaster::ContrastEnhancementCumulativeCut:
return "CumulativeCut";
break;
default:
break;
}
return "None";
}

QgsRaster::ContrastEnhancementLimits QgsRaster::contrastEnhancementLimitsFromString( QString theLimits )
{
if ( theLimits == "MinMax" )
{
return ContrastEnhancementMinMax;
}
else if ( theLimits == "StdDev" )
{
return ContrastEnhancementStdDev;
}
else if ( theLimits == "CumulativeCut" )
{
return ContrastEnhancementCumulativeCut;
}
return ContrastEnhancementNone;
}


99 changes: 99 additions & 0 deletions src/core/raster/qgsraster.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/***************************************************************************
qgsraster.h - Raster namespace
--------------------------------------
Date : Apr 2013
Copyright : (C) 2013 by Radim Blazek
email : radim dot blazek at gmail dot com
***************************************************************************/

/***************************************************************************
* *
* 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 QGSRASTER_H
#define QGSRASTER_H

#include <QString>

/** \ingroup core
* Raster namespace.
*/
class CORE_EXPORT QgsRaster
{
public:
// This is modified copy of GDALColorInterp
enum ColorInterpretation
{
UndefinedColorInterpretation = 0,
/*! Greyscale */ GrayIndex = 1,
/*! Paletted (see associated color table) */ PaletteIndex = 2, // indexed color table
/*! Red band of RGBA image */ RedBand = 3,
/*! Green band of RGBA image */ GreenBand = 4,
/*! Blue band of RGBA image */ BlueBand = 5,
/*! Alpha (0=transparent, 255=opaque) */ AlphaBand = 6,
/*! Hue band of HLS image */ HueBand = 7,
/*! Saturation band of HLS image */ SaturationBand = 8,
/*! Lightness band of HLS image */ LightnessBand = 9,
/*! Cyan band of CMYK image */ CyanBand = 10,
/*! Magenta band of CMYK image */ MagentaBand = 11,
/*! Yellow band of CMYK image */ YellowBand = 12,
/*! Black band of CMLY image */ BlackBand = 13,
/*! Y Luminance */ YCbCr_YBand = 14,
/*! Cb Chroma */ YCbCr_CbBand = 15,
/*! Cr Chroma */ YCbCr_CrBand = 16,
/*! Continuous palette, QGIS addition, GRASS */ ContinuousPalette = 17
};

enum IdentifyFormat
{
IdentifyFormatUndefined = 0,
IdentifyFormatValue = 1, // numerical pixel value
IdentifyFormatText = 1 << 1, // WMS text
IdentifyFormatHtml = 1 << 2, // WMS HTML
IdentifyFormatFeature = 1 << 3 // WMS GML -> feature
};

// Progress types
enum RasterProgressType
{
ProgressHistogram = 0,
ProgressPyramids = 1,
ProgressStatistics = 2
};

enum RasterBuildPyramids
{
PyramidsFlagNo = 0,
PyramidsFlagYes = 1,
PyramidsCopyExisting = 2
};

enum RasterPyramidsFormat
{
PyramidsGTiff = 0,
PyramidsInternal = 1,
PyramidsErdas = 2
};

/** \brief Contrast enhancement limits */
enum ContrastEnhancementLimits
{
ContrastEnhancementNone,
ContrastEnhancementMinMax,
ContrastEnhancementStdDev,
ContrastEnhancementCumulativeCut
};

static QString contrastEnhancementLimitsAsString( QgsRaster::ContrastEnhancementLimits theLimits );
static ContrastEnhancementLimits contrastEnhancementLimitsFromString( QString theLimits );

};

#endif


50 changes: 25 additions & 25 deletions src/core/raster/qgsrasterdataprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,12 @@ QString QgsRasterDataProvider::metadata()
}

// Default implementation for values
QgsRasterIdentifyResult QgsRasterDataProvider::identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
QgsRasterIdentifyResult QgsRasterDataProvider::identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
{
QgsDebugMsg( "Entered" );
QMap<int, QVariant> results;

if ( theFormat != IdentifyFormatValue || !( capabilities() & IdentifyValue ) )
if ( theFormat != QgsRaster::IdentifyFormatValue || !( capabilities() & IdentifyValue ) )
{
QgsDebugMsg( "Format not supported" );
return QgsRasterIdentifyResult( ERR( tr( "Format not supported" ) ) );
Expand All @@ -289,7 +289,7 @@ QgsRasterIdentifyResult QgsRasterDataProvider::identify( const QgsPoint & thePoi
{
results.insert( bandNo, QVariant() );
}
return QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormatValue, results );
return QgsRasterIdentifyResult( QgsRaster::IdentifyFormatValue, results );
}

QgsRectangle myExtent = theExtent;
Expand Down Expand Up @@ -333,7 +333,7 @@ QgsRasterIdentifyResult QgsRasterDataProvider::identify( const QgsPoint & thePoi
results.insert( i, QVariant() );
}
}
return QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormatValue, results );
return QgsRasterIdentifyResult( QgsRaster::IdentifyFormatValue, results );
}

QString QgsRasterDataProvider::lastErrorFormat()
Expand Down Expand Up @@ -441,60 +441,60 @@ QgsRasterDataProvider* QgsRasterDataProvider::create( const QString &providerKey
return createFn( uri, format, nBands, type, width, height, geoTransform, crs, createOptions );
}

QString QgsRasterDataProvider::identifyFormatName( IdentifyFormat format )
QString QgsRasterDataProvider::identifyFormatName( QgsRaster::IdentifyFormat format )
{
switch ( format )
{
case IdentifyFormatValue:
case QgsRaster::IdentifyFormatValue:
return "Value";
case IdentifyFormatText:
case QgsRaster::IdentifyFormatText:
return "Text";
case IdentifyFormatHtml:
case QgsRaster::IdentifyFormatHtml:
return "Html";
case IdentifyFormatFeature:
case QgsRaster::IdentifyFormatFeature:
return "Feature";
default:
return "Undefined";
}
}

QString QgsRasterDataProvider::identifyFormatLabel( IdentifyFormat format )
QString QgsRasterDataProvider::identifyFormatLabel( QgsRaster::IdentifyFormat format )
{
switch ( format )
{
case IdentifyFormatValue:
case QgsRaster::IdentifyFormatValue:
return tr( "Value" );
case IdentifyFormatText:
case QgsRaster::IdentifyFormatText:
return ( "Text" );
case IdentifyFormatHtml:
case QgsRaster::IdentifyFormatHtml:
return tr( "Html" );
case IdentifyFormatFeature:
case QgsRaster::IdentifyFormatFeature:
return tr( "Feature" );
default:
return "Undefined";
}
}

QgsRasterDataProvider::IdentifyFormat QgsRasterDataProvider::identifyFormatFromName( QString formatName )
QgsRaster::IdentifyFormat QgsRasterDataProvider::identifyFormatFromName( QString formatName )
{
if ( formatName == "Value" ) return IdentifyFormatValue;
if ( formatName == "Text" ) return IdentifyFormatText;
if ( formatName == "Html" ) return IdentifyFormatHtml;
if ( formatName == "Feature" ) return IdentifyFormatFeature;
return IdentifyFormatUndefined;
if ( formatName == "Value" ) return QgsRaster::IdentifyFormatValue;
if ( formatName == "Text" ) return QgsRaster::IdentifyFormatText;
if ( formatName == "Html" ) return QgsRaster::IdentifyFormatHtml;
if ( formatName == "Feature" ) return QgsRaster::IdentifyFormatFeature;
return QgsRaster::IdentifyFormatUndefined;
}

QgsRasterInterface::Capability QgsRasterDataProvider::identifyFormatToCapability( IdentifyFormat format )
QgsRasterInterface::Capability QgsRasterDataProvider::identifyFormatToCapability( QgsRaster::IdentifyFormat format )
{
switch ( format )
{
case IdentifyFormatValue:
case QgsRaster::IdentifyFormatValue:
return IdentifyValue;
case IdentifyFormatText:
case QgsRaster::IdentifyFormatText:
return IdentifyText;
case IdentifyFormatHtml:
case QgsRaster::IdentifyFormatHtml:
return IdentifyHtml;
case IdentifyFormatFeature:
case QgsRaster::IdentifyFormatFeature:
return IdentifyFeature;
default:
return NoCapabilities;
Expand Down
116 changes: 31 additions & 85 deletions src/core/raster/qgsrasterdataprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "qgsfield.h"
#include "qgslogger.h"
#include "qgsrasterbandstats.h"
#include "qgsraster.h"
#include "qgsrasterhistogram.h"
#include "qgsrasterinterface.h"
#include "qgsrasterpyramid.h"
Expand All @@ -53,61 +54,6 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
Q_OBJECT

public:
// This is modified copy of GDALColorInterp
enum ColorInterpretation
{
UndefinedColorInterpretation = 0,
/*! Greyscale */ GrayIndex = 1,
/*! Paletted (see associated color table) */ PaletteIndex = 2, // indexed color table
/*! Red band of RGBA image */ RedBand = 3,
/*! Green band of RGBA image */ GreenBand = 4,
/*! Blue band of RGBA image */ BlueBand = 5,
/*! Alpha (0=transparent, 255=opaque) */ AlphaBand = 6,
/*! Hue band of HLS image */ HueBand = 7,
/*! Saturation band of HLS image */ SaturationBand = 8,
/*! Lightness band of HLS image */ LightnessBand = 9,
/*! Cyan band of CMYK image */ CyanBand = 10,
/*! Magenta band of CMYK image */ MagentaBand = 11,
/*! Yellow band of CMYK image */ YellowBand = 12,
/*! Black band of CMLY image */ BlackBand = 13,
/*! Y Luminance */ YCbCr_YBand = 14,
/*! Cb Chroma */ YCbCr_CbBand = 15,
/*! Cr Chroma */ YCbCr_CrBand = 16,
/*! Continuous palette, QGIS addition, GRASS */ ContinuousPalette = 17,
/*! Max current value */ ColorInterpretationMax = 17
};

enum IdentifyFormat
{
IdentifyFormatUndefined = 0,
IdentifyFormatValue = 1, // numerical pixel value
IdentifyFormatText = 1 << 1, // WMS text
IdentifyFormatHtml = 1 << 2, // WMS HTML
IdentifyFormatFeature = 1 << 3 // WMS GML -> feature
};

// Progress types
enum RasterProgressType
{
ProgressHistogram = 0,
ProgressPyramids = 1,
ProgressStatistics = 2
};

enum RasterBuildPyramids
{
PyramidsFlagNo = 0,
PyramidsFlagYes = 1,
CopyExisting = 2
};

enum RasterPyramidsFormat
{
PyramidsGTiff = 0,
PyramidsInternal = 1,
PyramidsErdas = 2
};

QgsRasterDataProvider();

QgsRasterDataProvider( const QString & uri );
Expand Down Expand Up @@ -137,63 +83,63 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
virtual int colorInterpretation( int theBandNo ) const
{
Q_UNUSED( theBandNo );
return QgsRasterDataProvider::UndefinedColorInterpretation;
return QgsRaster::UndefinedColorInterpretation;
}

QString colorName( int colorInterpretation ) const
{
// Modified copy from GDAL
switch ( colorInterpretation )
{
case UndefinedColorInterpretation:
case QgsRaster::UndefinedColorInterpretation:
return "Undefined";

case GrayIndex:
case QgsRaster::GrayIndex:
return "Gray";

case PaletteIndex:
case QgsRaster::PaletteIndex:
return "Palette";

case RedBand:
case QgsRaster::RedBand:
return "Red";

case GreenBand:
case QgsRaster::GreenBand:
return "Green";

case BlueBand:
case QgsRaster::BlueBand:
return "Blue";

case AlphaBand:
case QgsRaster::AlphaBand:
return "Alpha";

case HueBand:
case QgsRaster::HueBand:
return "Hue";

case SaturationBand:
case QgsRaster::SaturationBand:
return "Saturation";

case LightnessBand:
case QgsRaster::LightnessBand:
return "Lightness";

case CyanBand:
case QgsRaster::CyanBand:
return "Cyan";

case MagentaBand:
case QgsRaster::MagentaBand:
return "Magenta";

case YellowBand:
case QgsRaster::YellowBand:
return "Yellow";

case BlackBand:
case QgsRaster::BlackBand:
return "Black";

case YCbCr_YBand:
case QgsRaster::YCbCr_YBand:
return "YCbCr_Y";

case YCbCr_CbBand:
case QgsRaster::YCbCr_CbBand:
return "YCbCr_Cb";

case YCbCr_CrBand:
case QgsRaster::YCbCr_CrBand:
return "YCbCr_Cr";

default:
Expand Down Expand Up @@ -243,7 +189,7 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
/** \brief Create pyramid overviews */
virtual QString buildPyramids( const QList<QgsRasterPyramid> & thePyramidList,
const QString & theResamplingMethod = "NEAREST",
RasterPyramidsFormat theFormat = PyramidsGTiff,
QgsRaster::RasterPyramidsFormat theFormat = QgsRaster::PyramidsGTiff,
const QStringList & theConfigOptions = QStringList() )
{
Q_UNUSED( thePyramidList ); Q_UNUSED( theResamplingMethod );
Expand Down Expand Up @@ -285,15 +231,15 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
* @param theExtent context extent
* @param theWidth context width
* @param theHeight context height
* @return IdentifyFormatValue: map of values for each band, keys are band numbers
* @return QgsRaster::IdentifyFormatValue: map of values for each band, keys are band numbers
* (from 1).
* IdentifyFormatFeature: map of QgsRasterFeatureList for each sublayer
* (WMS) - TODO: it is not consistent with IdentifyFormatValue.
* IdentifyFormatHtml: map of HTML strings for each sublayer (WMS).
* QgsRaster::IdentifyFormatFeature: map of QgsRasterFeatureList for each sublayer
* (WMS) - TODO: it is not consistent with QgsRaster::IdentifyFormatValue.
* QgsRaster::IdentifyFormatHtml: map of HTML strings for each sublayer (WMS).
* Empty if failed or there are no results (TODO: better error reporting).
*/
//virtual QMap<int, QVariant> identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );
virtual QgsRasterIdentifyResult identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );
//virtual QMap<int, QVariant> identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );
virtual QgsRasterIdentifyResult identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );

/**
* \brief Returns the caption error text for the last error in this provider
Expand Down Expand Up @@ -384,14 +330,14 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast

/** Validates pyramid creation options for a specific dataset and destination format
* @note used by GDAL provider only */
virtual QString validatePyramidsConfigOptions( RasterPyramidsFormat pyramidsFormat,
virtual QString validatePyramidsConfigOptions( QgsRaster::RasterPyramidsFormat pyramidsFormat,
const QStringList & theConfigOptions, const QString & fileFormat )
{ Q_UNUSED( pyramidsFormat ); Q_UNUSED( theConfigOptions ); Q_UNUSED( fileFormat ); return QString(); }

static QString identifyFormatName( IdentifyFormat format );
static IdentifyFormat identifyFormatFromName( QString formatName );
static QString identifyFormatLabel( IdentifyFormat format );
static Capability identifyFormatToCapability( IdentifyFormat format );
static QString identifyFormatName( QgsRaster::IdentifyFormat format );
static QgsRaster::IdentifyFormat identifyFormatFromName( QString formatName );
static QString identifyFormatLabel( QgsRaster::IdentifyFormat format );
static Capability identifyFormatToCapability( QgsRaster::IdentifyFormat format );

signals:
/** Emit a signal to notify of the progress event.
Expand Down
16 changes: 8 additions & 8 deletions src/core/raster/qgsrasterfilewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
QgsRasterFileWriter::QgsRasterFileWriter( const QString& outputUrl ):
mMode( Raw ), mOutputUrl( outputUrl ), mOutputProviderKey( "gdal" ), mOutputFormat( "GTiff" ),
mTiledMode( false ), mMaxTileWidth( 500 ), mMaxTileHeight( 500 ),
mBuildPyramidsFlag( QgsRasterDataProvider::PyramidsFlagNo ),
mPyramidsFormat( QgsRasterDataProvider::PyramidsGTiff ),
mBuildPyramidsFlag( QgsRaster::PyramidsFlagNo ),
mPyramidsFormat( QgsRaster::PyramidsGTiff ),
mProgressDialog( 0 ), mPipe( 0 ), mInput( 0 )
{

Expand Down Expand Up @@ -212,8 +212,8 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster( const Qgs
QgsRasterBandStats stats = srcProvider->bandStatistics( bandNo, QgsRasterBandStats::Min | QgsRasterBandStats::Max, srcExtent, 250000 );

// Test if we have free (not used) values
double typeMinValue = QgsContrastEnhancement::maximumValuePossible(( QgsContrastEnhancement::QgsRasterDataType )srcProvider->srcDataType( bandNo ) );
double typeMaxValue = QgsContrastEnhancement::maximumValuePossible(( QgsContrastEnhancement::QgsRasterDataType )srcProvider->srcDataType( bandNo ) );
double typeMinValue = QgsContrastEnhancement::maximumValuePossible(( QGis::DataType )srcProvider->srcDataType( bandNo ) );
double typeMaxValue = QgsContrastEnhancement::maximumValuePossible(( QGis::DataType )srcProvider->srcDataType( bandNo ) );
if ( stats.minimumValue > typeMinValue )
{
destNoDataValue = typeMinValue;
Expand Down Expand Up @@ -363,14 +363,14 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeDataRaster(
{
QString vrtFilePath( mOutputUrl + "/" + vrtFileName() );
writeVRT( vrtFilePath );
if ( mBuildPyramidsFlag == QgsRasterDataProvider::PyramidsFlagYes )
if ( mBuildPyramidsFlag == QgsRaster::PyramidsFlagYes )
{
buildPyramids( vrtFilePath );
}
}
else
{
if ( mBuildPyramidsFlag == QgsRasterDataProvider::PyramidsFlagYes )
if ( mBuildPyramidsFlag == QgsRaster::PyramidsFlagYes )
{
buildPyramids( mOutputUrl );
}
Expand Down Expand Up @@ -600,14 +600,14 @@ QgsRasterFileWriter::WriterError QgsRasterFileWriter::writeImageRaster( QgsRaste
{
QString vrtFilePath( mOutputUrl + "/" + vrtFileName() );
writeVRT( vrtFilePath );
if ( mBuildPyramidsFlag == QgsRasterDataProvider::PyramidsFlagYes )
if ( mBuildPyramidsFlag == QgsRaster::PyramidsFlagYes )
{
buildPyramids( vrtFilePath );
}
}
else
{
if ( mBuildPyramidsFlag == QgsRasterDataProvider::PyramidsFlagYes )
if ( mBuildPyramidsFlag == QgsRaster::PyramidsFlagYes )
{
buildPyramids( mOutputUrl );
}
Expand Down
12 changes: 6 additions & 6 deletions src/core/raster/qgsrasterfilewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,17 @@ class CORE_EXPORT QgsRasterFileWriter
void setMaxTileWidth( int w ) { mMaxTileWidth = w; }
int maxTileWidth() const { return mMaxTileWidth; }

QgsRasterDataProvider::RasterBuildPyramids buildPyramidsFlag() const { return mBuildPyramidsFlag; }
void setBuildPyramidsFlag( QgsRasterDataProvider::RasterBuildPyramids f ) { mBuildPyramidsFlag = f; }
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const { return mBuildPyramidsFlag; }
void setBuildPyramidsFlag( QgsRaster::RasterBuildPyramids f ) { mBuildPyramidsFlag = f; }

QList< int > pyramidsList() const { return mPyramidsList; }
void setPyramidsList( const QList< int > & list ) { mPyramidsList = list; }

QString pyramidsResampling() const { return mPyramidsResampling; }
void setPyramidsResampling( const QString & str ) { mPyramidsResampling = str; }

QgsRasterDataProvider::RasterPyramidsFormat pyramidsFormat() const { return mPyramidsFormat; }
void setPyramidsFormat( QgsRasterDataProvider::RasterPyramidsFormat f ) { mPyramidsFormat = f; }
QgsRaster::RasterPyramidsFormat pyramidsFormat() const { return mPyramidsFormat; }
void setPyramidsFormat( QgsRaster::RasterPyramidsFormat f ) { mPyramidsFormat = f; }

void setMaxTileHeight( int h ) { mMaxTileHeight = h; }
int maxTileHeight() const { return mMaxTileHeight; }
Expand Down Expand Up @@ -157,8 +157,8 @@ class CORE_EXPORT QgsRasterFileWriter

QList< int > mPyramidsList;
QString mPyramidsResampling;
QgsRasterDataProvider::RasterBuildPyramids mBuildPyramidsFlag;
QgsRasterDataProvider::RasterPyramidsFormat mPyramidsFormat;
QgsRaster::RasterBuildPyramids mBuildPyramidsFlag;
QgsRaster::RasterPyramidsFormat mPyramidsFormat;
QStringList mPyramidsConfigOptions;

QDomDocument mVRTDocument;
Expand Down
6 changes: 3 additions & 3 deletions src/core/raster/qgsrasteridentifyresult.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@

QgsRasterIdentifyResult::QgsRasterIdentifyResult()
: mValid( false )
, mFormat( QgsRasterDataProvider::IdentifyFormatUndefined )
, mFormat( QgsRaster::IdentifyFormatUndefined )
{
}

QgsRasterIdentifyResult::QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormat theFormat, QMap<int, QVariant> theResults )
QgsRasterIdentifyResult::QgsRasterIdentifyResult( QgsRaster::IdentifyFormat theFormat, QMap<int, QVariant> theResults )
: mValid( true )
, mFormat( theFormat )
, mResults( theResults )
Expand All @@ -37,7 +37,7 @@ QgsRasterIdentifyResult::QgsRasterIdentifyResult( QgsRasterDataProvider::Identif

QgsRasterIdentifyResult::QgsRasterIdentifyResult( QgsError theError )
: mValid( false )
, mFormat( QgsRasterDataProvider::IdentifyFormatUndefined )
, mFormat( QgsRaster::IdentifyFormatUndefined )
, mError( theError )
{
}
Expand Down
13 changes: 7 additions & 6 deletions src/core/raster/qgsrasteridentifyresult.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "qgis.h"
#include "qgslogger.h"
#include "qgsrasterdataprovider.h"
#include "qgsraster.h"

/** \ingroup core
* Raster identify results container.
Expand All @@ -34,7 +35,7 @@ class CORE_EXPORT QgsRasterIdentifyResult
* @param theFormat the result format
* @param theResults the results
*/
QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormat theFormat, QMap<int, QVariant> theResults );
QgsRasterIdentifyResult( QgsRaster::IdentifyFormat theFormat, QMap<int, QVariant> theResults );

/** \brief Constructor. Creates invalid result with error.
* @param theError the error
Expand All @@ -47,12 +48,12 @@ class CORE_EXPORT QgsRasterIdentifyResult
bool isValid() const { return mValid; }

/** \brief Get results format */
QgsRasterDataProvider::IdentifyFormat format() const { return mFormat; }
QgsRaster::IdentifyFormat format() const { return mFormat; }

/** \brief Get results. Results are different for each format:
* IdentifyFormatValue: map of values for each band, keys are band numbers (from 1).
* IdentifyFormatFeature: map of QgsRasterFeatureList for each sublayer (WMS)
* IdentifyFormatHtml: map of HTML strings for each sublayer (WMS).
* QgsRaster::IdentifyFormatValue: map of values for each band, keys are band numbers (from 1).
* QgsRaster::IdentifyFormatFeature: map of QgsRasterFeatureList for each sublayer (WMS)
* QgsRaster::IdentifyFormatHtml: map of HTML strings for each sublayer (WMS).
*/
QMap<int, QVariant> results() const { return mResults; }

Expand All @@ -73,7 +74,7 @@ class CORE_EXPORT QgsRasterIdentifyResult
bool mValid;

/** \brief Results format */
QgsRasterDataProvider::IdentifyFormat mFormat;
QgsRaster::IdentifyFormat mFormat;

/** \brief Results */
// TODO: better hierarchy (sublayer multiple feature sets)?
Expand Down
70 changes: 17 additions & 53 deletions src/core/raster/qgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ QPixmap QgsRasterLayer::paletteAsPixmap( int theBandNumber )

// Only do this for the GDAL provider?
// Maybe WMS can do this differently using QImage::numColors and QImage::color()
if ( mDataProvider->colorInterpretation( theBandNumber ) == QgsRasterDataProvider::PaletteIndex )
if ( mDataProvider->colorInterpretation( theBandNumber ) == QgsRaster::PaletteIndex )
{
QgsDebugMsg( "....found paletted image" );
QgsColorRampShader myShader;
Expand Down Expand Up @@ -873,11 +873,11 @@ void QgsRasterLayer::setDataProvider( QString const & provider )
{
mRasterType = ColorLayer;
}
else if ( mDataProvider->colorInterpretation( 1 ) == QgsRasterDataProvider::PaletteIndex )
else if ( mDataProvider->colorInterpretation( 1 ) == QgsRaster::PaletteIndex )
{
mRasterType = Palette;
}
else if ( mDataProvider->colorInterpretation( 1 ) == QgsRasterDataProvider::ContinuousPalette )
else if ( mDataProvider->colorInterpretation( 1 ) == QgsRaster::ContinuousPalette )
{
mRasterType = Palette;
}
Expand All @@ -892,11 +892,11 @@ void QgsRasterLayer::setDataProvider( QString const & provider )
QgsDebugMsg( "Setting mDrawingStyle to SingleBandColorDataStyle " + QString::number( SingleBandColorDataStyle ) );
setDrawingStyle( SingleBandColorDataStyle );
}
else if ( mRasterType == Palette && mDataProvider->colorInterpretation( 1 ) == QgsRasterDataProvider::PaletteIndex )
else if ( mRasterType == Palette && mDataProvider->colorInterpretation( 1 ) == QgsRaster::PaletteIndex )
{
setDrawingStyle( PalettedColor ); //sensible default
}
else if ( mRasterType == Palette && mDataProvider->colorInterpretation( 1 ) == QgsRasterDataProvider::ContinuousPalette )
else if ( mRasterType == Palette && mDataProvider->colorInterpretation( 1 ) == QgsRaster::ContinuousPalette )
{
setDrawingStyle( SingleBandPseudoColor );
// Load color table
Expand Down Expand Up @@ -925,7 +925,7 @@ void QgsRasterLayer::setDataProvider( QString const & provider )
// Auto set alpha band
for ( int bandNo = 1; bandNo <= mDataProvider->bandCount(); bandNo++ )
{
if ( mDataProvider->colorInterpretation( bandNo ) == QgsRasterDataProvider::AlphaBand )
if ( mDataProvider->colorInterpretation( bandNo ) == QgsRaster::AlphaBand )
{
if ( mPipe.renderer() )
{
Expand Down Expand Up @@ -953,23 +953,23 @@ void QgsRasterLayer::setDataProvider( QString const & provider )

// Set default identify format - use the richest format available
int capabilities = mDataProvider->capabilities();
QgsRasterDataProvider::IdentifyFormat identifyFormat = QgsRasterDataProvider::IdentifyFormatUndefined;
QgsRaster::IdentifyFormat identifyFormat = QgsRaster::IdentifyFormatUndefined;
if ( capabilities & QgsRasterInterface::IdentifyHtml )
{
// HTML is usually richest
identifyFormat = QgsRasterDataProvider::IdentifyFormatHtml;
identifyFormat = QgsRaster::IdentifyFormatHtml;
}
else if ( capabilities & QgsRasterInterface::IdentifyFeature )
{
identifyFormat = QgsRasterDataProvider::IdentifyFormatFeature;
identifyFormat = QgsRaster::IdentifyFormatFeature;
}
else if ( capabilities & QgsRasterInterface::IdentifyText )
{
identifyFormat = QgsRasterDataProvider::IdentifyFormatText;
identifyFormat = QgsRaster::IdentifyFormatText;
}
else if ( capabilities & QgsRasterInterface::IdentifyValue )
{
identifyFormat = QgsRasterDataProvider::IdentifyFormatValue;
identifyFormat = QgsRaster::IdentifyFormatValue;
}
setCustomProperty( "identify/format", QgsRasterDataProvider::identifyFormatName( identifyFormat ) );

Expand Down Expand Up @@ -1002,7 +1002,7 @@ void QgsRasterLayer::closeDataProvider()
mDataProvider = 0;
}

void QgsRasterLayer::setContrastEnhancementAlgorithm( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm, ContrastEnhancementLimits theLimits, QgsRectangle theExtent, int theSampleSize, bool theGenerateLookupTableFlag )
void QgsRasterLayer::setContrastEnhancementAlgorithm( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm, QgsRaster::ContrastEnhancementLimits theLimits, QgsRectangle theExtent, int theSampleSize, bool theGenerateLookupTableFlag )
{
QgsDebugMsg( QString( "theAlgorithm = %1 theLimits = %2 theExtent.isEmpty() = %3" ).arg( theAlgorithm ).arg( theLimits ).arg( theExtent.isEmpty() ) );
if ( !mPipe.renderer() || !mDataProvider )
Expand Down Expand Up @@ -1033,26 +1033,26 @@ void QgsRasterLayer::setContrastEnhancementAlgorithm( QgsContrastEnhancement::Co
if ( myBand != -1 )
{
QGis::DataType myType = ( QGis::DataType )mDataProvider->dataType( myBand );
QgsContrastEnhancement* myEnhancement = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )myType );
QgsContrastEnhancement* myEnhancement = new QgsContrastEnhancement(( QGis::DataType )myType );
myEnhancement->setContrastEnhancementAlgorithm( theAlgorithm, theGenerateLookupTableFlag );

double myMin = std::numeric_limits<double>::quiet_NaN();
double myMax = std::numeric_limits<double>::quiet_NaN();

if ( theLimits == ContrastEnhancementMinMax )
if ( theLimits == QgsRaster::ContrastEnhancementMinMax )
{
QgsRasterBandStats myRasterBandStats = mDataProvider->bandStatistics( myBand, QgsRasterBandStats::Min | QgsRasterBandStats::Max, theExtent, theSampleSize );
myMin = myRasterBandStats.minimumValue;
myMax = myRasterBandStats.maximumValue;
}
else if ( theLimits == ContrastEnhancementStdDev )
else if ( theLimits == QgsRaster::ContrastEnhancementStdDev )
{
double myStdDev = 1; // make optional?
QgsRasterBandStats myRasterBandStats = mDataProvider->bandStatistics( myBand, QgsRasterBandStats::Mean | QgsRasterBandStats::StdDev, theExtent, theSampleSize );
myMin = myRasterBandStats.mean - ( myStdDev * myRasterBandStats.stdDev );
myMax = myRasterBandStats.mean + ( myStdDev * myRasterBandStats.stdDev );
}
else if ( theLimits == ContrastEnhancementCumulativeCut )
else if ( theLimits == QgsRaster::ContrastEnhancementCumulativeCut )
{
QSettings mySettings;
double myLower = mySettings.value( "/Raster/cumulativeCutLower", QString::number( CUMULATIVE_CUT_LOWER ) ).toDouble();
Expand Down Expand Up @@ -1129,47 +1129,11 @@ void QgsRasterLayer::setDefaultContrastEnhancement()
}

QString myLimitsString = mySettings.value( "/Raster/defaultContrastEnhancementLimits", "CumulativeCut" ).toString();
ContrastEnhancementLimits myLimits = contrastEnhancementLimitsFromString( myLimitsString );
QgsRaster::ContrastEnhancementLimits myLimits = QgsRaster::contrastEnhancementLimitsFromString( myLimitsString );

setContrastEnhancementAlgorithm( myAlgorithm, myLimits );
}

QString QgsRasterLayer::contrastEnhancementLimitsAsString( ContrastEnhancementLimits theLimits )
{
switch ( theLimits )
{
case QgsRasterLayer::ContrastEnhancementMinMax:
return "MinMax";
break;
case QgsRasterLayer::ContrastEnhancementStdDev:
return "StdDev";
break;
case QgsRasterLayer::ContrastEnhancementCumulativeCut:
return "CumulativeCut";
break;
default:
break;
}
return "None";
}

QgsRasterLayer::ContrastEnhancementLimits QgsRasterLayer::contrastEnhancementLimitsFromString( QString theLimits )
{
if ( theLimits == "MinMax" )
{
return ContrastEnhancementMinMax;
}
else if ( theLimits == "StdDev" )
{
return ContrastEnhancementStdDev;
}
else if ( theLimits == "CumulativeCut" )
{
return ContrastEnhancementCumulativeCut;
}
return ContrastEnhancementNone;
}

/**
*
* Implemented mainly for serialisation / deserialisation of settings to xml.
Expand Down
15 changes: 2 additions & 13 deletions src/core/raster/qgsrasterlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "qgshuesaturationfilter.h"
#include "qgsmaplayer.h"
#include "qgspoint.h"
#include "qgsraster.h"
#include "qgsrasterdataprovider.h"
#include "qgsrasterinterface.h"
#include "qgsrasterpipe.h"
Expand Down Expand Up @@ -243,15 +244,6 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
ColorLayer
};

/** \brief Contrast enhancement limits */
enum ContrastEnhancementLimits
{
ContrastEnhancementNone,
ContrastEnhancementMinMax,
ContrastEnhancementStdDev,
ContrastEnhancementCumulativeCut
};

static void buildSupportedRasterFileFilter( QString & fileFilters );

/** This helper checks to see whether the file name appears to be a valid
Expand Down Expand Up @@ -346,9 +338,6 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
/** \brief Returns the number of raster units per each raster pixel. In a world file, this is normally the first row (without the sign) */
double rasterUnitsPerPixel();

static QString contrastEnhancementLimitsAsString( QgsRasterLayer::ContrastEnhancementLimits theLimits );
static ContrastEnhancementLimits contrastEnhancementLimitsFromString( QString theLimits );

/** \brief Set contrast enhancement algorithm
* @param theAlgorithm Contrast enhancement algorithm
* @param theLimits Limits
Expand All @@ -358,7 +347,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer


void setContrastEnhancementAlgorithm( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm,
ContrastEnhancementLimits theLimits = ContrastEnhancementMinMax,
QgsRaster::ContrastEnhancementLimits theLimits = QgsRaster::ContrastEnhancementMinMax,
QgsRectangle theExtent = QgsRectangle(),
int theSampleSize = SAMPLE_SIZE,
bool theGenerateLookupTableFlag = true );
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgsrasterrendererregistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ QgsRasterRenderer* QgsRasterRendererRegistry::defaultRendererForDrawingStyle( co
int grayBand = 1;
renderer = new QgsSingleBandGrayRenderer( provider, grayBand );

QgsContrastEnhancement* ce = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )(
QgsContrastEnhancement* ce = new QgsContrastEnhancement(( QGis::DataType )(
provider->dataType( grayBand ) ) );

// Default contrast enhancement is set from QgsRasterLayer, it has already setContrastEnhancementAlgorithm(). Default enhancement must only be set if default style was not loaded (to avoid stats calculation).
Expand Down
2 changes: 1 addition & 1 deletion src/core/raster/qgssinglebandgrayrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ QgsRasterRenderer* QgsSingleBandGrayRenderer::create( const QDomElement& elem, Q
QDomElement contrastEnhancementElem = elem.firstChildElement( "contrastEnhancement" );
if ( !contrastEnhancementElem.isNull() )
{
QgsContrastEnhancement* ce = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )(
QgsContrastEnhancement* ce = new QgsContrastEnhancement(( QGis::DataType )(
input->dataType( grayBand ) ) ) ;
ce->readXML( contrastEnhancementElem );
r->setContrastEnhancement( ce );
Expand Down
14 changes: 7 additions & 7 deletions src/gui/qgsmaptoolidentify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,15 @@ bool QgsMapToolIdentify::identifyRasterLayer( QList<IdentifyResult> *results, Qg

QMap<int, QVariant> values;

QgsRasterDataProvider::IdentifyFormat format = QgsRasterDataProvider::identifyFormatFromName( layer->customProperty( "identify/format" ).toString() );
QgsRaster::IdentifyFormat format = QgsRasterDataProvider::identifyFormatFromName( layer->customProperty( "identify/format" ).toString() );

// check if the format is really supported otherwise use first supported format
if ( !( QgsRasterDataProvider::identifyFormatToCapability( format ) & capabilities ) )
{
if ( capabilities & QgsRasterInterface::IdentifyFeature ) format = QgsRasterDataProvider::IdentifyFormatFeature;
else if ( capabilities & QgsRasterInterface::IdentifyValue ) format = QgsRasterDataProvider::IdentifyFormatValue;
else if ( capabilities & QgsRasterInterface::IdentifyHtml ) format = QgsRasterDataProvider::IdentifyFormatHtml;
else if ( capabilities & QgsRasterInterface::IdentifyText ) format = QgsRasterDataProvider::IdentifyFormatText;
if ( capabilities & QgsRasterInterface::IdentifyFeature ) format = QgsRaster::IdentifyFormatFeature;
else if ( capabilities & QgsRasterInterface::IdentifyValue ) format = QgsRaster::IdentifyFormatValue;
else if ( capabilities & QgsRasterInterface::IdentifyHtml ) format = QgsRaster::IdentifyFormatHtml;
else if ( capabilities & QgsRasterInterface::IdentifyText ) format = QgsRaster::IdentifyFormatText;
else return false;
}

Expand Down Expand Up @@ -423,7 +423,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( QList<IdentifyResult> *results, Qg

//QString type = tr( "Raster" );
QgsGeometry geometry;
if ( format == QgsRasterDataProvider::IdentifyFormatValue )
if ( format == QgsRaster::IdentifyFormatValue )
{
foreach ( int bandNo, values.keys() )
{
Expand All @@ -442,7 +442,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( QList<IdentifyResult> *results, Qg
QString label = layer->name();
results->append( IdentifyResult( qobject_cast<QgsMapLayer *>( layer ), label, attributes, derivedAttributes ) );
}
else if ( format == QgsRasterDataProvider::IdentifyFormatFeature )
else if ( format == QgsRaster::IdentifyFormatFeature )
{
foreach ( int i, values.keys() )
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsrasterformatsaveoptionswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ QgsRasterFormatSaveOptionsWidget::QgsRasterFormatSaveOptionsWidget( QWidget* par
QgsRasterFormatSaveOptionsWidget::Type type, QString provider )
: QWidget( parent ), mFormat( format ), mProvider( provider ), mRasterLayer( 0 ),
mRasterFileName( QString() ), mPyramids( false ),
mPyramidsFormat( QgsRasterDataProvider::PyramidsGTiff )
mPyramidsFormat( QgsRaster::PyramidsGTiff )

{
setupUi( this );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsrasterformatsaveoptionswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget,
void setRasterFileName( const QString& file ) { mRasterLayer = 0; mRasterFileName = file; }
QStringList options() const;
void setType( QgsRasterFormatSaveOptionsWidget::Type type = Default );
void setPyramidsFormat( QgsRasterDataProvider::RasterPyramidsFormat format )
void setPyramidsFormat( QgsRaster::RasterPyramidsFormat format )
{ mPyramids = true; mPyramidsFormat = format; }

public slots:
Expand Down Expand Up @@ -93,7 +93,7 @@ class GUI_EXPORT QgsRasterFormatSaveOptionsWidget: public QWidget,
QMap< QString, QString> mOptionsMap;
static QMap< QString, QStringList > mBuiltinProfiles;
bool mPyramids;
QgsRasterDataProvider::RasterPyramidsFormat mPyramidsFormat;
QgsRaster::RasterPyramidsFormat mPyramidsFormat;

QString settingsKey( QString profile ) const;
QString currentProfileKey() const;
Expand Down
10 changes: 5 additions & 5 deletions src/gui/qgsrasterlayersaveasdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ QgsRasterLayerSaveAsDialog::QgsRasterLayerSaveAsDialog( QgsRasterLayer* rasterLa

// TODO enable "use existing", has no effect for now, because using Create() in gdal provider
// if ( ! mDataProvider->hasPyramids() )
// mPyramidsButtonGroup->button( QgsRasterDataProvider::CopyExisting )->setEnabled( false );
// mPyramidsButtonGroup->button( QgsRaster::PyramidsCopyExisting )->setEnabled( false );
mPyramidsUseExistingCheckBox->setEnabled( false );
mPyramidsUseExistingCheckBox->setVisible( false );

Expand Down Expand Up @@ -818,14 +818,14 @@ QList<int> QgsRasterLayerSaveAsDialog::pyramidsList() const
return mPyramidsGroupBox->isChecked() ? mPyramidsOptionsWidget->overviewList() : QList<int>();
}

QgsRasterDataProvider::RasterBuildPyramids QgsRasterLayerSaveAsDialog::buildPyramidsFlag() const
QgsRaster::RasterBuildPyramids QgsRasterLayerSaveAsDialog::buildPyramidsFlag() const
{
if ( ! mPyramidsGroupBox->isChecked() )
return QgsRasterDataProvider::PyramidsFlagNo;
return QgsRaster::PyramidsFlagNo;
else if ( mPyramidsUseExistingCheckBox->isChecked() )
return QgsRasterDataProvider::CopyExisting;
return QgsRaster::PyramidsCopyExisting;
else
return QgsRasterDataProvider::PyramidsFlagYes;
return QgsRaster::PyramidsFlagYes;
}

bool QgsRasterLayerSaveAsDialog::validate() const
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsrasterlayersaveasdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class GUI_EXPORT QgsRasterLayerSaveAsDialog: public QDialog, private Ui::QgsRast
QList<QgsRasterNuller::NoData> noData() const;

QList< int > pyramidsList() const;
QgsRasterDataProvider::RasterBuildPyramids buildPyramidsFlag() const;
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
QString pyramidsResamplingMethod() const { return mPyramidsOptionsWidget->resamplingMethod(); }
QgsRasterDataProvider::RasterPyramidsFormat pyramidsFormat() const
QgsRaster::RasterPyramidsFormat pyramidsFormat() const
{ return mPyramidsOptionsWidget->pyramidsFormat(); }
QStringList pyramidsConfigOptions() const
{ return mPyramidsOptionsWidget->configOptions(); }
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsrasterpyramidsoptionswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ QgsRasterPyramidsOptionsWidget::QgsRasterPyramidsOptionsWidget( QWidget* parent,
setupUi( this );

mSaveOptionsWidget->setProvider( provider );
mSaveOptionsWidget->setPyramidsFormat( QgsRasterDataProvider::PyramidsGTiff );
mSaveOptionsWidget->setPyramidsFormat( QgsRaster::PyramidsGTiff );
mSaveOptionsWidget->setType( QgsRasterFormatSaveOptionsWidget::ProfileLineEdit );

updateUi();
Expand Down Expand Up @@ -165,7 +165,7 @@ void QgsRasterPyramidsOptionsWidget::on_cbxPyramidsLevelsCustom_toggled( bool to
void QgsRasterPyramidsOptionsWidget::on_cbxPyramidsFormat_currentIndexChanged( int index )
{
mSaveOptionsWidget->setEnabled( index != 2 );
mSaveOptionsWidget->setPyramidsFormat(( QgsRasterDataProvider::RasterPyramidsFormat ) index );
mSaveOptionsWidget->setPyramidsFormat(( QgsRaster::RasterPyramidsFormat ) index );
}

void QgsRasterPyramidsOptionsWidget::setOverviewList()
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsrasterpyramidsoptionswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class GUI_EXPORT QgsRasterPyramidsOptionsWidget: public QWidget,
QStringList configOptions() const { return mSaveOptionsWidget->options(); }
QgsRasterFormatSaveOptionsWidget* createOptionsWidget() { return mSaveOptionsWidget; }
const QList<int> overviewList() const { return mOverviewList; }
QgsRasterDataProvider::RasterPyramidsFormat pyramidsFormat() const
{ return ( QgsRasterDataProvider::RasterPyramidsFormat ) cbxPyramidsFormat->currentIndex(); }
QgsRaster::RasterPyramidsFormat pyramidsFormat() const
{ return ( QgsRaster::RasterPyramidsFormat ) cbxPyramidsFormat->currentIndex(); }
QString resamplingMethod() const;
void setRasterLayer( QgsRasterLayer* rasterLayer ) { mSaveOptionsWidget->setRasterLayer( rasterLayer ); }
void setRasterFileName( const QString& file ) { mSaveOptionsWidget->setRasterFileName( file ); }
Expand Down
6 changes: 3 additions & 3 deletions src/gui/raster/qgsmultibandcolorrendererwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void QgsMultiBandColorRendererWidget::setCustomMinMaxValues( QgsMultiBandColorRe
double redMax = mRedMaxLineEdit->text().toDouble( &redMaxOk );
if ( redMinOk && redMaxOk )
{
redEnhancement = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )(
redEnhancement = new QgsContrastEnhancement(( QGis::DataType )(
provider->dataType( redBand ) ) );
redEnhancement->setMinimumValue( redMin );
redEnhancement->setMaximumValue( redMax );
Expand All @@ -143,7 +143,7 @@ void QgsMultiBandColorRendererWidget::setCustomMinMaxValues( QgsMultiBandColorRe
double greenMax = mGreenMaxLineEdit->text().toDouble( &greenMaxOk );
if ( greenMinOk && greenMaxOk )
{
greenEnhancement = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )(
greenEnhancement = new QgsContrastEnhancement(( QGis::DataType )(
provider->dataType( greenBand ) ) );
greenEnhancement->setMinimumValue( greenMin );
greenEnhancement->setMaximumValue( greenMax );
Expand All @@ -154,7 +154,7 @@ void QgsMultiBandColorRendererWidget::setCustomMinMaxValues( QgsMultiBandColorRe
double blueMax = mBlueMaxLineEdit->text().toDouble( &blueMaxOk );
if ( blueMinOk && blueMaxOk )
{
blueEnhancement = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )(
blueEnhancement = new QgsContrastEnhancement(( QGis::DataType )(
provider->dataType( blueBand ) ) );
blueEnhancement->setMinimumValue( blueMin );
blueEnhancement->setMaximumValue( blueMax );
Expand Down
10 changes: 5 additions & 5 deletions src/gui/raster/qgsrasterhistogramwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,12 +613,12 @@ void QgsRasterHistogramWidget::on_cboHistoBand_currentIndexChanged( int index )

int theBandNo = index + 1;
// TODO - there are 2 definitions of raster data type that should be unified
// QgsRasterDataProvider::DataType and QgsContrastEnhancement::QgsRasterDataType
// QgsRasterDataProvider::DataType and QGis::DataType
// TODO - fix gdal provider: changes data type when nodata value is not found
// this prevents us from getting proper min and max values here
// minStr = QString::number( QgsContrastEnhancement::minimumValuePossible( ( QgsContrastEnhancement::QgsRasterDataType )
// minStr = QString::number( QgsContrastEnhancement::minimumValuePossible( ( QGis::DataType )
// mRasterLayer->dataProvider()->dataType( theBandNo ) ) );
// maxStr = QString::number( QgsContrastEnhancement::maximumValuePossible( ( QgsContrastEnhancement::QgsRasterDataType )
// maxStr = QString::number( QgsContrastEnhancement::maximumValuePossible( ( QGis::DataType )
// mRasterLayer->dataProvider()->dataType( theBandNo ) ) );

QPair< QString, QString > myMinMax = rendererMinMax( theBandNo );
Expand Down Expand Up @@ -746,9 +746,9 @@ void QgsRasterHistogramWidget::histoAction( const QString actionName, bool actio
// TODO - fix gdal provider: changes data type when nodata value is not found
// this prevents us from getting proper min and max values here
minMaxValues[0] = QgsContrastEnhancement::minimumValuePossible(
( QgsContrastEnhancement::QgsRasterDataType ) mRasterLayer->dataProvider()->dataType( theBandNo ) );
( QGis::DataType ) mRasterLayer->dataProvider()->dataType( theBandNo ) );
minMaxValues[1] = QgsContrastEnhancement::maximumValuePossible(
( QgsContrastEnhancement::QgsRasterDataType ) mRasterLayer->dataProvider()->dataType( theBandNo ) );
( QGis::DataType ) mRasterLayer->dataProvider()->dataType( theBandNo ) );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/gui/raster/qgssinglebandgrayrendererwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ QgsRasterRenderer* QgsSingleBandGrayRendererWidget::renderer()
}
int band = mGrayBandComboBox->itemData( mGrayBandComboBox->currentIndex() ).toInt();

QgsContrastEnhancement* e = new QgsContrastEnhancement(( QgsContrastEnhancement::QgsRasterDataType )(
QgsContrastEnhancement* e = new QgsContrastEnhancement(( QGis::DataType )(
provider->dataType( band ) ) );
e->setMinimumValue( mMinLineEdit->text().toDouble() );
e->setMaximumValue( mMaxLineEdit->text().toDouble() );
Expand Down
4 changes: 2 additions & 2 deletions src/mapserver/qgswmsserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1385,11 +1385,11 @@ int QgsWMSServer::featureInfoFromRasterLayer( QgsRasterLayer* layer,
// to guess correct source resolution
if ( mMapRenderer->hasCrsTransformEnabled() && layer->dataProvider()->crs() != mMapRenderer->destinationCrs() )
{
attributes = layer->dataProvider()->identify( *infoPoint, QgsRasterDataProvider::IdentifyFormatValue ).results();
attributes = layer->dataProvider()->identify( *infoPoint, QgsRaster::IdentifyFormatValue ).results();
}
else
{
attributes = layer->dataProvider()->identify( *infoPoint, QgsRasterDataProvider::IdentifyFormatValue, mMapRenderer->extent(), mMapRenderer->outputSize().width(), mMapRenderer->outputSize().height() ).results();
attributes = layer->dataProvider()->identify( *infoPoint, QgsRaster::IdentifyFormatValue, mMapRenderer->extent(), mMapRenderer->outputSize().width(), mMapRenderer->outputSize().height() ).results();
}

for ( QMap<int, QVariant>::const_iterator it = attributes.constBegin(); it != attributes.constEnd(); ++it )
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/georeferencer/qgsgeorefplugingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ void QgsGeorefPluginGui::localHistogramStretch()
{
QgsRectangle rectangle = mIface->mapCanvas()->mapRenderer()->outputExtentToLayerExtent( mLayer, mIface->mapCanvas()->extent() );

mLayer->setContrastEnhancementAlgorithm( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRasterLayer::ContrastEnhancementMinMax, rectangle );
mLayer->setContrastEnhancementAlgorithm( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRaster::ContrastEnhancementMinMax, rectangle );
mLayer->setCacheImage( NULL );
mCanvas->refresh();
}
Expand Down
30 changes: 15 additions & 15 deletions src/providers/gdal/qgsgdalprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -875,13 +875,13 @@ int QgsGdalProvider::yBlockSize() const
int QgsGdalProvider::xSize() const { return mWidth; }
int QgsGdalProvider::ySize() const { return mHeight; }

QgsRasterIdentifyResult QgsGdalProvider::identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
QgsRasterIdentifyResult QgsGdalProvider::identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
{
QgsDebugMsg( QString( "thePoint = %1 %2" ).arg( thePoint.x(), 0, 'g', 10 ).arg( thePoint.y(), 0, 'g', 10 ) );

QMap<int, QVariant> results;

if ( theFormat != IdentifyFormatValue )
if ( theFormat != QgsRaster::IdentifyFormatValue )
{
return QgsRasterIdentifyResult( ERR( tr( "Format not supported" ) ) );
}
Expand All @@ -893,7 +893,7 @@ QgsRasterIdentifyResult QgsGdalProvider::identify( const QgsPoint & thePoint, Id
{
results.insert( bandNo, QVariant() ); // null QVariant represents no data
}
return QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormatValue, results );
return QgsRasterIdentifyResult( QgsRaster::IdentifyFormatValue, results );
}

QgsRectangle myExtent = theExtent;
Expand Down Expand Up @@ -973,7 +973,7 @@ QgsRasterIdentifyResult QgsGdalProvider::identify( const QgsPoint & thePoint, Id
}
delete myBlock;
}
return QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormatValue, results );
return QgsRasterIdentifyResult( QgsRaster::IdentifyFormatValue, results );
}

int QgsGdalProvider::capabilities() const
Expand Down Expand Up @@ -1264,7 +1264,7 @@ QgsRasterHistogram QgsGdalProvider::histogram( int theBandNo,
QgsDebugMsg( QString( "xSize() = %1 ySize() = %2 theSampleSize = %3 bApproxOK = %4" ).arg( xSize() ).arg( ySize() ).arg( theSampleSize ).arg( bApproxOK ) );

QgsGdalProgress myProg;
myProg.type = ProgressHistogram;
myProg.type = QgsRaster::ProgressHistogram;
myProg.provider = this;

#if 0 // this is the old method
Expand Down Expand Up @@ -1365,7 +1365,7 @@ QgsRasterHistogram QgsGdalProvider::histogram( int theBandNo,
* @return null string on success, otherwise a string specifying error
*/
QString QgsGdalProvider::buildPyramids( const QList<QgsRasterPyramid> & theRasterPyramidList,
const QString & theResamplingMethod, RasterPyramidsFormat theFormat,
const QString & theResamplingMethod, QgsRaster::RasterPyramidsFormat theFormat,
const QStringList & theConfigOptions )
{
//TODO: Consider making theRasterPyramidList modifyable by this method to indicate if the pyramid exists after build attempt
Expand All @@ -1389,7 +1389,7 @@ QString QgsGdalProvider::buildPyramids( const QList<QgsRasterPyramid> & theRaste
}

// check if building internally
if ( theFormat == PyramidsInternal )
if ( theFormat == QgsRaster::PyramidsInternal )
{

// test if the file is writable
Expand Down Expand Up @@ -1440,13 +1440,13 @@ QString QgsGdalProvider::buildPyramids( const QList<QgsRasterPyramid> & theRaste
// are we using Erdas Imagine external overviews?
QgsStringMap myConfigOptionsOld;
myConfigOptionsOld[ "USE_RRD" ] = CPLGetConfigOption( "USE_RRD", "NO" );
if ( theFormat == PyramidsErdas )
if ( theFormat == QgsRaster::PyramidsErdas )
CPLSetConfigOption( "USE_RRD", "YES" );
else
CPLSetConfigOption( "USE_RRD", "NO" );

// add any driver-specific configuration options, save values to be restored later
if ( theFormat != PyramidsErdas && ! theConfigOptions.isEmpty() )
if ( theFormat != QgsRaster::PyramidsErdas && ! theConfigOptions.isEmpty() )
{
foreach ( QString option, theConfigOptions )
{
Expand Down Expand Up @@ -1508,7 +1508,7 @@ QString QgsGdalProvider::buildPyramids( const QList<QgsRasterPyramid> & theRaste
{
//build the pyramid and show progress to console
QgsGdalProgress myProg;
myProg.type = ProgressPyramids;
myProg.type = QgsRaster::ProgressPyramids;
myProg.provider = this;
myError = GDALBuildOverviews( mGdalBaseDataset, theMethod,
myOverviewLevelsVector.size(), myOverviewLevelsVector.data(),
Expand Down Expand Up @@ -1568,7 +1568,7 @@ QString QgsGdalProvider::buildPyramids( const QList<QgsRasterPyramid> & theRaste
// https://trac.osgeo.org/gdal/ticket/4831
// Crash can be avoided if dataset is reopened, fixed in GDAL 1.9.2
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1920
if ( theFormat == PyramidsInternal )
if ( theFormat == QgsRaster::PyramidsInternal )
#else
if ( true ) // GDAL #4831 fix
#endif
Expand Down Expand Up @@ -2204,7 +2204,7 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int theBandNo, int theStats,
double pdfMean;
double pdfStdDev;
QgsGdalProgress myProg;
myProg.type = ProgressHistogram;
myProg.type = QgsRaster::ProgressHistogram;
myProg.provider = this;

// try to fetch the cached stats (bForce=FALSE)
Expand Down Expand Up @@ -2704,19 +2704,19 @@ QString QgsGdalProvider::validateCreationOptions( const QStringList& createOptio
return message;
}

QString QgsGdalProvider::validatePyramidsCreationOptions( RasterPyramidsFormat pyramidsFormat,
QString QgsGdalProvider::validatePyramidsCreationOptions( QgsRaster::RasterPyramidsFormat pyramidsFormat,
const QStringList & theConfigOptions, const QString & fileFormat )
{
// Erdas Imagine format does not support config options
if ( pyramidsFormat == PyramidsErdas )
if ( pyramidsFormat == QgsRaster::PyramidsErdas )
{
if ( ! theConfigOptions.isEmpty() )
return "Erdas Imagine format does not support config options";
else
return QString();
}
// Internal pyramids format only supported for gtiff/georaster/hfa/jp2kak/mrsid/nitf files
else if ( pyramidsFormat == PyramidsInternal )
else if ( pyramidsFormat == QgsRaster::PyramidsInternal )
{
QStringList supportedFormats;
supportedFormats << "gtiff" << "georaster" << "hfa" << "jp2kak" << "mrsid" << "nitf";
Expand Down
6 changes: 3 additions & 3 deletions src/providers/gdal/qgsgdalprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class QgsGdalProvider : public QgsRasterDataProvider, QgsGdalProviderBase
*/
bool isValid();

QgsRasterIdentifyResult identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );
QgsRasterIdentifyResult identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );

/**
* \brief Returns the caption error text for the last error in this provider
Expand Down Expand Up @@ -215,7 +215,7 @@ class QgsGdalProvider : public QgsRasterDataProvider, QgsGdalProviderBase

QString buildPyramids( const QList<QgsRasterPyramid> & theRasterPyramidList,
const QString & theResamplingMethod = "NEAREST",
RasterPyramidsFormat theFormat = PyramidsGTiff,
QgsRaster::RasterPyramidsFormat theFormat = QgsRaster::PyramidsGTiff,
const QStringList & theCreateOptions = QStringList() );
QList<QgsRasterPyramid> buildPyramidList( QList<int> overviewList = QList<int>() );

Expand Down Expand Up @@ -250,7 +250,7 @@ class QgsGdalProvider : public QgsRasterDataProvider, QgsGdalProviderBase
bool remove();

QString validateCreationOptions( const QStringList& createOptions, QString format );
QString validatePyramidsCreationOptions( RasterPyramidsFormat pyramidsFormat,
QString validatePyramidsCreationOptions( QgsRaster::RasterPyramidsFormat pyramidsFormat,
const QStringList & theConfigOptions, const QString & fileFormat );

signals:
Expand Down
36 changes: 18 additions & 18 deletions src/providers/gdal/qgsgdalproviderbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,60 +173,60 @@ int QgsGdalProviderBase::colorInterpretationFromGdal( int gdalColorInterpretatio
switch ( gdalColorInterpretation )
{
case GCI_Undefined:
return QgsRasterDataProvider::UndefinedColorInterpretation;
return QgsRaster::UndefinedColorInterpretation;
break;
case GCI_GrayIndex:
return QgsRasterDataProvider::GrayIndex;
return QgsRaster::GrayIndex;
break;
case GCI_PaletteIndex:
return QgsRasterDataProvider::PaletteIndex;
return QgsRaster::PaletteIndex;
break;
case GCI_RedBand:
return QgsRasterDataProvider::RedBand;
return QgsRaster::RedBand;
break;
case GCI_GreenBand:
return QgsRasterDataProvider::GreenBand;
return QgsRaster::GreenBand;
break;
case GCI_BlueBand:
return QgsRasterDataProvider::BlueBand;
return QgsRaster::BlueBand;
break;
case GCI_AlphaBand:
return QgsRasterDataProvider::AlphaBand;
return QgsRaster::AlphaBand;
break;
case GCI_HueBand:
return QgsRasterDataProvider::HueBand;
return QgsRaster::HueBand;
break;
case GCI_SaturationBand:
return QgsRasterDataProvider::SaturationBand;
return QgsRaster::SaturationBand;
break;
case GCI_LightnessBand:
return QgsRasterDataProvider::LightnessBand;
return QgsRaster::LightnessBand;
break;
case GCI_CyanBand:
return QgsRasterDataProvider::CyanBand;
return QgsRaster::CyanBand;
break;
case GCI_MagentaBand:
return QgsRasterDataProvider::MagentaBand;
return QgsRaster::MagentaBand;
break;
case GCI_YellowBand:
return QgsRasterDataProvider::YellowBand;
return QgsRaster::YellowBand;
break;
case GCI_BlackBand:
return QgsRasterDataProvider::BlackBand;
return QgsRaster::BlackBand;
break;
case GCI_YCbCr_YBand:
return QgsRasterDataProvider::YCbCr_YBand;
return QgsRaster::YCbCr_YBand;
break;
case GCI_YCbCr_CbBand:
return QgsRasterDataProvider::YCbCr_CbBand;
return QgsRaster::YCbCr_CbBand;
break;
case GCI_YCbCr_CrBand:
return QgsRasterDataProvider::YCbCr_CrBand;
return QgsRaster::YCbCr_CrBand;
break;
default:
break;
}
return QgsRasterDataProvider::UndefinedColorInterpretation;
return QgsRaster::UndefinedColorInterpretation;
}

void QgsGdalProviderBase::registerGdalDrivers()
Expand Down
12 changes: 6 additions & 6 deletions src/providers/grass/qgsgrassrasterprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ int QgsGrassRasterProvider::yBlockSize() const
int QgsGrassRasterProvider::xSize() const { return mCols; }
int QgsGrassRasterProvider::ySize() const { return mRows; }

QgsRasterIdentifyResult QgsGrassRasterProvider::identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
QgsRasterIdentifyResult QgsGrassRasterProvider::identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
{
Q_UNUSED( theExtent );
Q_UNUSED( theWidth );
Expand All @@ -432,9 +432,9 @@ QgsRasterIdentifyResult QgsGrassRasterProvider::identify( const QgsPoint & thePo
QMap<int, QVariant> results;
QMap<int, QVariant> noDataResults;
noDataResults.insert( 1, QVariant() );
QgsRasterIdentifyResult noDataResult( IdentifyFormatValue, results );
QgsRasterIdentifyResult noDataResult( QgsRaster::IdentifyFormatValue, results );

if ( theFormat != IdentifyFormatValue )
if ( theFormat != QgsRaster::IdentifyFormatValue )
{
return QgsRasterIdentifyResult( ERROR( tr( "Format not supported" ) ) );
}
Expand Down Expand Up @@ -471,7 +471,7 @@ QgsRasterIdentifyResult QgsGrassRasterProvider::identify( const QgsPoint & thePo

results.insert( 1, value );

return QgsRasterIdentifyResult( IdentifyFormatValue, results );
return QgsRasterIdentifyResult( QgsRaster::IdentifyFormatValue, results );
}

int QgsGrassRasterProvider::capabilities() const
Expand Down Expand Up @@ -517,9 +517,9 @@ int QgsGrassRasterProvider::colorInterpretation( int bandNo ) const
QList<QgsColorRampShader::ColorRampItem> ct = colorTable( bandNo );
if ( ct.size() > 0 )
{
return QgsRasterDataProvider::ContinuousPalette;
return QgsRaster::ContinuousPalette;
}
return QgsRasterDataProvider::GrayIndex;
return QgsRaster::GrayIndex;
}

QString QgsGrassRasterProvider::metadata()
Expand Down
2 changes: 1 addition & 1 deletion src/providers/grass/qgsgrassrasterprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class QgsGrassRasterProvider : public QgsRasterDataProvider
*/
bool isValid();

QgsRasterIdentifyResult identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );
QgsRasterIdentifyResult identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );

/**
* \brief Returns the caption error text for the last error in this provider
Expand Down
8 changes: 4 additions & 4 deletions src/providers/wcs/qgswcsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1599,14 +1599,14 @@ QString QgsWcsProvider:: htmlRow( const QString &text1, const QString &text2 )
return "<tr>" + htmlCell( text1 ) + htmlCell( text2 ) + "</tr>";
}

QgsRasterIdentifyResult QgsWcsProvider::identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
QgsRasterIdentifyResult QgsWcsProvider::identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
{
QgsDebugMsg( QString( "thePoint = %1 %2" ).arg( thePoint.x(), 0, 'g', 10 ).arg( thePoint.y(), 0, 'g', 10 ) );
QgsDebugMsg( QString( "theWidth = %1 theHeight = %2" ).arg( theWidth ).arg( theHeight ) );
QgsDebugMsg( "theExtent = " + theExtent.toString() );
QMap<int, QVariant> results;

if ( theFormat != IdentifyFormatValue )
if ( theFormat != QgsRaster::IdentifyFormatValue )
{
return QgsRasterIdentifyResult( ERROR( tr( "Format not supported" ) ) );
}
Expand All @@ -1618,7 +1618,7 @@ QgsRasterIdentifyResult QgsWcsProvider::identify( const QgsPoint & thePoint, Ide
{
results.insert( i, QVariant() );
}
return QgsRasterIdentifyResult( IdentifyFormatValue, results );
return QgsRasterIdentifyResult( QgsRaster::IdentifyFormatValue, results );
}

QgsRectangle myExtent = theExtent;
Expand Down Expand Up @@ -1711,7 +1711,7 @@ QgsRasterIdentifyResult QgsWcsProvider::identify( const QgsPoint & thePoint, Ide
}
}

return QgsRasterIdentifyResult( IdentifyFormatValue, results );
return QgsRasterIdentifyResult( QgsRaster::IdentifyFormatValue, results );
}

QgsCoordinateReferenceSystem QgsWcsProvider::crs()
Expand Down
2 changes: 1 addition & 1 deletion src/providers/wcs/qgswcsprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class QgsWcsProvider : public QgsRasterDataProvider, QgsGdalProviderBase
int xSize() const;
int ySize() const;
QString metadata();
QgsRasterIdentifyResult identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );
QgsRasterIdentifyResult identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );
QString lastErrorTitle();
QString lastError();
QString lastErrorFormat();
Expand Down
26 changes: 13 additions & 13 deletions src/providers/wms/qgswmsprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1424,19 +1424,19 @@ bool QgsWmsProvider::retrieveServerCapabilities( bool forceRefresh )
// GML.1, GML.2, or GML.3
// 1.1.0, 1.3.0 - mime types, GML should use application/vnd.ogc.gml
// but in UMN Mapserver it may be also OUTPUTFORMAT, e.g. OGRGML
IdentifyFormat format = IdentifyFormatUndefined;
QgsRaster::IdentifyFormat format = QgsRaster::IdentifyFormatUndefined;
if ( f == "MIME" )
format = IdentifyFormatText; // 1.0
format = QgsRaster::IdentifyFormatText; // 1.0
else if ( f == "text/plain" )
format = IdentifyFormatText;
format = QgsRaster::IdentifyFormatText;
else if ( f == "text/html" )
format = IdentifyFormatHtml;
format = QgsRaster::IdentifyFormatHtml;
else if ( f.startsWith( "GML." ) )
format = IdentifyFormatFeature; // 1.0
format = QgsRaster::IdentifyFormatFeature; // 1.0
else if ( f == "application/vnd.ogc.gml" )
format = IdentifyFormatFeature;
format = QgsRaster::IdentifyFormatFeature;
else if ( f.contains( "gml", Qt::CaseInsensitive ) )
format = IdentifyFormatFeature;
format = QgsRaster::IdentifyFormatFeature;

mIdentifyFormats.insert( format, f );
#if 0
Expand Down Expand Up @@ -3357,7 +3357,7 @@ int QgsWmsProvider::identifyCapabilities() const
{
int capability = NoCapabilities;

foreach ( IdentifyFormat f, mIdentifyFormats.keys() )
foreach ( QgsRaster::IdentifyFormat f, mIdentifyFormats.keys() )
{
capability |= identifyFormatToCapability( f );
}
Expand Down Expand Up @@ -3918,7 +3918,7 @@ QString QgsWmsProvider::metadata()
return metadata;
}

QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent, int theWidth, int theHeight )
{
QgsDebugMsg( QString( "theFormat = %1" ).arg( theFormat ) );
QStringList resultStrings;
Expand Down Expand Up @@ -4117,13 +4117,13 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Ide
}
}

if ( theFormat == IdentifyFormatHtml || theFormat == IdentifyFormatText )
if ( theFormat == QgsRaster::IdentifyFormatHtml || theFormat == QgsRaster::IdentifyFormatText )
{
//resultStrings << mIdentifyResult;
//results.insert( count, mIdentifyResult );
results.insert( count, QString::fromUtf8( mIdentifyResultBodies.value( 0 ) ) );
}
else if ( theFormat == IdentifyFormatFeature ) // GML
else if ( theFormat == QgsRaster::IdentifyFormatFeature ) // GML
{
// The response maybe
// 1) simple GML
Expand Down Expand Up @@ -4290,12 +4290,12 @@ QgsRasterIdentifyResult QgsWmsProvider::identify( const QgsPoint & thePoint, Ide
#if 0
QString str;

if ( theFormat == IdentifyFormatHtml )
if ( theFormat == QgsRaster::IdentifyFormatHtml )
{
str = "<table>\n<tr><td>" + resultStrings.join( "</td></tr>\n<tr><td>" ) + "</td></tr>\n</table>";
results.insert( 1, str );
}
else if ( theFormat == IdentifyFormatText )
else if ( theFormat == QgsRaster::IdentifyFormatText )
{
str = resultStrings.join( "\n-------------\n" );
results.insert( 1, str );
Expand Down
4 changes: 2 additions & 2 deletions src/providers/wms/qgswmsprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ class QgsWmsProvider : public QgsRasterDataProvider
*/
QString metadata();

QgsRasterIdentifyResult identify( const QgsPoint & thePoint, IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );
QgsRasterIdentifyResult identify( const QgsPoint & thePoint, QgsRaster::IdentifyFormat theFormat, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );

/**
* \brief Returns the caption error text for the last error in this provider
Expand Down Expand Up @@ -1090,7 +1090,7 @@ class QgsWmsProvider : public QgsRasterDataProvider
QStringList mSupportedGetFeatureFormats;

//! Formats supported by server and provider
QMap<IdentifyFormat, QString> mIdentifyFormats;
QMap<QgsRaster::IdentifyFormat, QString> mIdentifyFormats;

QgsCoordinateReferenceSystem mCrs;

Expand Down
6 changes: 3 additions & 3 deletions tests/src/core/testcontrastenhancements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void TestContrastEnhancements::clipMinMaxEnhancementTest()
{
//Clips 0 < x < 10, 240 < X < 256
//Stretch no stretch is applied
QgsClipToMinMaxEnhancement myEnhancement( QgsContrastEnhancement::QGS_Byte, 10.0, 240.0 );
QgsClipToMinMaxEnhancement myEnhancement( QGis::Byte, 10.0, 240.0 );
// Original pixel value 0.0 Should be out of range thus clipped
QVERIFY( !myEnhancement.isValueInDisplayableRange( 0.0 ) );
//Original pixel value of 10.0 should be scaled to 10.0
Expand All @@ -82,7 +82,7 @@ void TestContrastEnhancements::linearMinMaxEnhancementWithClipTest()
{
//First clips 0 < x < 10, 240 < X < 256
//Then stretch 10 = 0, 240 = 255 linearly distribute values 10 -> 240 between 0 -> 255
QgsLinearMinMaxEnhancementWithClip myEnhancement( QgsContrastEnhancement::QGS_Byte, 10.0, 240.0 );
QgsLinearMinMaxEnhancementWithClip myEnhancement( QGis::Byte, 10.0, 240.0 );
// Original pixel value 0.0 Should be out of range thus clipped
QVERIFY( !myEnhancement.isValueInDisplayableRange( 0.0 ) );
//Original pixel value of 10.0 should be scaled to 0.0
Expand All @@ -94,7 +94,7 @@ void TestContrastEnhancements::linearMinMaxEnhancementWithClipTest()
void TestContrastEnhancements::linearMinMaxEnhancementTest()
{
//Stretch 10 = 0, 240 = 255 linearly distribute values 10 -> 240 between 0 -> 255
QgsLinearMinMaxEnhancement myEnhancement( QgsContrastEnhancement::QGS_Byte, 10.0, 240.0 );
QgsLinearMinMaxEnhancement myEnhancement( QGis::Byte, 10.0, 240.0 );
//0 should be scaled to 10 and not clipped
QVERIFY( myEnhancement.isValueInDisplayableRange( 0.0 ) );
//Original pixel value of 10.0 should be scaled to 0.0
Expand Down
8 changes: 4 additions & 4 deletions tests/src/core/testqgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void TestQgsRasterLayer::cleanupTestCase()
void TestQgsRasterLayer::isValid()
{
QVERIFY( mpRasterLayer->isValid() );
mpRasterLayer->setContrastEnhancementAlgorithm( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRasterLayer::ContrastEnhancementMinMax );
mpRasterLayer->setContrastEnhancementAlgorithm( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRaster::ContrastEnhancementMinMax );
mpMapRenderer->setExtent( mpRasterLayer->extent() );
QVERIFY( render( "raster" ) );
}
Expand Down Expand Up @@ -290,7 +290,7 @@ void TestQgsRasterLayer::colorRamp4()

void TestQgsRasterLayer::landsatBasic()
{
mpLandsatRasterLayer->setContrastEnhancementAlgorithm( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRasterLayer::ContrastEnhancementMinMax );
mpLandsatRasterLayer->setContrastEnhancementAlgorithm( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRaster::ContrastEnhancementMinMax );
QStringList myLayers;
myLayers << mpLandsatRasterLayer->id();
mpMapRenderer->setLayerSet( myLayers );
Expand Down Expand Up @@ -356,7 +356,7 @@ void TestQgsRasterLayer::buildExternalOverviews()
// Ok now we can go on to test
//

QgsRasterDataProvider::RasterPyramidsFormat myFormatFlag = QgsRasterDataProvider::PyramidsGTiff;
QgsRaster::RasterPyramidsFormat myFormatFlag = QgsRaster::PyramidsGTiff;
QList< QgsRasterPyramid > myPyramidList = mypLayer->dataProvider()->buildPyramidList();
for ( int myCounterInt = 0; myCounterInt < myPyramidList.count(); myCounterInt++ )
{
Expand Down Expand Up @@ -446,7 +446,7 @@ void TestQgsRasterLayer::transparency()
QVERIFY( mpFloat32RasterLayer->isValid() );
QgsSingleBandGrayRenderer* renderer = new QgsSingleBandGrayRenderer( mpRasterLayer->dataProvider(), 1 );
mpFloat32RasterLayer->setRenderer( renderer );
mpFloat32RasterLayer->setContrastEnhancementAlgorithm( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRasterLayer::ContrastEnhancementMinMax );
mpFloat32RasterLayer->setContrastEnhancementAlgorithm( QgsContrastEnhancement::StretchToMinimumMaximum, QgsRaster::ContrastEnhancementMinMax );

qDebug( "contrastEnhancement.minimumValue = %.17g", renderer->contrastEnhancement()->minimumValue() );
qDebug( "contrastEnhancement.maximumValue = %.17g", renderer->contrastEnhancement()->maximumValue() );
Expand Down
7 changes: 4 additions & 3 deletions tests/src/python/test_qgsrasterlayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from PyQt4.QtCore import QFileInfo, QString, QStringList
from PyQt4 import QtGui

from qgis.core import (QgsRasterLayer,
from qgis.core import (QgsRaster,
QgsRasterLayer,
QgsRasterDataProvider,
QgsColorRampShader,
QgsContrastEnhancement,
Expand Down Expand Up @@ -53,7 +54,7 @@ def testIdentify(self):
#print 'Extents: %s' % myRasterLayer.extent().toString()
#myResult, myRasterValues = myRasterLayer.identify(myPoint)
#assert myResult
myRasterValues = myRasterLayer.dataProvider().identify(myPoint, QgsRasterDataProvider.IdentifyFormatValue ).results()
myRasterValues = myRasterLayer.dataProvider().identify(myPoint, QgsRaster.IdentifyFormatValue ).results()

assert len( myRasterValues ) > 0

Expand Down Expand Up @@ -90,7 +91,7 @@ def testTransparency(self):
myRasterLayer.setRenderer(renderer)
myRasterLayer.setContrastEnhancementAlgorithm(
QgsContrastEnhancement.StretchToMinimumMaximum,
QgsRasterLayer.ContrastEnhancementMinMax)
QgsRaster.ContrastEnhancementMinMax)

myContrastEnhancement = myRasterLayer.renderer().contrastEnhancement()
#print ("myContrastEnhancement.minimumValue = %.17g" %
Expand Down