-Removed strange triplicate defs in .h file

-Moved loadDefaultStyle() to prevent crash when loading qml

git-svn-id: http://svn.osgeo.org/qgis/trunk@8051 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
ersts 2008-01-26 02:55:50 +00:00
parent e4e86b8f29
commit 899596b708
11 changed files with 5 additions and 1193 deletions

View File

@ -31,69 +31,3 @@ class CORE_EXPORT QgsClipToMinMaxEnhancement : public QgsContrastEnhancementFunc
};
#endif
/* **************************************************************************
qgscliptominmaxenhancement.h - description
-------------------
begin : Fri Nov 16 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSCLIPTOMINMAXENHANCEMENT_H
#define QGSCLIPTOMINMAXENHANCEMENT_H
#include "qgscontrastenhancementfunction.h"
class CORE_EXPORT QgsClipToMinMaxEnhancement : public QgsContrastEnhancementFunction
{
public:
QgsClipToMinMaxEnhancement(QgsContrastEnhancement::QgsRasterDataType, double, double);
int enhanceValue(double);
bool isValueInDisplayableRange(double);
};
#endif
/* **************************************************************************
qgscliptominmaxenhancement.h - description
-------------------
begin : Fri Nov 16 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSCLIPTOMINMAXENHANCEMENT_H
#define QGSCLIPTOMINMAXENHANCEMENT_H
#include "qgscontrastenhancementfunction.h"
class CORE_EXPORT QgsClipToMinMaxEnhancement : public QgsContrastEnhancementFunction
{
public:
QgsClipToMinMaxEnhancement(QgsContrastEnhancement::QgsRasterDataType, double, double);
int enhanceValue(double);
bool isValueInDisplayableRange(double);
};
#endif

View File

@ -68,162 +68,6 @@ public:
private:
/**Gets the color for a pixel value from the classification vector mValueClassification. Assigns the color of the lower class for every pixel between two class breaks.*/
bool getDiscreteColor(double, int*, int*, int*);
/**Gets the color for a pixel value from the classification vector mValueClassification. Interpolates the color between two class breaks linearly.*/
bool getInterpolatedColor(double, int*, int*, int*);
/**This vector holds the information for classification based on values. Each item holds a value, a label and a color. The member mDiscreteClassification holds if one color is applied for all values between two class breaks (true) or if the item values are (linearly) interpolated for values between the item values (false)*/
QList<QgsColorRampShader::ColorRampItem> mColorRampItemList;
QgsColorRampShader::COLOR_RAMP_TYPE mColorRampType;
};
#endif
/* **************************************************************************
qgscolorrampshader.h - description
-------------------
begin : Fri Dec 28 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
This class is based off of code that was originally written by Marco Hugentobler and
originally part of the larger QgsRasterLayer class
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSCOLORRAMPSHADER_H
#define QGSCOLORRAMPSHADER_H
#include <QColor>
#include "qgsrastershaderfunction.h"
class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction {
public:
QgsColorRampShader(double theMinimumValue=0.0, double theMaximumValue=255.0);
//An entry for classification based upon value.
//Such a classification is typically used for
//single band layers where a pixel value represents
//not a color but a quantity, e.g. temperature or elevation
struct ColorRampItem
{
QString label;
double value;
QColor color;
};
enum COLOR_RAMP_TYPE {
INTERPOLATED,
DISCRETE
};
bool generateShadedValue(double, int*, int*, int*);
bool generateShadedValue(double, double, double, int*, int*, int*);
/** Get the custom colormap*/
QList<QgsColorRampShader::ColorRampItem> getColorRampItemList() const {return mColorRampItemList;}
/**Get the color ramp type */
QgsColorRampShader::COLOR_RAMP_TYPE getColorRampType() {return mColorRampType;}
/**Set custom colormap */
void setColorRampItemList(const QList<QgsColorRampShader::ColorRampItem>& theList) { mColorRampItemList = theList; }
/**Set discrete/interpolated colors for custom classification*/
void setColorRampType(QgsColorRampShader::COLOR_RAMP_TYPE theColorRampType) {mColorRampType = theColorRampType;}
private:
/**Gets the color for a pixel value from the classification vector mValueClassification. Assigns the color of the lower class for every pixel between two class breaks.*/
bool getDiscreteColor(double, int*, int*, int*);
/**Gets the color for a pixel value from the classification vector mValueClassification. Interpolates the color between two class breaks linearly.*/
bool getInterpolatedColor(double, int*, int*, int*);
/**This vector holds the information for classification based on values. Each item holds a value, a label and a color. The member mDiscreteClassification holds if one color is applied for all values between two class breaks (true) or if the item values are (linearly) interpolated for values between the item values (false)*/
QList<QgsColorRampShader::ColorRampItem> mColorRampItemList;
QgsColorRampShader::COLOR_RAMP_TYPE mColorRampType;
};
#endif
/* **************************************************************************
qgscolorrampshader.h - description
-------------------
begin : Fri Dec 28 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
This class is based off of code that was originally written by Marco Hugentobler and
originally part of the larger QgsRasterLayer class
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSCOLORRAMPSHADER_H
#define QGSCOLORRAMPSHADER_H
#include <QColor>
#include "qgsrastershaderfunction.h"
class CORE_EXPORT QgsColorRampShader : public QgsRasterShaderFunction {
public:
QgsColorRampShader(double theMinimumValue=0.0, double theMaximumValue=255.0);
//An entry for classification based upon value.
//Such a classification is typically used for
//single band layers where a pixel value represents
//not a color but a quantity, e.g. temperature or elevation
struct ColorRampItem
{
QString label;
double value;
QColor color;
};
enum COLOR_RAMP_TYPE {
INTERPOLATED,
DISCRETE
};
bool generateShadedValue(double, int*, int*, int*);
bool generateShadedValue(double, double, double, int*, int*, int*);
/** Get the custom colormap*/
QList<QgsColorRampShader::ColorRampItem> getColorRampItemList() const {return mColorRampItemList;}
/**Get the color ramp type */
QgsColorRampShader::COLOR_RAMP_TYPE getColorRampType() {return mColorRampType;}
/**Set custom colormap */
void setColorRampItemList(const QList<QgsColorRampShader::ColorRampItem>& theList) { mColorRampItemList = theList; }
/**Set discrete/interpolated colors for custom classification*/
void setColorRampType(QgsColorRampShader::COLOR_RAMP_TYPE theColorRampType) {mColorRampType = theColorRampType;}
private:
/**Gets the color for a pixel value from the classification vector mValueClassification. Assigns the color of the lower class for every pixel between two class breaks.*/
bool getDiscreteColor(double, int*, int*, int*);

