Salome HOME
Porting on OCCT 7.0 and Qt 5. Make compilable version.
[modules/hydro.git] / src / HYDROData / HYDROData_SinusX.cxx
index c7f7701ee77a232a447b45a855490d165d722815..8bee17ad234dc0f49745827ba054f2c2cabe8173 100644 (file)
@@ -43,7 +43,7 @@ HYDROData_SinusX::~HYDROData_SinusX()
 {
 }
 
-void HYDROData_SinusX::CollectExistingNames(Handle_HYDROData_Document theDocument)
+void HYDROData_SinusX::CollectExistingNames(Handle(HYDROData_Document) theDocument)
 {
   HYDROData_Iterator anIter( theDocument );
   int anInd = 0;
@@ -86,7 +86,8 @@ QString HYDROData_SinusX::GetName(const QString& theName)
 }
 
 
-bool HYDROData_SinusX::Import(const QString& theFilePath, Handle(HYDROData_Document) theDocument, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
+bool HYDROData_SinusX::Import(const QString& theFilePath, Handle(HYDROData_Document) theDocument,
+  NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities)
 {
   if ( theFilePath.isEmpty() )
   { 
@@ -115,7 +116,7 @@ bool HYDROData_SinusX::Import(const QString& theFilePath, Handle(HYDROData_Docum
 
 }
 
-void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
+void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities)
 { 
   for ( size_t i = 0; i < myCurveBlocks.size(); i++ )
   {
@@ -131,7 +132,7 @@ void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollec
       }
 
       aBath->SetAltitudePoints(aAPoints);
-      aBath->SetName(GetName(myCurveBlocks[i].myName + "_bath"));
+      aBath->SetName(GetName(myCurveBlocks[i].myName));
       theEntities.Append(aBath);
     }
     if (myCurveBlocks[i].myType == 1 || myCurveBlocks[i].myType == 3) // XYZ curve or isocontour
@@ -153,9 +154,9 @@ void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollec
       aProfileUZ->CalculateAndAddPoints(aPoints, aPolyXY);
       Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( theDocument->CreateObject( KIND_PROFILE ) );
       aProfile->SetParametricPoints(aProfileUZ->GetPoints());
-      aPolyXY->SetName(GetName(myCurveBlocks[i].myName + "_polyXY"));
-      aProfileUZ->SetName(GetName(myCurveBlocks[i].myName + "_profileUZ"));
-      aProfile->SetName(GetName(myCurveBlocks[i].myName + "_profile"));
+      aPolyXY->SetName(GetName(myCurveBlocks[i].myName));
+      aProfileUZ->SetName(GetName(myCurveBlocks[i].myName));
+      aProfile->SetName(GetName(myCurveBlocks[i].myName));
       aPolyXY->SetWireColor(HYDROData_PolylineXY::DefaultWireColor());
       theEntities.Append(aPolyXY);
       theEntities.Append(aProfileUZ);
@@ -187,7 +188,7 @@ void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollec
             aProfile->SetRightPoint(gp_XY(xr, yr));
             aProfile->Update();
           }
-          aProfile->SetName(GetName(myCurveBlocks[i].myName + "_profile"));
+          aProfile->SetName(GetName(myCurveBlocks[i].myName));
           theEntities.Append(aProfile);
         }
       }
@@ -204,7 +205,7 @@ void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollec
         aProfile->GetProfileUZ()->SetSectionType(0,  myCurveBlocks[i].myIsSpline ? HYDROData_PolylineXY::SECTION_SPLINE : HYDROData_PolylineXY::SECTION_POLYLINE);
         aProfile->GetProfileUZ()->SetSectionClosed(0, myCurveBlocks[i].myIsClosed ? true : false);
         aProfile->SetProfilePoints(aPointList);
-        aProfile->SetName(GetName(myCurveBlocks[i].myName + "_profile"));
+        aProfile->SetName(GetName(myCurveBlocks[i].myName));
         theEntities.Append(aProfile);
       }
     }
@@ -273,7 +274,9 @@ bool HYDROData_SinusX::Parse(QFile& theFile)
         if (aBList[0] == "CN")
         {
            for (int i = 1; i < aBList.size(); i++)
-             Name += aBList[i] + "_"; 
+             Name += aBList[i] + "_";
+           if (Name.size() <= 1)
+             Name = "noname_";
            Name.remove(Name.size() - 1, 1);
            aCurveBlockInfo.myName = Name;
         }
@@ -320,7 +323,7 @@ bool HYDROData_SinusX::Parse(QFile& theFile)
 
 }
 
-bool HYDROData_SinusX::Export(const QString& theFilePath, const NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
+bool HYDROData_SinusX::Export(const QString& theFilePath, const NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities)
 {
   if ( theFilePath.isEmpty() )
   { 
@@ -346,7 +349,7 @@ bool HYDROData_SinusX::Export(const QString& theFilePath, const NCollection_Sequ
 
 }
 
-void HYDROData_SinusX::HydroToSX(QFile& theFile, const NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
+void HYDROData_SinusX::HydroToSX(QFile& theFile, const NCollection_Sequence<Handle(HYDROData_Entity)>& theEntities)
 {
   QTextStream aTextStream(&theFile);
   aTextStream << "C  Generated by HYDRO Module\n";
@@ -354,7 +357,7 @@ void HYDROData_SinusX::HydroToSX(QFile& theFile, const NCollection_Sequence<Hand
 
   for (int i = 1; i <= theEntities.Size(); i++)
   {
-    Handle_HYDROData_Entity anEnt = theEntities.Value(i);
+    Handle(HYDROData_Entity) anEnt = theEntities.Value(i);
     if (anEnt->IsKind( STANDARD_TYPE(HYDROData_Bathymetry) ))
     {
       Handle(HYDROData_Bathymetry) aBathy = Handle(HYDROData_Bathymetry)::DownCast( anEnt );