From: adv Date: Fri, 27 Dec 2013 12:26:28 +0000 (+0000) Subject: Bathymetry points has been changed from QList to NCollection_Sequence. X-Git-Tag: BR_hydro_v_0_7~19 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b45bf3e182741f13e3bb9f66f114a840be017dea;p=modules%2Fhydro.git Bathymetry points has been changed from QList to NCollection_Sequence. --- diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index 49b133e5..44a61a11 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -78,18 +78,17 @@ void HYDROData_Bathymetry::SetAltitudePoints( const AltitudePoints& thePoints ) { RemoveAltitudePoints(); - if ( thePoints.isEmpty() ) + if ( thePoints.IsEmpty() ) return; // Save coordinates Handle(TDataStd_RealArray) aCoordsArray = - TDataStd_RealArray::Set( myLab.FindChild( DataTag_AltitudePoints ), 0, thePoints.size() * 3 - 1 ); + TDataStd_RealArray::Set( myLab.FindChild( DataTag_AltitudePoints ), 0, thePoints.Length() * 3 - 1 ); - AltitudePoints::const_iterator aListItBeg = thePoints.constBegin(); - AltitudePoints::const_iterator aListItEnd = thePoints.constEnd(); - for ( int i = 0 ; aListItBeg != aListItEnd; ++i, ++aListItBeg ) + AltitudePoints::Iterator anIter( thePoints ); + for ( int i = 0 ; anIter.More(); ++i, anIter.Next() ) { - const AltitudePoint& aPoint = *aListItBeg; + const AltitudePoint& aPoint = anIter.Value(); aCoordsArray->SetValue( i * 3, aPoint.X() ); aCoordsArray->SetValue( i * 3 + 1, aPoint.Y() ); @@ -121,7 +120,7 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() c aPoint.SetY( aCoordsArray->Value( i++ ) ); aPoint.SetZ( aCoordsArray->Value( i++ ) ); - aPoints << aPoint; + aPoints.Append( aPoint ); } return aPoints; @@ -196,7 +195,7 @@ double HYDROData_Bathymetry::GetAltitudeForPoint( const gp_XY& thePoint ) const double aResAltitude = anInvalidAltitude; AltitudePoints anAltitudePoints = GetAltitudePoints(); - if ( anAltitudePoints.isEmpty() ) + if ( anAltitudePoints.IsEmpty() ) return aResAltitude; QPolygonF aBoundingRect; @@ -210,11 +209,10 @@ double HYDROData_Bathymetry::GetAltitudeForPoint( const gp_XY& thePoint ) const AltitudePoint( -DBL_MAX, DBL_MAX, anInvalidAltitude ), AltitudePoint( DBL_MAX, DBL_MAX, anInvalidAltitude ) }; - AltitudePoints::const_iterator aListItBeg = anAltitudePoints.constBegin(); - AltitudePoints::const_iterator aListItEnd = anAltitudePoints.constEnd(); - for ( ; aListItBeg != aListItEnd; ++aListItBeg ) + AltitudePoints::Iterator anIter( anAltitudePoints ); + for ( ; anIter.More(); anIter.Next() ) { - const AltitudePoint& aPoint = *aListItBeg; + const AltitudePoint& aPoint = anIter.Value(); double aDeltaX = Abs( aPoint.X() ) - Abs( thePoint.X() ); double aDeltaY = Abs( aPoint.Y() ) - Abs( thePoint.Y() ); @@ -364,14 +362,13 @@ void HYDROData_Bathymetry::SetAltitudesInverted( const bool theIsInverted, // Update altitude points AltitudePoints anAltitudePoints = GetAltitudePoints(); - if ( anAltitudePoints.isEmpty() ) + if ( anAltitudePoints.IsEmpty() ) return; - AltitudePoints::iterator aListItBeg = anAltitudePoints.begin(); - AltitudePoints::iterator aListItEnd = anAltitudePoints.end(); - for ( ; aListItBeg != aListItEnd; ++aListItBeg ) + AltitudePoints::Iterator anIter( anAltitudePoints ); + for ( ; anIter.More(); anIter.Next() ) { - AltitudePoint& aPoint = *aListItBeg; + AltitudePoint& aPoint = anIter.ChangeValue(); aPoint.SetZ( aPoint.Z() * -1 ); } @@ -420,7 +417,7 @@ bool HYDROData_Bathymetry::ImportFromFile( const QString& theFileName ) SetAltitudePoints( aPoints ); } - return aRes && !aPoints.isEmpty(); + return aRes && !aPoints.IsEmpty(); } bool HYDROData_Bathymetry::importFromXYZFile( QFile& theFile, @@ -474,7 +471,7 @@ bool HYDROData_Bathymetry::importFromXYZFile( QFile& theFile, if ( anIsAltitudesInverted ) aPoint.SetZ( -aPoint.Z() ); - thePoints << aPoint; + thePoints.Append( aPoint ); } #ifdef _TIMER @@ -504,9 +501,13 @@ bool HYDROData_Bathymetry::CreateBoundaryPolyline() const double Xmin = 0.0, Xmax = 0.0, Ymin = 0.0, Ymax = 0.0; bool isFirst = true; AltitudePoints aPoints = GetAltitudePoints(); - foreach( AltitudePoint aPnt, aPoints ) + + AltitudePoints::Iterator anIter( aPoints ); + for ( ; anIter.More(); anIter.Next() ) { - double x = aPnt.X(), y = aPnt.Y(); + const AltitudePoint& aPoint = anIter.Value(); + + double x = aPoint.X(), y = aPoint.Y(); if( isFirst || xXmax ) diff --git a/src/HYDROData/HYDROData_Bathymetry.h b/src/HYDROData/HYDROData_Bathymetry.h index e8682fd4..352b8c70 100644 --- a/src/HYDROData/HYDROData_Bathymetry.h +++ b/src/HYDROData/HYDROData_Bathymetry.h @@ -19,8 +19,8 @@ class HYDROData_Bathymetry : public HYDROData_IAltitudeObject { public: - typedef gp_XYZ AltitudePoint; - typedef QList AltitudePoints; + typedef gp_XYZ AltitudePoint; + typedef NCollection_Sequence AltitudePoints; protected: diff --git a/src/HYDROData/test_HYDROData_Bathymetry.cxx b/src/HYDROData/test_HYDROData_Bathymetry.cxx index 28769ef6..37f5cbfe 100755 --- a/src/HYDROData/test_HYDROData_Bathymetry.cxx +++ b/src/HYDROData/test_HYDROData_Bathymetry.cxx @@ -115,7 +115,7 @@ void test_HYDROData_Bathymetry::testFileImport() CPPUNIT_ASSERT( aBathymetry->ImportFromFile( aFileName ) ); HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry->GetAltitudePoints(); - CPPUNIT_ASSERT( anAltitudePoints.length() == 20 ); + CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 ); gp_XY aTestPoint( 1, 1 ); double anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint ); @@ -161,7 +161,7 @@ void test_HYDROData_Bathymetry::testCopy() CPPUNIT_ASSERT( aBathymetry1->ImportFromFile( aFileName ) ); HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry1->GetAltitudePoints(); - CPPUNIT_ASSERT( anAltitudePoints.length() == 20 ); + CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 ); } Handle(HYDROData_Bathymetry) aBathymetry2 = @@ -172,7 +172,7 @@ void test_HYDROData_Bathymetry::testCopy() if ( anIsFileCreated ) { HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry2->GetAltitudePoints(); - CPPUNIT_ASSERT( anAltitudePoints.length() == 20 ); + CPPUNIT_ASSERT( anAltitudePoints.Length() == 20 ); } aDoc->Close(); diff --git a/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx b/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx index 5b7a850b..13c19b97 100644 --- a/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx +++ b/src/HYDROGUI/HYDROGUI_VTKPrsBathymetry.cxx @@ -75,7 +75,7 @@ void HYDROGUI_VTKPrsBathymetry::compute() if ( !aBathymetry.IsNull() ) { HYDROData_Bathymetry::AltitudePoints anAltPoints = aBathymetry->GetAltitudePoints(); - int aNbPoints = anAltPoints.length(); + int aNbPoints = anAltPoints.Length(); HYDROData_Bathymetry::AltitudePoint anAltPnt; vtkPoints* aPoints = vtkPoints::New(); @@ -93,7 +93,7 @@ void HYDROGUI_VTKPrsBathymetry::compute() int anInvalidZ = InvalidZValue(); for (int i = 0; i < aNbPoints; i++ ) { - anAltPnt = anAltPoints.at( i ); + anAltPnt = anAltPoints.Value( i ); aZ = anAltPnt.Z(); if ( ValuesLessEquals( aZ, anInvalidZ ) ) {