~ubuntu-branches/ubuntu/wily/qgis/wily

« back to all changes in this revision

Viewing changes to src/raster/qgsrasterlayer.h

  • Committer: Bazaar Package Importer
  • Author(s): Johan Van de Wauw
  • Date: 2010-07-11 20:23:24 UTC
  • mfrom: (3.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100711202324-5ktghxa7hracohmr
Tags: 1.4.0+12730-3ubuntu1
* Merge from Debian unstable (LP: #540941).
* Fix compilation issues with QT 4.7
* Add build-depends on libqt4-webkit-dev 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
                        qgsrasterlayer.h  -  description
3
 
                              -------------------
4
 
        begin                : Fri Jun 28 2002
5
 
        copyright            : (C) 2004 by T.Sutton, Gary E.Sherman, Steve Halasz
6
 
        email                : tim@linfiniti.com
7
 
***************************************************************************/
8
 
 
9
 
/***************************************************************************
10
 
 *                                                                         *
11
 
 *   This program is free software; you can redistribute it and/or modify  *
12
 
 *   it under the terms of the GNU General Public License as published by  *
13
 
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 
 *   (at your option) any later version.                                   *
15
 
 *                                                                         *
16
 
 ***************************************************************************/
17
 
/* $Id: qgsrasterlayer.h 6393 2007-01-04 08:13:13Z g_j_m $ */
18
 
 
19
 
/** \file qgsrasterlayer.h
20
 
 *  \brief This class provides qgis with the ability to render raster datasets
21
 
 *  onto the mapcanvas
22
 
 *
23
 
 *  The qgsrasterlayer class makes use of gdal for data io, and thus supports
24
 
 *  any gdal supported format. The constructor attemtps to infer what type of
25
 
 *  file (RASTER_LAYER_TYPE) is being opened - not in terms of the file format (tif, ascii grid etc.)
26
 
 *  but rather in terms of whether the image is a GRAYSCALE, PALETTED or MULTIBAND,
27
 
 *
28
 
 *  Within the three allowable raster layer types, there are 8 permutations of 
29
 
 *  how a layer can actually be rendered. These are defined in the DRAWING_STYLE enum
30
 
 *  and consist of:
31
 
 *
32
 
 *  SINGLE_BAND_GRAY -> a GRAYSCALE layer drawn as a range of gray colors (0-255)
33
 
 *  SINGLE_BAND_PSEUDO_COLOR -> a GRAYSCALE layer drawn using a pseudocolor algorithm
34
 
 *  PALETTED_SINGLE_BAND_GRAY -> a PALLETED layer drawn in gray scale (using only one of the color components)
35
 
 *  PALETTED_SINGLE_BAND_PSEUDO_COLOR -> a PALLETED layer having only one of its color components rendered as psuedo color
36
 
 *  PALETTED_MULTI_BAND_COLOR -> a PALLETED image where the bands contains 24bit color info and 8 bits is pulled out per color
37
 
 *  MULTI_BAND_SINGLE_BAND_GRAY -> a layer containing 2 or more bands, but using only one band to produce a grayscale image
38
 
 *  MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR -> a layer containing 2 or more bands, but using only one band to produce a pseudocolor image
39
 
 *  MULTI_BAND_COLOR -> a layer containing 2 or more bands, mapped to the three RGBcolors. In the case of a multiband with only two bands, one band will have to be mapped to more than one color
40
 
 *
41
 
 *  Each of the above mentioned drawing styles is implemented in its own draw* function.
42
 
 *  Some of the drawing styles listed above require statistics about the layer such 
43
 
 *  as the min / max / mean / stddev etc. Statics for a band can be gathered using the 
44
 
 *  getRasterBandStats function. Note that statistics gathering is a slow process and 
45
 
 *  evey effort should be made to call this function as few times as possible. For this
46
 
 *  reason, qgsraster has a vector class member to store stats for each band. The 
47
 
 *  constructor initialises this vector on startup, but only populates the band name and
48
 
 *  number fields.
49
 
 *  
50
 
 *  Note that where bands are of gdal 'undefined' type, their values may exceed the 
51
 
 *  renderable range of 0-255. Because of this a linear scaling histogram stretch is
52
 
 *  applied to undefined layers to normalise the data into the 0-255 range.
53
 
 *
54
 
 *  A qgsrasterlayer band can be referred to either by name or by number (base=1). It
55
 
 *  should be noted that band names as stored in datafiles may not be uniqe, and 
56
 
 *  so the rasterlayer class appends the band number in brackets behind each band name.
57
 
 *  
58
 
 *  Sample useage of the QgsRasterLayer class:
59
 
 *
60
 
 *     QString myFileNameQString = "/path/to/file";
61
 
 *     QFileInfo myFileInfo(myFileNameQString);
62
 
 *     QString myBaseNameQString = myFileInfo.baseName();
63
 
 *     QgsRasterLayer *myRasterLayer = new QgsRasterLayer(myFileNameQString, myBaseNameQString);
64
 
 *     myRasterLayer->initContextMenu(this); //prepare the right click pop up menu
65
 
 *
66
 
 *  In order to automate redrawing of a raster layer, you should like it to a map canvas like this :
67
 
 *  
68
 
 *     QObject::connect( myRasterLayer, SIGNAL(repaintRequested()), mapCanvas, SLOT(refresh()) );
69
 
 *
70
 
 *  A raster layer can also export its legend as a pixmap:
71
 
 *
72
 
 *     QPixmap myQPixmap = myRasterLayer->legendPixmap();
73
 
 *
74
 
 * Once a layer has been created you can find out what type of layer it is (GRAY_OR_UNDEFINED, PALETTE or MULTIBAND):
75
 
 *
76
 
 *    if (rasterLayer->getRasterLayerType()==QgsRasterLayer::MULTIBAND)
77
 
 *    {
78
 
 *      //do something
79
 
 *    }
80
 
 *    else if (rasterLayer->getRasterLayerType()==QgsRasterLayer::PALETTE)
81
 
 *    {
82
 
 *      //do something
83
 
 *    }
84
 
 *    else // QgsRasterLayer::GRAY_OR_UNDEFINED
85
 
 *    {
86
 
 *      //do something.
87
 
 *    }
88
 
 *
89
 
 * You can combine layer type detection with the setDrawingStyle method to override the default drawing style assigned
90
 
 * when a layer is loaded.:
91
 
 *
92
 
 *    if (rasterLayer->getRasterLayerType()==QgsRasterLayer::MULTIBAND)
93
 
 *    {
94
 
 *       myRasterLayer->setDrawingStyle(QgsRasterLayer::MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR);
95
 
 *    }
96
 
 *    else if (rasterLayer->getRasterLayerType()==QgsRasterLayer::PALETTE)
97
 
 *    {
98
 
 *      myRasterLayer->setDrawingStyle(QgsRasterLayer::PALETTED_SINGLE_BAND_PSEUDO_COLOR);
99
 
 *    }
100
 
 *    else // QgsRasterLayer::GRAY_OR_UNDEFINED
101
 
 *    {
102
 
 *      myRasterLayer->setDrawingStyle(QgsRasterLayer::SINGLE_BAND_PSEUDO_COLOR);
103
 
 *    }
104
 
 * 
105
 
 *  Raster layers can also have an aribitary level of transparency defined, and have their
106
 
 *  colour palettes inverted using the setTransparency and setInvertHistogramFlag methods. 
107
 
 * 
108
 
 *  Pseudocolour images can have their output adjusted to a given number of standard
109
 
 *  deviations using the setStdDevsToPlot method.
110
 
 * 
111
 
 *  The final area of functionality you may be interested in is band mapping. Band mapping
112
 
 *  allows you to choose arbitary band -> colour mappings and is applicable only to PALETTE
113
 
 *  and MULTIBAND rasters, There are four mappings that can be made : red, green, blue and gray.
114
 
 *  Mappings are non exclusive. That is a given band can be assigned to no, some or all 
115
 
 *  colour mappings. The constructor sets sensible defaults for band mappings but these can be
116
 
 *  overridden at run time using the setRedBandName,setGreenBandName,setBlueBandName and setGrayBandName 
117
 
 *  methods.
118
 
 */
119
 
 
120
 
/*
121
 
 * 
122
 
 * PROGRAMMERS NOTES:
123
 
 * 
124
 
 * 
125
 
 Please observe the following variable naming guidelines when editing this class:
126
 
----------------
127
 
In my opinion, clarity of code is more important than brevity, so variables should be given clear, 
128
 
unambiguous names. Variables names should be written in mixed case, with a lowercase first letter. 
129
 
Each variable name should include a scope resolution indicator and a type indicator, in the form:
130
 
 
131
 
[scope]+[name]+[type]
132
 
 
133
 
Where scope resolution indicators are:
134
 
 
135
 
- global vars and class members : [none]
136
 
- variables passed as parameters to a function/method: the
137
 
- variables declared locally in a method or function: my
138
 
 
139
 
For example:
140
 
 
141
 
class FooClass {
142
 
  int fooInt;  //class var has no prefix
143
 
 
144
 
  public void FooClass::fooMethod (int theBarInt)  //function parameter prefixed by 'the'
145
 
  {
146
 
    fooInt=1;
147
 
    int myLocalInt=0; //function members prefixed by 'my'
148
 
    myLocalInt=fooInt+theBarInt;
149
 
  }
150
 
}
151
 
 
152
 
Using this scope resolution naming scheme makes the origin of each variable unambiguous and the 
153
 
code easy to read (especially by people who did not write it!).
154
 
 
155
 
The [name] part of the variable should be short and descriptive, usually a noun.
156
 
 
157
 
The [type] part of the variable should be the type class of the variable written out in full.
158
 
 
159
 
*/ 
160
 
 
161
 
 
162
 
#ifndef QGSRASTERLAYER_H
163
 
#define QGSRASTERLAYER_H
164
 
 
165
 
//
166
 
// Includes
167
 
// 
168
 
 
169
 
#include <QDateTime>
170
 
#include <QVector>
171
 
#include <QList>
172
 
 
173
 
#include "qgspoint.h"
174
 
#include "qgsmaplayer.h"
175
 
#include "qgscolortable.h"
176
 
#include "qgsrasterlayer.h"
177
 
#include "qgsrasterbandstats.h"
178
 
#include "qgsrasterpyramid.h"
179
 
 
180
 
/*
181
 
 * 
182
 
 * New includes that will convert this class to a data provider interface
183
 
 * (B Morley)
184
 
 *
185
 
 */ 
186
 
 
187
 
#include "qgsrasterdataprovider.h"
188
 
 
189
 
/*
190
 
 * END
191
 
 */
192
 
 
193
 
 
194
 
#include <gdal_priv.h>
195
 
//
196
 
// Forward declarations
197
 
//
198
 
class QgsRect;
199
 
class QgsRasterLayerProperties;
200
 
class GDALDataset;
201
 
class GDALRasterBand;
202
 
class QImage;
203
 
class QSlider;
204
 
class QLibrary;
205
 
//
206
 
// Structs
207
 
//
208
 
 
209
 
 
210
 
  
211
 
  
212
 
/*! \class QgsRasterLayer
213
 
 *  \brief This class provides qgis with the ability to render raster datasets
214
 
 *  onto the mapcanvas..
215
 
 */
216
 
 
217
 
class QgsRasterLayer : public QgsMapLayer
218
 
{
219
 
    Q_OBJECT
220
 
public:
221
 
    //
222
 
    // Static methods:
223
 
    //
224
 
        
225
 
    static void buildSupportedRasterFileFilter(QString & fileFilters);
226
 
    static bool isSupportedRasterDriver(QString const &driverName);
227
 
 
228
 
    /** This helper checks to see whether the filename appears to be a valid
229
 
       raster file name */
230
 
    static bool isValidRasterFileName(QString const & theFileNameQString);
231
 
 
232
 
    //
233
 
    // Non Static methods:
234
 
    //
235
 
        
236
 
    /** \brief This is the constructor for the RasterLayer class.
237
 
     *
238
 
     * The main tasks carried out by the constructor are:
239
 
     *
240
 
     * -Populate the RasterStatsVector with initial values for each band.
241
 
     *
242
 
     * -Calculate the layer extents
243
 
     *
244
 
     * -Determine whether the layer is gray, paletted or multiband.
245
 
     *
246
 
     * -Assign sensible defaults for the red,green, blue and gray bands.
247
 
     *
248
 
     * -
249
 
     * */
250
 
    QgsRasterLayer(QString const & path = QString::null, 
251
 
                   QString const &  baseName = QString::null);
252
 
 
253
 
    /** \brief The destuctor.  */
254
 
    ~QgsRasterLayer();
255
 
 
256
 
    /** \brief  A vector containing one RasterBandStats struct per raster band in this raster layer.
257
 
     * Note that while very RasterBandStats element will have the name and number of its associated
258
 
     * band populated, any additional stats are calculated on a need to know basis.*/
259
 
    typedef QVector<QgsRasterBandStats> RasterStatsVector;
260
 
 
261
 
 
262
 
    /** \brief  A list containing one RasterPyramid struct per 
263
 
     * POTENTIAL pyramid layer. How this works is we divide the height
264
 
     * and width of the raster by an incrementing number. As soon as the result
265
 
     * of the division is <=256 we stop allowing RasterPyramid stracuts
266
 
     * to be added to the list. Each time a RasterPyramid is created
267
 
     * we will check to see if a pyramid matching these dimensions already exists
268
 
     * in the raster layer, and if so mark the exists flag as true. */
269
 
      
270
 
    typedef QList<QgsRasterPyramid> RasterPyramidList;
271
 
 
272
 
    /** \brief This typedef is used when the showProgress function is passed to gdal as a function
273
 
    pointer. */
274
 
    //  typedef  int (QgsRasterLayer::*showTextProgress)( double theProgressDouble,
275
 
    //                                      const char *theMessageCharArray,
276
 
    //                                      void *theData);
277
 
 
278
 
    /** \brief Identify raster value(s) found on the point position 
279
 
     *
280
 
     * \param point[in]  a coordinate in the CRS of this layer.
281
 
     */
282
 
    void identify(const QgsPoint& point, std::map<QString,QString>& results);
283
 
 
284
 
    /** \brief Identify arbitrary details from the WMS server found on the point position
285
 
     *
286
 
     * \param point[in]  an image pixel coordinate in the last requested extent of layer.
287
 
     *
288
 
     * \return  A text document containing the return from the WMS server
289
 
     *
290
 
     * \note  The arbitraryness of the returned document is enforced by WMS standards
291
 
     *        up to at least v1.3.0
292
 
     */
293
 
    QString identifyAsText(const QgsPoint& point);
294
 
 
295
 
    /** \brief Query gdal to find out the WKT projection string for this layer. This implements the virtual method of the same name defined in QgsMapLayer*/
296
 
    QString getProjectionWKT();
297
 
 
298
 
    /** \brief Draws a thumbnail of the rasterlayer into the supplied pixmap pointer */
299
 
     void drawThumbnail(QPixmap * theQPixmap);
300
 
 
301
 
    /** \brief Get an 8x8 pixmap of the colour palette. If the layer has no palette a white pixmap will be returned. */
302
 
     QPixmap getPaletteAsPixmap();
303
 
     
304
 
    /** \brief This is called when the view on the rasterlayer needs to be refreshed (redrawn).  
305
 
 
306
 
      \param drawingToEditingCanvas  Are we drawing to an editable canvas?
307
 
                                  currently not used, but retain to be similar to
308
 
                                  the QgsVectorLayer interface
309
 
     */
310
 
    bool draw(QPainter * theQPainter,
311
 
              QgsRect * theViewExtent,
312
 
              QgsMapToPixel * theQgsMapToPixel,
313
 
              bool drawingToEditingCanvas);
314
 
 
315
 
    /** \brief This is an overloaded version of the above function that is called by both draw above and drawThumbnail */
316
 
    void draw(QPainter * theQPainter,
317
 
              QgsRasterViewPort * myRasterViewPort,
318
 
              QgsMapToPixel * theQgsMapToPixel = 0);
319
 
    
320
 
    //
321
 
    // Accessors for image height and width
322
 
    //
323
 
    /** \brief Accessor that returns the width of the (unclipped) raster  */
324
 
    const int getRasterXDim() {return rasterXDimInt;};
325
 
 
326
 
    /** \brief Accessor that returns the height of the (unclipped) raster  */
327
 
    const int getRasterYDim() {return rasterYDimInt;};
328
 
 
329
 
    //
330
 
    // Accessor and mutator for no data double
331
 
    //
332
 
    /** \brief  Accessor that returns the NO_DATA entry for this raster. */
333
 
    const double getNoDataValue() {return noDataValueDouble;}
334
 
 
335
 
    /** \brief  Mutator that allows the  NO_DATA entry for this raster to be overridden. */
336
 
    void setNoDataValue(double theNoDataDouble) { noDataValueDouble=theNoDataDouble; return;};
337
 
 
338
 
    //
339
 
    // Accessor and mutator for invertHistogramFlag
340
 
    //
341
 
    /** \brief Accessor to find out whether the histogram should be inverted.   */
342
 
    bool getInvertHistogramFlag()
343
 
    {
344
 
        return invertHistogramFlag;
345
 
    }
346
 
    /** \brief Mutator to alter the state of the invert histogram flag.  */
347
 
    void setInvertHistogramFlag(bool theFlag)
348
 
    {
349
 
        invertHistogramFlag=theFlag;
350
 
    }
351
 
    //
352
 
    // Accessor and mutator for stdDevsToPlotDouble
353
 
    //
354
 
    /** \brief Accessor to find out how many standard deviations are being plotted.  */
355
 
    double getStdDevsToPlot()
356
 
    {
357
 
        return stdDevsToPlotDouble;
358
 
    };
359
 
    /** \brief Mutator to alter the number of standard deviations that should be plotted.  */
360
 
    void setStdDevsToPlot(double theDouble)
361
 
    {
362
 
        stdDevsToPlotDouble = theDouble;
363
 
    };
364
 
    /** \brief Get the number of bands in this layer  */
365
 
    const unsigned int getBandCount()
366
 
    {
367
 
        return rasterStatsVector.size();
368
 
    };
369
 
    /** \brief Get RasterBandStats for a band given its number (read only)  */
370
 
    const  QgsRasterBandStats getRasterBandStats(int);
371
 
    /** \brief  Check whether a given band number has stats associated with it */
372
 
    const bool hasStats(int theBandNoInt);
373
 
    /** \brief Overloaded method that also returns stats for a band, but uses the band colour name
374
 
    *    Note this approach is not recommeneded because it is possible for two gdal raster
375
 
    *    bands to have the same name!
376
 
    */
377
 
    const  QgsRasterBandStats getRasterBandStats(QString const &);
378
 
    /** \brief Get the number of a band given its name. Note this will be the rewritten name set 
379
 
    *   up in the constructor, and will not necessarily be the same as the name retrieved directly from gdal!
380
 
    *   If no matching band is found zero will be returned! */
381
 
    const  int getRasterBandNumber (QString const & theBandNameQString);
382
 
    /** \brief Get the name of a band given its number.  */
383
 
    const  QString getRasterBandName(int theBandNoInt);
384
 
    /** \brief Find out whether a given band exists.    */
385
 
    bool hasBand(QString const &  theBandName);
386
 
    /** \brief accessor for transparency level.  */
387
 
    unsigned int getTransparency();
388
 
    /** \brief Call any inline image manipulation filters */
389
 
    void filterLayer(QImage * theQImage);
390
 
    /** \brief Accessor for red band name (allows alternate mappings e.g. map blue as red colour). */
391
 
    QString getRedBandName()
392
 
    {
393
 
        return redBandNameQString;
394
 
    };
395
 
    /** \brief Mutator for red band name (allows alternate mappings e.g. map blue as red colour). */
396
 
    void setRedBandName(QString const & theBandNameQString);
397
 
    // 
398
 
    // Accessor and mutator for green band name
399
 
    // 
400
 
    /** \brief Accessor for green band name mapping.  */
401
 
    QString getGreenBandName()
402
 
    {
403
 
        return greenBandNameQString;
404
 
    };
405
 
    /** \brief Mutator for green band name mapping.  */
406
 
    void setGreenBandName(QString const & theBandNameQString);
407
 
    //
408
 
    // Accessor and mutator for blue band name
409
 
    // 
410
 
    /** \brief  Accessor for blue band name mapping. */
411
 
    QString getBlueBandName()
412
 
    {
413
 
        return blueBandNameQString;
414
 
    };
415
 
    /** \brief Mutator for blue band name mapping.  */
416
 
    void setBlueBandName(QString const & theBandNameQString);
417
 
    //
418
 
    // Accessor and mutator for transparent band name
419
 
    // 
420
 
    /** \brief  Accessor for transparent band name mapping. */
421
 
    QString getTransparentBandName()
422
 
    {
423
 
        return transparentBandNameQString;
424
 
    };
425
 
    /** \brief Mutator for transparent band name mapping.  */
426
 
    void setTransparentBandName(QString const & theBandNameQString);
427
 
    //
428
 
    // Accessor and mutator for gray band name
429
 
    //
430
 
    /** \brief Accessor for gray band name mapping.  */
431
 
    QString getGrayBandName()
432
 
    {
433
 
        return grayBandNameQString;
434
 
    };
435
 
    /** \brief Mutator for gray band name mapping.  */
436
 
    void setGrayBandName(QString const & theBandNameQString);
437
 
    // 
438
 
    // Accessor and mutator for showDebugOverlayFlag
439
 
    // 
440
 
    /** \brief Accessor for a flag that determines whether to show some debug info on the image.  */
441
 
    bool getShowDebugOverlayFlag()
442
 
    {
443
 
        return showDebugOverlayFlag;
444
 
    };
445
 
    /** \brief Mutator for a flag that determines whether to show some debug info on the image.  */
446
 
    void setShowDebugOverlayFlag(bool theFlag)
447
 
    {
448
 
        showDebugOverlayFlag=theFlag;
449
 
    };
450
 
    // 
451
 
    // Accessor and mutator for min and max red
452
 
    // 
453
 
    /** \brief Accessor for minimum clipping range for red.
454
 
     *
455
 
     * The clipping range can have different interpretations - it can either be used to perform
456
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
457
 
     * that falls outside the clipping range.*/
458
 
    double getMinRedDouble()
459
 
    {
460
 
        return minRedDouble;
461
 
    };
462
 
    /** \brief Mutator for minimum clipping range for red.
463
 
     *
464
 
     * The clipping range can have different interpretations - it can either be used to perform
465
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
466
 
     * that falls outside the clipping range.*/
467
 
    void setMinRedDouble(double theDouble)
468
 
    {
469
 
        minRedDouble=theDouble;
470
 
    };
471
 
    /** \brief Accessor for maximum clipping range for red.
472
 
     *
473
 
     * The clipping range can have different interpretations - it can either be used to perform
474
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
475
 
     * that falls outside the clipping range.*/
476
 
    double getMaxRedDouble()
477
 
    {
478
 
        return maxRedDouble;
479
 
    };
480
 
    /** \brief Mutator for maximum clipping range for red.
481
 
     *
482
 
     * The clipping range can have different interpretations - it can either be used to perform
483
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
484
 
     * that falls outside the clipping range.*/
485
 
    void setMaxRedDouble(double theDouble)
486
 
    {
487
 
        maxRedDouble=theDouble;
488
 
    };
489
 
    // 
490
 
    // Accessor and mutator for min and max green
491
 
    // 
492
 
    /** \brief Accessor for minimum clipping range for green.
493
 
     *
494
 
     * The clipping range can have different interpretations - it can either be used to perform
495
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
496
 
     * that falls outside the clipping range.*/
497
 
    double getMinGreenDouble()
498
 
    {
499
 
        return minGreenDouble;
500
 
    };
501
 
    /** \brief Mutator for minimum clipping range for green.
502
 
     *
503
 
     * The clipping range can have different interpretations - it can either be used to perform
504
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
505
 
     * that falls outside the clipping range.*/
506
 
    void setMinGreenDouble(double theDouble)
507
 
    {
508
 
        minGreenDouble=theDouble;
509
 
    };
510
 
    /** \brief Accessor for maximum clipping range for green.
511
 
     *
512
 
     * The clipping range can have different interpretations - it can either be used to perform
513
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
514
 
     * that falls outside the clipping range.*/
515
 
    double getMaxGreenDouble()
516
 
    {
517
 
        return maxGreenDouble;
518
 
    };
519
 
    /** \brief Mutator for maximum clipping range for green.
520
 
     *
521
 
     * The clipping range can have different interpretations - it can either be used to perform
522
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
523
 
     * that falls outside the clipping range.*/
524
 
    void setMaxGreenDouble(double theDouble)
525
 
    {
526
 
        maxGreenDouble=theDouble;
527
 
    };
528
 
    // 
529
 
    // Accessor and mutator for min and max blue
530
 
    // 
531
 
    /** \brief Accessor for minimum clipping range for blue.
532
 
     *
533
 
     * The clipping range can have different interpretations - it can either be used to perform
534
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
535
 
     * that falls outside the clipping range.*/
536
 
    /** \brief   */
537
 
    double getMinBlueDouble()
538
 
    {
539
 
        return minBlueDouble;
540
 
    };
541
 
    /** \brief Mutator for minimum clipping range for blue.
542
 
     *
543
 
     * The clipping range can have different interpretations - it can either be used to perform
544
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
545
 
     * that falls outside the clipping range.*/
546
 
    void setMinBlueDouble(double theDouble)
547
 
    {
548
 
        minBlueDouble=theDouble;
549
 
    };
550
 
    /** \brief Accessor for maximum clipping range for blue.
551
 
     *
552
 
     * The clipping range can have different interpretations - it can either be used to perform
553
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
554
 
     * that falls outside the clipping range.*/
555
 
    double getMaxBlueDouble()
556
 
    {
557
 
        return maxBlueDouble;
558
 
    };
559
 
    /** \brief Mutator for maximum clipping range for blue.
560
 
     *
561
 
     * The clipping range can have different interpretations - it can either be used to perform
562
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
563
 
     * that falls outside the clipping range.*/
564
 
    void setMaxBlueDouble(double theDouble)
565
 
    {
566
 
        maxBlueDouble=theDouble;
567
 
    };
568
 
    // 
569
 
    // Accessor and mutator for min and max gray
570
 
    // 
571
 
    /** \brief Accessor for minimum clipping range for gray.
572
 
     *
573
 
     * The clipping range can have different interpretations - it can either be used to perform
574
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
575
 
     * that falls outside the clipping range.*/
576
 
    double getMinGrayDouble()
577
 
    {
578
 
        return minGrayDouble;
579
 
    };
580
 
    /** \brief Mutator for minimum clipping range for gray.
581
 
     *
582
 
     * The clipping range can have different interpretations - it can either be used to perform
583
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
584
 
     * that falls outside the clipping range.*/
585
 
    void setMinGrayDouble(double theDouble)
586
 
    {
587
 
        minGrayDouble=theDouble;
588
 
    };
589
 
    /** \brief Accessor for maximum clipping range for gray.
590
 
     *
591
 
     * The clipping range can have different interpretations - it can either be used to perform
592
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
593
 
     * that falls outside the clipping range.*/
594
 
    double getMaxGrayDouble()
595
 
    {
596
 
        return maxGrayDouble;
597
 
    };
598
 
    /** \brief Mutator for maximum clipping range for gray.
599
 
     *
600
 
     * The clipping range can have different interpretations - it can either be used to perform
601
 
     * a histogram stretch between the minimum and maximum clipping values, or to exclude data
602
 
     * that falls outside the clipping range.*/
603
 
    void setMaxGrayDouble(double theDouble)
604
 
    {
605
 
        maxGrayDouble=theDouble;
606
 
    };
607
 
    //
608
 
    /** \brief This enumerator describes the types of histogram scaling algorithms that can be used.  */
609
 
    enum COLOR_SCALING_ALGORITHM
610
 
    {
611
 
        STRETCH_TO_MINMAX, //linear histogram stretch
612
 
        STRETCH_AND_CLIP_TO_MINMAX,
613
 
        CLIP_TO_MINMAX
614
 
    } colorScalingAlgorithm;
615
 
    //
616
 
    // Accessor and mutator for the color scaling algorithm
617
 
    //
618
 
    /** \brief Accessor for colour scaling algorithm. */
619
 
    COLOR_SCALING_ALGORITHM getColorScalingAlgorithm()
620
 
    {
621
 
        return colorScalingAlgorithm;
622
 
    };
623
 
    /** \brief Mutator for color scaling algorithm. */
624
 
    void setColorScalingAlgorithm(COLOR_SCALING_ALGORITHM theAlgorithm)
625
 
    {
626
 
        colorScalingAlgorithm=theAlgorithm;
627
 
    };
628
 
    
629
 
    /** \brief This enumerator describes the types of histogram colour ramping that can be used.  */
630
 
    enum COLOR_RAMPING_TYPE
631
 
    {
632
 
        BLUE_GREEN_RED, 
633
 
        FREAK_OUT //it will scare your granny!
634
 
    } colorRampingType;
635
 
    //
636
 
    // Accessor and mutator for the color ramping type
637
 
    //
638
 
    /** \brief Accessor for colour ramping type. */
639
 
    COLOR_RAMPING_TYPE getColorRampingType()
640
 
    {
641
 
        return colorRampingType;
642
 
    };
643
 
    /** \brief Mutator for color scaling algorithm. */
644
 
    void setColorRampingType(COLOR_RAMPING_TYPE theRamping)
645
 
    {
646
 
        colorRampingType=theRamping;
647
 
    };
648
 
    
649
 
    /** \brief This enumerator describes the different kinds of drawing we can do.  */
650
 
    enum DRAWING_STYLE
651
 
    {
652
 
        SINGLE_BAND_GRAY, // a "Gray" or "Undefined" layer drawn as a range of gray colors
653
 
        SINGLE_BAND_PSEUDO_COLOR,// a "Gray" or "Undefined" layer drawn using a pseudocolor algorithm
654
 
        PALETTED_COLOR, //a "Palette" image drawn using color table
655
 
        PALETTED_SINGLE_BAND_GRAY,// a "Palette" layer drawn in gray scale (using only one of the color components)
656
 
        PALETTED_SINGLE_BAND_PSEUDO_COLOR, // a "Palette" layer having only one of its color components rendered as psuedo color
657
 
        PALETTED_MULTI_BAND_COLOR, // a "Palette" image is decomposed to 3 channels (RGB) and drawn 
658
 
                                   // as multiband 
659
 
        MULTI_BAND_SINGLE_BAND_GRAY, // a layer containing 2 or more bands, but using only one band to produce a grayscale image
660
 
        MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR, //a layer containing 2 or more bands, but using only one band to produce a pseudocolor image
661
 
        MULTI_BAND_COLOR //a layer containing 2 or more bands, mapped to the three RGBcolors. In the case of a multiband with only two bands, one band will have to be mapped to more than one color
662
 
    } drawingStyle;    
663
 
    //
664
 
    // Accessor and mutator for drawing style.
665
 
    //
666
 
    /** \brief Accessor for drawing style.  */
667
 
    DRAWING_STYLE getDrawingStyle() {return drawingStyle;};
668
 
    /** \brief Returns a string representation of drawing style.
669
 
     *
670
 
     * Implementaed mainly for serialisation / deserialisation of settings to xml.
671
 
     * NOTE: May be deprecated in the future!. Use alternate implementation above rather.
672
 
     * */
673
 
    QString getDrawingStyleAsQString();
674
 
    /** \brief Mutator for drawing style.  */
675
 
    void setDrawingStyle(DRAWING_STYLE const &  theDrawingStyle) {drawingStyle=theDrawingStyle;};
676
 
    /** \brief Overloaded version of the above function for convenience when restoring from xml.
677
 
     *
678
 
     * Implementaed mainly for serialisation / deserialisation of settings to xml.
679
 
     * NOTE: May be deprecated in the future! Use alternate implementation above rather.
680
 
     * */
681
 
    void setDrawingStyle(QString  const & theDrawingStyleQString);
682
 
 
683
 
 
684
 
 
685
 
 
686
 
    /** \brief This enumerator describes the type of raster layer.  */
687
 
    enum RASTER_LAYER_TYPE
688
 
    {
689
 
        GRAY_OR_UNDEFINED,
690
 
        PALETTE,
691
 
        MULTIBAND    
692
 
    } rasterLayerType;
693
 
    //
694
 
    //accessor and for raster layer type (READ ONLY)
695
 
    //
696
 
    /** \brief  Accessor for raster layer type (which is a read only property) */
697
 
    RASTER_LAYER_TYPE getRasterLayerType() { return rasterLayerType; };
698
 
    /** \brief Accessor for hasPyramidsFlag (READ ONLY) */
699
 
    bool getHasPyramidsFlag() {return hasPyramidsFlag;};
700
 
     
701
 
    /** \brief Get a legend image for this layer.  */
702
 
    QPixmap getLegendQPixmap();
703
 
    /** \brief  Overloaded version of above function that can print layer name onto legend. */
704
 
    QPixmap getLegendQPixmap(bool); 
705
 
    
706
 
    /** \brief Use this method when you want an annotated legend suitable for print output etc. 
707
 
     * @param int theLabelCountInt Number of vertical labels to display (defaults to 3)
708
 
     * */
709
 
    QPixmap getDetailedLegendQPixmap(int theLabelCount);
710
 
    
711
 
    /**
712
 
     * Returns the sublayers of this layer
713
 
     *
714
 
     * (Useful for providers that manage their own layers, such as WMS)
715
 
     *
716
 
     */
717
 
    QStringList subLayers() const;
718
 
    
719
 
    /**
720
 
     * Reorders the *previously selected* sublayers of this layer from bottom to top
721
 
     *
722
 
     * (Useful for providers that manage their own layers, such as WMS)
723
 
     *
724
 
     */
725
 
    virtual void setLayerOrder(QStringList const & layers);
726
 
    
727
 
    /**
728
 
     * Set the visibility of the given sublayer name
729
 
     */
730
 
    virtual void setSubLayerVisibility(QString const & name, bool vis);
731
 
 
732
 
    /** tailor the right-click context menu with raster layer only stuff 
733
 
 
734
 
      @note called by QgsMapLayer::initContextMenu();
735
 
     */
736
 
    void initContextMenu_(QgisApp *);
737
 
 
738
 
    /** \brief Emit a signal asking for a repaint. (inherited from maplayer) */
739
 
    void triggerRepaint();
740
 
    /** \brief Obtain GDAL Metadata for this layer */
741
 
    QString getMetadata(); 
742
 
    /** \brief Accessor for ths raster layers pyramid list. A pyramid list defines the 
743
 
     * POTENTIAL pyramids that can be in a raster. To know which of the pyramid layers 
744
 
     * ACTUALLY exists you need to look at the existsFlag member in each struct stored in the 
745
 
     * list.*/
746
 
    RasterPyramidList buildRasterPyramidList();
747
 
    /** \brief Helper method to retrieve the nth pyramid layer struct from the PyramidList. 
748
 
     * If the nth layer does not exist, NULL will be returned. */
749
 
//   RasterPyramid getRasterPyramid(int thePyramidNo);
750
 
 
751
 
    /**Currently returns always false*/
752
 
    bool isEditable() const;
753
 
    
754
 
    /** Return time stamp for given file name */
755
 
    static QDateTime lastModified ( QString const &  name );
756
 
 
757
 
    /**Returns the path to an icon which characterises the type of layer*/
758
 
    QString layerTypeIconPath();
759
 
 
760
 
    /**Refresh the symbology part of the legend
761
 
     by adding a child item to mLegendSymbologyGroupParent*/
762
 
    void refreshLegend();
763
 
 
764
 
    /**Copies the symbology settings from another layer. Returns true in case of success*/
765
 
    bool copySymbologySettings(const QgsMapLayer& other) {return false;} //todo
766
 
 
767
 
    bool isSymbologyCompatible(const QgsMapLayer& other) const {return false;} //todo
768
 
 
769
 
    /**
770
 
     * If an operation returns 0 (e.g. draw()), this function
771
 
     * returns the text of the error associated with the failure.
772
 
     * Interactive users of this provider can then, for example,
773
 
     * call a QMessageBox to display the contents.
774
 
     */
775
 
    QString errorCaptionString();
776
 
  
777
 
    /**
778
 
     * If an operation returns 0 (e.g. draw()), this function
779
 
     * returns the text of the error associated with the failure.
780
 
     * Interactive users of this provider can then, for example,
781
 
     * call a QMessageBox to display the contents.
782
 
     */
783
 
    QString errorString();
784
 
 
785
 
    /** Returns the data provider
786
 
     *
787
 
     *  \retval 0 if not using the data provider model (i.e. directly using GDAL)
788
 
     */
789
 
    QgsRasterDataProvider* getDataProvider();
790
 
 
791
 
    /** Returns the data provider in a const-correct manner
792
 
     *
793
 
     *  \retval 0 if not using the data provider model (i.e. directly using GDAL)
794
 
     */
795
 
    const QgsRasterDataProvider* getDataProvider() const;
796
 
 
797
 
 
798
 
 
799
 
public slots:    
800
 
    /** \brief Mutator for transparency level. Should be between 0 and 255 */
801
 
    void setTransparency(unsigned int);
802
 
    /**
803
 
     * Convert this raster to another format
804
 
     */
805
 
    //void const convertTo();
806
 
    /**
807
 
     * Mainly inteded for use in propogating progress updates from gdal up to the parent app.
808
 
     **/
809
 
    void updateProgress(int,int);
810
 
 
811
 
    /** sets whether this is in overview or not */
812
 
    void inOverview( bool );
813
 
 
814
 
    /** \brief Slot called when the popup menu transparency slider has been moved.*/
815
 
    void popupTransparencySliderMoved(int);
816
 
     
817
 
    /** \brief Create  gdal pyramid overviews  for this layer.
818
 
    * This will speed up performance at the expense of hard drive space.
819
 
    * Also, write access to the file is required. If no paramter is passed in
820
 
    * it will default to nearest neighbor resampling. */
821
 
    void buildPyramids(RasterPyramidList const &, 
822
 
                       QString const &  theResamplingMethod="NEAREST");
823
 
    /** \brief Used at the moment by the above function but hopefully will later
824
 
    be useable by any operation that needs to notify the user of its progress. */
825
 
/*
826
 
    int showTextProgress( double theProgressDouble,
827
 
                          const char *theMessageCharArray,
828
 
                          void *theData);    
829
 
*/
830
 
 
831
 
    /** \brief This method is called when the properties for this layer needs to be modified. 
832
 
     * invokes an instance of the QgsRasterLayerProperties dialog box.*/
833
 
    /* virtual */ void showLayerProperties();
834
 
 
835
 
  /** Populate the histogram vector for a given layer
836
 
  * @param theBandNoInt - which band to compute the histogram for
837
 
  * @param theBinCountInt - how many 'bins' to categorise the data into
838
 
  * @param theIgnoreOutOfRangeFlag - whether to ignore values that are out of range (default=true)
839
 
  * @param theThoroughBandScanFlag - whether to visit each cell when computing the histogram (default=false)
840
 
  */
841
 
  void populateHistogram(int theBandNoInt, 
842
 
                         int theBinCountInt=256,
843
 
                         bool theIgnoreOutOfRangeFlag=true,
844
 
                         bool theThoroughBandScanFlag=false);
845
 
 
846
 
    /** \brief Color table 
847
 
     *  \param band number
848
 
     *  \return pointer to color table
849
 
     */
850
 
    QgsColorTable *colorTable ( int theBandNoInt );
851
 
 protected:
852
 
 
853
 
    /** reads vector layer specific state from project file DOM node.
854
 
 
855
 
        @note
856
 
 
857
 
        Called by QgsMapLayer::readXML().
858
 
 
859
 
    */
860
 
    /* virtual */ bool readXML_( QDomNode & layer_node );
861
 
 
862
 
 
863
 
 
864
 
  /** write vector layer specific state to project file DOM node.
865
 
 
866
 
      @note
867
 
 
868
 
      Called by QgsMapLayer::writeXML().
869
 
 
870
 
  */
871
 
  /* virtual */ bool writeXML_( QDomNode & layer_node, QDomDocument & doc );
872
 
    
873
 
private:
874
 
 
875
 
    //
876
 
    // Private methods
877
 
    //
878
 
    /** \brief Paint debug information onto the output image.  */
879
 
    void showDebugOverlay(QPainter * theQPainter, QgsRasterViewPort * theRasterViewPort);
880
 
 
881
 
    //
882
 
    // Grayscale Imagery
883
 
    //
884
 
 
885
 
    /** \brief Drawing routine for single band grayscale image.  */
886
 
    void drawSingleBandGray(QPainter * theQPainter, 
887
 
                            QgsRasterViewPort * theRasterViewPort,
888
 
                            QgsMapToPixel * theQgsMapToPixel,
889
 
                            int theBandNoInt);
890
 
 
891
 
    /** \brief Drawing routine for single band grayscale image, rendered in pseudocolor.  */
892
 
    void drawSingleBandPseudoColor(QPainter * theQPainter, 
893
 
                                   QgsRasterViewPort * theRasterViewPort,
894
 
                                   QgsMapToPixel * theQgsMapToPixel,
895
 
                                   int theBandNoInt);
896
 
 
897
 
 
898
 
    //
899
 
    // Paletted Layers
900
 
    //
901
 
    
902
 
    /** \brief Drawing routine for paletted image, rendered as a single band image in color.  */
903
 
    void drawPalettedSingleBandColor(QPainter * theQPainter,
904
 
                                     QgsRasterViewPort * theRasterViewPort,
905
 
                                     QgsMapToPixel * theQgsMapToPixel,
906
 
                                     int theBandNoInt);
907
 
    
908
 
    /** \brief Drawing routine for paletted image, rendered as a single band image in grayscale.  */
909
 
    void drawPalettedSingleBandGray(QPainter * theQPainter,
910
 
                                    QgsRasterViewPort * theRasterViewPort,
911
 
                                    QgsMapToPixel * theQgsMapToPixel,
912
 
                                    int theBandNoInt,
913
 
                                    QString const &  theColorQString);
914
 
 
915
 
    /** \brief Drawing routine for paletted image, rendered as a single band image in pseudocolor.  */
916
 
    void drawPalettedSingleBandPseudoColor(QPainter * theQPainter,
917
 
                                           QgsRasterViewPort * theRasterViewPort,
918
 
                                           QgsMapToPixel * theQgsMapToPixel,
919
 
                                           int theBandNoInt,
920
 
                                           QString const &  theColorQString);
921
 
 
922
 
    /** \brief Drawing routine for paletted multiband image.  */
923
 
    void drawPalettedMultiBandColor(QPainter * theQPainter,
924
 
                                    QgsRasterViewPort * theRasterViewPort,
925
 
                                    QgsMapToPixel * theQgsMapToPixel,                                
926
 
                                    int theBandNoInt);
927
 
 
928
 
    //
929
 
    // Multiband Layers
930
 
    //
931
 
    
932
 
    /** \brief Drawing routine for multiband image, rendered as a single band image in grayscale.  */
933
 
    void drawMultiBandSingleBandGray(QPainter * theQPainter,
934
 
                                     QgsRasterViewPort * theRasterViewPort, 
935
 
                                     QgsMapToPixel * theQgsMapToPixel,
936
 
                                     int theBandNoInt);
937
 
 
938
 
    /** \brief Drawing routine for multiband image, rendered as a single band image in pseudocolor.  */
939
 
    void drawMultiBandSingleBandPseudoColor(QPainter * theQPainter, 
940
 
                                            QgsRasterViewPort * theRasterViewPort, 
941
 
                                            QgsMapToPixel * theQgsMapToPixel,
942
 
                                            int theBandNoInt);
943
 
 
944
 
    /** \brief Drawing routine for multiband image  */
945
 
    void drawMultiBandColor(QPainter * theQPainter, 
946
 
                            QgsRasterViewPort * theRasterViewPort,
947
 
                            QgsMapToPixel * theQgsMapToPixel);
948
 
 
949
 
    /** \brief Read color table from GDAL raster band */
950
 
    void readColorTable ( GDALRasterBand *gdalBand, QgsColorTable *theColorTable );
951
 
 
952
 
    /** \brief Allocate memory and load data to that allocated memory, data type is the same
953
 
     *         as raster band. The memory must be released later!
954
 
     *  \return pointer to the memory
955
 
     */
956
 
    void *readData ( GDALRasterBand *gdalBand, QgsRasterViewPort *viewPort );
957
 
 
958
 
    /** \brief Read a raster value on given position from memory block created by readData() 
959
 
     *  \param index index in memory block
960
 
     */
961
 
    inline double readValue ( void *data, GDALDataType type, int index );
962
 
 
963
 
 
964
 
    /**
965
 
       Load the given raster file
966
 
 
967
 
       @returns true if successfully read file
968
 
 
969
 
       @note
970
 
       
971
 
       Called from ctor if a raster image given there
972
 
     */
973
 
    bool readFile( QString const & fileName );
974
 
    
975
 
    /** \brief Close data set and release related data */
976
 
    void closeDataset ();
977
 
 
978
 
    /** \brief Update the layer if it is outdated */
979
 
    bool update ();
980
 
 
981
 
    /**
982
 
      set up the coordinate transform - in the case of raster this is mainly used to convert
983
 
      the inverese projection of the map extents of the canvas when zooming in etc. so
984
 
      that they match the coordinate system of this layer
985
 
      if no other layers exist, set the output projection to be
986
 
      the same as the input projection, otherwise set the output to the
987
 
      project srs
988
 
     */
989
 
    void setupDestSrs();
990
 
 
991
 
    //
992
 
    // Private member vars
993
 
    //
994
 
    /** \brief  Raster width. */
995
 
    int rasterXDimInt;
996
 
    /** \brief  Raster Height. */
997
 
    int rasterYDimInt;
998
 
    /** \brief Cell value representing no data. e.g. -9999  */
999
 
    double noDataValueDouble;
1000
 
    /** \brief Flag to indicate whether debug infor overlay should be rendered onto the raster.  */
1001
 
    bool showDebugOverlayFlag;
1002
 
    /** \brief Pointer to the gdaldataset.  */
1003
 
    GDALDataset * gdalDataset;
1004
 
    /** \brief Values for mapping pixel to world coordinates.  */
1005
 
    double adfGeoTransform[6];
1006
 
    /** \brief Flag indicating whether the histogram should be inverted or not.  */
1007
 
    bool invertHistogramFlag;
1008
 
    /** \brief Number of stddev to plot (0) to ignore. Not applicable to all layer types.  */
1009
 
    double stdDevsToPlotDouble;
1010
 
    /** \brief A collection of stats - one for each band in the layer.
1011
 
     * The typedef for this is defined above before class declaration
1012
 
     */
1013
 
    RasterStatsVector rasterStatsVector;
1014
 
    /** \brief The band to be associated with the color red - usually 1.  */
1015
 
    QString redBandNameQString;
1016
 
    /** \brief The band to be associated with the color green - usually 2.  */
1017
 
    QString greenBandNameQString;
1018
 
    /** \brief The band to be associated with the color blue - usually 3.  */
1019
 
    QString blueBandNameQString;
1020
 
    /** \brief The band to be associated with transparency.  */
1021
 
    QString transparentBandNameQString;
1022
 
    /** \brief The band to be associated with the grayscale only ouput - usually 1.  */
1023
 
    QString grayBandNameQString;
1024
 
    /** \brief Minimum red value - used in scaling procedure.  */
1025
 
    double minRedDouble;
1026
 
    /** \brief Maximum red value - used in scaling procedure.  */
1027
 
    double maxRedDouble;
1028
 
    /** \brief Minimum green value - used in scaling procedure.  */
1029
 
    double minGreenDouble;
1030
 
    /** \brief Maximum green value - used in scaling procedure.  */
1031
 
    double maxGreenDouble;
1032
 
    /** \brief Minimum blue value - used in scaling procedure.  */
1033
 
    double minBlueDouble;
1034
 
    /** \brief Maximum blue value - used in scaling procedure.  */
1035
 
    double maxBlueDouble;
1036
 
    /** \brief Minimum gray value - used in scaling procedure.  */
1037
 
    double minGrayDouble;
1038
 
    /** \brief Maximum gray value - used in scaling procedure.  */
1039
 
    double maxGrayDouble;
1040
 
    /** \brief Whether this raster has overviews / pyramids or not */
1041
 
    bool hasPyramidsFlag;
1042
 
    /** \brief These are two little icons used to indicate whether a 
1043
 
     * layer has pyramds bult or not. */
1044
 
    QPixmap mPyramidPixmap, mNoPyramidPixmap;
1045
 
    /** \brief This list holds a series of RasterPyramid structs
1046
 
     * which store infomation for each potential pyramid level for this raster.*/
1047
 
    RasterPyramidList mPyramidList;
1048
 
    //Transparency slider for popup menu
1049
 
    QSlider * mTransparencySlider; 
1050
 
 
1051
 
    /* raster properties dialog 
1052
 
 
1053
 
       @todo XXX should consider generalizing this
1054
 
    */
1055
 
    QgsRasterLayerProperties * mLayerProperties;
1056
 
    
1057
 
/*
1058
 
 * 
1059
 
 * New functions that will convert this class to a data provider interface
1060
 
 * (B Morley)
1061
 
 *
1062
 
 */ 
1063
 
 
1064
 
public:
1065
 
 
1066
 
  //! Constructor in provider mode
1067
 
  // TODO Rename into a general constructor when the old raster interface is retired
1068
 
  // \param  dummy  is just there to distinguish this function signature from the old non-provider one.
1069
 
  QgsRasterLayer(int dummy, 
1070
 
                 QString const & baseName = QString(),
1071
 
                 QString const & path = QString(),
1072
 
                 QString const & providerLib = QString(),
1073
 
                 QStringList const & layers = QStringList(),
1074
 
                 QStringList const & styles = QStringList(),
1075
 
                 QString const & format = QString(),
1076
 
                 QString const & crs = QString(),
1077
 
                 QString const & proxyHost = QString(),
1078
 
                 int proxyPort = 80,
1079
 
                 QString const & proxyUser = QString(),
1080
 
                 QString const & proxyPass = QString());
1081
 
 
1082
 
  void setDataProvider( QString const & provider,
1083
 
                        QStringList const & layers,
1084
 
                        QStringList const & styles,
1085
 
                        QString const & format,
1086
 
                        QString const & crs,
1087
 
                        QString const & proxyHost,
1088
 
                        int proxyPort,
1089
 
                        QString const & proxyUser,
1090
 
                        QString const & proxyPass );
1091
 
 
1092
 
  //! Does this layer use a provider for setting/retrieving data?
1093
 
  bool usesProvider();
1094
 
 
1095
 
  /**
1096
 
   * Sets a proxy for the path given in the constructor
1097
 
   *
1098
 
   * \retval TRUE if proxy setting is successful (if indeed it is supported)
1099
 
   */
1100
 
  bool setProxy(QString const & host = 0,
1101
 
                            int port = 80,
1102
 
                QString const & user = 0,
1103
 
                QString const & pass = 0);
1104
 
 
1105
 
  //! Which provider is being used for this Raster Layer?
1106
 
  QString providerKey();
1107
 
 
1108
 
public slots:
1109
 
 
1110
 
  void showStatusMessage(QString const & theMessage);
1111
 
 
1112
 
 
1113
 
private:
1114
 
 
1115
 
  //! Data provider key
1116
 
  QString mProviderKey;
1117
 
  
1118
 
  //! pointer for loading the provider library
1119
 
  QLibrary *myLib;
1120
 
 
1121
 
  //! Pointer to data provider derived from the abstract base class QgsDataProvider
1122
 
  QgsRasterDataProvider *dataProvider;
1123
 
 
1124
 
  /**Flag indicating wheter the layer is in editing mode or not*/
1125
 
  bool mEditable;
1126
 
  
1127
 
  /**Flag indicating wheter the layer has been modified since the last commit*/
1128
 
  bool mModified;
1129
 
 
1130
 
  //! Timestamp, the last modified time of the data source when the layer was created
1131
 
  QDateTime mLastModified;
1132
 
 
1133
 
  /**
1134
 
   * The error caption associated with the last error.
1135
 
   */
1136
 
  QString mErrorCaption;
1137
 
 
1138
 
  /**
1139
 
   * The error message associated with the last error.
1140
 
   */
1141
 
  QString mError;
1142
 
 
1143
 
};
1144
 
 
1145
 
#endif