View File

@ -135,277 +135,3 @@ private:
};
#endif
/* **************************************************************************
qgscontrastenhancement.h - description
-------------------
begin : Mon Oct 22 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
This class contains code that was originally part of the larger QgsRasterLayer
class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSCONTRASTENHANCEMENT_H
#define QGSCONTRASTENHANCEMENT_H
#include <limits>
class QgsContrastEnhancementFunction;
class CORE_EXPORT QgsContrastEnhancement {
public:
/** \brief This enumerator describes the types of contrast enhancement algorithms that can be used. */
enum CONTRAST_ENHANCEMENT_ALGORITHM
{
NO_STRETCH, //this should be the default color scaling algorithm
STRETCH_TO_MINMAX, //linear histogram stretch
STRETCH_AND_CLIP_TO_MINMAX,
CLIP_TO_MINMAX,
USER_DEFINED
};
/** 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...
*/
typedef 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();
/*
*
* Static methods
*
*/
/** \brief Helper function that returns the maximum possible value for a GDAL data type */
static double getMaximumPossibleValue(QgsRasterDataType);
/** \brief Helper function that returns the minimum possible value for a GDAL data type */
static double getMinimumPossibleValue(QgsRasterDataType);
/*
*
* Non-Static Inline methods
*
*/
/** \brief Return the maximum value for the contrast enhancement range. */
double getMaximumValue() { return mMaximumValue; }
/** \brief Return the minimum value for the contrast enhancement range. */
double getMinimumValue() { return mMinimumValue; }
CONTRAST_ENHANCEMENT_ALGORITHM getContrastEnhancementAlgorithm() { return mContrastEnhancementAlgorithm; }
/*
*
* Non-Static methods
*
*/
/** \brief Return true if pixel is in stretable range, false if pixel is outside of range (i.e., clipped) */
bool isValueInDisplayableRange(double);
/** \brief Set the contrast enhancement algorithm */
void setContrastEnhancementAlgorithm(CONTRAST_ENHANCEMENT_ALGORITHM, bool generateTable=true);
/** \brief A public method that allows the user to set their own custom contrast enhancment function */
void setContrastEnhancementFunction(QgsContrastEnhancementFunction*);
/** \brief Set the maximum value for the contrast enhancement range. */
void setMaximumValue(double, bool generateTable=true);
/** \brief Return the minimum value for the contrast enhancement range. */
void setMinimumValue(double, bool generateTable=true);
/** \brief Apply the contrast enhancement to a value. Return values are 0 - 254, -1 means the pixel was clipped and should not be displayed */
int stretch(double);
private:
/** \brief Current contrast enhancement algorithm */
CONTRAST_ENHANCEMENT_ALGORITHM mContrastEnhancementAlgorithm;
/** \brief Data type of the band */
QgsRasterDataType mRasterDataType;
/** \brief Maximum range of values for a given data type */
double mRasterDataTypeRange;
/** \brief Flag indicating if the lookup table needs to be regenerated */
bool mEnhancementDirty;
QgsContrastEnhancementFunction* mContrastEnhancementFunction;
/** \brief User defineable minimum value for the band, used for stretching */
double mMinimumValue;
/** \brief user defineable maximum value for the band, used for stretching */
double mMaximumValue;
/** \brief Scalar so that values can be used as array indicies */
double mLookupTableOffset;
/** \brief Pointer to the lookup table */
int *mLookupTable;
/** \brief Method to generate a new lookup table */
bool generateLookupTable();
/** \brief Method to calculate the actual stretched value(s) */
int calculateContrastEnhancementValue(double);
};
#endif
/* **************************************************************************
qgscontrastenhancement.h - description
-------------------
begin : Mon Oct 22 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
This class contains code that was originally part of the larger QgsRasterLayer
class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSCONTRASTENHANCEMENT_H
#define QGSCONTRASTENHANCEMENT_H
#include <limits>
class QgsContrastEnhancementFunction;
class CORE_EXPORT QgsContrastEnhancement {
public:
/** \brief This enumerator describes the types of contrast enhancement algorithms that can be used. */
enum CONTRAST_ENHANCEMENT_ALGORITHM
{
NO_STRETCH, //this should be the default color scaling algorithm
STRETCH_TO_MINMAX, //linear histogram stretch
STRETCH_AND_CLIP_TO_MINMAX,
CLIP_TO_MINMAX,
USER_DEFINED
};
/** 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...
*/
typedef 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();
/*
*
* Static methods
*
*/
/** \brief Helper function that returns the maximum possible value for a GDAL data type */
static double getMaximumPossibleValue(QgsRasterDataType);
/** \brief Helper function that returns the minimum possible value for a GDAL data type */
static double getMinimumPossibleValue(QgsRasterDataType);
/*
*
* Non-Static Inline methods
*
*/
/** \brief Return the maximum value for the contrast enhancement range. */
double getMaximumValue() { return mMaximumValue; }
/** \brief Return the minimum value for the contrast enhancement range. */
double getMinimumValue() { return mMinimumValue; }
CONTRAST_ENHANCEMENT_ALGORITHM getContrastEnhancementAlgorithm() { return mContrastEnhancementAlgorithm; }
/*
*
* Non-Static methods
*
*/
/** \brief Return true if pixel is in stretable range, false if pixel is outside of range (i.e., clipped) */
bool isValueInDisplayableRange(double);
/** \brief Set the contrast enhancement algorithm */
void setContrastEnhancementAlgorithm(CONTRAST_ENHANCEMENT_ALGORITHM, bool generateTable=true);
/** \brief A public method that allows the user to set their own custom contrast enhancment function */
void setContrastEnhancementFunction(QgsContrastEnhancementFunction*);
/** \brief Set the maximum value for the contrast enhancement range. */
void setMaximumValue(double, bool generateTable=true);
/** \brief Return the minimum value for the contrast enhancement range. */
void setMinimumValue(double, bool generateTable=true);
/** \brief Apply the contrast enhancement to a value. Return values are 0 - 254, -1 means the pixel was clipped and should not be displayed */
int stretch(double);
private:
/** \brief Current contrast enhancement algorithm */
CONTRAST_ENHANCEMENT_ALGORITHM mContrastEnhancementAlgorithm;
/** \brief Data type of the band */
QgsRasterDataType mRasterDataType;
/** \brief Maximum range of values for a given data type */
double mRasterDataTypeRange;
/** \brief Flag indicating if the lookup table needs to be regenerated */
bool mEnhancementDirty;
QgsContrastEnhancementFunction* mContrastEnhancementFunction;
/** \brief User defineable minimum value for the band, used for stretching */
double mMinimumValue;
/** \brief user defineable maximum value for the band, used for stretching */
double mMaximumValue;
/** \brief Scalar so that values can be used as array indicies */
double mLookupTableOffset;
/** \brief Pointer to the lookup table */
int *mLookupTable;
/** \brief Method to generate a new lookup table */
bool generateLookupTable();
/** \brief Method to calculate the actual stretched value(s) */
int calculateContrastEnhancementValue(double);
};
#endif

