{
}
-TopoDS_Shape HYDROData_ProfileUZ::GetShape()
+QStringList HYDROData_ProfileUZ::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+{
+ QStringList aResList = dumpObjectCreation( theTreatedObjects );
+ QString aName = GetObjPyName();
+
+ // Set polilyne data
+ const TCollection_AsciiString& aSectName = GetSectionName( 0 );
+ const SectionType& aSectType = GetSectionType( 0 );
+ bool aSectClosure = IsClosedSection( 0 );
+
+ aResList << QString( "%1.AddSection( \"%2\", %3, %4 );" ).arg( aName )
+ .arg( aSectName.ToCString() ).arg( aSectType ).arg( aSectClosure );
+
+ HYDROData_IPolyline::PointsList aSectPointsList = GetPoints( 0 );
+ for ( int k = 1, aNbPoints = aSectPointsList.Size(); k <= aNbPoints; ++k )
+ {
+ const Point& aSectPoint = aSectPointsList.Value( k );
+
+ aResList << QString( "%1.AddPoint( 0, gp_XY( %2, %3 ) );" ).arg( aName )
+ .arg( aSectPoint.X() ).arg( aSectPoint.Y() );
+ }
+
+ aResList << QString( "" );
+ aResList << QString( "%1.Update();" ).arg( aName );
+ aResList << QString( "" );
+
+ return aResList;
+}
+
+TopoDS_Shape HYDROData_ProfileUZ::GetShape() const
{
// TODO
return TopoDS_Shape();
}
-double HYDROData_ProfileUZ::GetDepthFromDistance( const double& theDistance ) const
+double HYDROData_ProfileUZ::GetDepthFromDistance( const PointsList& thePoints,
+ const double& theDistance )
{
double aResDepth = 0.0;
- HYDROData_IPolyline::PointsList aPoints = GetPoints();
- int aNbPoints = aPoints.Size();
+ int aNbPoints = thePoints.Size();
if ( aNbPoints < 2 )
return aResDepth;
double aCompDist = 0.0;
- HYDROData_IPolyline::Point aPrevPoint = aPoints.First();
+ HYDROData_IPolyline::Point aPrevPoint = thePoints.First();
for ( int i = 2; i <= aNbPoints; ++i )
{
- const Point& aCurPoint = aPoints.Value( i );
+ const Point& aCurPoint = thePoints.Value( i );
double aPntDist = gp_Pnt2d( aPrevPoint.X(), 0 ).Distance( gp_Pnt2d( aCurPoint.X(), 0 ) );
if ( theDistance < aCompDist )
{
- double aComPntDist = gp_Pnt2d( aPoints.First().X(), 0 ).Distance( gp_Pnt2d( aPrevPoint.X(), 0 ) );
+ double aComPntDist = gp_Pnt2d( thePoints.First().X(), 0 ).Distance( gp_Pnt2d( aPrevPoint.X(), 0 ) );
double aFindDist = theDistance - aComPntDist;
double aRatio = aFindDist / ( aPntDist - aFindDist );