X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_ProfileUZ.cxx;h=49fa3899596e151e8b3e7ec993ebc9765598062f;hb=4d4d74dd554819c30f1c8ded5520cc6c25aba56b;hp=a91549c5ce3ab85fdc25116e05330bcd4019b916;hpb=474c2cd65280d793f1c81ca528bc92e1cff988e6;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_ProfileUZ.cxx b/src/HYDROData/HYDROData_ProfileUZ.cxx old mode 100755 new mode 100644 index a91549c5..49fa3899 --- a/src/HYDROData/HYDROData_ProfileUZ.cxx +++ b/src/HYDROData/HYDROData_ProfileUZ.cxx @@ -1,8 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE -// -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// +// Copyright (C) 2014-2015 EDF-R&D // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either @@ -36,6 +32,9 @@ #include +#include +#include + IMPLEMENT_STANDARD_HANDLE(HYDROData_ProfileUZ, HYDROData_IPolyline) IMPLEMENT_STANDARD_RTTIEXT(HYDROData_ProfileUZ, HYDROData_IPolyline) @@ -259,7 +258,7 @@ void HYDROData_ProfileUZ::RemovePoint( const int /*theSectionIndex*/, } } -HYDROData_ProfileUZ::PointsList HYDROData_ProfileUZ::GetPoints( const int /*theSectionIndex*/ ) const +HYDROData_ProfileUZ::PointsList HYDROData_ProfileUZ::GetPoints( const int /*theSectionIndex*/, bool /*IsConvertToGlobal*/ ) const { PointsList aResList; @@ -279,4 +278,36 @@ HYDROData_ProfileUZ::PointsList HYDROData_ProfileUZ::GetPoints( const int /*theS return aResList; } +void HYDROData_ProfileUZ::CalculateAndAddPoints(const NCollection_Sequence& theXYZPoints, Handle_HYDROData_PolylineXY& thePolylineXY) +{ + // Fill 2D polyline + for ( int i = 1; i <= theXYZPoints.Size(); i++ ) { + const HYDROData_Profile::ProfilePoint& aBottomPoint = theXYZPoints.Value( i ); + thePolylineXY->AddPoint( 0, HYDROData_PolylineXY::Point( aBottomPoint.X(), aBottomPoint.Y() ) ); + } + + // Calculate profile UZ points + + // First point + const HYDROData_Profile::ProfilePoint& aFirstBottomPoint = theXYZPoints.First(); + AddPoint( 0, HYDROData_ProfileUZ::Point( 0, aFirstBottomPoint.Z() ) ); + + // Intermediate points + double aPolylineCommonDist = thePolylineXY->GetDistance( 0, thePolylineXY->NbPoints( 0 ) - 1 ); + + for ( int i = 2, aNbPoints = theXYZPoints.Size(); i < aNbPoints; i++ ) { + const HYDROData_Profile::ProfilePoint& aBottomPoint = theXYZPoints.Value( i ); + + double aDistance = thePolylineXY->GetDistance( 0, i - 1 ); + + Standard_Real anU = aDistance; // = ( aDistance / aPolylineCommonDist ) * aPolylineCommonDist; + AddPoint( 0, HYDROData_ProfileUZ::Point( anU, aBottomPoint.Z() ) ); + } + + // Last point + const HYDROData_Profile::ProfilePoint& aLastBottomPoint = theXYZPoints.Last(); + AddPoint( 0, HYDROData_ProfileUZ::Point( aPolylineCommonDist, aLastBottomPoint.Z() ) ); + +} +