From 5a8d8e4352ca50e2b12a2ddf25f0fd8f6f842418 Mon Sep 17 00:00:00 2001 From: adv Date: Fri, 24 Jan 2014 05:54:45 +0000 Subject: [PATCH] API for GetZoneFromPoint() corrected to be more pythonic. --- src/HYDROPy/HYDROData_CalculationCase.sip | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/HYDROPy/HYDROData_CalculationCase.sip b/src/HYDROPy/HYDROData_CalculationCase.sip index 4ebb4b59..bf1cb020 100644 --- a/src/HYDROPy/HYDROData_CalculationCase.sip +++ b/src/HYDROPy/HYDROData_CalculationCase.sip @@ -296,14 +296,20 @@ public: * \param thePoint the point to examine * \return result zone */ - HYDROData_Zone GetZoneFromPoint( const gp_XY& thePoint ) const [Handle_HYDROData_Zone ( const gp_XY& )]; + HYDROData_Zone GetZoneFromPoint( SIP_PYTUPLE ) const [Handle_HYDROData_Zone ( const gp_XY& )]; %MethodCode Handle(HYDROData_Zone) aRes; - Py_BEGIN_ALLOW_THREADS - aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( *a0 ) : - sipCpp->GetZoneFromPoint( *a0 ); - Py_END_ALLOW_THREADS + double x = 0.0, y = 0.0; + if ( PyArg_ParseTuple( a0, "dd", &x, &y ) ) + { + gp_XY aPnt( x, y ); + + Py_BEGIN_ALLOW_THREADS + aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetZoneFromPoint( aPnt ) : + sipCpp->GetZoneFromPoint( aPnt ); + Py_END_ALLOW_THREADS + } sipRes = (HYDROData_Zone*)createPointer( aRes ); %End -- 2.39.2