This file is indexed.

/usr/include/qgis/qgscontrastenhancement.h is in libqgis-dev 1.7.4+1.7.5~20120320-1.1+b1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* **************************************************************************
                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;

/** \ingroup core
 * Manipulates raster pixel values so that they enhanceContrast or clip into a
 * specified numerical range according to the specified
 * ContrastEnhancementAlgorithm.
 */
class CORE_EXPORT QgsContrastEnhancement
{

  public:

    /** \brief This enumerator describes the types of contrast enhancement algorithms that can be used.  */
    enum ContrastEnhancementAlgorithm
    {
      NoEnhancement,                  //this should be the default color scaling algorithm
      StretchToMinimumMaximum,        //linear histogram enhanceContrast
      StretchAndClipToMinimumMaximum,
      ClipToMinimumMaximum,
      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();

    /*
     *
     * Static methods
     *
     */
    /** \brief Helper function that returns the maximum possible value for a GDAL data type */
    static double maximumValuePossible( QgsRasterDataType );

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

    /*
     *
     * Non-Static Inline methods
     *
     */
    /** \brief Return the maximum value for the contrast enhancement range. */
    double maximumValue() const { return mMaximumValue; }

    /** \brief Return the minimum value for the contrast enhancement range. */
    double minimumValue() const { return mMinimumValue; }

    ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() { return mContrastEnhancementAlgorithm; }

    /*
     *
     * Non-Static methods
     *
     */
    /** \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 enhanceContrast( double );

    /** \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( ContrastEnhancementAlgorithm, 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 );

  private:
    /** \brief Current contrast enhancement algorithm */
    ContrastEnhancementAlgorithm mContrastEnhancementAlgorithm;

    /** \brief Pointer to the contrast enhancement function */
    QgsContrastEnhancementFunction* mContrastEnhancementFunction;

    /** \brief Flag indicating if the lookup table needs to be regenerated */
    bool mEnhancementDirty;

    /** \brief Scalar so that values can be used as array indicies */
    double mLookupTableOffset;

    /** \brief Pointer to the lookup table */
    int *mLookupTable;

    /** \brief User defineable minimum value for the band, used for enhanceContrasting */
    double mMinimumValue;

    /** \brief user defineable maximum value for the band, used for enhanceContrasting */
    double mMaximumValue;

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

    /** \brief Maximum range of values for a given data type */
    double mRasterDataTypeRange;



    /** \brief Method to generate a new lookup table */
    bool generateLookupTable();

    /** \brief Method to calculate the actual enhanceContrasted value(s) */
    int calculateContrastEnhancementValue( double );
};

#endif