Skip to content
Permalink
Browse files

common raster enums moved to raster namespace

  • Loading branch information
blazek committed Apr 24, 2013
1 parent 0b6dab9 commit 5533d571c8f8b3b36177843475351b17e64166fe
Showing with 535 additions and 509 deletions.
  1. +1 −0 python/core/core.sip
  2. +1 −1 python/core/raster/qgscliptominmaxenhancement.sip
  3. +3 −27 python/core/raster/qgscontrastenhancement.sip
  4. +1 −1 python/core/raster/qgscontrastenhancementfunction.sip
  5. +1 −1 python/core/raster/qgslinearminmaxenhancement.sip
  6. +1 −1 python/core/raster/qgslinearminmaxenhancementwithclip.sip
  7. +77 −0 python/core/raster/qgsraster.sip
  8. +3 −58 python/core/raster/qgsrasterdataprovider.sip
  9. +4 −4 python/core/raster/qgsrasterfilewriter.sip
  10. +2 −2 python/core/raster/qgsrasteridentifyresult.sip
  11. +1 −13 python/core/raster/qgsrasterlayer.sip
  12. +1 −1 python/gui/qgsrasterformatsaveoptionswidget.sip
  13. +2 −2 python/gui/qgsrasterlayersaveasdialog.sip
  14. +1 −1 python/gui/qgsrasterpyramidsoptionswidget.sip
  15. +1 −1 src/app/legend/qgslegend.cpp
  16. +5 −5 src/app/qgisapp.cpp
  17. +1 −1 src/app/qgisapp.h
  18. +9 −9 src/app/qgsidentifyresultsdialog.cpp
  19. +2 −2 src/app/qgsrasterlayerproperties.cpp
  20. +2 −0 src/core/CMakeLists.txt
  21. +2 −2 src/core/raster/qgscliptominmaxenhancement.cpp
  22. +1 −1 src/core/raster/qgscliptominmaxenhancement.h
  23. +32 −30 src/core/raster/qgscontrastenhancement.cpp
  24. +6 −28 src/core/raster/qgscontrastenhancement.h
  25. +2 −2 src/core/raster/qgscontrastenhancementfunction.cpp
  26. +3 −2 src/core/raster/qgscontrastenhancementfunction.h
  27. +1 −1 src/core/raster/qgslinearminmaxenhancement.cpp
  28. +1 −1 src/core/raster/qgslinearminmaxenhancement.h
  29. +1 −1 src/core/raster/qgslinearminmaxenhancementwithclip.cpp
  30. +1 −1 src/core/raster/qgslinearminmaxenhancementwithclip.h
  31. +3 −3 src/core/raster/qgsmultibandcolorrenderer.cpp
  32. +56 −0 src/core/raster/qgsraster.cpp
  33. +99 −0 src/core/raster/qgsraster.h
  34. +25 −25 src/core/raster/qgsrasterdataprovider.cpp
  35. +31 −85 src/core/raster/qgsrasterdataprovider.h
  36. +8 −8 src/core/raster/qgsrasterfilewriter.cpp
  37. +6 −6 src/core/raster/qgsrasterfilewriter.h
  38. +3 −3 src/core/raster/qgsrasteridentifyresult.cpp
  39. +7 −6 src/core/raster/qgsrasteridentifyresult.h
  40. +17 −53 src/core/raster/qgsrasterlayer.cpp
  41. +2 −13 src/core/raster/qgsrasterlayer.h
  42. +1 −1 src/core/raster/qgsrasterrendererregistry.cpp
  43. +1 −1 src/core/raster/qgssinglebandgrayrenderer.cpp
  44. +7 −7 src/gui/qgsmaptoolidentify.cpp
  45. +1 −1 src/gui/qgsrasterformatsaveoptionswidget.cpp
  46. +2 −2 src/gui/qgsrasterformatsaveoptionswidget.h
  47. +5 −5 src/gui/qgsrasterlayersaveasdialog.cpp
  48. +2 −2 src/gui/qgsrasterlayersaveasdialog.h
  49. +2 −2 src/gui/qgsrasterpyramidsoptionswidget.cpp
  50. +2 −2 src/gui/qgsrasterpyramidsoptionswidget.h
  51. +3 −3 src/gui/raster/qgsmultibandcolorrendererwidget.cpp
  52. +5 −5 src/gui/raster/qgsrasterhistogramwidget.cpp
  53. +1 −1 src/gui/raster/qgssinglebandgrayrendererwidget.cpp
  54. +2 −2 src/mapserver/qgswmsserver.cpp
  55. +1 −1 src/plugins/georeferencer/qgsgeorefplugingui.cpp
  56. +15 −15 src/providers/gdal/qgsgdalprovider.cpp
  57. +3 −3 src/providers/gdal/qgsgdalprovider.h
  58. +18 −18 src/providers/gdal/qgsgdalproviderbase.cpp
  59. +6 −6 src/providers/grass/qgsgrassrasterprovider.cpp
  60. +1 −1 src/providers/grass/qgsgrassrasterprovider.h
  61. +4 −4 src/providers/wcs/qgswcsprovider.cpp
  62. +1 −1 src/providers/wcs/qgswcsprovider.h
  63. +13 −13 src/providers/wms/qgswmsprovider.cpp
  64. +2 −2 src/providers/wms/qgswmsprovider.h
  65. +3 −3 tests/src/core/testcontrastenhancements.cpp
  66. +4 −4 tests/src/core/testqgsrasterlayer.cpp
  67. +4 −3 tests/src/python/test_qgsrasterlayer.py
