Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
299 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
class QgsErrorMessage | ||
{ | ||
%TypeHeaderCode | ||
#include <qgserror.h> | ||
%End | ||
public: | ||
enum Format | ||
{ | ||
Text, // Plain text | ||
Html | ||
}; | ||
|
||
QgsErrorMessage(); | ||
|
||
QgsErrorMessage( const QString & theMessage, const QString & theTag = QString::null, const QString & theFile = QString::null, const QString & theFunction = QString::null, int theLine = 0 ); | ||
|
||
QString message() const; | ||
QString tag() const; | ||
QString file() const; | ||
QString function() const; | ||
int line() const; | ||
}; | ||
|
||
class QgsError | ||
{ | ||
%TypeHeaderCode | ||
#include <qgserror.h> | ||
%End | ||
public: | ||
|
||
QgsError(); | ||
|
||
QgsError( const QString & theMessage, const QString & theTag ); | ||
|
||
void append( const QString & theMessage, const QString & theTag ); | ||
|
||
void append( const QgsErrorMessage & theMessage ); | ||
|
||
bool isEmpty() const; | ||
|
||
QString message( QgsErrorMessage::Format theFormat = QgsErrorMessage::Html ) const; | ||
|
||
QString summary() const; | ||
|
||
void clear(); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
class QgsRasterIdentifyResult | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsrasteridentifyresult.h> | ||
%End | ||
public: | ||
QgsRasterIdentifyResult(); | ||
|
||
QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormat theFormat, QMap<int, QVariant> theResults ); | ||
|
||
QgsRasterIdentifyResult( QgsError theError ); | ||
|
||
virtual ~QgsRasterIdentifyResult(); | ||
|
||
bool isValid() const; | ||
|
||
QgsRasterDataProvider::IdentifyFormat format() const; | ||
|
||
QMap<int, QVariant> results() const; | ||
|
||
void setParams( const QMap<QString, QVariant> & theParams ); | ||
|
||
QMap<QString, QVariant> params() const; | ||
|
||
QgsError error() const; | ||
|
||
void setError( const QgsError & theError ); | ||
|
||
void appendError( const QgsErrorMessage & theMessage ); | ||
|
||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/*************************************************************************** | ||
qgsrasteridentifyresult.cpp | ||
-------------------------------------- | ||
Date : Apr 8, 2013 | ||
Copyright : (C) 2013 by Radim Blazek | ||
email : radim dot blazek at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
//#include <QTime> | ||
|
||
#include "qgis.h" | ||
#include "qgslogger.h" | ||
#include "qgsrasteridentifyresult.h" | ||
#include "qgsrasterdataprovider.h" | ||
|
||
QgsRasterIdentifyResult::QgsRasterIdentifyResult() | ||
: mValid(false) | ||
, mFormat(QgsRasterDataProvider::IdentifyFormatUndefined) | ||
{ | ||
} | ||
|
||
QgsRasterIdentifyResult::QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormat theFormat, QMap<int, QVariant> theResults ) | ||
: mValid(true) | ||
, mFormat(theFormat) | ||
, mResults(theResults) | ||
{ | ||
} | ||
|
||
QgsRasterIdentifyResult::QgsRasterIdentifyResult( QgsError theError ) | ||
: mValid(false) | ||
, mFormat(QgsRasterDataProvider::IdentifyFormatUndefined) | ||
, mError(theError) | ||
{ | ||
} | ||
|
||
QgsRasterIdentifyResult::~QgsRasterIdentifyResult() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/*************************************************************************** | ||
qgsrasteridentifyresult.h | ||
-------------------------------------- | ||
Date : Apr 8, 2013 | ||
Copyright : (C) 2013 by Radim Blazek | ||
email : radim dot blazek at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSRASTERIDENTIFYRESULT_H | ||
#define QGSRASTERIDENTIFYRESULT_H | ||
|
||
#include "qgis.h" | ||
#include "qgslogger.h" | ||
#include "qgsrasterdataprovider.h" | ||
|
||
/** \ingroup core | ||
* Raster identify results container. | ||
*/ | ||
class CORE_EXPORT QgsRasterIdentifyResult | ||
{ | ||
public: | ||
QgsRasterIdentifyResult(); | ||
|
||
/** \brief Constructor. Creates valid result. | ||
* @param theResults results | ||
*/ | ||
QgsRasterIdentifyResult( QgsRasterDataProvider::IdentifyFormat theFormat, QMap<int, QVariant> theResults ); | ||
|
||
/** \brief Constructor. Creates invalid result with error. | ||
* @param theResults results | ||
*/ | ||
QgsRasterIdentifyResult( QgsError theError ); | ||
|
||
virtual ~QgsRasterIdentifyResult(); | ||
|
||
/** \brief Returns true if valid */ | ||
bool isValid() const { return mValid; } | ||
|
||
/** \brief Get results format */ | ||
QgsRasterDataProvider::IdentifyFormat format() const { return mFormat; } | ||
|
||
/** \brief Get results. Results are different for each format: | ||
* IdentifyFormatValue: map of values for each band, keys are band numbers (from 1). | ||
* IdentifyFormatFeature: map of QgsRasterFeatureList for each sublayer (WMS) | ||
* IdentifyFormatHtml: map of HTML strings for each sublayer (WMS). | ||
*/ | ||
QMap<int, QVariant> results() const { return mResults; } | ||
|
||
/** Set map of optional parameters */ | ||
void setParams( const QMap<QString, QVariant> & theParams ) { mParams = theParams; } | ||
|
||
/** Get map of optional parameters */ | ||
QMap<QString, QVariant> params() const { return mParams; } | ||
|
||
/** \brief Get error */ | ||
QgsError error() const { return mError; } | ||
|
||
/** \brief Set error */ | ||
void setError( const QgsError & theError ) { mError = theError;} | ||
|
||
/** \brief Add error message */ | ||
void appendError( const QgsErrorMessage & theMessage ) { mError.append( theMessage );} | ||
|
||
private: | ||
/** \brief Is valid */ | ||
bool mValid; | ||
|
||
/** \brief Results format */ | ||
QgsRasterDataProvider::IdentifyFormat mFormat; | ||
|
||
/** \brief Results */ | ||
// TODO: better hierarchy (sublayer multiple feature sets)? | ||
// TODO?: results are not consistent for different formats (per band x per sublayer) | ||
QMap<int, QVariant> mResults; | ||
|
||
/** \brief Additional params (e.g. request url used by WMS) */ | ||
QMap<QString, QVariant> mParams; | ||
|
||
/** \brief Error */ | ||
QgsError mError; | ||
}; | ||
|
||
#endif | ||
|
||
|
Oops, something went wrong.