View File

@ -50,107 +50,3 @@ class CORE_EXPORT QgsContrastEnhancementFunction
};
#endif
/* **************************************************************************
qgscontrastenhancementfunction.h - description
-------------------
begin : Fri Nov 16 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSCONTRASTENHANCEMENTFUNCTION_H
#define QGSCONTRASTENHANCEMENTFUNCTION_H
#include "qgscontrastenhancement.h"
class CORE_EXPORT QgsContrastEnhancementFunction
{
public:
QgsContrastEnhancementFunction(QgsContrastEnhancement::QgsRasterDataType, double, double);
virtual ~QgsContrastEnhancementFunction() {}
/** \brief Mustator for the maximum value */
void setMaximumValue(double);
/** \brief Mutator for the minimum value */
void setMinimumValue(double);
/** \brief A customizable method that takes in a double and returns a int between 0 and 255 */
virtual int enhanceValue(double);
/** \brief A customicable method to indicate if the pixels is displayable */
virtual bool isValueInDisplayableRange(double);
protected:
/** \brief User defineable maximum value for the band, used for stretching */
double mMaximumValue;
/** \brief User defineable minimum value for the band, used for stretching */
double mMinimumValue;
/** \brief Minimum maximum range for the band, used for stretching */
double mMinimumMaximumRange;
/** \brief Data type of the band */
QgsContrastEnhancement::QgsRasterDataType mQgsRasterDataType;
};
#endif
/* **************************************************************************
qgscontrastenhancementfunction.h - description
-------------------
begin : Fri Nov 16 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSCONTRASTENHANCEMENTFUNCTION_H
#define QGSCONTRASTENHANCEMENTFUNCTION_H
#include "qgscontrastenhancement.h"
class CORE_EXPORT QgsContrastEnhancementFunction
{
public:
QgsContrastEnhancementFunction(QgsContrastEnhancement::QgsRasterDataType, double, double);
virtual ~QgsContrastEnhancementFunction() {}
/** \brief Mustator for the maximum value */
void setMaximumValue(double);
/** \brief Mutator for the minimum value */
void setMinimumValue(double);
/** \brief A customizable method that takes in a double and returns a int between 0 and 255 */
virtual int enhanceValue(double);
/** \brief A customicable method to indicate if the pixels is displayable */
virtual bool isValueInDisplayableRange(double);
protected:
/** \brief User defineable maximum value for the band, used for stretching */
double mMaximumValue;
/** \brief User defineable minimum value for the band, used for stretching */
double mMinimumValue;
/** \brief Minimum maximum range for the band, used for stretching */
double mMinimumMaximumRange;
/** \brief Data type of the band */
QgsContrastEnhancement::QgsRasterDataType mQgsRasterDataType;
};
#endif

