]> SALOME platform Git repositories - modules/hydro.git/commitdiff
Salome HOME
sinusX p.3
authorisn <isn@opencascade.com>
Wed, 17 Jun 2015 08:48:48 +0000 (11:48 +0300)
committerisn <isn@opencascade.com>
Wed, 17 Jun 2015 08:48:48 +0000 (11:48 +0300)
src/HYDROData/CMakeLists.txt
src/HYDROData/HYDROData_SinusX.cxx [new file with mode: 0644]
src/HYDROData/HYDROData_SinusX.h [new file with mode: 0644]
src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx
src/HYDROGUI/HYDROGUI_ImportSinusXOp.h

index 2476f552d25ecd94120b08492090a9fbb4acead5..dd93e1d3e6d922cfd4575db8eef179921ae439d2 100644 (file)
@@ -52,6 +52,7 @@ set(PROJECT_HEADERS
     HYDROData_IProfilesInterpolator.h
     HYDROData_LinearInterpolator.h
     HYDROData_InterpolatorsFactory.h
+    HYDROData_SinusX.h
     shapelib/shapefil.h
 )
 
@@ -105,6 +106,7 @@ set(PROJECT_SOURCES
     HYDROData_IProfilesInterpolator.cxx
     HYDROData_LinearInterpolator.cxx
     HYDROData_InterpolatorsFactory.cxx
+    HYDROData_SinusX.cxx
     shapelib/dbfopen.c
     shapelib/safileio.c
     shapelib/shpopen.c
diff --git a/src/HYDROData/HYDROData_SinusX.cxx b/src/HYDROData/HYDROData_SinusX.cxx
new file mode 100644 (file)
index 0000000..5c0c6f5
--- /dev/null
@@ -0,0 +1,258 @@
+// 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
+//
+// 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
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "HYDROData_SinusX.h"
+
+#include <HYDROData_PolylineXY.h>
+#include <HYDROData_Bathymetry.h>
+#include <HYDROData_Entity.h>
+#include <HYDROData_Document.h>
+#include <HYDROData_Profile.h>
+
+#include <gp_XYZ.hxx>
+#include <gp_XY.hxx>
+
+#include <QFile>
+#include <QFileInfo>
+#include <QString>
+#include <QStringList>
+
+HYDROData_SinusX::HYDROData_SinusX( ) 
+{
+}
+
+HYDROData_SinusX::~HYDROData_SinusX()
+{
+}
+
+
+bool HYDROData_SinusX::Import(const QString& theFilePath, Handle(HYDROData_Document) theDocument, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
+{
+  if ( theFilePath.isEmpty() )
+  { 
+    return false;
+  }
+
+  QString anExt = theFilePath.split('.', QString::SkipEmptyParts).back();
+
+  if (anExt == "sx")
+  {
+    QFile aFile (theFilePath);
+    
+    aFile.open(QIODevice::ReadOnly);
+
+    Parse(aFile);
+   
+    SXToHydro(theDocument, theEntities);
+    
+    aFile.close();
+    
+    return true;
+  }
+  else
+    return false;
+
+}
+
+void HYDROData_SinusX::SXToHydro(Handle(HYDROData_Document) theDocument, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
+{ 
+  for ( size_t i = 0; i < myCurveBlocks.size(); i++ )
+  {
+    if (myCurveBlocks[i].myType == 4) ///  scatter plot -> to bathy
+    {
+      Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( theDocument->CreateObject( KIND_BATHYMETRY ) );
+      HYDROData_Bathymetry::AltitudePoints aAPoints;
+      for (size_t j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++)
+        aAPoints.Append(gp_XYZ (myCurveBlocks[i].myXYZPoints[j]));
+
+      aBath->SetAltitudePoints(aAPoints);
+      aBath->SetName(myCurveBlocks[i].myName);
+      theEntities.Append(aBath);
+    }
+    if (myCurveBlocks[i].myType == 1 || myCurveBlocks[i].myType == 3)
+    {
+      NCollection_Sequence<gp_XYZ> aPoints;
+      for (size_t j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++)
+        aPoints.Append(gp_XYZ (myCurveBlocks[i].myXYZPoints[j]));
+      if (myCurveBlocks[i].myIsClosed)
+        aPoints.Append(gp_XYZ (myCurveBlocks[i].myXYZPoints[0]));
+      Handle(HYDROData_ProfileUZ) aProfileUZ = Handle(HYDROData_ProfileUZ)::DownCast( theDocument->CreateObject( KIND_PROFILEUZ ) );
+      Handle(HYDROData_PolylineXY) aPolyXY = Handle(HYDROData_PolylineXY)::DownCast( theDocument->CreateObject( KIND_POLYLINEXY ) );
+      aPolyXY->AddSection( "",  myCurveBlocks[i].myIsSpline ? HYDROData_PolylineXY::SECTION_SPLINE : HYDROData_PolylineXY::SECTION_POLYLINE, false ); 
+      aProfileUZ->CalculateAndAddPoints(aPoints, aPolyXY);
+      Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( theDocument->CreateObject( KIND_PROFILE ) );
+      aProfile->SetParametricPoints(aProfileUZ->GetPoints());
+      aPolyXY->SetName(myCurveBlocks[i].myName + "_polyXY");
+      aProfileUZ->SetName(myCurveBlocks[i].myName + "_profileUZ");
+      aProfile->SetName(myCurveBlocks[i].myName + "_profile");
+      theEntities.Append(aPolyXY);
+      theEntities.Append(aProfileUZ);
+      theEntities.Append(aProfile);
+    }
+    if (myCurveBlocks[i].myType == 2)
+    {
+      if (myCurveBlocks[i].myCurvePlane == 2)
+      {
+        if (myCurveBlocks[i].myAdditionalCurveInfo.size() == 4)
+        {
+          Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( theDocument->CreateObject( KIND_PROFILE ) );
+          HYDROData_ProfileUZ::PointsList aPointList;
+          for (size_t j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++)
+            aPointList.Append(gp_XY (myCurveBlocks[i].myXYZPoints[j].X(), myCurveBlocks[i].myXYZPoints[j].Z()));
+           
+          aProfile->SetParametricPoints(aPointList);
+          if ( ! (myCurveBlocks[i].myAdditionalCurveInfo[0] == 0 &&  myCurveBlocks[i].myAdditionalCurveInfo[1] == 0 && 
+            myCurveBlocks[i].myAdditionalCurveInfo[2] == 0 && myCurveBlocks[i].myAdditionalCurveInfo[3] == 0) )
+          {
+            aProfile->SetLeftPoint(gp_XY(myCurveBlocks[i].myAdditionalCurveInfo[0], myCurveBlocks[i].myAdditionalCurveInfo[1]));
+            aProfile->SetRightPoint(gp_XY(myCurveBlocks[i].myAdditionalCurveInfo[2], myCurveBlocks[i].myAdditionalCurveInfo[3]));
+            aProfile->Update();
+          }
+          aProfile->SetName(myCurveBlocks[i].myName + "_profile");
+          theEntities.Append(aProfile);
+        }
+      }
+      if (myCurveBlocks[i].myCurvePlane == 0)
+      {
+        Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( theDocument->CreateObject( KIND_PROFILE ) );
+        HYDROData_Profile::ProfilePoints aPointList;
+        for (size_t j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++)
+          aPointList.Append(myCurveBlocks[i].myXYZPoints[j]);
+        aProfile->SetProfilePoints(aPointList);
+        aProfile->SetName(myCurveBlocks[i].myName + "_profile");
+        theEntities.Append(aProfile);
+      }
+    }
+  }
+
+}
+
+
+
+bool HYDROData_SinusX::Parse(QFile& theFile)
+{
+  if ( !theFile.isOpen() )
+    return false;
+
+  QString aLine;
+  QString aBLine;
+  QStringList aList;
+  QStringList aBList;
+  myCurveBlocks.clear();
+  bool aTotStat = true;
+
+  aLine = theFile.readLine().simplified();
+  aList = aLine.split( ' ', QString::SkipEmptyParts );
+
+  for (;!theFile.atEnd();) 
+  {
+    if (aList[0] == "B" && (aList[1] == "C" || aList[1] == "P" || aList[1] == "N" || aList[1] == "S" ))
+    {  
+      HYDROGUI_CurveBlock aCurveBlockInfo;
+      if (aList[1] == "C")
+        aCurveBlockInfo.myType = 1;
+      else if (aList[1] == "P")
+        aCurveBlockInfo.myType = 2;
+      else if (aList[1] == "N")
+        aCurveBlockInfo.myType = 3;
+      else if (aList[1] == "S")
+        aCurveBlockInfo.myType = 4;
+
+      if (aList.size() == 9)
+      {
+        for (int j = 2; j < 8; j++)
+          aCurveBlockInfo.myRefCoords.push_back(aList[j].toDouble());
+        aCurveBlockInfo.myRefRatio = aList[8].toDouble();
+      }
+
+      QString Name;
+      do
+      {
+        aBLine = theFile.readLine().simplified();
+        aBList = aBLine.split( ' ', QString::SkipEmptyParts );
+         
+        if (aBList[0] == "CP")
+        {
+          if (aBList.size() == 2 && (aBList[1] == "0" || aBList[1] == "1" || aBList[1] == "2"))
+            aCurveBlockInfo.myCurvePlane = aBList[1].toInt();
+          else if (aBList.size() == 3 && (aBList[1] == "0" || aBList[1] == "1") && (aBList[2] == "0" || aBList[2] == "1"))
+          {
+            aCurveBlockInfo.myIsClosed = aBList[1].toInt();
+            aCurveBlockInfo.myIsSpline = aBList[2].toInt();
+          }
+          else
+          {
+            for (int j = 1; j < aBList.size(); j++)
+              aCurveBlockInfo.myAdditionalCurveInfo.push_back(aBList[j].toDouble());
+          }
+        }
+        if (aBList[0] == "CN")
+        {
+           for (int i = 1; i < aBList.size(); i++)
+             Name += aBList[i] + "_"; 
+           Name.remove(Name.size() - 1, 1);
+           aCurveBlockInfo.myName = Name;
+        }
+      } while (!theFile.atEnd() && aBLine[0] == 'C' );
+
+      bool aStat;
+      aTotStat = true;
+      do
+      {
+        if (aBList.size() >= 3 && aBLine[0] != 'B' && aBLine[0] != 'C') {
+          gp_XYZ anXYZ;
+          anXYZ.SetX (aBList[0].toDouble(&aStat));  
+          aTotStat = aTotStat && aStat;
+          anXYZ.SetY (aBList[1].toDouble(&aStat));
+          aTotStat = aTotStat && aStat;
+          anXYZ.SetZ (aBList[2].toDouble(&aStat));
+          aTotStat = aTotStat && aStat;
+
+          aCurveBlockInfo.myXYZPoints.push_back(anXYZ);
+          
+          aBLine = theFile.readLine().simplified();
+          aBList = aBLine.split( ' ', QString::SkipEmptyParts );
+        }
+        else 
+          break;
+    
+      } while (!theFile.atEnd() || !aBLine.isEmpty());
+      if (aTotStat)
+        myCurveBlocks.push_back(aCurveBlockInfo);
+
+      aLine = aBLine;
+      aList = aBList;
+
+    }
+    else
+    {
+      aLine = theFile.readLine().simplified();
+      aList = aLine.split( ' ', QString::SkipEmptyParts );
+    }
+
+  }
+
+  return true;
+
+}
+
diff --git a/src/HYDROData/HYDROData_SinusX.h b/src/HYDROData/HYDROData_SinusX.h
new file mode 100644 (file)
index 0000000..0d8e9e1
--- /dev/null
@@ -0,0 +1,67 @@
+// 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
+//
+// 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
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef HYDRODATA_SINUSX_H
+#define HYDRODATA_SINUSX_H
+
+#include <vector>
+#include <HYDROData.h>
+#include <NCollection_Sequence.hxx>
+#include <QString>
+
+class QFile;
+class gp_XYZ;
+//class QString;
+class Handle_HYDROData_Entity;
+class Handle_HYDROData_Document;
+
+struct HYDROGUI_CurveBlock
+{
+  //HYDROGUI_CurveBlock() : myType(-1), myIsConnected(false), myIsClosed(false), myName(""), myCurvePlane(-1), myRefRatio(1.0) 
+    //{};
+  std::vector<gp_XYZ> myXYZPoints;
+  int myType;
+  bool myIsSpline;
+  bool myIsClosed;
+  int myCurvePlane;
+  QString myName;
+  std::vector<double> myAdditionalCurveInfo;
+  std::vector<double> myRefCoords;
+  double myRefRatio;
+};
+
+class HYDRODATA_EXPORT HYDROData_SinusX 
+{
+
+public:
+  HYDROData_SinusX( );
+  virtual ~HYDROData_SinusX();
+  bool Import (const QString& theFilePath, Handle(HYDROData_Document) theDocument, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities);
+private:
+  void SXToHydro(Handle(HYDROData_Document) theDocument, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities);
+  bool Parse( QFile& theFile );
+private:
+
+  std::vector<HYDROGUI_CurveBlock> myCurveBlocks;
+};
+
+#endif
index 291338a0ed5b536e382a3e04fdf0db69e443282c..583def4b7de8537cdede5f688640555a96ae588f 100644 (file)
@@ -43,6 +43,8 @@
 #include <QFileInfo>
 #include <QMessageBox>
 
+#include <HYDROData_SinusX.h>
+
 
 HYDROGUI_ImportSinusXOp::HYDROGUI_ImportSinusXOp( HYDROGUI_Module* theModule )
 : HYDROGUI_Operation( theModule )
@@ -88,20 +90,22 @@ void HYDROGUI_ImportSinusXOp::onApply()
 
   if (anExt == "sx")
   {
-    QFile aFile (aFileName);
-    aFile.open(QIODevice::ReadOnly);
-
-    Parse(aFile);
-
     QApplication::setOverrideCursor( Qt::WaitCursor );
 
     startDocOperation();
 
-    ProcessSX();
-
-    commitDocOperation();
-    commit();
-    aFile.close();
+    HYDROData_SinusX aSinusXImporter;
+    NCollection_Sequence<Handle_HYDROData_Entity> anEntities;
+    if (aSinusXImporter.Import(aFileName, doc(), anEntities)) 
+    {
+      UpdateView(anEntities);
+      commitDocOperation();
+      commit();
+    }
+    else
+    {
+      abort();
+    }
   }
 
   module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init );
@@ -109,204 +113,17 @@ void HYDROGUI_ImportSinusXOp::onApply()
   QApplication::restoreOverrideCursor();
 }
 
-void HYDROGUI_ImportSinusXOp::ProcessSX()
+void HYDROGUI_ImportSinusXOp::UpdateView( NCollection_Sequence<Handle_HYDROData_Entity>& anEntities)
 {
-  /*Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( doc()->CreateObject( KIND_POLYLINEXY ) );
-
-  Handle(HYDROData_Polyline3D) aPolylineObj = Handle(HYDROData_Polyline3D)::DownCast( doc()->CreateObject( KIND_POLYLINE ) );
-  */
-  //TODO - move to hydro data
-  std::vector<Handle(HYDROData_Entity)> anEntities;
-  for ( int i = 0; i < myCurveBlocks.size(); i++ )
-  {
-    if (myCurveBlocks[i].myType == 4) ///  scatter plot -> to bathy
-    {
-      Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( doc()->CreateObject( KIND_BATHYMETRY ) );
-      HYDROData_Bathymetry::AltitudePoints aAPoints;
-      for (int j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++)
-        aAPoints.Append(gp_XYZ (myCurveBlocks[i].myXYZPoints[j]));
-
-      aBath->SetAltitudePoints(aAPoints);
-      aBath->SetName(myCurveBlocks[i].myName);
-      anEntities.push_back(aBath);
-    }
-    if (myCurveBlocks[i].myType == 1 || myCurveBlocks[i].myType == 3)
-    {
-      NCollection_Sequence<gp_XYZ> aPoints;
-      for (int j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++)
-        aPoints.Append(gp_XYZ (myCurveBlocks[i].myXYZPoints[j]));
-      if (myCurveBlocks[i].myIsClosed)
-        aPoints.Append(gp_XYZ (myCurveBlocks[i].myXYZPoints[0]));
-      Handle(HYDROData_ProfileUZ) aProfileUZ = Handle(HYDROData_ProfileUZ)::DownCast( doc()->CreateObject( KIND_PROFILEUZ ) );
-      Handle(HYDROData_PolylineXY) aPolyXY = Handle(HYDROData_PolylineXY)::DownCast( doc()->CreateObject( KIND_POLYLINEXY ) );
-      aPolyXY->AddSection( "",  myCurveBlocks[i].myIsSpline ? HYDROData_PolylineXY::SECTION_SPLINE : HYDROData_PolylineXY::SECTION_POLYLINE, false ); 
-      aProfileUZ->CalculateAndAddPoints(aPoints, aPolyXY);
-      Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( doc()->CreateObject( KIND_PROFILE ) );
-      aProfile->SetParametricPoints(aProfileUZ->GetPoints());
-      aPolyXY->SetName(myCurveBlocks[i].myName + "_polyXY");
-      aProfileUZ->SetName(myCurveBlocks[i].myName + "_profileUZ");
-      aProfile->SetName(myCurveBlocks[i].myName + "_profile");
-      anEntities.push_back(aPolyXY);
-      anEntities.push_back(aProfileUZ);
-      anEntities.push_back(aProfile);
-    }
-    if (myCurveBlocks[i].myType == 2)
-    {
-      if (myCurveBlocks[i].myCurvePlane == 2)
-      {
-        if (myCurveBlocks[i].myAdditionalCurveInfo.size() == 4)
-        {
-          Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( doc()->CreateObject( KIND_PROFILE ) );
-          HYDROData_ProfileUZ::PointsList aPointList;
-          for (int j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++)
-            aPointList.Append(gp_XY (myCurveBlocks[i].myXYZPoints[j].X(), myCurveBlocks[i].myXYZPoints[j].Z()));
-           
-          aProfile->SetParametricPoints(aPointList);
-          if ( ! (myCurveBlocks[i].myAdditionalCurveInfo[0] == 0 &&  myCurveBlocks[i].myAdditionalCurveInfo[1] == 0 && 
-            myCurveBlocks[i].myAdditionalCurveInfo[2] == 0 && myCurveBlocks[i].myAdditionalCurveInfo[3] == 0) )
-          {
-            aProfile->SetLeftPoint(gp_XY(myCurveBlocks[i].myAdditionalCurveInfo[0], myCurveBlocks[i].myAdditionalCurveInfo[1]));
-            aProfile->SetRightPoint(gp_XY(myCurveBlocks[i].myAdditionalCurveInfo[2], myCurveBlocks[i].myAdditionalCurveInfo[3]));
-            aProfile->Update();
-          }
-          aProfile->SetName(myCurveBlocks[i].myName + "_profile");
-          anEntities.push_back(aProfile);
-        }
-      }
-      if (myCurveBlocks[i].myCurvePlane == 0)
-      {
-         Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( doc()->CreateObject( KIND_PROFILE ) );
-         HYDROData_Profile::ProfilePoints aPointList;
-         for (int j = 0; j < myCurveBlocks[i].myXYZPoints.size(); j++)
-           aPointList.Append(myCurveBlocks[i].myXYZPoints[j]);
-         aProfile->SetProfilePoints(aPointList);
-         aProfile->SetName(myCurveBlocks[i].myName + "_profile");
-         anEntities.push_back(aProfile);
-      }
-    }
-  }
-
-  /////
-
   size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() );
   if ( anActiveViewId == 0 )
     anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() );
 