@@ -128,6 +128,7 @@
%Include gps/qgsnmeaconnection.sip
%Include gps/qgsqtlocationconnection.sip

%Include raster/qgsraster.sip
%Include raster/qgscliptominmaxenhancement.sip
%Include raster/qgscolorrampshader.sip
%Include raster/qgscontrastenhancement.sip
@@ -5,7 +5,7 @@ class QgsClipToMinMaxEnhancement : QgsContrastEnhancementFunction
%End

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

int enhance( double );

@@ -17,31 +17,7 @@ class 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();

/*
@@ -50,10 +26,10 @@ class 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 );

/*
*
@@ -7,7 +7,7 @@ class QgsContrastEnhancementFunction
%End

public:
QgsContrastEnhancementFunction( QgsContrastEnhancement::QgsRasterDataType, double, double );
QgsContrastEnhancementFunction( QGis::DataType, double, double );
virtual ~QgsContrastEnhancementFunction();

/** \brief Mustator for the maximum value */
@@ -5,7 +5,7 @@ class QgsLinearMinMaxEnhancement : QgsContrastEnhancementFunction
%End

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

int enhance( double );

@@ -9,7 +9,7 @@ class QgsLinearMinMaxEnhancementWithClip : QgsContrastEnhancementFunction
%End

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

int enhance( double );

@@ -0,0 +1,77 @@
/*! \class QgsRaster
*/

class QgsRaster
{
%TypeHeaderCode
#include <qgsraster.h>
%End

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 = 0x2, // WMS text
IdentifyFormatHtml = 0x4, // WMS HTML
IdentifyFormatFeature = 0x8 // 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 );

};

@@ -16,61 +16,6 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface

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,
IdentifyFormatText = 2,
IdentifyFormatHtml = 4,
IdentifyFormatFeature = 8
};

// 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 );
@@ -148,7 +93,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
/** \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() );

/** \brief Accessor for ths raster layers pyramid list.
@@ -169,7 +114,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface
*/
virtual QString metadata() = 0;

virtual QgsRasterIdentifyResult identify( const QgsPoint & thePoint, 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 );

//QMap<QString, QString> identify( const QgsPoint & thePoint, const QgsRectangle &theExtent = QgsRectangle(), int theWidth = 0, int theHeight = 0 );

@@ -252,7 +197,7 @@ class QgsRasterDataProvider : QgsDataProvider, QgsRasterInterface