View File

@ -47,107 +47,3 @@ private:
};
#endif
/* **************************************************************************
qgsfreakoutshader.h - description
-------------------
begin : Fri Dec 28 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
This class contains code that was originally part of the larger QgsRasterLayer
class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSFREAKOUTSHADER_H
#define QGSFREAKOUTSHADER_H
#include "qgsrastershaderfunction.h"
class CORE_EXPORT QgsFreakOutShader : public QgsRasterShaderFunction {
public:
QgsFreakOutShader(double theMinimumValue=0.0, double theMaximumValue=255.0);
bool generateShadedValue(double, int*, int*, int*);
bool generateShadedValue(double, double, double, int*, int*, int*);
/** \brief Set the maximum value */
void setMaximumValue(double);
/** \brief Return the minimum value */
void setMinimumValue(double);
private:
void setClassBreaks();
double mBreakSize;
double mClassBreakMin1;
double mClassBreakMax1;
double mClassBreakMin2;
double mClassBreakMax2;
double mClassBreakMin3;
};
#endif
/* **************************************************************************
qgsfreakoutshader.h - description
-------------------
begin : Fri Dec 28 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
This class contains code that was originally part of the larger QgsRasterLayer
class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSFREAKOUTSHADER_H
#define QGSFREAKOUTSHADER_H
#include "qgsrastershaderfunction.h"
class CORE_EXPORT QgsFreakOutShader : public QgsRasterShaderFunction {
public:
QgsFreakOutShader(double theMinimumValue=0.0, double theMaximumValue=255.0);
bool generateShadedValue(double, int*, int*, int*);
bool generateShadedValue(double, double, double, int*, int*, int*);
/** \brief Set the maximum value */
void setMaximumValue(double);
/** \brief Return the minimum value */
void setMinimumValue(double);
private:
void setClassBreaks();
double mBreakSize;
double mClassBreakMin1;
double mClassBreakMax1;
double mClassBreakMin2;
double mClassBreakMax2;
double mClassBreakMin3;
};
#endif

