return aResList;
}
-double HYDROData_AltitudeObject::GetAltitudeForPoint( const gp_XY& thePoint ) const
+double HYDROData_AltitudeObject::GetAltitudeForPoint( const gp_XY& thePoint,
+ int theMethod) const
{
DEBTRACE("HYDROData_AltitudeObject::GetAltitudeForPoint");
double aResAltitude = GetInvalidAltitude();
* \param thePoint the point to examine
* \return altitude value
*/
- HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
+ int theMethod = 0) const;
protected:
return false;
}
-double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint) const
+double HYDROData_Bathymetry::GetAltitudeForPoint(const gp_XY& thePoint, int theMethod) const
{
- DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << ")");
+ DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << "), interpolation method: " << theMethod);
double anInvalidAltitude = GetInvalidAltitude();
double aResAltitude = anInvalidAltitude;
// - get the triangle containing the point in the Delaunay2D mesh,
// - interpolate altitude
- bool isBathyInterpolRequired = true;
+ bool isBathyInterpolRequired = false;
+ if (theMethod)
+ isBathyInterpolRequired =true;
if (isBathyInterpolRequired)
{
vtkPolyData* aDelaunay2D = GetVtkDelaunay2D();
/**
* Returns altitude for given point.
* \param thePoint the point to examine
+ * \param theMethod interpolation model, default 0 = nearest point
* \return altitude value
*/
- HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint, int theMethod=0 ) const;
public:
// Public methods to work with files.
}
double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint,
- const Handle(HYDROData_Region)& theRegion ) const
+ const Handle(HYDROData_Region)& theRegion,
+ int theMethod) const
{
double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude();
//DEBTRACE("GetAltitudeForPoint Region " << theRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString());
Handle(HYDROData_Region) aRefRegion = Handle(HYDROData_Region)::DownCast( aZone->GetFatherObject() );
if ( IsEqual( aRefRegion, theRegion ) )
- aResAltitude = GetAltitudeForPoint( thePoint, aZone );
+ aResAltitude = GetAltitudeForPoint( thePoint, aZone, theMethod );
else
{
DEBTRACE("GetAltitudeForPoint Region " << aRefRegion->GetName().toStdString() << " Zone " << aZone->GetName().toStdString() << " ---------------------------");
- aResAltitude = GetAltitudeForPoint( thePoint, aZone );
+ aResAltitude = GetAltitudeForPoint( thePoint, aZone, theMethod );
}
}
else
}
double HYDROData_CalculationCase::GetAltitudeForPoint( const gp_XY& thePoint,
- const Handle(HYDROData_Zone)& theZone ) const
+ const Handle(HYDROData_Zone)& theZone,
+ int theMethod) const
{
//DEBTRACE("GetAltitudeForPoint Zone " << theZone->GetName().toStdString());
double aResAltitude = HYDROData_IAltitudeObject::GetInvalidAltitude();
else
{
//DEBTRACE("aZoneInterpolator == NULL");
- aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint );
+ aPointAltitude = anObjAltitude->GetAltitudeForPoint( thePoint, theMethod );
}
if ( ValuesEquals( aPointAltitude, HYDROData_IAltitudeObject::GetInvalidAltitude() ) )
NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
const NCollection_Sequence<gp_XY>& thePoints,
- const Handle(HYDROData_Region)& theRegion ) const
+ const Handle(HYDROData_Region)& theRegion,
+ int theMethod) const
{
- //DEBTRACE("HYDROData_CalculationCase::GetAltitudesForPoints " << theRegion->GetName().toStdString());
+ DEBTRACE("HYDROData_CalculationCase::GetAltitudesForPoints " << theRegion->GetName().toStdString());
NCollection_Sequence<double> aResSeq;
for ( int i = 1, n = thePoints.Length(); i <= n; ++i )
{
const gp_XY& thePnt = thePoints.Value( i );
- double anAltitude = GetAltitudeForPoint( thePnt, theRegion );
+ double anAltitude = GetAltitudeForPoint( thePnt, theRegion, theMethod );
aResSeq.Append( anAltitude );
}
NCollection_Sequence<double> HYDROData_CalculationCase::GetAltitudesForPoints(
const NCollection_Sequence<gp_XY>& thePoints,
- const Handle(HYDROData_Zone)& theZone ) const
+ const Handle(HYDROData_Zone)& theZone,
+ int theMethod) const
{
NCollection_Sequence<double> aResSeq;
{
const gp_XY& thePnt = thePoints.Value( i );
- double anAltitude = GetAltitudeForPoint( thePnt, theZone );
+ double anAltitude = GetAltitudeForPoint( thePnt, theZone, theMethod );
aResSeq.Append( anAltitude );
}
/**\class HYDROData_CalculationCase
- * \brief Calculation case is defined by selection of Geometry objects with or without \93Zone of water\94.
+ * \brief Calculation case is defined by selection of Geometry objects with or without �Zone of water�.
*
*/
class HYDROData_CalculationCase : public HYDROData_Entity
* \return result altitude value
*/
HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
- const Handle(HYDROData_Region)& theRegion ) const;
+ const Handle(HYDROData_Region)& theRegion,
+ int theMethod = 0) const;
/**
* Returns altitude for given point on given zone.
* \return result altitude value
*/
HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
- const Handle(HYDROData_Zone)& theZone ) const;
+ const Handle(HYDROData_Zone)& theZone,
+ int theMethod = 0) const;
/**
* Returns strickler coefficient for given point.
*/
HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
const NCollection_Sequence<gp_XY>& thePoints,
- const Handle(HYDROData_Region)& theRegion ) const;
+ const Handle(HYDROData_Region)& theRegion,
+ int theMethod = 0) const;
/**
* Returns altitudes for given points on given zone.
*/
HYDRODATA_EXPORT virtual NCollection_Sequence<double> GetAltitudesForPoints(
const NCollection_Sequence<gp_XY>& thePoints,
- const Handle(HYDROData_Zone)& theZone ) const;
+ const Handle(HYDROData_Zone)& theZone,
+ int theMethod = 0) const;
/**
* Returns region to which the point is belongs.
{
}
-double HYDROData_ChannelAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) const
+double HYDROData_ChannelAltitude::GetAltitudeForPoint( const gp_XY& thePoint,
+ int theMethod) const
{
DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << ")");
double aResAltitude = GetInvalidAltitude();
* \param thePoint the point to examine
* \return altitude value
*/
- HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
+ int theMethod =0) const;
protected:
* \param thePoint the point to examine
* \return altitude value
*/
- HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const = 0;
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint, int theMethod=0 ) const = 0;
protected:
myAltitudeObject->GetAltitudeForPoint( gp_XY( theCoordX, theCoordY ) );
}
-double HYDROData_IInterpolator::GetAltitudeForPoint( const gp_XY& thePoint ) const
+double HYDROData_IInterpolator::GetAltitudeForPoint( const gp_XY& thePoint) const
{
DEBTRACE("HYDROData_IInterpolator::GetAltitudeForPoint");
return GetAltitudeForPoint( thePoint.X(), thePoint.Y() );
{
}
-double HYDROData_ObstacleAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) const
+double HYDROData_ObstacleAltitude::GetAltitudeForPoint( const gp_XY& thePoint,
+ int theMethod) const
{
DEBTRACE("HYDROData_ObstacleAltitude::GetAltitudeForPoint");
double aResAltitude = GetInvalidAltitude();
* \param thePoint the point to examine
* \return altitude value
*/
- HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
+ int theMethod = 0) const;
protected:
return !theLeftWire.IsNull() && !theRightWire.IsNull();
}
-double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint ) const
+double HYDROData_StreamAltitude::GetAltitudeForPoint( const gp_XY& thePoint,
+ int theMethod) const
{
DEBTRACE("GetAltitudeForPoint p(" << thePoint.X() << ", " << thePoint.Y() << ")");
double aResAltitude = GetInvalidAltitude();
* \param thePoint the point to examine
* \return altitude value
*/
- HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint ) const;
+ HYDRODATA_EXPORT virtual double GetAltitudeForPoint( const gp_XY& thePoint,
+ int theMethod = 0) const;
protected:
*/
NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
const NCollection_Sequence<double>& theCoordsY,
- HYDROData_Region theRegion ) const
- [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Region& )];
+ HYDROData_Region theRegion,
+ int theMethod = 0) const
+ [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Region&, int)];
%MethodCode
NCollection_Sequence<gp_XY> aPnts;
Handle(HYDROData_Region) aRefRegion =
Handle(HYDROData_Region)::DownCast( createHandle( a2 ) );
-
+ int aMethod = a3;
+
NCollection_Sequence<double> aRes;
Py_BEGIN_ALLOW_THREADS
- aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion ) :
- sipCpp->GetAltitudesForPoints( aPnts, aRefRegion );
+ aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefRegion, aMethod ) :
+ sipCpp->GetAltitudesForPoints( aPnts, aRefRegion, aMethod );
Py_END_ALLOW_THREADS
sipRes = new NCollection_Sequence<double>( aRes );
*/
NCollection_Sequence<double> GetAltitudesForPoints( const NCollection_Sequence<double>& theCoordsX,
const NCollection_Sequence<double>& theCoordsY,
- HYDROData_Zone theZone ) const
- [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Zone& )];
+ HYDROData_Zone theZone,
+ int theMethod = 0) const
+ [NCollection_Sequence<double> ( const NCollection_Sequence<gp_XY>&, const Handle_HYDROData_Zone&, int )];
%MethodCode
NCollection_Sequence<gp_XY> aPnts;
Handle(HYDROData_Zone) aRefZone =
Handle(HYDROData_Zone)::DownCast( createHandle( a2 ) );
+ int aMethod = a3;
NCollection_Sequence<double> aRes;
Py_BEGIN_ALLOW_THREADS
- aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone ) :
- sipCpp->GetAltitudesForPoints( aPnts, aRefZone );
+ aRes = sipSelfWasArg ? sipCpp->HYDROData_CalculationCase::GetAltitudesForPoints( aPnts, aRefZone, aMethod ) :
+ sipCpp->GetAltitudesForPoints( aPnts, aRefZone, aMethod );
Py_END_ALLOW_THREADS
sipRes = new NCollection_Sequence<double>( aRes );
smesh = smeshBuilder.New(theStudy)
-def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef):
+def interpolZ(nomCas, fichierMaillage, dicoGroupeRegion, zUndef, interpolMethod = 0):
"""
interpolZ takes a 2D (x,y) mesh and calls the active instance of module HYDRO
to interpolate the bathymetry/altimetry on the mesh nodes, to produce the Z value of each node.
dicoGroupeRegion: python dictionary giving the coorespondance of mesh groups to HYDRO regions.
Key: face group name, value: region name in the HYDRO Case
zUndef: Z value to use for nodes outside the regions (there must be none if the case is correct).
+ interpolMethod: integer value, default 0 = nearest point on bathymetry, 1 = linear interpolation
return <fichierMaillage>Z.med : med file with Z value on nodes
return <fichierMaillage>F.med : an exact copy of <fichierMaillage>Z.med
"""
#print xyz
vx.append(xyz[0])
vy.append(xyz[1])
- vz = cas.GetAltitudesForPoints( vx, vy, region )
+ vz = cas.GetAltitudesForPoints( vx, vy, region, interpolMethod )
minz = min(vz)
maxz = max(vz)
statz[grp.GetName()] = (minz, maxz)