-  for (int i = 0; i < anEntities.size() ; i++)
+  for (int i = 1; i <= anEntities.Size() ; i++)
   {
-    anEntities[i]->Update();
-    module()->setObjectVisible( anActiveViewId, anEntities[i], true );
-    module()->setIsToUpdate( anEntities[i] );
+    anEntities(i)->Update();
+    module()->setObjectVisible( anActiveViewId, anEntities(i), true );
+    module()->setIsToUpdate( anEntities(i) );
   }
 }
  
-
-
-
-bool HYDROGUI_ImportSinusXOp::Parse( QFile& theFile)
-{
-  if ( !theFile.isOpen() )
-    return false;
-
-  QString aLine;
-  QString aBLine;
-  QStringList aList;
-  QStringList aBList;
-  myCurveBlocks.clear();
-  bool aTotStat = true;
-
-  aLine = theFile.readLine().simplified();
-  aList = aLine.split( ' ', QString::SkipEmptyParts );
-
-  for (;!theFile.atEnd();) 
-  {
-    if (aList[0] == "B" && (aList[1] == "C" || aList[1] == "P" || aList[1] == "N" || aList[1] == "S" ))
-    {  
-      HYDROGUI_CurveBlock aCurveBlockInfo;
-      if (aList[1] == "C")
-        aCurveBlockInfo.myType = 1;
-      else if (aList[1] == "P")
-        aCurveBlockInfo.myType = 2;
-      else if (aList[1] == "N")
-        aCurveBlockInfo.myType = 3;
-      else if (aList[1] == "S")
-        aCurveBlockInfo.myType = 4;
-
-      if (aList.size() == 9)
-      {
-        for (int j = 2; j < 8; j++)
-          aCurveBlockInfo.myRefCoords.push_back(aList[j].toDouble());
-        aCurveBlockInfo.myRefRatio = aList[8].toDouble();
-      }
-
-      QString Name;
-      do
-      {
-        aBLine = theFile.readLine().simplified();
-        aBList = aBLine.split( ' ', QString::SkipEmptyParts );
-         
-        if (aBList[0] == "CP")
-        {
-          if (aBList.size() == 2 && (aBList[1] == "0" || aBList[1] == "1" || aBList[1] == "2"))
-            aCurveBlockInfo.myCurvePlane = aBList[1].toInt();
-          else if (aBList.size() == 3 && (aBList[1] == "0" || aBList[1] == "1") && (aBList[2] == "0" || aBList[2] == "1"))
-          {
-            aCurveBlockInfo.myIsClosed = aBList[1].toInt();
-            aCurveBlockInfo.myIsSpline = aBList[2].toInt();
-          }
-          else
-          {
-            for (int j = 1; j < aBList.size(); j++)
-              aCurveBlockInfo.myAdditionalCurveInfo.push_back(aBList[j].toDouble());
-          }
-        }
-        if (aBList[0] == "CN")
-        {
-           for (int i = 1; i < aBList.size(); i++)
-             Name += aBList[i] + "_"; 
-           Name.remove(Name.size() - 1, 1);
-           aCurveBlockInfo.myName = Name;
-        }
-      } while (!theFile.atEnd() && aBLine[0] == 'C' );
-
-      bool aStat;
-      aTotStat = true;
-      do
-      {
-        if (aBList.size() >= 3 && aBLine[0] != 'B' && aBLine[0] != 'C') {
-          gp_XYZ anXYZ;
-          anXYZ.SetX (aBList[0].toDouble(&aStat));  
-          aTotStat = aTotStat && aStat;
-          anXYZ.SetY (aBList[1].toDouble(&aStat));
-          aTotStat = aTotStat && aStat;
-          anXYZ.SetZ (aBList[2].toDouble(&aStat));
-          aTotStat = aTotStat && aStat;
-
-          aCurveBlockInfo.myXYZPoints.push_back(anXYZ);
-          
-          aBLine = theFile.readLine().simplified();
-          aBList = aBLine.split( ' ', QString::SkipEmptyParts );
-        }
-        else 
-          break;
-    
-      } while (!theFile.atEnd() || !aBLine.isEmpty());
-      if (aTotStat)
-        myCurveBlocks.push_back(aCurveBlockInfo);
-
-      aLine = aBLine;
-      aList = aBList;
-
-    }
-    else
-    {
-      aLine = theFile.readLine().simplified();
-      aList = aLine.split( ' ', QString::SkipEmptyParts );
-    }
-
-  }
-
-  return true;
-
-}
-
index dcd38ed554c01c8a09b56ae4e738d0ddf761c564..d2abad60474f803dc33f4eecf50152f05eaf8c60 100644 (file)
 #define HYDROGUI_IMPORTSINUSX_H
 
 #include "HYDROGUI_Operation.h"