View File

@ -31,69 +31,3 @@ class CORE_EXPORT QgsLinearMinMaxEnhancement : public QgsContrastEnhancementFunc
};
#endif
/* **************************************************************************
qgslinearminmaxenhancement.h - description
-------------------
begin : Fri Nov 16 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSLINEARMINMAXENHANCEMENT_H
#define QGSLINEARMINMAXENHANCEMENT_H
#include "qgscontrastenhancementfunction.h"
class CORE_EXPORT QgsLinearMinMaxEnhancement : public QgsContrastEnhancementFunction
{
public:
QgsLinearMinMaxEnhancement(QgsContrastEnhancement::QgsRasterDataType, double, double);
int enhanceValue(double);
};
#endif
/* **************************************************************************
qgslinearminmaxenhancement.h - description
-------------------
begin : Fri Nov 16 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSLINEARMINMAXENHANCEMENT_H
#define QGSLINEARMINMAXENHANCEMENT_H
#include "qgscontrastenhancementfunction.h"
class CORE_EXPORT QgsLinearMinMaxEnhancement : public QgsContrastEnhancementFunction
{
public:
QgsLinearMinMaxEnhancement(QgsContrastEnhancement::QgsRasterDataType, double, double);
int enhanceValue(double);
};
#endif

View File

@ -31,69 +31,3 @@ class CORE_EXPORT QgsLinearMinMaxEnhancementWithClip : public QgsContrastEnhance
};
#endif
/* **************************************************************************
qgslinearminmaxenhancementwithclip.h - description
-------------------
begin : Fri Nov 16 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSLINEARMINMAXENHANCEMENTWITHCLIP_H
#define QGSLINEARMINMAXENHANCEMENTWITHCLIP_H
#include "qgscontrastenhancementfunction.h"
class CORE_EXPORT QgsLinearMinMaxEnhancementWithClip : public QgsContrastEnhancementFunction
{
public:
QgsLinearMinMaxEnhancementWithClip(QgsContrastEnhancement::QgsRasterDataType, double, double);
int enhanceValue(double);
bool isValueInDisplayableRange(double);
};
#endif
/* **************************************************************************
qgslinearminmaxenhancementwithclip.h - description
-------------------
begin : Fri Nov 16 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSLINEARMINMAXENHANCEMENTWITHCLIP_H
#define QGSLINEARMINMAXENHANCEMENTWITHCLIP_H
#include "qgscontrastenhancementfunction.h"
class CORE_EXPORT QgsLinearMinMaxEnhancementWithClip : public QgsContrastEnhancementFunction
{
public:
QgsLinearMinMaxEnhancementWithClip(QgsContrastEnhancement::QgsRasterDataType, double, double);
int enhanceValue(double);
bool isValueInDisplayableRange(double);
};
#endif

View File

@ -45,109 +45,4 @@ private:
double mClassBreakMax2;
double mClassBreakMin3;
};
#endif
/* **************************************************************************
qgspseudocolorshader.h - description
-------------------
begin : Fri Dec 28 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
This class contains code that was originally part of the larger QgsRasterLayer
class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSPSEUDOCOLORSHADER_H
#define QGSPSEUDOCOLORSHADER_H
#include "qgsrastershaderfunction.h"
class CORE_EXPORT QgsPseudoColorShader : public QgsRasterShaderFunction {
public:
QgsPseudoColorShader(double theMinimumValue=0.0, double theMaximumValue=255.0);
bool generateShadedValue(double, int*, int*, int*);
bool generateShadedValue(double, double, double, int*, int*, int*);
/** \brief Set the maximum value */
void setMaximumValue(double);
/** \brief Return the minimum value */
void setMinimumValue(double);
private:
void setClassBreaks();
double mBreakSize;
double mClassBreakMin1;
double mClassBreakMax1;
double mClassBreakMin2;
double mClassBreakMax2;
double mClassBreakMin3;
};
#endif
/* **************************************************************************
qgspseudocolorshader.h - description
-------------------
begin : Fri Dec 28 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
This class contains code that was originally part of the larger QgsRasterLayer
class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSPSEUDOCOLORSHADER_H
#define QGSPSEUDOCOLORSHADER_H
#include "qgsrastershaderfunction.h"
class CORE_EXPORT QgsPseudoColorShader : public QgsRasterShaderFunction {
public:
QgsPseudoColorShader(double theMinimumValue=0.0, double theMaximumValue=255.0);
bool generateShadedValue(double, int*, int*, int*);
bool generateShadedValue(double, double, double, int*, int*, int*);
/** \brief Set the maximum value */
void setMaximumValue(double);
/** \brief Return the minimum value */
void setMinimumValue(double);
private:
void setClassBreaks();
double mBreakSize;
double mClassBreakMin1;
double mClassBreakMax1;
double mClassBreakMin2;
double mClassBreakMax2;
double mClassBreakMin3;
};
#endif