/** 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 );

signals:
@@ -44,17 +44,17 @@ class QgsRasterFileWriter
void setMaxTileWidth( int w );
int maxTileWidth() const;

QgsRasterDataProvider::RasterBuildPyramids buildPyramidsFlag() const;
void setBuildPyramidsFlag( QgsRasterDataProvider::RasterBuildPyramids f );
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
void setBuildPyramidsFlag( QgsRaster::RasterBuildPyramids f );

QList< int > pyramidsList() const;
void setPyramidsList( const QList< int > & list );

QString pyramidsResampling() const;
void setPyramidsResampling( const QString & str );

QgsRasterDataProvider::RasterPyramidsFormat pyramidsFormat() const;
void setPyramidsFormat( QgsRasterDataProvider::RasterPyramidsFormat f );
QgsRaster::RasterPyramidsFormat pyramidsFormat() const;
void setPyramidsFormat( QgsRaster::RasterPyramidsFormat f );

void setMaxTileHeight( int h );
int maxTileHeight() const;
@@ -6,15 +6,15 @@ class QgsRasterIdentifyResult
public:
QgsRasterIdentifyResult();

QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormat theFormat, QMap<int, QVariant> theResults );
QgsRasterIdentifyResult( QgsRaster::IdentifyFormat theFormat, QMap<int, QVariant> theResults );

QgsRasterIdentifyResult( QgsError theError );

virtual ~QgsRasterIdentifyResult();

bool isValid() const;

QgsRasterDataProvider::IdentifyFormat format() const;
QgsRaster::IdentifyFormat format() const;

QMap<int, QVariant> results() const;

@@ -90,15 +90,6 @@ class QgsRasterLayer : QgsMapLayer
ColorLayer
};

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

//
// Static methods:
//
@@ -201,9 +192,6 @@ class QgsRasterLayer : 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 Mutator for contrast enhancement algorithm
* @param theAlgorithm Contrast enhancement algorithm
* @param theLimits Limits
@@ -213,7 +201,7 @@ class QgsRasterLayer : QgsMapLayer


void setContrastEnhancementAlgorithm( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm,
ContrastEnhancementLimits theLimits = ContrastEnhancementMinMax,
QgsRaster::ContrastEnhancementLimits theLimits = QgsRaster::ContrastEnhancementMinMax,
QgsRectangle theExtent = QgsRectangle(),
int theSampleSize = QgsRasterLayer::SAMPLE_SIZE,
bool theGenerateLookupTableFlag = true );
@@ -27,7 +27,7 @@ class QgsRasterFormatSaveOptionsWidget : QWidget
void setRasterFileName( const QString& file );
QStringList options() const;
void setType( QgsRasterFormatSaveOptionsWidget::Type type = Default );
void setPyramidsFormat( QgsRasterDataProvider::RasterPyramidsFormat format );
void setPyramidsFormat( QgsRaster::RasterPyramidsFormat format );

public slots:

@@ -49,9 +49,9 @@ class QgsRasterLayerSaveAsDialog : QDialog
QList<QgsRasterNuller::NoData> noData() const;

QList< int > pyramidsList() const;
QgsRasterDataProvider::RasterBuildPyramids buildPyramidsFlag() const;
QgsRaster::RasterBuildPyramids buildPyramidsFlag() const;
QString pyramidsResamplingMethod() const;
QgsRasterDataProvider::RasterPyramidsFormat pyramidsFormat() const;
QgsRaster::RasterPyramidsFormat pyramidsFormat() const;
QStringList pyramidsConfigOptions() const;

void hideFormat();
@@ -15,7 +15,7 @@ class QgsRasterPyramidsOptionsWidget: QWidget
QStringList configOptions() const;
QgsRasterFormatSaveOptionsWidget* createOptionsWidget() /Factory/;
const QList<int> overviewList() const;
QgsRasterDataProvider::RasterPyramidsFormat pyramidsFormat() const;
QgsRaster::RasterPyramidsFormat pyramidsFormat() const;
QString resamplingMethod() const;
void setRasterLayer( QgsRasterLayer* rasterLayer );
void setRasterFileName( const QString& file );
@@ -2757,7 +2757,7 @@ void QgsLegend::legendLayerStretchUsingCurrentExtent()

QgsRectangle myRectangle;
myRectangle = mMapCanvas->mapRenderer()->outputExtentToLayerExtent( layer, mMapCanvas->extent() );
layer->setContrastEnhancementAlgorithm( contrastEnhancementAlgorithm, QgsRasterLayer::ContrastEnhancementMinMax, myRectangle );
layer->setContrastEnhancementAlgorithm( contrastEnhancementAlgorithm, QgsRaster::ContrastEnhancementMinMax, myRectangle );

layer->setCacheImage( NULL );
refreshLayerSymbology( layer->id() );

0 comments on commit 5533d57

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