-#include <vector>
+#include <NCollection_Sequence.hxx>
 
 class SUIT_FileDlg;
-class QFile;
-class gp_XYZ;
-
-struct HYDROGUI_CurveBlock
-{
-  //HYDROGUI_CurveBlock() : myType(-1), myIsConnected(false), myIsClosed(false), myName(""), myCurvePlane(-1), myRefRatio(1.0) 
-    //{};
-  std::vector<gp_XYZ> myXYZPoints;
-  int myType;
-  bool myIsSpline;
-  bool myIsClosed;
-  int myCurvePlane;
-  QString myName;
-  std::vector<double> myAdditionalCurveInfo;
-  std::vector<double> myRefCoords;
-  double myRefRatio;
-};
+class Handle_HYDROData_Entity;
 
 class HYDROGUI_ImportSinusXOp : public HYDROGUI_Operation
 {
@@ -56,11 +40,9 @@ public:
 protected:
   virtual void startOperation();
   virtual void onApply();
-  void ProcessSX();
-  bool Parse( QFile& theFile );
+  void UpdateView( NCollection_Sequence<Handle_HYDROData_Entity>& anEntities);
 private:
   SUIT_FileDlg* myFileDlg;
-  std::vector<HYDROGUI_CurveBlock> myCurveBlocks;
 };
 
 #endif