View File

@ -393,6 +393,11 @@ QgsRasterLayer::QgsRasterLayer(
mStandardDeviations(0),
mDataProvider(0)
{
mUserDefinedRGBMinMaxFlag = false; //defaults needed to bypass stretch
mUserDefinedGrayMinMaxFlag = false;
mRasterShader = new QgsRasterShader();
if ( loadDefaultStyleFlag )
{
bool defaultLoadedFlag = false;
@ -402,10 +407,6 @@ QgsRasterLayer::QgsRasterLayer(
return;
}
}
mUserDefinedRGBMinMaxFlag = false; //defaults needed to bypass stretch
mUserDefinedGrayMinMaxFlag = false;
mRasterShader = new QgsRasterShader();
// Initialise the affine transform matrix
mGeoTransform[0] = 0;

View File

@ -17,100 +17,6 @@ email : ersts@amnh.org
***************************************************************************/
#ifndef QGSRASTERSHADERFUNCTION_H
#define QGSRASTERSHADERFUNCTION_H
class CORE_EXPORT QgsRasterShaderFunction {
public:
QgsRasterShaderFunction(double theMinimumValue=0.0, double theMaximumValue=255.0);
virtual ~QgsRasterShaderFunction() {}
/** \brief generates and new RGB value based on one input value */
virtual bool generateShadedValue(double, int*, int*, int*);
/** \brief generates and new RGB value based on original RGB value */
virtual bool generateShadedValue(double, double, double, int*, int*, int*);
/** \brief Set the maximum value */
virtual void setMaximumValue(double);
/** \brief Return the minimum value */
virtual void setMinimumValue(double);
protected:
/** \brief User defineable maximum value for the shading function */
double mMaximumValue;
/** \brief User defineable minimum value for the shading function */
double mMinimumValue;
/** \brief Minimum maximum range for the shading function */
double mMinimumMaximumRange;
};
#endif
/* **************************************************************************
qgsrastershaderfunction.h - description
-------------------
begin : Fri Dec 28 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSRASTERSHADERFUNCTION_H
#define QGSRASTERSHADERFUNCTION_H
class CORE_EXPORT QgsRasterShaderFunction {
public:
QgsRasterShaderFunction(double theMinimumValue=0.0, double theMaximumValue=255.0);
virtual ~QgsRasterShaderFunction() {}
/** \brief generates and new RGB value based on one input value */
virtual bool generateShadedValue(double, int*, int*, int*);
/** \brief generates and new RGB value based on original RGB value */
virtual bool generateShadedValue(double, double, double, int*, int*, int*);
/** \brief Set the maximum value */
virtual void setMaximumValue(double);
/** \brief Return the minimum value */
virtual void setMinimumValue(double);
protected:
/** \brief User defineable maximum value for the shading function */
double mMaximumValue;
/** \brief User defineable minimum value for the shading function */
double mMinimumValue;
/** \brief Minimum maximum range for the shading function */
double mMinimumMaximumRange;
};
#endif
/* **************************************************************************
qgsrastershaderfunction.h - description
-------------------
begin : Fri Dec 28 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSRASTERSHADERFUNCTION_H
#define QGSRASTERSHADERFUNCTION_H

View File

@ -75,157 +75,3 @@ class CORE_EXPORT QgsRasterTransparency
};
#endif
/* **************************************************************************
qgsrastertransparency.h - description
-------------------
begin : Mon Nov 30 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSRASTERTRANSPARENCY_H
#define QGSRASTERTRANSPARENCY_H
class CORE_EXPORT QgsRasterTransparency
{
public:
QgsRasterTransparency();
//
// Structs to hold transparent pixel vlaues
//
struct TransparentThreeValuePixel
{
double red;
double green;
double blue;
double percentTransparent;
};
struct TransparentSingleValuePixel
{
double pixelValue;
double percentTransparent;
};
//
// Initializer, Accessor and mutator for transparency tables.
//
/** \brief Mutator for transparentSingleValuePixelList */
QList<QgsRasterTransparency::TransparentSingleValuePixel> getTransparentSingleValuePixelList();
/** \brief Mutator for transparentThreeValuePixelList */
QList<QgsRasterTransparency::TransparentThreeValuePixel> getTransparentThreeValuePixelList();
/** \brief Reset to the transparency list to a single value */
void initializeTransparentPixelList(double);
/** \brief Reset to the transparency list to a single value */
void initializeTransparentPixelList(double, double, double);
/** \brief Accessor for transparentSingleValuePixelList */
void setTransparentSingleValuePixelList(QList<QgsRasterTransparency::TransparentSingleValuePixel>);
/** \brief Accessor for transparentThreeValuePixelList */
void setTransparentThreeValuePixelList(QList<QgsRasterTransparency::TransparentThreeValuePixel>);
/** \brief Returns the transparency value for a single value Pixel */
int getAlphaValue(double, int theGlobalTransparency=255);
/** \brief Return the transparency value for a RGB Pixel */
int getAlphaValue(double, double, double, int theGlobalTransparency=255);
private:
/** \brief The list to hold transparency values for RGB layers */
QList<QgsRasterTransparency::TransparentThreeValuePixel> mTransparentThreeValuePixelList;
/** \brief The lsit to hold transparency values for single value pixel layers */
QList<QgsRasterTransparency::TransparentSingleValuePixel> mTransparentSingleValuePixelList;
};
#endif
/* **************************************************************************
qgsrastertransparency.h - description
-------------------
begin : Mon Nov 30 2007
copyright : (C) 2007 by Peter J. Ersts
email : ersts@amnh.org
****************************************************************************/
/* **************************************************************************
* *
* 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 QGSRASTERTRANSPARENCY_H
#define QGSRASTERTRANSPARENCY_H
class CORE_EXPORT QgsRasterTransparency
{
public:
QgsRasterTransparency();
//
// Structs to hold transparent pixel vlaues
//
struct TransparentThreeValuePixel
{
double red;
double green;
double blue;
double percentTransparent;
};
struct TransparentSingleValuePixel
{
double pixelValue;
double percentTransparent;
};
//
// Initializer, Accessor and mutator for transparency tables.
//
/** \brief Mutator for transparentSingleValuePixelList */
QList<QgsRasterTransparency::TransparentSingleValuePixel> getTransparentSingleValuePixelList();
/** \brief Mutator for transparentThreeValuePixelList */
QList<QgsRasterTransparency::TransparentThreeValuePixel> getTransparentThreeValuePixelList();
/** \brief Reset to the transparency list to a single value */
void initializeTransparentPixelList(double);
/** \brief Reset to the transparency list to a single value */
void initializeTransparentPixelList(double, double, double);
/** \brief Accessor for transparentSingleValuePixelList */
void setTransparentSingleValuePixelList(QList<QgsRasterTransparency::TransparentSingleValuePixel>);
/** \brief Accessor for transparentThreeValuePixelList */
void setTransparentThreeValuePixelList(QList<QgsRasterTransparency::TransparentThreeValuePixel>);
/** \brief Returns the transparency value for a single value Pixel */
int getAlphaValue(double, int theGlobalTransparency=255);
/** \brief Return the transparency value for a RGB Pixel */
int getAlphaValue(double, double, double, int theGlobalTransparency=255);
private:
/** \brief The list to hold transparency values for RGB layers */
QList<QgsRasterTransparency::TransparentThreeValuePixel> mTransparentThreeValuePixelList;
/** \brief The lsit to hold transparency values for single value pixel layers */
QList<QgsRasterTransparency::TransparentSingleValuePixel> mTransparentSingleValuePixelList;
};
#endif