1 |
|
/*! \class QgsRasterLayer
|
2 |
|
* \brief This class provides qgis with the ability to render raster datasets
|
3 |
|
* onto the mapcanvas..
|
4 |
|
*/
|
5 |
|
|
6 |
|
class QgsRasterLayer : QgsMapLayer
|
7 |
|
{
|
8 |
|
%TypeHeaderCode
|
9 |
|
#include <qgsrasterpyramid.h>
|
10 |
|
#include <qgsrasterlayer.h>
|
11 |
|
#include <qgscontrastenhancement.h>
|
12 |
|
#include <qgsrastertransparency.h>
|
13 |
|
#include <qgsrastershader.h>
|
14 |
|
%End
|
15 |
|
|
16 |
|
public:
|
17 |
|
/** \brief This is the constructor for the RasterLayer class.
|
18 |
|
*
|
19 |
|
* The main tasks carried out by the constructor are:
|
20 |
|
*
|
21 |
|
* -Load the rasters default style (.qml) file if it exists
|
22 |
|
*
|
23 |
|
* -Populate the RasterStatsVector with initial values for each band.
|
24 |
|
*
|
25 |
|
* -Calculate the layer extents
|
26 |
|
*
|
27 |
|
* -Determine whether the layer is gray, paletted or multiband.
|
28 |
|
*
|
29 |
|
* -Assign sensible defaults for the red, green, blue and gray bands.
|
30 |
|
*
|
31 |
|
* -
|
32 |
|
* */
|
33 |
|
QgsRasterLayer( const QString & path = QString::null,
|
34 |
|
const QString & baseName = QString::null,
|
35 |
|
bool loadDefaultStyleFlag = true );
|
36 |
|
|
37 |
|
/** \brief [ data provider interface ] Constructor in provider mode */
|
38 |
|
QgsRasterLayer( int dummy,
|
39 |
|
const QString & baseName = QString(),
|
40 |
|
const QString & path = QString(),
|
41 |
|
const QString & providerLib = QString(),
|
42 |
|
const QStringList & layers = QStringList(),
|
43 |
|
const QStringList & styles = QStringList(),
|
44 |
|
const QString & format = QString(),
|
45 |
|
const QString & crs = QString());
|
46 |
|
|
47 |
|
|
48 |
|
/** \brief The destructor */
|
49 |
|
~QgsRasterLayer();
|
50 |
|
|
51 |
|
|
52 |
|
//
|
53 |
|
// Enums, structs and typedefs
|
54 |
|
//
|
55 |
|
/** \brief This enumerator describes the types of shading that can be used */
|
56 |
|
enum ColorShadingAlgorithm
|
57 |
|
{
|
58 |
|
UndefinedShader,
|
59 |
|
PseudoColorShader,
|
60 |
|
FreakOutShader,
|
61 |
|
ColorRampShader,
|
62 |
|
UserDefinedShader
|
63 |
|
};
|
64 |
|
|
65 |
|
/** \brief This enumerator describes the different kinds of drawing we can do */
|
66 |
|
enum DrawingStyle
|
67 |
|
{
|
68 |
|
UndefinedDrawingStyle,
|
69 |
|
SingleBandGray, // a single band image drawn as a range of gray colors
|
70 |
|
SingleBandPseudoColor, // a single band image drawn using a pseudocolor algorithm
|
71 |
|
PalettedColor, //a "Palette" image drawn using color table
|
72 |
|
PalettedSingleBandGray, // a "Palette" layer drawn in gray scale
|
73 |
|
PalettedSingleBandPseudoColor, // a "Palette" layerdrawn using a pseudocolor algorithm
|
74 |
|
PalettedMultiBandColor, // currently not supported
|
75 |
|
MultiBandSingleGandGray, // a layer containing 2 or more bands, but a single band drawn as a range of gray colors
|
76 |
|
MultiBandSingleBandPseudoColor, //a layer containing 2 or more bands, but a single band drawn using a pseudocolor algorithm
|
77 |
|
MultiBandColor //a layer containing 2 or more bands, mapped to RGB color space.
|
78 |
|
//In the case of a multiband with only two bands, one band will be mapped to more than one color.
|
79 |
|
};
|
80 |
|
|
81 |
|
/** \brief This enumerator describes the type of raster layer */
|
82 |
|
enum LayerType
|
83 |
|
{
|
84 |
|
GrayOrUndefined,
|
85 |
|
Palette,
|
86 |
|
Multiband
|
87 |
|
} ;
|
88 |
|
|
89 |
|
/** \brief A list containing on ContrastEnhancement object per raster band in this raster layer */
|
90 |
|
typedef QList<QgsContrastEnhancement> ContrastEnhancementList;
|
91 |
|
|
92 |
|
/** \brief A list containing one RasterPyramid struct per raster band in this raster layer.
|
93 |
|
* POTENTIAL pyramid layer. This works by dividing the height
|
94 |
|
* and width of the raster by an incrementing number. As soon as the result
|
95 |
|
* of the division is <=256 we stop allowing RasterPyramid structs
|
96 |
|
* to be added to the list. Each time a RasterPyramid is created
|
97 |
|
* we will check to see if a pyramid matching these dimensions already exists
|
98 |
|
* in the raster layer, and if so mark the exists flag as true */
|
99 |
|
typedef QList<QgsRasterPyramid> RasterPyramidList;
|
100 |
|
|
101 |
|
/** \brief A list containing one RasterBandStats struct per raster band in this raster layer.
|
102 |
|
* Note that while every RasterBandStats element will have the name and number of its associated
|
103 |
|
* band populated, any additional stats are calculated on a need to know basis.*/
|
104 |
|
typedef QList<QgsRasterBandStats> RasterStatsList;
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
//
|
111 |
|
// Static methods:
|
112 |
|
//
|
113 |
|
static void buildSupportedRasterFileFilter( QString & fileFilters );
|
114 |
|
|
115 |
|
/** This helper checks to see whether the file name appears to be a valid
|
116 |
|
* raster file name. If the file name looks like it could be valid,
|
117 |
|
* but some sort of error occurs in processing the file, the error is
|
118 |
|
* returned in retError.
|
119 |
|
*/
|
120 |
|
static bool isValidRasterFileName( const QString & theFileNameQString, QString &retError );
|
121 |
|
|
122 |
|
static bool isValidRasterFileName( const QString & theFileNameQString );
|
123 |
|
|
124 |
|
/** Return time stamp for given file name */
|
125 |
|
static QDateTime lastModified( const QString & name );
|
126 |
|
|
127 |
|
/** \brief ensures that GDAL drivers are registered, but only once */
|
128 |
|
static void registerGdalDrivers();
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
|
133 |
|
//
|
134 |
|
// Non Static inline methods
|
135 |
|
//
|
136 |
|
|
137 |
|
/** \brief Accessor for blue band name mapping */
|
138 |
|
QString blueBandName() const;
|
139 |
|
|
140 |
|
/** \brief Accessor for color shader algorithm */
|
141 |
|
QgsRasterLayer::ColorShadingAlgorithm colorShadingAlgorithm() const;
|
142 |
|
|
143 |
|
/** \brief Accessor for contrast enhancement algorithm */
|
144 |
|
QgsContrastEnhancement::ContrastEnhancementAlgorithm contrastEnhancementAlgorithm();
|
145 |
|
|
146 |
|
/** \brief Returns contrast enhancement algorithm as a string */
|
147 |
|
QString contrastEnhancementAlgorithmAsString() const;
|
148 |
|
|
149 |
|
/** \brief Accessor for drawing style */
|
150 |
|
DrawingStyle drawingStyle();
|
151 |
|
|
152 |
|
/** \brief Accessor for gray band name mapping */
|
153 |
|
QString grayBandName() const;
|
154 |
|
|
155 |
|
/** \brief Accessor for green band name mapping */
|
156 |
|
QString greenBandName() const;
|
157 |
|
|
158 |
|
/** \brief Accessor for mHasPyramids (READ ONLY) */
|
159 |
|
bool hasPyramids();
|
160 |
|
|
161 |
|
/** \brief Accessor for mUserDefinedGrayMinimumMaximum */
|
162 |
|
bool hasUserDefinedGrayMinimumMaximum() const;
|
163 |
|
|
164 |
|
/** \brief Accessor for mUserDefinedRGBMinimumMaximum */
|
165 |
|
bool hasUserDefinedRGBMinimumMaximum() const;
|
166 |
|
|
167 |
|
/** \brief Accessor that returns the height of the (unclipped) raster */
|
168 |
|
int height();
|
169 |
|
|
170 |
|
/** \brief Accessor to find out whether the histogram should be inverted */
|
171 |
|
bool invertHistogram() const;
|
172 |
|
|
173 |
|
/** \brief Is the NoDataValue Valid */
|
174 |
|
bool isNoDataValueValid() const;
|
175 |
|
|
176 |
|
/** \brief Accessor for mGrayMinimumMaximumEstimated */
|
177 |
|
bool isGrayMinimumMaximumEstimated() const;
|
178 |
|
|
179 |
|
/** \brief Accessor for mRGBMinimumMaximumEstimated */
|
180 |
|
bool isRGBMinimumMaximumEstimated() const;
|
181 |
|
|
182 |
|
/** \brief Accessor that returns the NO_DATA entry for this raster */
|
183 |
|
double noDataValue( bool* isValid = 0 );
|
184 |
|
|
185 |
|
/** \brief Returns a pointer to the transparency object */
|
186 |
|
QgsRasterTransparency* rasterTransparency();
|
187 |
|
|
188 |
|
/** \brief Accessor for raster shader */
|
189 |
|
QgsRasterShader* rasterShader();
|
190 |
|
|
191 |
|
/** \brief Accessor for raster layer type (which is a read only property) */
|
192 |
|
LayerType rasterType();
|
193 |
|
|
194 |
|
/** \brief Accessor for red band name (allows alternate mappings e.g. map blue as red color) */
|
195 |
|
QString redBandName();
|
196 |
|
|
197 |
|
/** [ data provider interface ] Set the data provider */
|
198 |
|
void setDataProvider( const QString & provider,
|
199 |
|
const QStringList & layers,
|
200 |
|
const QStringList & styles,
|
201 |
|
const QString & format,
|
202 |
|
const QString & crs );
|
203 |
|
|
204 |
|
/** \brief Mutator for drawing style */
|
205 |
|
void setDrawingStyle( const DrawingStyle & theDrawingStyle );
|
206 |
|
|
207 |
|
/** \brief Mutator for mGrayMinimumMaximumEstimated */
|
208 |
|
void setGrayMinimumMaximumEstimated( bool theBool );
|
209 |
|
|
210 |
|
/** \brief Mutator to alter the state of the invert histogram flag */
|
211 |
|
void setInvertHistogram( bool theFlag );
|
212 |
|
|
213 |
|
/** \brief Mutator for mRGBMinimumMaximumEstimated */
|
214 |
|
void setRGBMinimumMaximumEstimated( bool theBool );
|
215 |
|
|
216 |
|
/** \brief Mutator to alter the number of standard deviations that should be plotted */
|
217 |
|
void setStandardDeviations( double theStdDevsToPlot );
|
218 |
|
|
219 |
|
/** \brief Mutator for mUserDefinedGrayMinimumMaximum */
|
220 |
|
void setUserDefinedGrayMinimumMaximum( bool theBool );
|
221 |
|
|
222 |
|
/** \brief Mutator for mUserDefinedRGBMinimumMaximum */
|
223 |
|
void setUserDefinedRGBMinimumMaximum( bool theBool );
|
224 |
|
|
225 |
|
/** \brief Accessor to find out how many standard deviations are being plotted */
|
226 |
|
double standardDeviations() const;
|
227 |
|
|
228 |
|
/** \brief Accessor for transparent band name mapping */
|
229 |
|
QString transparentBandName() const;
|
230 |
|
|
231 |
|
/** \brief [ data provider interface ] Does this layer use a provider for setting/retrieving data? */
|
232 |
|
bool usesProvider();
|
233 |
|
|
234 |
|
/** \brief Accessor that returns the width of the (unclipped) raster */
|
235 |
|
int width();
|
236 |
|
|
237 |
|
|
238 |
|
|
239 |
|
|
240 |
|
|
241 |
|
//
|
242 |
|
// Non Static methods
|
243 |
|
//
|
244 |
|
/** \brief Get the number of bands in this layer */
|
245 |
|
unsigned int bandCount();
|
246 |
|
|
247 |
|
/** \brief Get the name of a band given its number */
|
248 |
|
const QString bandName( int theBandNoInt );
|
249 |
|
|
250 |
|
/** \brief Get the number of a band given its name. The name is the rewritten name set
|
251 |
|
* up in the constructor, and will not necessarily be the same as the name retrieved directly from gdal!
|
252 |
|
* If no matching band is found zero will be returned! */
|
253 |
|
int bandNumber( const QString & theBandName );
|
254 |
|
|
255 |
|
/** \brief Get RasterBandStats for a band given its number (read only) */
|
256 |
|
const QgsRasterBandStats bandStatistics( int );
|
257 |
|
|
258 |
|
/** \brief Get RasterBandStats for a band given its name (read only) */
|
259 |
|
const QgsRasterBandStats bandStatistics( const QString & );
|
260 |
|
|
261 |
|
/** \brief Accessor for ths raster layers pyramid list. A pyramid list defines the
|
262 |
|
* POTENTIAL pyramids that can be in a raster. To know which of the pyramid layers
|
263 |
|
* ACTUALLY exists you need to look at the existsFlag member in each struct stored in the
|
264 |
|
* list.
|
265 |
|
*/
|
266 |
|
RasterPyramidList buildPyramidList();
|
267 |
|
|
268 |
|
/** \brief Accessor for color shader algorithm */
|
269 |
|
QString colorShadingAlgorithmAsString() const;
|
270 |
|
|
271 |
|
/** \brief Wrapper for GDALComputeRasterMinMax with the estimate option */
|
272 |
|
void computeMinimumMaximumEstimates( int theBand, double* theMinMax );
|
273 |
|
|
274 |
|
/** \brief Wrapper for GDALComputeRasterMinMax with the estimate option */
|
275 |
|
void computeMinimumMaximumEstimates( QString theBand, double* theMinMax );
|
276 |
|
|
277 |
|
/** \brief Get a pointer to the contrast enhancement for the selected band */
|
278 |
|
QgsContrastEnhancement* contrastEnhancement( unsigned int theBand );
|
279 |
|
|
280 |
|
/**Copies the symbology settings from another layer. Returns true in case of success*/
|
281 |
|
bool copySymbologySettings( const QgsMapLayer& theOther );
|
282 |
|
|
283 |
|
/** \brief Get a pointer to the color table */
|
284 |
|
//QList<QgsColorRampShader::ColorRampItem>* colorTable( int theBandNoInt );
|
285 |
|
|
286 |
|
/** Returns the data provider */
|
287 |
|
QgsRasterDataProvider* dataProvider();
|
288 |
|
|
289 |
|
/** Returns the data provider in a const-correct manner */
|
290 |
|
//const QgsRasterDataProvider* dataProvider() const;
|
291 |
|
|
292 |
|
/** \brief This is called when the view on the raster layer needs to be redrawn */
|
293 |
|
bool draw( QgsRenderContext& rendererContext );
|
294 |
|
|
295 |
|
/** \brief This is an overloaded version of the draw() function that is called by both draw() and thumbnailAsPixmap */
|
296 |
|
void draw( QPainter * theQPainter,
|
297 |
|
QgsRasterViewPort * myRasterViewPort,
|
298 |
|
const QgsMapToPixel* theQgsMapToPixel = 0 );
|
299 |
|
|
300 |
|
/** \brief Returns a string representation of drawing style
|
301 |
|
*
|
302 |
|
* Implementaed mainly for serialisation / deserialisation of settings to xml.
|
303 |
|
* NOTE: May be deprecated in the future!. DrawingStyle drawingStyle() instead.
|
304 |
|
* */
|
305 |
|
QString drawingStyleAsString() const;
|
306 |
|
|
307 |
|
/** \brief Checks if symbology is the same as another layers */
|
308 |
|
bool hasCompatibleSymbology( const QgsMapLayer& theOther ) const;
|
309 |
|
|
310 |
|
/** \brief Check whether a given band number has stats associated with it */
|
311 |
|
bool hasStatistics( int theBandNoInt );
|
312 |
|
|
313 |
|
/** \brief Identify raster value(s) found on the point position */
|
314 |
|
bool identify( const QgsPoint & point, QMap<QString, QString>& results /Out/ );
|
315 |
|
|
316 |
|
/** \brief Identify arbitrary details from the WMS server found on the point position */
|
317 |
|
QString identifyAsText( const QgsPoint & point );
|
318 |
|
|
319 |
|
/** \brief Currently returns always false */
|
320 |
|
bool isEditable() const;
|
321 |
|
|
322 |
|
/** \brief [ data provider interface ] If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the failure */
|
323 |
|
QString lastError();
|
324 |
|
|
325 |
|
/** \brief [ data provider interface ] If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the failure */
|
326 |
|
QString lastErrorTitle();
|
327 |
|
|
328 |
|
/** \brief Get a legend image for this layer */
|
329 |
|
QPixmap legendAsPixmap();
|
330 |
|
|
331 |
|
/** \brief Overloaded version of above function that can print layer name onto legend */
|
332 |
|
//QPixmap legendAsPixmap( bool );
|
333 |
|
|
334 |
|
/** \brief Use this method when you want an annotated legend suitable for print output etc */
|
335 |
|
//QPixmap legendAsPixmap( int theLabelCount );
|
336 |
|
|
337 |
|
/** \brief Accessor for maximum value user for contrast enhancement */
|
338 |
|
double maximumValue( unsigned int theBand );
|
339 |
|
|
340 |
|
/** \brief Accessor for maximum value user for contrast enhancement */
|
341 |
|
double maximumValue( QString theBand );
|
342 |
|
|
343 |
|
/** \brief Obtain GDAL Metadata for this layer */
|
344 |
|
QString metadata();
|
345 |
|
|
346 |
|
/** \brief Accessor for minimum value user for contrast enhancement */
|
347 |
|
double minimumValue( unsigned int theBand );
|
348 |
|
|
349 |
|
/** \brief Accessor for minimum value user for contrast enhancement */
|
350 |
|
double minimumValue( QString theBand );
|
351 |
|
|
352 |
|
/** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */
|
353 |
|
QPixmap paletteAsPixmap( int theBand = 1 );
|
354 |
|
|
355 |
|
/** \brief [ data provider interface ] Which provider is being used for this Raster Layer? */
|
356 |
|
QString providerKey();
|
357 |
|
|
358 |
|
/** \brief Returns the number of raster units per each raster pixel. In a world file, this is normally the first row (without the sign) */
|
359 |
|
double rasterUnitsPerPixel();
|
360 |
|
|
361 |
|
/** \brief Read color table from GDAL raster band */
|
362 |
|
//bool readColorTable( int theBandNumber, QList<QgsColorRampShader::ColorRampItem>* theList );
|
363 |
|
|
364 |
|
/** \brief Simple reset function that set the noDataValue back to the value stored in the first raster band */
|
365 |
|
void resetNoDataValue();
|
366 |
|
|
367 |
|
/** \brief Mutator for blue band name mapping */
|
368 |
|
void setBlueBandName( const QString & theBandName );
|
369 |
|
|
370 |
|
/** \brief Mutator for color shader algorithm */
|
371 |
|
void setColorShadingAlgorithm( QgsRasterLayer::ColorShadingAlgorithm theShaderAlgorithm );
|
372 |
|
|
373 |
|
/** \brief Mutator for color shader algorithm */
|
374 |
|
void setColorShadingAlgorithm( QString theShaderAlgorithm );
|
375 |
|
|
376 |
|
/** \brief Mutator for contrast enhancement algorithm */
|
377 |
|
void setContrastEnhancementAlgorithm( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm,
|
378 |
|
bool theGenerateLookupTableFlag = true );
|
379 |
|
|
380 |
|
/** \brief Mutator for contrast enhancement algorithm */
|
381 |
|
void setContrastEnhancementAlgorithm( QString theAlgorithm, bool theGenerateLookupTableFlag = true );
|
382 |
|
|
383 |
|
/** \brief Mutator for contrast enhancement function */
|
384 |
|
void setContrastEnhancementFunction( QgsContrastEnhancementFunction* theFunction );
|
385 |
|
|
386 |
|
/** \brief Overloaded version of the above function for convenience when restoring from xml */
|
387 |
|
void setDrawingStyle( const QString & theDrawingStyleQString );
|
388 |
|
|
389 |
|
/** \brief Mutator for gray band name mapping */
|
390 |
|
void setGrayBandName( const QString & theBandName );
|
391 |
|
|
392 |
|
/** \brief Mutator for green band name mapping */
|
393 |
|
void setGreenBandName( const QString & theBandName );
|
394 |
|
|
395 |
|
/** \brief Mutator for setting the maximum value for contrast enhancement */
|
396 |
|
void setMaximumValue( unsigned int theBand, double theValue, bool theGenerateLookupTableFlag = true );
|
397 |
|
|
398 |
|
/** \brief Mutator for setting the maximum value for contrast enhancement */
|
399 |
|
void setMaximumValue( QString theBand, double theValue, bool theGenerateLookupTableFlag = true );
|
400 |
|
|
401 |
|
/** \brief Mutator for setting the minimum value for contrast enhancement */
|
402 |
|
void setMinimumValue( unsigned int theBand, double theValue, bool theGenerateLookupTableFlag = true );
|
403 |
|
|
404 |
|
/** \brief Mutator for setting the minimum value for contrast enhancement */
|
405 |
|
void setMinimumValue( QString theBand, double theValue, bool theGenerateLookupTableFlag = true );
|
406 |
|
|
407 |
|
/** \brief Mutator that allows the NO_DATA entry for this raster to be overridden */
|
408 |
|
void setNoDataValue( double theNoData );
|
409 |
|
|
410 |
|
/** \brief Set the raster shader function to a user defined function */
|
411 |
|
void setRasterShaderFunction( QgsRasterShaderFunction* theFunction );
|
412 |
|
|
413 |
|
/** \brief Mutator for red band name (allows alternate mappings e.g. map blue as red color) */
|
414 |
|
void setRedBandName( const QString & theBandName );
|
415 |
|
|
416 |
|
/** \brief Mutator for transparent band name mapping */
|
417 |
|
void setTransparentBandName( const QString & theBandName );
|
418 |
|
|
419 |
|
/** \brief [ data provider interface ] A wrapper function to emit a progress update signal */
|
420 |
|
void showProgress( int theValue );
|
421 |
|
|
422 |
|
/** \brief Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS */
|
423 |
|
QStringList subLayers() const;
|
424 |
|
|
425 |
|
/** \brief Draws a thumbnail of the rasterlayer into the supplied pixmap pointer */
|
426 |
|
void thumbnailAsPixmap( QPixmap * theQPixmap );
|
427 |
|
|
428 |
|
/** \brief Emit a signal asking for a repaint. (inherited from maplayer) */
|
429 |
|
void triggerRepaint();
|
430 |
|
|
431 |
|
|
432 |
|
|
433 |
|
|
434 |
|
|
435 |
|
//
|
436 |
|
// Virtural methods
|
437 |
|
//
|
438 |
|
/**
|
439 |
|
* Reorders the *previously selected* sublayers of this layer from bottom to top
|
440 |
|
*
|
441 |
|
* (Useful for providers that manage their own layers, such as WMS)
|
442 |
|
*
|
443 |
|
*/
|
444 |
|
virtual void setLayerOrder( const QStringList & layers );
|
445 |
|
|
446 |
|
/**
|
447 |
|
* Set the visibility of the given sublayer name
|
448 |
|
*/
|
449 |
|
virtual void setSubLayerVisibility( const QString & name, bool vis );
|
450 |
|
|
451 |
|
|
452 |
|
|
453 |
|
|
454 |
|
|
455 |
|
public slots:
|
456 |
|
/** \brief Create GDAL pyramid overviews */
|
457 |
|
QString buildPyramids( const RasterPyramidList &,
|
458 |
|
const QString & theResamplingMethod = "NEAREST",
|
459 |
|
bool theTryInternalFlag = false );
|
460 |
|
|
461 |
|
/** \brief Populate the histogram vector for a given band */
|
462 |
|
void populateHistogram( int theBandNoInt,
|
463 |
|
int theBinCountInt = 256,
|
464 |
|
bool theIgnoreOutOfRangeFlag = true,
|
465 |
|
bool theThoroughBandScanFlag = false );
|
466 |
|
|
467 |
|
void showStatusMessage( const QString & theMessage );
|
468 |
|
|
469 |
|
/** \brief Propagate progress updates from GDAL up to the parent app */
|
470 |
|
void updateProgress( int, int );
|
471 |
|
|
472 |
|
|
473 |
|
|
474 |
|
|
475 |
|
|
476 |
|
signals:
|
477 |
|
/** \brief Signal for notifying listeners of long running processes */
|
478 |
|
void progressUpdate( int theValue );
|
479 |
|
|
480 |
|
|
481 |
|
|
482 |
|
|
483 |
|
protected:
|
484 |
|
|
485 |
|
/** \brief Read the symbology for the current layer from the Dom node supplied */
|
486 |
|
bool readSymbology( const QDomNode& node, QString& errorMessage );
|
487 |
|
|
488 |
|
/** \brief Reads layer specific state from project file Dom node */
|
489 |
|
bool readXml( QDomNode & layer_node );
|
490 |
|
|
491 |
|
/** \brief Write the symbology for the layer into the docment provided */
|
492 |
|
bool writeSymbology( QDomNode&, QDomDocument& doc, QString& errorMessage ) const;
|
493 |
|
|
494 |
|
/** \brief Write layer specific state to project file Dom node */
|
495 |
|
bool writeXml( QDomNode & layer_node, QDomDocument & doc );
|
496 |
|
|
497 |
|
};
|
498 |
|
|
|
1 |
/*! \class QgsRasterLayer
|
|
2 |
* \brief This class provides qgis with the ability to render raster datasets
|
|
3 |
* onto the mapcanvas..
|
|
4 |
*/
|
|
5 |
|
|
6 |
class QgsRasterLayer : QgsMapLayer
|
|
7 |
{
|
|
8 |
%TypeHeaderCode
|
|
9 |
#include <qgsrasterpyramid.h>
|
|
10 |
#include <qgsrasterlayer.h>
|
|
11 |
#include <qgscontrastenhancement.h>
|
|
12 |
#include <qgsrastertransparency.h>
|
|
13 |
#include <qgsrastershader.h>
|
|
14 |
%End
|
|
15 |
|
|
16 |
public:
|
|
17 |
/** \brief This is the constructor for the RasterLayer class.
|
|
18 |
*
|
|
19 |
* The main tasks carried out by the constructor are:
|
|
20 |
*
|
|
21 |
* -Load the rasters default style (.qml) file if it exists
|
|
22 |
*
|
|
23 |
* -Populate the RasterStatsVector with initial values for each band.
|
|
24 |
*
|
|
25 |
* -Calculate the layer extents
|
|
26 |
*
|
|
27 |
* -Determine whether the layer is gray, paletted or multiband.
|
|
28 |
*
|
|
29 |
* -Assign sensible defaults for the red, green, blue and gray bands.
|
|
30 |
*
|
|
31 |
* -
|
|
32 |
* */
|
|
33 |
QgsRasterLayer( const QString & path = QString::null,
|
|
34 |
const QString & baseName = QString::null,
|
|
35 |
bool loadDefaultStyleFlag = true );
|
|
36 |
|
|
37 |
/** \brief [ data provider interface ] Constructor in provider mode */
|
|
38 |
QgsRasterLayer( int dummy,
|
|
39 |
const QString & baseName = QString(),
|
|
40 |
const QString & path = QString(),
|
|
41 |
const QString & providerLib = QString(),
|
|
42 |
const QStringList & layers = QStringList(),
|
|
43 |
const QStringList & styles = QStringList(),
|
|
44 |
const QString & format = QString(),
|
|
45 |
const QString & crs = QString());
|
|
46 |
|
|
47 |
/** \brief [ data provider interface ] Constructor in provider mode to pass the parameters as a map */
|
|
48 |
QgsRasterLayer( QString const & rasterLayerPath,
|
|
49 |
QString const & baseName,
|
|
50 |
QMap<QString,QString> theWmsProperties);
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
/** \brief The destructor */
|
|
55 |
~QgsRasterLayer();
|
|
56 |
|
|
57 |
|
|
58 |
//
|
|
59 |
// Enums, structs and typedefs
|
|
60 |
//
|
|
61 |
/** \brief This enumerator describes the types of shading that can be used */
|
|
62 |
enum ColorShadingAlgorithm
|
|
63 |
{
|
|
64 |
UndefinedShader,
|
|
65 |
PseudoColorShader,
|
|
66 |
FreakOutShader,
|
|
67 |
ColorRampShader,
|
|
68 |
UserDefinedShader
|
|
69 |
};
|
|
70 |
|
|
71 |
/** \brief This enumerator describes the different kinds of drawing we can do */
|
|
72 |
enum DrawingStyle
|
|
73 |
{
|
|
74 |
UndefinedDrawingStyle,
|
|
75 |
SingleBandGray, // a single band image drawn as a range of gray colors
|
|
76 |
SingleBandPseudoColor, // a single band image drawn using a pseudocolor algorithm
|
|
77 |
PalettedColor, //a "Palette" image drawn using color table
|
|
78 |
PalettedSingleBandGray, // a "Palette" layer drawn in gray scale
|
|
79 |
PalettedSingleBandPseudoColor, // a "Palette" layerdrawn using a pseudocolor algorithm
|
|
80 |
PalettedMultiBandColor, // currently not supported
|
|
81 |
MultiBandSingleGandGray, // a layer containing 2 or more bands, but a single band drawn as a range of gray colors
|
|
82 |
MultiBandSingleBandPseudoColor, //a layer containing 2 or more bands, but a single band drawn using a pseudocolor algorithm
|
|
83 |
MultiBandColor //a layer containing 2 or more bands, mapped to RGB color space.
|
|
84 |
//In the case of a multiband with only two bands, one band will be mapped to more than one color.
|
|
85 |
};
|
|
86 |
|
|
87 |
/** \brief This enumerator describes the type of raster layer */
|
|
88 |
enum LayerType
|
|
89 |
{
|
|
90 |
GrayOrUndefined,
|
|
91 |
Palette,
|
|
92 |
Multiband
|
|
93 |
} ;
|
|
94 |
|
|
95 |
/** \brief A list containing on ContrastEnhancement object per raster band in this raster layer */
|
|
96 |
typedef QList<QgsContrastEnhancement> ContrastEnhancementList;
|
|
97 |
|
|
98 |
/** \brief A list containing one RasterPyramid struct per raster band in this raster layer.
|
|
99 |
* POTENTIAL pyramid layer. This works by dividing the height
|
|
100 |
* and width of the raster by an incrementing number. As soon as the result
|
|
101 |
* of the division is <=256 we stop allowing RasterPyramid structs
|
|
102 |
* to be added to the list. Each time a RasterPyramid is created
|
|
103 |
* we will check to see if a pyramid matching these dimensions already exists
|
|
104 |
* in the raster layer, and if so mark the exists flag as true */
|
|
105 |
typedef QList<QgsRasterPyramid> RasterPyramidList;
|
|
106 |
|
|
107 |
/** \brief A list containing one RasterBandStats struct per raster band in this raster layer.
|
|
108 |
* Note that while every RasterBandStats element will have the name and number of its associated
|
|
109 |
* band populated, any additional stats are calculated on a need to know basis.*/
|
|
110 |
typedef QList<QgsRasterBandStats> RasterStatsList;
|
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
|
|
115 |
|
|
116 |
//
|
|
117 |
// Static methods:
|
|
118 |
//
|
|
119 |
static void buildSupportedRasterFileFilter( QString & fileFilters );
|
|
120 |
|
|
121 |
/** This helper checks to see whether the file name appears to be a valid
|
|
122 |
* raster file name. If the file name looks like it could be valid,
|
|
123 |
* but some sort of error occurs in processing the file, the error is
|
|
124 |
* returned in retError.
|
|
125 |
*/
|
|
126 |
static bool isValidRasterFileName( const QString & theFileNameQString, QString &retError );
|
|
127 |
|
|
128 |
static bool isValidRasterFileName( const QString & theFileNameQString );
|
|
129 |
|
|
130 |
/** Return time stamp for given file name */
|
|
131 |
static QDateTime lastModified( const QString & name );
|
|
132 |
|
|
133 |
/** \brief ensures that GDAL drivers are registered, but only once */
|
|
134 |
static void registerGdalDrivers();
|
|
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
//
|
|
140 |
// Non Static inline methods
|
|
141 |
//
|
|
142 |
|
|
143 |
/** \brief Accessor for blue band name mapping */
|
|
144 |
QString blueBandName() const;
|
|
145 |
|
|
146 |
/** \brief Accessor for color shader algorithm */
|
|
147 |
QgsRasterLayer::ColorShadingAlgorithm colorShadingAlgorithm() const;
|
|
148 |
|
|
149 |
/** \brief Accessor for contrast enhancement algorithm */
|
|
150 |
QgsContrastEnhancement::ContrastEnhancementAlgorithm contrastEnhancementAlgorithm();
|
|
151 |
|
|
152 |
/** \brief Returns contrast enhancement algorithm as a string */
|
|
153 |
QString contrastEnhancementAlgorithmAsString() const;
|
|
154 |
|
|
155 |
/** \brief Accessor for drawing style */
|
|
156 |
DrawingStyle drawingStyle();
|
|
157 |
|
|
158 |
/** \brief Accessor for gray band name mapping */
|
|
159 |
QString grayBandName() const;
|
|
160 |
|
|
161 |
/** \brief Accessor for green band name mapping */
|
|
162 |
QString greenBandName() const;
|
|
163 |
|
|
164 |
/** \brief Accessor for mHasPyramids (READ ONLY) */
|
|
165 |
bool hasPyramids();
|
|
166 |
|
|
167 |
/** \brief Accessor for mUserDefinedGrayMinimumMaximum */
|
|
168 |
bool hasUserDefinedGrayMinimumMaximum() const;
|
|
169 |
|
|
170 |
/** \brief Accessor for mUserDefinedRGBMinimumMaximum */
|
|
171 |
bool hasUserDefinedRGBMinimumMaximum() const;
|
|
172 |
|
|
173 |
/** \brief Accessor that returns the height of the (unclipped) raster */
|
|
174 |
int height();
|
|
175 |
|
|
176 |
/** \brief Accessor to find out whether the histogram should be inverted */
|
|
177 |
bool invertHistogram() const;
|
|
178 |
|
|
179 |
/** \brief Is the NoDataValue Valid */
|
|
180 |
bool isNoDataValueValid() const;
|
|
181 |
|
|
182 |
/** \brief Accessor for mGrayMinimumMaximumEstimated */
|
|
183 |
bool isGrayMinimumMaximumEstimated() const;
|
|
184 |
|
|
185 |
/** \brief Accessor for mRGBMinimumMaximumEstimated */
|
|
186 |
bool isRGBMinimumMaximumEstimated() const;
|
|
187 |
|
|
188 |
/** \brief Accessor that returns the NO_DATA entry for this raster */
|
|
189 |
double noDataValue( bool* isValid = 0 );
|
|
190 |
|
|
191 |
/** \brief Returns a pointer to the transparency object */
|
|
192 |
QgsRasterTransparency* rasterTransparency();
|
|
193 |
|
|
194 |
/** \brief Accessor for raster shader */
|
|
195 |
QgsRasterShader* rasterShader();
|
|
196 |
|
|
197 |
/** \brief Accessor for raster layer type (which is a read only property) */
|
|
198 |
LayerType rasterType();
|
|
199 |
|
|
200 |
/** \brief Accessor for red band name (allows alternate mappings e.g. map blue as red color) */
|
|
201 |
QString redBandName();
|
|
202 |
|
|
203 |
/** [ data provider interface ] Set the data provider */
|
|
204 |
void setDataProvider( const QString & provider,
|
|
205 |
const QStringList & layers,
|
|
206 |
const QStringList & styles,
|
|
207 |
const QString & format,
|
|
208 |
const QString & crs,
|
|
209 |
const QString &sldurl=QString(),
|
|
210 |
const QString &sldbody=QString());
|
|
211 |
|
|
212 |
/** \brief Mutator for drawing style */
|
|
213 |
void setDrawingStyle( const DrawingStyle & theDrawingStyle );
|
|
214 |
|
|
215 |
/** \brief Mutator for mGrayMinimumMaximumEstimated */
|
|
216 |
void setGrayMinimumMaximumEstimated( bool theBool );
|
|
217 |
|
|
218 |
/** \brief Mutator to alter the state of the invert histogram flag */
|
|
219 |
void setInvertHistogram( bool theFlag );
|
|
220 |
|
|
221 |
/** \brief Mutator for mRGBMinimumMaximumEstimated */
|
|
222 |
void setRGBMinimumMaximumEstimated( bool theBool );
|
|
223 |
|
|
224 |
/** \brief Mutator to alter the number of standard deviations that should be plotted */
|
|
225 |
void setStandardDeviations( double theStdDevsToPlot );
|
|
226 |
|
|
227 |
/** \brief Mutator for mUserDefinedGrayMinimumMaximum */
|
|
228 |
void setUserDefinedGrayMinimumMaximum( bool theBool );
|
|
229 |
|
|
230 |
/** \brief Mutator for mUserDefinedRGBMinimumMaximum */
|
|
231 |
void setUserDefinedRGBMinimumMaximum( bool theBool );
|
|
232 |
|
|
233 |
/** \brief Accessor to find out how many standard deviations are being plotted */
|
|
234 |
double standardDeviations() const;
|
|
235 |
|
|
236 |
/** \brief Accessor for transparent band name mapping */
|
|
237 |
QString transparentBandName() const;
|
|
238 |
|
|
239 |
/** \brief [ data provider interface ] Does this layer use a provider for setting/retrieving data? */
|
|
240 |
bool usesProvider();
|
|
241 |
|
|
242 |
/** \brief Accessor that returns the width of the (unclipped) raster */
|
|
243 |
int width();
|
|
244 |
|
|
245 |
|
|
246 |
|
|
247 |
|
|
248 |
|
|
249 |
//
|
|
250 |
// Non Static methods
|
|
251 |
//
|
|
252 |
/** \brief Get the number of bands in this layer */
|
|
253 |
unsigned int bandCount();
|
|
254 |
|
|
255 |
/** \brief Get the name of a band given its number */
|
|
256 |
const QString bandName( int theBandNoInt );
|
|
257 |
|
|
258 |
/** \brief Get the number of a band given its name. The name is the rewritten name set
|
|
259 |
* up in the constructor, and will not necessarily be the same as the name retrieved directly from gdal!
|
|
260 |
* If no matching band is found zero will be returned! */
|
|
261 |
int bandNumber( const QString & theBandName );
|
|
262 |
|
|
263 |
/** \brief Get RasterBandStats for a band given its number (read only) */
|
|
264 |
const QgsRasterBandStats bandStatistics( int );
|
|
265 |
|
|
266 |
/** \brief Get RasterBandStats for a band given its name (read only) */
|
|
267 |
const QgsRasterBandStats bandStatistics( const QString & );
|
|
268 |
|
|
269 |
/** \brief Accessor for ths raster layers pyramid list. A pyramid list defines the
|
|
270 |
* POTENTIAL pyramids that can be in a raster. To know which of the pyramid layers
|
|
271 |
* ACTUALLY exists you need to look at the existsFlag member in each struct stored in the
|
|
272 |
* list.
|
|
273 |
*/
|
|
274 |
RasterPyramidList buildPyramidList();
|
|
275 |
|
|
276 |
/** \brief Accessor for color shader algorithm */
|
|
277 |
QString colorShadingAlgorithmAsString() const;
|
|
278 |
|
|
279 |
/** \brief Wrapper for GDALComputeRasterMinMax with the estimate option */
|
|
280 |
void computeMinimumMaximumEstimates( int theBand, double* theMinMax );
|
|
281 |
|
|
282 |
/** \brief Wrapper for GDALComputeRasterMinMax with the estimate option */
|
|
283 |
void computeMinimumMaximumEstimates( QString theBand, double* theMinMax );
|
|
284 |
|
|
285 |
/** \brief Get a pointer to the contrast enhancement for the selected band */
|
|
286 |
QgsContrastEnhancement* contrastEnhancement( unsigned int theBand );
|
|
287 |
|
|
288 |
/**Copies the symbology settings from another layer. Returns true in case of success*/
|
|
289 |
bool copySymbologySettings( const QgsMapLayer& theOther );
|
|
290 |
|
|
291 |
/** \brief Get a pointer to the color table */
|
|
292 |
//QList<QgsColorRampShader::ColorRampItem>* colorTable( int theBandNoInt );
|
|
293 |
|
|
294 |
/** Returns the data provider */
|
|
295 |
QgsRasterDataProvider* dataProvider();
|
|
296 |
|
|
297 |
/** Returns the data provider in a const-correct manner */
|
|
298 |
//const QgsRasterDataProvider* dataProvider() const;
|
|
299 |
|
|
300 |
/** \brief This is called when the view on the raster layer needs to be redrawn */
|
|
301 |
bool draw( QgsRenderContext& rendererContext );
|
|
302 |
|
|
303 |
/** \brief This is an overloaded version of the draw() function that is called by both draw() and thumbnailAsPixmap */
|
|
304 |
void draw( QPainter * theQPainter,
|
|
305 |
QgsRasterViewPort * myRasterViewPort,
|
|
306 |
const QgsMapToPixel* theQgsMapToPixel = 0 );
|
|
307 |
|
|
308 |
/** \brief Returns a string representation of drawing style
|
|
309 |
*
|
|
310 |
* Implementaed mainly for serialisation / deserialisation of settings to xml.
|
|
311 |
* NOTE: May be deprecated in the future!. DrawingStyle drawingStyle() instead.
|
|
312 |
* */
|
|
313 |
QString drawingStyleAsString() const;
|
|
314 |
|
|
315 |
/** \brief Checks if symbology is the same as another layers */
|
|
316 |
bool hasCompatibleSymbology( const QgsMapLayer& theOther ) const;
|
|
317 |
|
|
318 |
/** \brief Check whether a given band number has stats associated with it */
|
|
319 |
bool hasStatistics( int theBandNoInt );
|
|
320 |
|
|
321 |
/** \brief Identify raster value(s) found on the point position */
|
|
322 |
bool identify( const QgsPoint & point, QMap<QString, QString>& results /Out/ );
|
|
323 |
|
|
324 |
/** \brief Identify arbitrary details from the WMS server found on the point position */
|
|
325 |
QString identifyAsText( const QgsPoint & point );
|
|
326 |
|
|
327 |
/** \brief Currently returns always false */
|
|
328 |
bool isEditable() const;
|
|
329 |
|
|
330 |
/** \brief [ data provider interface ] If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the failure */
|
|
331 |
QString lastError();
|
|
332 |
|
|
333 |
/** \brief [ data provider interface ] If an operation returns 0 (e.g. draw()), this function returns the text of the error associated with the failure */
|
|
334 |
QString lastErrorTitle();
|
|
335 |
|
|
336 |
/** \brief Get a legend image for this layer */
|
|
337 |
QPixmap legendAsPixmap();
|
|
338 |
|
|
339 |
/** \brief Overloaded version of above function that can print layer name onto legend */
|
|
340 |
//QPixmap legendAsPixmap( bool );
|
|
341 |
|
|
342 |
/** \brief Use this method when you want an annotated legend suitable for print output etc */
|
|
343 |
//QPixmap legendAsPixmap( int theLabelCount );
|
|
344 |
|
|
345 |
/** \brief Accessor for maximum value user for contrast enhancement */
|
|
346 |
double maximumValue( unsigned int theBand );
|
|
347 |
|
|
348 |
/** \brief Accessor for maximum value user for contrast enhancement */
|
|
349 |
double maximumValue( QString theBand );
|
|
350 |
|
|
351 |
/** \brief Obtain GDAL Metadata for this layer */
|
|
352 |
QString metadata();
|
|
353 |
|
|
354 |
/** \brief Accessor for minimum value user for contrast enhancement */
|
|
355 |
double minimumValue( unsigned int theBand );
|
|
356 |
|
|
357 |
/** \brief Accessor for minimum value user for contrast enhancement */
|
|
358 |
double minimumValue( QString theBand );
|
|
359 |
|
|
360 |
/** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */
|
|
361 |
QPixmap paletteAsPixmap( int theBand = 1 );
|
|
362 |
|
|
363 |
/** \brief [ data provider interface ] Which provider is being used for this Raster Layer? */
|
|
364 |
QString providerKey();
|
|
365 |
|
|
366 |
/** \brief Returns the number of raster units per each raster pixel. In a world file, this is normally the first row (without the sign) */
|
|
367 |
double rasterUnitsPerPixel();
|
|
368 |
|
|
369 |
/** \brief Read color table from GDAL raster band */
|
|
370 |
//bool readColorTable( int theBandNumber, QList<QgsColorRampShader::ColorRampItem>* theList );
|
|
371 |
|
|
372 |
/** \brief Simple reset function that set the noDataValue back to the value stored in the first raster band */
|
|
373 |
void resetNoDataValue();
|
|
374 |
|
|
375 |
/** \brief Mutator for blue band name mapping */
|
|
376 |
void setBlueBandName( const QString & theBandName );
|
|
377 |
|
|
378 |
/** \brief Mutator for color shader algorithm */
|
|
379 |
void setColorShadingAlgorithm( QgsRasterLayer::ColorShadingAlgorithm theShaderAlgorithm );
|
|
380 |
|
|
381 |
/** \brief Mutator for color shader algorithm */
|
|
382 |
void setColorShadingAlgorithm( QString theShaderAlgorithm );
|
|
383 |
|
|
384 |
/** \brief Mutator for contrast enhancement algorithm */
|
|
385 |
void setContrastEnhancementAlgorithm( QgsContrastEnhancement::ContrastEnhancementAlgorithm theAlgorithm,
|
|
386 |
bool theGenerateLookupTableFlag = true );
|
|
387 |
|
|
388 |
/** \brief Mutator for contrast enhancement algorithm */
|
|
389 |
void setContrastEnhancementAlgorithm( QString theAlgorithm, bool theGenerateLookupTableFlag = true );
|
|
390 |
|
|
391 |
/** \brief Mutator for contrast enhancement function */
|
|
392 |
void setContrastEnhancementFunction( QgsContrastEnhancementFunction* theFunction );
|
|
393 |
|
|
394 |
/** \brief Overloaded version of the above function for convenience when restoring from xml */
|
|
395 |
void setDrawingStyle( const QString & theDrawingStyleQString );
|
|
396 |
|
|
397 |
/** \brief Mutator for gray band name mapping */
|
|
398 |
void setGrayBandName( const QString & theBandName );
|
|
399 |
|
|
400 |
/** \brief Mutator for green band name mapping */
|
|
401 |
void setGreenBandName( const QString & theBandName );
|
|
402 |
|
|
403 |
/** \brief Mutator for setting the maximum value for contrast enhancement */
|
|
404 |
void setMaximumValue( unsigned int theBand, double theValue, bool theGenerateLookupTableFlag = true );
|
|
405 |
|
|
406 |
/** \brief Mutator for setting the maximum value for contrast enhancement */
|
|
407 |
void setMaximumValue( QString theBand, double theValue, bool theGenerateLookupTableFlag = true );
|
|
408 |
|
|
409 |
/** \brief Mutator for setting the minimum value for contrast enhancement */
|
|
410 |
void setMinimumValue( unsigned int theBand, double theValue, bool theGenerateLookupTableFlag = true );
|
|
411 |
|
|
412 |
/** \brief Mutator for setting the minimum value for contrast enhancement */
|
|
413 |
void setMinimumValue( QString theBand, double theValue, bool theGenerateLookupTableFlag = true );
|
|
414 |
|
|
415 |
/** \brief Mutator that allows the NO_DATA entry for this raster to be overridden */
|
|
416 |
void setNoDataValue( double theNoData );
|
|
417 |
|
|
418 |
/** \brief Set the raster shader function to a user defined function */
|
|
419 |
void setRasterShaderFunction( QgsRasterShaderFunction* theFunction );
|
|
420 |
|
|
421 |
/** \brief Mutator for red band name (allows alternate mappings e.g. map blue as red color) */
|
|
422 |
void setRedBandName( const QString & theBandName );
|
|
423 |
|
|
424 |
/** \brief Mutator for transparent band name mapping */
|
|
425 |
void setTransparentBandName( const QString & theBandName );
|
|
426 |
|
|
427 |
/** \brief [ data provider interface ] A wrapper function to emit a progress update signal */
|
|
428 |
void showProgress( int theValue );
|
|
429 |
|
|
430 |
/** \brief Returns the sublayers of this layer - Useful for providers that manage their own layers, such as WMS */
|
|
431 |
QStringList subLayers() const;
|
|
432 |
|
|
433 |
/** \brief Draws a thumbnail of the rasterlayer into the supplied pixmap pointer */
|
|
434 |
void thumbnailAsPixmap( QPixmap * theQPixmap );
|
|
435 |
|
|
436 |
/** \brief Emit a signal asking for a repaint. (inherited from maplayer) */
|
|
437 |
void triggerRepaint();
|
|
438 |
|
|
439 |
|
|
440 |
|
|
441 |
|
|
442 |
|
|
443 |
//
|
|
444 |
// Virtural methods
|
|
445 |
//
|
|
446 |
/**
|
|
447 |
* Reorders the *previously selected* sublayers of this layer from bottom to top
|
|
448 |
*
|
|
449 |
* (Useful for providers that manage their own layers, such as WMS)
|
|
450 |
*
|
|
451 |
*/
|
|
452 |
virtual void setLayerOrder( const QStringList & layers );
|
|
453 |
|
|
454 |
/**
|
|
455 |
* Set the visibility of the given sublayer name
|
|
456 |
*/
|
|
457 |
virtual void setSubLayerVisibility( const QString & name, bool vis );
|
|
458 |
|
|
459 |
|
|
460 |
|
|
461 |
|
|
462 |
|
|
463 |
public slots:
|
|
464 |
/** \brief Create GDAL pyramid overviews */
|
|
465 |
QString buildPyramids( const RasterPyramidList &,
|
|
466 |
const QString & theResamplingMethod = "NEAREST",
|
|
467 |
bool theTryInternalFlag = false );
|
|
468 |
|
|
469 |
/** \brief Populate the histogram vector for a given band */
|
|
470 |
void populateHistogram( int theBandNoInt,
|
|
471 |
int theBinCountInt = 256,
|
|
472 |
bool theIgnoreOutOfRangeFlag = true,
|
|
473 |
bool theThoroughBandScanFlag = false );
|
|
474 |
|
|
475 |
void showStatusMessage( const QString & theMessage );
|
|
476 |
|
|
477 |
/** \brief Propagate progress updates from GDAL up to the parent app */
|
|
478 |
void updateProgress( int, int );
|
|
479 |
|
|
480 |
|
|
481 |
|
|
482 |
|
|
483 |
|
|
484 |
signals:
|
|
485 |
/** \brief Signal for notifying listeners of long running processes */
|
|
486 |
void progressUpdate( int theValue );
|
|
487 |
|
|
488 |
|
|
489 |
|
|
490 |
|
|
491 |
protected:
|
|
492 |
|
|
493 |
/** \brief Read the symbology for the current layer from the Dom node supplied */
|
|
494 |
bool readSymbology( const QDomNode& node, QString& errorMessage );
|
|
495 |
|
|
496 |
/** \brief Reads layer specific state from project file Dom node */
|
|
497 |
bool readXml( QDomNode & layer_node );
|
|
498 |
|
|
499 |
/** \brief Write the symbology for the layer into the docment provided */
|
|
500 |
bool writeSymbology( QDomNode&, QDomDocument& doc, QString& errorMessage ) const;
|
|
501 |
|
|
502 |
/** \brief Write layer specific state to project file Dom node */
|
|
503 |
bool writeXml( QDomNode & layer_node, QDomDocument & doc );
|
|
504 |
|
|
505 |
};
|
|
506 |
|