From: isn Date: Fri, 9 Sep 2016 18:09:45 +0000 (+0300) Subject: Merge remote-tracking branch 'remotes/origin/BR_HYDRO_IMPS_2016' into BR_MULTI_BATHS X-Git-Tag: v1.6~75^2~3^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ccf0c94c7ad984eddae21372ca02edbaf1d6bb1e;p=modules%2Fhydro.git Merge remote-tracking branch 'remotes/origin/BR_HYDRO_IMPS_2016' into BR_MULTI_BATHS Conflicts: src/HYDROData/HYDROData_Bathymetry.cxx --- ccf0c94c7ad984eddae21372ca02edbaf1d6bb1e diff --cc src/HYDROData/HYDROData_Bathymetry.cxx index 9cb013af,19a11e70..472101b0 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@@ -547,54 -495,46 +552,54 @@@ bool HYDROData_Bathymetry::IsAltitudesI return aRes; } -bool HYDROData_Bathymetry::ImportFromFile( const TCollection_AsciiString& theFileName ) +bool HYDROData_Bathymetry::ImportFromFiles( const QStringList& theFileNames ) { - // Try to open the file - QFile aFile( theFileName.ToCString() ); - if ( !aFile.exists() || !aFile.open( QIODevice::ReadOnly ) ) - return false; + AltitudePoints AllPoints; + bool Stat = false; - bool aRes = false; + foreach (QString theFileName, theFileNames) + { + // Try to open the file + QFile aFile( theFileName ); + if ( !aFile.exists() || !aFile.open( QIODevice::ReadOnly ) ) + continue; - QString aFileSuf = QFileInfo( aFile ).suffix().toLower(); + QString aFileSuf = QFileInfo( aFile ).suffix().toLower(); - AltitudePoints aPoints; - HYDROData_Bathymetry::AltitudePoints aPoints; ++ HYDROData_Bathymetry::AltitudePoints aPoints; - // Try to import the file - if ( aFileSuf == "xyz" ) - aRes = importFromXYZFile( aFile, aPoints ); - else if ( aFileSuf == "asc" ) - aRes = importFromASCFile( aFile, aPoints ); + // Try to import the file + if ( aFileSuf == "xyz" ) + Stat = importFromXYZFile( aFile, aPoints ); + else if ( aFileSuf == "asc" ) + Stat = importFromASCFile( aFile, aPoints ); - // Close the file - aFile.close(); - + if (!Stat) + continue; //ignore this points + + // Close the file + aFile.close(); + + AllPoints.Append(aPoints); + } // Convert from global to local CS Handle_HYDROData_Document aDoc = HYDROData_Document::Document( myLab ); - AltitudePoints::Iterator anIter( AllPoints ); - for ( ; anIter.More(); anIter.Next() ) - HYDROData_Bathymetry::AltitudePoints::iterator anIter = aPoints.begin(), aLast = aPoints.end(); ++ HYDROData_Bathymetry::AltitudePoints::iterator anIter = AllPoints.begin(), aLast = AllPoints.end(); + for ( ; anIter!=aLast; ++anIter ) { - AltitudePoint& aPoint = anIter.ChangeValue(); - aDoc->Transform( aPoint, true ); + HYDROData_Bathymetry::AltitudePoint& aPoint = *anIter; + aDoc->Transform( aPoint.X, aPoint.Y, aPoint.Z, true ); } - if ( aRes ) + if ( Stat ) { // Update file path and altitude points of this Bathymetry - SetFilePath( theFileName ); - SetAltitudePoints( aPoints ); + SetFilePaths (theFileNames ); + SetAltitudePoints( AllPoints ); } - return Stat && !AllPoints.IsEmpty(); - return aRes && !aPoints.empty(); ++ return Stat && !AllPoints.empty(); } bool HYDROData_Bathymetry::importFromXYZFile( QFile& theFile, diff --cc src/HYDRO_tests/CMakeLists.txt index 064f9e83,47a3e942..f220d401 --- a/src/HYDRO_tests/CMakeLists.txt +++ b/src/HYDRO_tests/CMakeLists.txt @@@ -19,9 -19,8 +19,10 @@@ set(PROJECT_HEADER test_HYDROGUI_ListModel.h test_HYDROGUI_Shape.h test_HYDROGUI_LandCoverMapDlg.h + test_HYDROData_CalcCase.h + test_Dependencies.h + test_HYDROData_DTM.h TestShape.h TestViewer.h diff --cc src/HYDRO_tests/test_HYDROData_Bathymetry.cxx index 54b6631f,27ab51a4..202d1a71 --- a/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx +++ b/src/HYDRO_tests/test_HYDROData_Bathymetry.cxx @@@ -125,10 -125,10 +125,10 @@@ void test_HYDROData_Bathymetry::testFil if ( !createTestFile( aFileName ) ) return; // No file has been created - CPPUNIT_ASSERT( aBathymetry->ImportFromFile( aFileName.toStdString().c_str() ) ); + CPPUNIT_ASSERT( aBathymetry->ImportFromFiles( QStringList(aFileName)) ); HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry->GetAltitudePoints(); - CPPUNIT_ASSERT_EQUAL( 2300, anAltitudePoints.Length() ); + CPPUNIT_ASSERT_EQUAL( 2300, (int)anAltitudePoints.size() ); gp_XY aTestPoint( 1, 1 ); double anAltitude = aBathymetry->GetAltitudeForPoint( aTestPoint, 1 ); @@@ -171,10 -171,10 +171,10 @@@ void test_HYDROData_Bathymetry::testCop if ( anIsFileCreated ) { - CPPUNIT_ASSERT( aBathymetry1->ImportFromFile( aFileName.toStdString().c_str() ) ); + CPPUNIT_ASSERT( aBathymetry1->ImportFromFiles( QStringList(aFileName ) ) ); HYDROData_Bathymetry::AltitudePoints anAltitudePoints = aBathymetry1->GetAltitudePoints(); - CPPUNIT_ASSERT_EQUAL( 2300, anAltitudePoints.Length() ); + CPPUNIT_ASSERT_EQUAL( 2300, (int)anAltitudePoints.size() ); } Handle(HYDROData_Bathymetry) aBathymetry2 =