Skip to content
Permalink
Browse files

[API] add sip bindings for QgsCsException

  • Loading branch information
jef-n committed Jan 28, 2012
1 parent 3c45355 commit 2564e6a79ac91b733fa5ed562ef170a2878610eb
@@ -102,7 +102,7 @@ MACRO(ADD_SIP_PYTHON_MODULE MODULE_NAME MODULE_SIP)
OUTPUT ${_sip_output_files}
COMMAND ${CMAKE_COMMAND} -E echo ${message}
COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files}
COMMAND ${SIP_BINARY_PATH} ${_sip_tags} ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} ${_sip_includes} ${_abs_module_sip}
COMMAND ${SIP_BINARY_PATH} ${_sip_tags} -e ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} ${_sip_includes} ${_abs_module_sip}
DEPENDS ${_abs_module_sip} ${SIP_EXTRA_FILES_DEPEND}
)
# not sure if type MODULE could be uses anywhere, limit to cygwin for now
@@ -6,6 +6,7 @@
%Import QtNetwork/QtNetworkmod.sip

%Include conversions.sip
%Include qgsexception.sip

// TODO: more files to wrap

@@ -91,7 +91,7 @@ class QgsCoordinateTransform : QObject
* @param direction TransformDirection (defaults to ForwardTransform)
* @return QgsPoint in Destination Coordinate System
*/
QgsPoint transform(const QgsPoint p,TransformDirection direction=ForwardTransform);
QgsPoint transform(const QgsPoint p,TransformDirection direction=ForwardTransform) throw (QgsCsException);

/*! Transform the point specified by x,y from Source Coordinate System to Destination Coordinate System
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
@@ -101,7 +101,7 @@ class QgsCoordinateTransform : QObject
* @param direction TransformDirection (defaults to ForwardTransform)
* @return QgsPoint in Destination Coordinate System
*/
QgsPoint transform(const double x, const double y,TransformDirection direction=ForwardTransform);
QgsPoint transform(const double x, const double y,TransformDirection direction=ForwardTransform) throw (QgsCsException);

/*! Transform a QgsRectangle to the dest Coordinate system
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
@@ -113,12 +113,12 @@ class QgsCoordinateTransform : QObject
* @param direction TransformDirection (defaults to ForwardTransform)
* @return QgsRectangle in Destination Coordinate System
*/
QgsRectangle transformBoundingBox(const QgsRectangle theRect,TransformDirection direction=ForwardTransform);
QgsRectangle transformBoundingBox(const QgsRectangle theRect,TransformDirection direction=ForwardTransform) throw (QgsCsException);

// Same as for the other transform() functions, but alters the x
// and y variables in place. The second one works with good old-fashioned
// C style arrays.
void transformInPlace(double& x, double& y, double &z, TransformDirection direction = ForwardTransform);
void transformInPlace(double& x, double& y, double &z, TransformDirection direction = ForwardTransform) throw (QgsCsException);

// TODO: argument not supported
//void transformInPlace(std::vector<double>& x, std::vector<double>& y, std::vector<double>& z,
@@ -131,7 +131,7 @@ class QgsCoordinateTransform : QObject
* @param direction TransformDirection (defaults to ForwardTransform)
* @return QgsRectangle in Destination Coordinate System
*/
QgsRectangle transform(const QgsRectangle theRect,TransformDirection direction=ForwardTransform);
QgsRectangle transform(const QgsRectangle theRect,TransformDirection direction=ForwardTransform) throw (QgsCsException);

/*! Transform an array of coordinates to a different Coordinate System
* If the direction is ForwardTransform then coordinates are transformed from layer CS --> map canvas CS,
@@ -141,7 +141,7 @@ class QgsCoordinateTransform : QObject
* @param direction TransformDirection (defaults to ForwardTransform)
* @return QgsRectangle in Destination Coordinate System
*/
void transformCoords( const int &numPoint, double *x, double *y, double *z,TransformDirection direction=ForwardTransform);
void transformCoords( const int &numPoint, double *x, double *y, double *z,TransformDirection direction=ForwardTransform) throw (QgsCsException);

/*!
* Flag to indicate whether the coordinate systems have been initialised
@@ -0,0 +1,17 @@
%Exception QgsCsException(SIP_Exception) /PyName=QgsCsException/
{
%RaiseCode
SIP_BLOCK_THREADS
PyErr_SetString(sipException_QgsCsException, sipExceptionRef.what().toUtf8().constData() );
SIP_UNBLOCK_THREADS
%End
};

%Exception QgsException(SIP_Exception) /PyName=QgsException/
{
%RaiseCode
SIP_BLOCK_THREADS
PyErr_SetString(sipException_QgsException, sipExceptionRef.what().toUtf8().constData() );
SIP_UNBLOCK_THREADS
%End
};
@@ -324,7 +324,17 @@ bool QgsMapToolIdentify::identifyRasterLayer( QgsRasterLayer *layer, int x, int

QMap< QString, QString > attributes, derivedAttributes;
QgsPoint idPoint = mCanvas->getCoordinateTransform()->toMapCoordinates( x, y );
idPoint = toLayerCoordinates( layer, idPoint );
try
{
idPoint = toLayerCoordinates( layer, idPoint );
}
catch( QgsCsException &cse )
{
Q_UNUSED( cse );
QgsDebugMsg( QString( "coordinate not reprojectable: %1" ).arg( cse.what() ) );
return false;
}

QString type;

if ( layer->providerType() == "wms" )
@@ -1885,13 +1885,13 @@ QgsRasterBandStats QgsGdalProvider::bandStatistics( int theBandNo )
myRasterBandStats.statsGathered = true;

#ifdef QGISDEBUG
QgsLogger::debug( "************ STATS **************", 1, __FILE__, __FUNCTION__, __LINE__ );
QgsLogger::debug( "VALID NODATA", mValidNoDataValue, 1, __FILE__, __FUNCTION__, __LINE__ );
QgsLogger::debug( "MIN", myRasterBandStats.minimumValue, 1, __FILE__, __FUNCTION__, __LINE__ );
QgsLogger::debug( "MAX", myRasterBandStats.maximumValue, 1, __FILE__, __FUNCTION__, __LINE__ );
QgsLogger::debug( "RANGE", myRasterBandStats.range, 1, __FILE__, __FUNCTION__, __LINE__ );
QgsLogger::debug( "MEAN", myRasterBandStats.mean, 1, __FILE__, __FUNCTION__, __LINE__ );
QgsLogger::debug( "STDDEV", myRasterBandStats.stdDev, 1, __FILE__, __FUNCTION__, __LINE__ );
QgsDebugMsg( "************ STATS **************" );
QgsDebugMsg( QString( "VALID NODATA %1" ).arg( mValidNoDataValue ) );
QgsDebugMsg( QString( "MIN %1" ).arg( myRasterBandStats.minimumValue ) );
QgsDebugMsg( QString( "MAX %1" ).arg( myRasterBandStats.maximumValue ) );
QgsDebugMsg( QString( "RANGE %1" ).arg( myRasterBandStats.range ) );
QgsDebugMsg( QString( "MEAN %1" ).arg( myRasterBandStats.mean ) );
QgsDebugMsg( QString( "STDDEV %1" ).arg( myRasterBandStats.stdDev ) );
#endif

myRasterBandStats.statsGathered = true;

0 comments on commit 2564e6a

Please sign in to comment.
You can’t perform that action at this time.