Skip to content

Commit

Permalink
common raster enums moved to raster namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Apr 24, 2013
1 parent 0b6dab9 commit 5533d57
Show file tree
Hide file tree
Showing 67 changed files with 535 additions and 509 deletions.
1 change: 1 addition & 0 deletions python/core/core.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/core/raster/qgscliptominmaxenhancement.sip
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class QgsClipToMinMaxEnhancement : QgsContrastEnhancementFunction
%End

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

int enhance( double );

Expand Down
30 changes: 3 additions & 27 deletions python/core/raster/qgscontrastenhancement.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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();

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

/*
*
Expand Down
2 changes: 1 addition & 1 deletion python/core/raster/qgscontrastenhancementfunction.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion python/core/raster/qgslinearminmaxenhancement.sip
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class QgsLinearMinMaxEnhancement : QgsContrastEnhancementFunction
%End

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

int enhance( double );

Expand Down
2 changes: 1 addition & 1 deletion python/core/raster/qgslinearminmaxenhancementwithclip.sip
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class QgsLinearMinMaxEnhancementWithClip : QgsContrastEnhancementFunction
%End

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

int enhance( double );

Expand Down
77 changes: 77 additions & 0 deletions python/core/raster/qgsraster.sip
Original file line number Diff line number Diff line change
@@ -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 );

};

61 changes: 3 additions & 58 deletions python/core/raster/qgsrasterdataprovider.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down Expand Up @@ -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.
Expand All @@ -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 );

Expand Down Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions python/core/raster/qgsrasterfilewriter.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions python/core/raster/qgsrasteridentifyresult.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
14 changes: 1 addition & 13 deletions python/core/raster/qgsrasterlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,6 @@ class QgsRasterLayer : QgsMapLayer
ColorLayer
};

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

//
// Static methods:
//
Expand Down Expand Up @@ -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
Expand All @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion python/gui/qgsrasterformatsaveoptionswidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
4 changes: 2 additions & 2 deletions python/gui/qgsrasterlayersaveasdialog.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion python/gui/qgsrasterpyramidsoptionswidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() );
Expand Down
Loading

0 comments on commit 5533d57

Please sign in to comment.