⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qgsrasterlayer.h

📁 一个非常好的GIS开源新版本
💻 H
📖 第 1 页 / 共 3 页
字号:
     * If an operation returns 0 (e.g. draw()), this function     * returns the text of the error associated with the failure.     * Interactive users of this provider can then, for example,     * call a QMessageBox to display the contents.     */    QString errorCaptionString();      /**     * If an operation returns 0 (e.g. draw()), this function     * returns the text of the error associated with the failure.     * Interactive users of this provider can then, for example,     * call a QMessageBox to display the contents.     */    QString errorString();    /** Returns the data provider     *     *  \retval 0 if not using the data provider model (i.e. directly using GDAL)     */    QgsRasterDataProvider* getDataProvider();    /** Returns the data provider in a const-correct manner     *     *  \retval 0 if not using the data provider model (i.e. directly using GDAL)     */    const QgsRasterDataProvider* getDataProvider() const;     /** \brief Mutator for mUserDefinedRGBMinMaxFlag */    void setUserDefinedRGBMinMax(bool theBool)    {      mUserDefinedRGBMinMaxFlag = theBool;    }     /** \brief Accessor for userDefinedMinMax.  */    bool getUserDefinedRGBMinMax()    {      return mUserDefinedRGBMinMaxFlag;    }    /** \brief Mutator for mUserDefinedRGBMinMaxFlag */    void setUserDefinedGrayMinMax(bool theBool)    {      mUserDefinedGrayMinMaxFlag = theBool;    }     /** \brief Accessor for userDefinedMinMax.  */    bool getUserDefinedGrayMinMax()    {      return mUserDefinedGrayMinMaxFlag;    }public slots:        /**     * Convert this raster to another format     */    //void const convertTo();    /**     * Mainly inteded for use in propogating progress updates from gdal up to the parent app.     **/    void updateProgress(int,int);    /** \brief Create  gdal pyramid overviews  for this layer.    * This will speed up performance at the expense of hard drive space.    * Also, write access to the file is required. If no paramter is passed in    * it will default to nearest neighbor resampling.    * \return null string on success, otherwise a string specifying error    */    QString buildPyramids(const RasterPyramidList &,                           const QString &  theResamplingMethod="NEAREST");    /** \brief Used at the moment by the above function but hopefully will later    be useable by any operation that needs to notify the user of its progress. *//*    int showTextProgress( double theProgress,                          const char *theMessageCharArray,                          void *theData);    */  /** Populate the histogram vector for a given layer  * @param theBandNoInt - which band to compute the histogram for  * @param theBinCountInt - how many 'bins' to categorise the data into  * @param theIgnoreOutOfRangeFlag - whether to ignore values that are out of range (default=true)  * @param theThoroughBandScanFlag - whether to visit each cell when computing the histogram (default=false)  */  void populateHistogram(int theBandNoInt,                          int theBinCountInt=256,                         bool theIgnoreOutOfRangeFlag=true,                         bool theThoroughBandScanFlag=false);    /** \brief Color table      *  \param band number     *  \return pointer to color table     */    QgsColorTable *colorTable ( int theBandNoInt ); protected:    /** reads vector layer specific state from project file DOM node.        @note        Called by QgsMapLayer::readXML().    */    /* virtual */ bool readXML_( QDomNode & layer_node );  /** write vector layer specific state to project file DOM node.      @note      Called by QgsMapLayer::writeXML().  */  /* virtual */ bool writeXML_( QDomNode & layer_node, QDomDocument & doc );    private:    //    // Private methods    //    /** \brief Paint debug information onto the output image.  */    void showDebugOverlay(QPainter * theQPainter, QgsRasterViewPort * theRasterViewPort);    //    // Grayscale Imagery    //    /** \brief Drawing routine for single band grayscale image.  */    void drawSingleBandGray(QPainter * theQPainter,                             QgsRasterViewPort * theRasterViewPort,                            QgsMapToPixel * theQgsMapToPixel,                            int theBandNoInt);    /** \brief Drawing routine for single band grayscale image, rendered in pseudocolor.  */    void drawSingleBandPseudoColor(QPainter * theQPainter,                                    QgsRasterViewPort * theRasterViewPort,                                   QgsMapToPixel * theQgsMapToPixel,                                   int theBandNoInt);    //    // Paletted Layers    //        /** \brief Drawing routine for paletted image, rendered as a single band image in color.  */    void drawPalettedSingleBandColor(QPainter * theQPainter,                                     QgsRasterViewPort * theRasterViewPort,                                     QgsMapToPixel * theQgsMapToPixel,                                     int theBandNoInt);        /** \brief Drawing routine for paletted image, rendered as a single band image in grayscale.  */    void drawPalettedSingleBandGray(QPainter * theQPainter,                                    QgsRasterViewPort * theRasterViewPort,                                    QgsMapToPixel * theQgsMapToPixel,                                    int theBandNoInt,                                    const QString &  theColorQString);    /** \brief Drawing routine for paletted image, rendered as a single band image in pseudocolor.  */    void drawPalettedSingleBandPseudoColor(QPainter * theQPainter,                                           QgsRasterViewPort * theRasterViewPort,                                           QgsMapToPixel * theQgsMapToPixel,                                           int theBandNoInt,                                           const QString &  theColorQString);    /** \brief Drawing routine for paletted multiband image.  */    void drawPalettedMultiBandColor(QPainter * theQPainter,                                    QgsRasterViewPort * theRasterViewPort,                                    QgsMapToPixel * theQgsMapToPixel,                                                                    int theBandNoInt);    //    // Multiband Layers    //        /** \brief Drawing routine for multiband image, rendered as a single band image in grayscale.  */    void drawMultiBandSingleBandGray(QPainter * theQPainter,                                     QgsRasterViewPort * theRasterViewPort,                                      QgsMapToPixel * theQgsMapToPixel,                                     int theBandNoInt);    /** \brief Drawing routine for multiband image, rendered as a single band image in pseudocolor.  */    void drawMultiBandSingleBandPseudoColor(QPainter * theQPainter,                                             QgsRasterViewPort * theRasterViewPort,                                             QgsMapToPixel * theQgsMapToPixel,                                            int theBandNoInt);    /** \brief Drawing routine for multiband image  */    void drawMultiBandColor(QPainter * theQPainter,                             QgsRasterViewPort * theRasterViewPort,                            QgsMapToPixel * theQgsMapToPixel);    /** \brief Places the rendered image onto the canvas */    void paintImageToCanvas(QPainter* theQPainter, QgsRasterViewPort * theRasterViewPort,                            QgsMapToPixel * theQgsMapToPixel, QImage* theImage);    /** \brief Read color table from GDAL raster band */    void readColorTable ( GDALRasterBandH gdalBand, QgsColorTable *theColorTable );    /** \brief Allocate memory and load data to that allocated memory, data type is the same     *         as raster band. The memory must be released later!     *  \return pointer to the memory     */    void *readData ( GDALRasterBandH gdalBand, QgsRasterViewPort *viewPort );    /** \brief Read a raster value on given position from memory block created by readData()      *  \param index index in memory block     */    inline double readValue ( void *data, GDALDataType type, int index );    /**       Load the given raster file       @returns true if successfully read file       @note              Called from ctor if a raster image given there     */    bool readFile( const QString & fileName );        /** \brief Close data set and release related data */    void closeDataset ();    /** \brief Update the layer if it is outdated */    bool update ();    //    // Private member vars    //    /** \brief  Raster width. */    int mRasterXDim;    /** \brief  Raster Height. */    int mRasterYDim;    /** \brief Cell value representing no data. e.g. -9999  */    double mNoDataValue;    /** \brief Flag indicating if the nodatavalue is valid*/    bool mValidNoDataValue;    /** \brief Flag to indicate whether debug infor overlay should be rendered onto the raster.  */    bool mDebugOverlayFlag;    /** \brief Pointer to the gdaldataset.  */    GDALDatasetH mGdalBaseDataset;    /** \brief Pointer to the gdaldataset (possibly warped vrt).  */    GDALDatasetH mGdalDataset;    /** \brief Values for mapping pixel to world coordinates. Contents of     * this array are the same as the gdal adfGeoTransform */    double mGeoTransform[6];    /** \brief Flag indicating whether the colour of pixels should be inverted or not.  */    bool mInvertPixelsFlag;    /** \brief Number of stddev to plot (0) to ignore. Not applicable to all layer types.  */    double mStandardDeviations;    /** \brief A collection of stats - one for each band in the layer.     * The typedef for this is defined above before class declaration     */    RasterStatsList mRasterStatsList;    /** \brief List containging the contrast enhancements for each band */    ContrastEnhancementList mContrastEnhancementList;    /** \brief The contrast enhancement algorithm being used */    QgsContrastEnhancement::CONTRAST_ENHANCEMENT_ALGORITHM mContrastEnhancementAlgorithm;    /** \brief The raster shading algorithm being used */    COLOR_SHADING_ALGORITHM mColorShadingAlgorithm;    /** \brief The raster shader for the layer */    QgsRasterShader* mRasterShader;    /** \brief The band to be associated with the color red - usually 1.  */    QString mRedBandName;    /** \brief The band to be associated with the color green - usually 2.  */    QString mGreenBandName;    /** \brief The band to be associated with the color blue - usually 3.  */    QString mBlueBandName;    /** \brief The transparency container */    QgsRasterTransparency mRasterTransparency;    /** \brief The band to be associated with transparency.  */    QString mTransparencyBandName;    /** \brief The Layer to be associated with transparency.  */    QString mTransparentLayerName;    /** \brief The band to be associated with the grayscale only ouput - usually 1.  */    QString mGrayBandName;    /** \brief Whether this raster has overviews / pyramids or not */    bool hasPyramidsFlag;    /** \brief Flag to indicate if the user entered custom min max values */    bool mUserDefinedRGBMinMaxFlag;    /** \brief Flag to indicate if the user entered custom min max values */    bool mUserDefinedGrayMinMaxFlag;    /** \brief This list holds a series of RasterPyramid structs     * which store infomation for each potential pyramid level for this raster.*/    RasterPyramidList mPyramidList;/* *  * New functions that will convert this class to a data provider interface * (B Morley) * */  public:   //! Constructor in provider mode  // TODO Rename into a general constructor when the old raster interface is retired  // \param  dummy  is just there to distinguish this function signature from the old non-provider one.  QgsRasterLayer(int dummy,                  const QString & baseName = QString(),                 const QString & path = QString(),                 const QString & providerLib = QString(),                 const QStringList & layers = QStringList(),                 const QStringList & styles = QStringList(),                 const QString & format = QString(),                 const QString & crs = QString(),                 const QString & proxyHost = QString(),                 int proxyPort = 80,                 const QString & proxyUser = QString(),                 const QString & proxyPass = QString());  void setDataProvider( const QString & provider,                        const QStringList & layers,                        const QStringList & styles,                        const QString & format,                        const QString & crs,                        const QString & proxyHost,                        int proxyPort,                        const QString & proxyUser,                        const QString & proxyPass );  //! Does this layer use a provider for setting/retrieving data?  bool usesProvider();  /**   * Sets a proxy for the path given in the constructor   *   * \retval TRUE if proxy setting is successful (if indeed it is supported)   */  bool setProxy(const QString & host = 0,                            int port = 80,                const QString & user = 0,                const QString & pass = 0);  //! Which provider is being used for this Raster Layer?  QString providerKey();public slots:  void showStatusMessage(const QString & theMessage);private:    //! Data provider key  QString mProviderKey;    //! pointer for loading the provider library  QLibrary *mLib;  //! Pointer to data provider derived from the abstract base class QgsDataProvider  QgsRasterDataProvider *mDataProvider;  /**Flag indicating wheter the layer is in editing mode or not*/  bool mEditable;    /**Flag indicating wheter the layer has been modified since the last commit*/  bool mModified;  //! Timestamp, the last modified time of the data source when the layer was created  QDateTime mLastModified;  /**   * The error caption associated with the last error.   */  QString mErrorCaption;  /**   * The error message associated with the last error.   */  QString mError;};#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -