]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
Merge remote-tracking branch 'remotes/origin/BR_HYDRO_IMPS_2016' into BR_MULTI_BATHS
authorisn <isn@opencascade.com>
Fri, 9 Sep 2016 18:09:45 +0000 (21:09 +0300)
committerisn <isn@opencascade.com>
Fri, 9 Sep 2016 18:09:45 +0000 (21:09 +0300)
Conflicts:
src/HYDROData/HYDROData_Bathymetry.cxx

1  2 
src/HYDROData/HYDROData_Bathymetry.cxx
src/HYDROData/HYDROData_Bathymetry.h
src/HYDROPy/HYDROData_Bathymetry.sip
src/HYDRO_tests/CMakeLists.txt
src/HYDRO_tests/test_HYDROData_Bathymetry.cxx

index 9cb013af0438c171fa847e30a4a2b409ad3c45da,19a11e70133c1da5a62a2a1675fc3b7a6b2475fb..472101b02b85f6ccf7c025d2a332c9437b03a0cf
@@@ -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,
Simple merge
Simple merge
index 064f9e83a37d2bf9d25b47394222e472988cd933,47a3e94279e3af65b92317c82677a396f05984a0..f220d40163d9a1d2a3d6c95832d1a473caabd2c3
@@@ -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
index 54b6631f62d11878abe5722947d56cf59adb06f6,27ab51a422baef58c3983b547bc36d9e96865116..202d1a7137356ca2a1f9ea1b270b70121d6837a6
@@@ -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 =