📄 qgsrasterlayer.h
字号:
/** \brief Find out whether a given band exists. */ bool hasBand(const QString & theBandName); /** \brief Call any inline image manipulation filters */ void filterLayer(QImage * theQImage); /** \brief Accessor for red band name (allows alternate mappings e.g. map blue as red colour). */ QString getRedBandName() { return mRedBandName; } /** \brief Mutator for red band name (allows alternate mappings e.g. map blue as red colour). */ void setRedBandName(const QString & theBandNameQString); // // Accessor and mutator for green band name // /** \brief Accessor for green band name mapping. */ QString getGreenBandName() { return mGreenBandName; } /** \brief Mutator for green band name mapping. */ void setGreenBandName(const QString & theBandNameQString); // // Accessor and mutator for blue band name // /** \brief Accessor for blue band name mapping. */ QString getBlueBandName() { return mBlueBandName; } /** \brief Mutator for blue band name mapping. */ void setBlueBandName(const QString & theBandNameQString); // // Accessor raster transparency object // /** \brief Returns a pointer to the transparency object */ QgsRasterTransparency* getRasterTransparency() { return &mRasterTransparency; } // // Accessor and mutator for transparent band name // /** \brief Accessor for transparent band name mapping. */ QString getTransparentBandName() { return mTransparencyBandName; } /** \brief Mutator for transparent band name mapping. */ void setTransparentBandName(const QString & theBandNameQString); // // Accessor and mutator for transparent band name // /** \brief Accessor for transparent band name mapping. */ QString getTransparentLayerName() { return mTransparentLayerName; } /** \brief Mutator for transparent band name mapping. */ void setTransparentLayerName(const QString & theLayerNameQString) { mTransparentLayerName = theLayerNameQString; } // // Accessor and mutator for gray band name // /** \brief Accessor for gray band name mapping. */ QString getGrayBandName() { return mGrayBandName; } /** \brief Mutator for gray band name mapping. */ void setGrayBandName(const QString & theBandNameQString); // // Accessor and mutator for mDebugOverlayFlag // /** \brief Accessor for a flag that determines whether to show some debug info on the image. */ bool getShowDebugOverlayFlag() { return mDebugOverlayFlag; } /** \brief Mutator for a flag that determines whether to show some debug info on the image. */ void setShowDebugOverlayFlag(bool theFlag) { mDebugOverlayFlag=theFlag; } // Accessor and mutator for minimum maximum values //TODO: Move these out of the header file... double getMinimumValue(unsigned int theBand) { if(0 < theBand && theBand <= getBandCount()) { return mContrastEnhancementList[theBand - 1].getMinimumValue(); } return 0.0; } double getMinimumValue(QString theBand) { return getMinimumValue(getRasterBandNumber(theBand)); } void setMinimumValue(unsigned int theBand, double theValue, bool theGenerateLookupTableFlag=true) { if(0 < theBand && theBand <= getBandCount()) { mContrastEnhancementList[theBand - 1].setMinimumValue(theValue, theGenerateLookupTableFlag); } } void setMinimumValue(QString theBand, double theValue, bool theGenerateLookupTableFlag=true) { if(theBand != tr("Not Set")) { setMinimumValue(getRasterBandNumber(theBand),theValue, theGenerateLookupTableFlag); } } double getMaximumValue(unsigned int theBand) { if(0 < theBand && theBand <= getBandCount()) { return mContrastEnhancementList[theBand - 1].getMaximumValue(); } return 0.0; } double getMaximumValue(QString theBand) { if(theBand != tr("Not Set")) { return getMaximumValue(getRasterBandNumber(theBand)); } return 0.0; } void setMaximumValue(unsigned int theBand, double theValue, bool theGenerateLookupTableFlag=true) { if(0 < theBand && theBand <= getBandCount()) { mContrastEnhancementList[theBand - 1].setMaximumValue(theValue, theGenerateLookupTableFlag); } } void setMaximumValue(QString theBand, double theValue, bool theGenerateLookupTableFlag=true) { if(theBand != tr("Not Set")) { setMaximumValue(getRasterBandNumber(theBand),theValue, theGenerateLookupTableFlag); } } QgsContrastEnhancement* getContrastEnhancement(unsigned int theBand) { return &mContrastEnhancementList[theBand - 1]; } // // Accessor and mutator for the contrast enhancement algorithm // /** \brief Accessor for contrast enhancement algorithm. */ QgsContrastEnhancement::CONTRAST_ENHANCEMENT_ALGORITHM getContrastEnhancementAlgorithm() { return mContrastEnhancementAlgorithm; } /** \brief Accessor for contrast enhancement algorithm. */ QString getContrastEnhancementAlgorithmAsQString(); /** \brief Mutator for contrast enhancement algorithm. */ void setContrastEnhancementAlgorithm(QgsContrastEnhancement::CONTRAST_ENHANCEMENT_ALGORITHM theAlgorithm, bool theGenerateLookupTableFlag=true) { QList<QgsContrastEnhancement>::iterator myIterator = mContrastEnhancementList.begin(); while(myIterator != mContrastEnhancementList.end()) { (*myIterator).setContrastEnhancementAlgorithm(theAlgorithm, theGenerateLookupTableFlag); ++myIterator; } mContrastEnhancementAlgorithm = theAlgorithm; } /** \brief Mutator for contrast enhancement algorithm. */ void setContrastEnhancementAlgorithm(QString theAlgorithm, bool theGenerateLookupTableFlag=true); // // Mutator for the contrast enhancement function // /** \brief Mutator for contrast enhancement function. */ void setContrastEnhancementFunction(QgsContrastEnhancementFunction* theFunction) { if(theFunction) { QList<QgsContrastEnhancement>::iterator myIterator = mContrastEnhancementList.begin(); while(myIterator != mContrastEnhancementList.end()) { (*myIterator).setContrastEnhancementFunction(theFunction); ++myIterator; } } } /** \brief This enumerator describes the types of shading that can be used. */ enum COLOR_SHADING_ALGORITHM { UNDEFINED_SHADING_ALGORITHM, PSEUDO_COLOR, FREAK_OUT, //it will scare your granny! COLOR_RAMP, USER_DEFINED }; // // Accessor and mutator for the color shader algorithm // /** \brief Accessor for colour shader algorithm. */ QgsRasterLayer::COLOR_SHADING_ALGORITHM getColorShadingAlgorithm() { return mColorShadingAlgorithm; } /** \brief Accessor for colour shader algorithm. */ QString getColorShadingAlgorithmAsQString(); /** \brief Mutator for color shader algorithm. */ void setColorShadingAlgorithm(QgsRasterLayer::COLOR_SHADING_ALGORITHM theShaderAlgorithm); /** \brief Mutator for color shader algorithm. */ void setColorShadingAlgorithm(QString theShaderAlgorithm); /** \brief Accessor for raster shader */ QgsRasterShader* getRasterShader() { return mRasterShader; } /** \brief Set the raster shader function to a user defined function */ void setRasterShaderFunction(QgsRasterShaderFunction* theFunction) { if(theFunction) { mRasterShader->setRasterShaderFunction(theFunction); mColorShadingAlgorithm = QgsRasterLayer::USER_DEFINED; } else { //If NULL as passed in, set a default shader function to prevent segfaults mRasterShader->setRasterShaderFunction(new QgsRasterShaderFunction()); mColorShadingAlgorithm = QgsRasterLayer::USER_DEFINED; } } /** \brief This enumerator describes the different kinds of drawing we can do. */ enum DRAWING_STYLE { UNDEFINED_DRAWING_STYLE, SINGLE_BAND_GRAY, // a "Gray" or "Undefined" layer drawn as a range of gray colors SINGLE_BAND_PSEUDO_COLOR,// a "Gray" or "Undefined" layer drawn using a pseudocolor algorithm PALETTED_COLOR, //a "Palette" image drawn using color table PALETTED_SINGLE_BAND_GRAY,// a "Palette" layer drawn in gray scale (using only one of the color components) PALETTED_SINGLE_BAND_PSEUDO_COLOR, // a "Palette" layer having only one of its color components rendered as psuedo color PALETTED_MULTI_BAND_COLOR, // a "Palette" image is decomposed to 3 channels (RGB) and drawn // as multiband MULTI_BAND_SINGLE_BAND_GRAY, // a layer containing 2 or more bands, but using only one band to produce a grayscale image MULTI_BAND_SINGLE_BAND_PSEUDO_COLOR, //a layer containing 2 or more bands, but using only one band to produce a pseudocolor image 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 } drawingStyle; // // Accessor and mutator for drawing style. // /** \brief Accessor for drawing style. */ DRAWING_STYLE getDrawingStyle() {return drawingStyle;} /** \brief Returns a string representation of drawing style. * * Implementaed mainly for serialisation / deserialisation of settings to xml. * NOTE: May be deprecated in the future!. Use alternate implementation above rather. * */ QString getDrawingStyleAsQString(); /** \brief Mutator for drawing style. */ void setDrawingStyle(const DRAWING_STYLE & theDrawingStyle) {drawingStyle=theDrawingStyle;} /** \brief Overloaded version of the above function for convenience when restoring from xml. * * Implementaed mainly for serialisation / deserialisation of settings to xml. * NOTE: May be deprecated in the future! Use alternate implementation above rather. * */ void setDrawingStyle(const QString & theDrawingStyleQString); /** \brief This enumerator describes the type of raster layer. */ enum RASTER_LAYER_TYPE { GRAY_OR_UNDEFINED, PALETTE, MULTIBAND } rasterLayerType; // //accessor and for raster layer type (READ ONLY) // /** \brief Accessor for raster layer type (which is a read only property) */ RASTER_LAYER_TYPE getRasterLayerType() { return rasterLayerType; } /** \brief Accessor for hasPyramidsFlag (READ ONLY) */ bool getHasPyramidsFlag() {return hasPyramidsFlag;} /** \brief Get a legend image for this layer. */ QPixmap getLegendQPixmap(); /** \brief Overloaded version of above function that can print layer name onto legend. */ QPixmap getLegendQPixmap(bool); /** \brief Use this method when you want an annotated legend suitable for print output etc. * @param int theLabelCountInt Number of vertical labels to display (defaults to 3) * */ QPixmap getDetailedLegendQPixmap(int theLabelCount); /** * Returns the sublayers of this layer * * (Useful for providers that manage their own layers, such as WMS) * */ QStringList subLayers() const; /** * Reorders the *previously selected* sublayers of this layer from bottom to top * * (Useful for providers that manage their own layers, such as WMS) * */ virtual void setLayerOrder(const QStringList & layers); /** * Set the visibility of the given sublayer name */ virtual void setSubLayerVisibility(const QString & name, bool vis); /** \brief Emit a signal asking for a repaint. (inherited from maplayer) */ void triggerRepaint(); /** \brief Obtain GDAL Metadata for this layer */ QString getMetadata(); /** \brief Accessor for ths raster layers pyramid list. A pyramid list defines the * POTENTIAL pyramids that can be in a raster. To know which of the pyramid layers * ACTUALLY exists you need to look at the existsFlag member in each struct stored in the * list.*/ RasterPyramidList buildRasterPyramidList(); /** \brief Helper method to retrieve the nth pyramid layer struct from the PyramidList. * If the nth layer does not exist, NULL will be returned. */// RasterPyramid getRasterPyramid(int thePyramidNo); /**Currently returns always false*/ bool isEditable() const; /** Return time stamp for given file name */ static QDateTime lastModified ( const QString & name ); /**Copies the symbology settings from another layer. Returns true in case of success*/ bool copySymbologySettings(const QgsMapLayer& other) { //preventwarnings if (other.type() < 0) { return false; } return false; } //todo bool isSymbologyCompatible(const QgsMapLayer& other) const { //preventwarnings if (other.type() < 0) { return false; } return false; } //todo /**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -