IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Profile, HYDROData_Object)
HYDROData_Profile::HYDROData_Profile()
IMPLEMENT_STANDARD_RTTIEXT(HYDROData_Profile, HYDROData_Object)
HYDROData_Profile::HYDROData_Profile()
bool HYDROData_Profile::IsValid() const
{
gp_XY aFirstPoint, aLastPoint;
bool HYDROData_Profile::IsValid() const
{
gp_XY aFirstPoint, aLastPoint;
anArray->SetValue( 0, aLPoint.X() );
anArray->SetValue( 1, aLPoint.Y() );
anArray->SetValue( 0, aLPoint.X() );
anArray->SetValue( 1, aLPoint.Y() );
thePoint.SetY( 0 ); //default left point of not-georeferenced profile
TDF_Label aLabel = myLab.FindChild( DataTag_FirstPoint, false );
if ( aLabel.IsNull() )
thePoint.SetY( 0 ); //default left point of not-georeferenced profile
TDF_Label aLabel = myLab.FindChild( DataTag_FirstPoint, false );
if ( aLabel.IsNull() )
anArray->SetValue( 0, aLPoint.X() );
anArray->SetValue( 1, aLPoint.Y() );
anArray->SetValue( 0, aLPoint.X() );
anArray->SetValue( 1, aLPoint.Y() );
const HYDROData_ProfileUZ::Point& aFirstParPoint = aParametricPoints.First();
const HYDROData_ProfileUZ::Point& aLastParPoint = aParametricPoints.Last();
const HYDROData_ProfileUZ::Point& aFirstParPoint = aParametricPoints.First();
const HYDROData_ProfileUZ::Point& aLastParPoint = aParametricPoints.Last();
- double aGeoDistance = gp_Pnt2d( aFirstPoint ).Distance( aLastPoint );
- double aParCommonDist = gp_Pnt2d( aFirstParPoint.X(), 0 ).Distance( gp_Pnt2d( aLastParPoint.X(), 0 ) );
+ double aFullLength = aLastPoint.X() - aFirstPoint.X();
+ double aParFullLength = aLastParPoint.X() - aFirstParPoint.X();
- double aParPointDist = gp_Pnt2d( aFirstParPoint.X(), 0 ).Distance( gp_Pnt2d( aParPoint.X(), 0 ) );
-
- double aParLen = ( aParPointDist / aParCommonDist ) * aGeoDistance;
-
- double aRatio = aParLen / ( aGeoDistance - aParLen );
+ double aParPointDist = aParPoint.X() - aFirstParPoint.X();
+ double aRatio = aParPointDist / aParFullLength;
- double aParX = ( aFirstPoint.X() + aRatio * aLastPoint.X() ) / ( 1 + aRatio );
- double aParY = ( aFirstPoint.Y() + aRatio * aLastPoint.Y() ) / ( 1 + aRatio );
+ double aParX = aFirstPoint.X() * (1-aRatio) + aLastPoint.X() * aRatio;
+ double aParY = aFirstPoint.Y() * (1-aRatio) + aLastPoint.Y() * aRatio;
ProfilePoint aCompPoint( aParX, aParY, aParPoint.Y() );
aResPoints.Append( aCompPoint );
ProfilePoint aCompPoint( aParX, aParY, aParPoint.Y() );
aResPoints.Append( aCompPoint );
{
ProfilePoint aMiddlePoint;
gp_XY aLeftPnt, aRightPnt;
{
ProfilePoint aMiddlePoint;
gp_XY aLeftPnt, aRightPnt;
- if ( GetLeftPoint( aLeftPnt, false ) && GetRightPoint( aRightPnt, false ) ) {
+ if ( GetLeftPoint( aLeftPnt, true, CanUseDefault ) && GetRightPoint( aRightPnt, true, CanUseDefault ) ) {
gp_XYZ aPnt1( aLeftPnt.X(), aLeftPnt.Y(), 0. );
gp_XYZ aPnt2( aRightPnt.X(), aRightPnt.Y(), 0. );
gp_Pnt aMiddlePoint2d( 0.5 * ( aPnt1 + aPnt2 ) );
gp_XYZ aPnt1( aLeftPnt.X(), aLeftPnt.Y(), 0. );
gp_XYZ aPnt2( aRightPnt.X(), aRightPnt.Y(), 0. );
gp_Pnt aMiddlePoint2d( 0.5 * ( aPnt1 + aPnt2 ) );