From 0aca4d4af7a598ae83cd1e592e083e862268d7fb Mon Sep 17 00:00:00 2001 From: isn Date: Tue, 16 Jun 2015 14:57:10 +0300 Subject: [PATCH] sinusX p.1 --- src/HYDROGUI/CMakeLists.txt | 2 + src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx | 190 -------------- src/HYDROGUI/HYDROGUI_ImportPolylineOp.h | 20 -- src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx | 283 +++++++++++++++++++++ src/HYDROGUI/HYDROGUI_ImportSinusXOp.h | 66 +++++ src/HYDROGUI/HYDROGUI_Operations.cxx | 8 + src/HYDROGUI/HYDROGUI_Operations.h | 2 + src/HYDROGUI/resources/HYDROGUI_msg_en.ts | 30 ++- 8 files changed, 390 insertions(+), 211 deletions(-) create mode 100644 src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx create mode 100644 src/HYDROGUI/HYDROGUI_ImportSinusXOp.h diff --git a/src/HYDROGUI/CMakeLists.txt b/src/HYDROGUI/CMakeLists.txt index fcf27039..82f38ca8 100644 --- a/src/HYDROGUI/CMakeLists.txt +++ b/src/HYDROGUI/CMakeLists.txt @@ -37,6 +37,7 @@ set(PROJECT_HEADERS HYDROGUI_ImportImageDlg.h HYDROGUI_ImportImageOp.h HYDROGUI_ImportPolylineOp.h + HYDROGUI_ImportSinusXOp.h HYDROGUI_InputPanel.h HYDROGUI_LocalCSDlg.h HYDROGUI_LocalCSOp.h @@ -161,6 +162,7 @@ set(PROJECT_SOURCES HYDROGUI_ImportImageDlg.cxx HYDROGUI_ImportImageOp.cxx HYDROGUI_ImportPolylineOp.cxx + HYDROGUI_ImportSinusXOp.cxx HYDROGUI_InputPanel.cxx HYDROGUI_LocalCSDlg.cxx HYDROGUI_LocalCSOp.cxx diff --git a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx index f343bbfc..1d02a454 100644 --- a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx @@ -152,98 +152,11 @@ void HYDROGUI_ImportPolylineOp::onApply() mySHPObjects.clear(); SHPClose(aHSHP); } - else if (anExt == "sx") - { - QFile aFile (aFileName); - aFile.open(QIODevice::ReadOnly); - - Parse(aFile); - - QApplication::setOverrideCursor( Qt::WaitCursor ); - - startDocOperation(); - - ProcessSX(); - - commitDocOperation(); - commit(); - aFile.close(); - } - module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init ); QApplication::restoreOverrideCursor(); } -void HYDROGUI_ImportPolylineOp::ProcessSX() -{ - Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( doc()->CreateObject( KIND_POLYLINEXY ) ); - - Handle(HYDROData_Polyline3D) aPolylineObj = Handle(HYDROData_Polyline3D)::DownCast( doc()->CreateObject( KIND_POLYLINE ) ); - - Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( doc()->CreateObject( KIND_BATHYMETRY ) ); - HYDROData_Bathymetry::AltitudePoints aAPoints; - - int aNSect = myCurveBlocks.size(); - for ( int i = 0 ; i < aNSect ; i++ ) - { - bool aSectClosure = true; - HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; - aPolylineXY->AddSection( TCollection_AsciiString(myCurveBlocks[i].myName.toStdString().c_str()), aSectType, myCurveBlocks[i].myIsConnected ); - - for ( int k = 0 ; k < myCurveBlocks[i].myXYZPoints.size() ; k+=3 ) - { - HYDROData_PolylineXY::Point aSectPoint; - aSectPoint.SetX( myCurveBlocks[i].myXYZPoints[k].X() ); - aSectPoint.SetY( myCurveBlocks[i].myXYZPoints[k].Y() ); - aPolylineXY->AddPoint( i, aSectPoint ); - - aAPoints.Append(myCurveBlocks[i].myXYZPoints[k]); - } - } - QString aFileName = myFileDlg->selectedFile(); - QFileInfo aFileInfo(aFileName); - QString aBaseFileName = aFileInfo.baseName(); - QString aBathName = aBaseFileName + "_bath_1"; - QString aPolyXYName = aBaseFileName + "_polyXY_1"; - QString aPoly3DName = aBaseFileName + "_poly3D_1"; - - int anInd = 2; - for (;HYDROGUI_Tool::FindObjectByName( module(), aBathName, KIND_BATHYMETRY) || - HYDROGUI_Tool::FindObjectByName( module(), aPolyXYName, KIND_POLYLINEXY) || - HYDROGUI_Tool::FindObjectByName( module(), aPoly3DName, KIND_POLYLINE);) - { - aBathName = aBaseFileName + "_bath_" + QString::number(anInd); - aPolyXYName = aBaseFileName + "_polyXY_" + QString::number(anInd); - aPoly3DName = aBaseFileName + "_poly3D_" + QString::number(anInd); - anInd++; - } - - aPolylineXY->SetName( aPolyXYName ); - aPolylineXY->SetWireColor(HYDROData_PolylineXY::DefaultWireColor()); - aPolylineXY->Update(); - - aBath->SetAltitudePoints(aAPoints); - aBath->SetName( aBathName ); - - aPolylineObj->SetPolylineXY (aPolylineXY, false); - aPolylineObj->SetAltitudeObject(aBath); - - aPolylineObj->SetBorderColor( HYDROData_Polyline3D::DefaultBorderColor() ); - aPolylineObj->SetName( aPoly3DName ); - - aPolylineObj->Update(); - - size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() ); - if ( anActiveViewId == 0 ) - anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() ); - - module()->setObjectVisible( anActiveViewId, aPolylineXY, true ); - module()->setObjectVisible( anActiveViewId, aPolylineObj, true ); - - module()->setIsToUpdate( aPolylineObj ); -} - void HYDROGUI_ImportPolylineOp::ProcessSHPPolyXY(SHPObject* anObj, QString theFileName, int theInd) { //if (anObj->nSHPType != SHPT_ARC && anObj->nSHPType != SHPT_ARCM) @@ -371,109 +284,6 @@ void HYDROGUI_ImportPolylineOp::ProcessSHPPoly3D(SHPObject* anObj, QString theFi module()->setIsToUpdate( aPolylineObj ); } - -bool HYDROGUI_ImportPolylineOp::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")) - { - 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 = 2; - - 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.myIsClosed = 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[0] == 'B'*/ ); - if (aTotStat) - myCurveBlocks.push_back(aCurveBlockInfo); - - } - else - { - aLine = theFile.readLine().simplified(); - aList = aLine.split( ' ', QString::SkipEmptyParts ); - } - - } - - return true; - -} - void HYDROGUI_ImportPolylineOp::Parse(SHPHandle theHandle) { int aShapeType; diff --git a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h index 20b2f6e2..15733625 100644 --- a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h +++ b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h @@ -31,23 +31,6 @@ //}; 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 myXYZPoints; - int myType; - bool myIsConnected; - bool myIsClosed; - int myCurvePlane; - QString myName; - std::vector myAdditionalCurveInfo; - std::vector myRefCoords; - double myRefRatio; -}; class HYDROGUI_ImportPolylineOp : public HYDROGUI_Operation { @@ -60,14 +43,11 @@ public: protected: virtual void startOperation(); virtual void onApply(); - void ProcessSX(); - bool Parse( QFile& theFile ); void Parse( SHPHandle theHandle); void ProcessSHPPolyXY(SHPObject* anObj, QString theFileName, int theInd); void ProcessSHPPoly3D(SHPObject* anObj, QString theFileName, int theInd); private: SUIT_FileDlg* myFileDlg; - std::vector myCurveBlocks; std::vector mySHPObjects; }; diff --git a/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx b/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx new file mode 100644 index 00000000..7491988e --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ImportSinusXOp.cxx @@ -0,0 +1,283 @@ +// 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 "HYDROGUI_ImportSinusXOp.h" + +#include "HYDROGUI_DataModel.h" +#include "HYDROGUI_Module.h" +#include "HYDROGUI_UpdateFlags.h" +#include "HYDROGUI_Tool.h" +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include + + +HYDROGUI_ImportSinusXOp::HYDROGUI_ImportSinusXOp( HYDROGUI_Module* theModule ) +: HYDROGUI_Operation( theModule ) +{ + setName( tr( "IMPORT_SINUSX" ) ); +} + +HYDROGUI_ImportSinusXOp::~HYDROGUI_ImportSinusXOp() +{ +} + +void HYDROGUI_ImportSinusXOp::startOperation() +{ + HYDROGUI_Operation::startOperation(); + + myFileDlg = new SUIT_FileDlg( module()->getApp()->desktop(), true ); + myFileDlg->setWindowTitle( getName() ); + myFileDlg->setFileMode( SUIT_FileDlg::ExistingFiles ); + myFileDlg->setFilter( tr("SINUSX_FILTER") ); + + connect( myFileDlg, SIGNAL( accepted() ), this, SLOT( onApply() ) ); + connect( myFileDlg, SIGNAL( rejected() ), this, SLOT( onCancel() ) ); + + myFileDlg->exec(); +} + +void HYDROGUI_ImportSinusXOp::onApply() +{ + if ( !myFileDlg ) + { + abort(); + return; + } + + QString aFileName = myFileDlg->selectedFile(); + if ( aFileName.isEmpty() ) + { + abort(); + return; + } + + QString anExt = aFileName.split('.', QString::SkipEmptyParts).back(); + + if (anExt == "sx") + { + QFile aFile (aFileName); + aFile.open(QIODevice::ReadOnly); + + Parse(aFile); + + QApplication::setOverrideCursor( Qt::WaitCursor ); + + startDocOperation(); + + ProcessSX(); + + commitDocOperation(); + commit(); + aFile.close(); + } + + module()->update( UF_Model | UF_VTKViewer | UF_VTK_Forced | UF_VTK_Init ); + + QApplication::restoreOverrideCursor(); +} + +void HYDROGUI_ImportSinusXOp::ProcessSX() +{ + Handle(HYDROData_PolylineXY) aPolylineXY = Handle(HYDROData_PolylineXY)::DownCast( doc()->CreateObject( KIND_POLYLINEXY ) ); + + Handle(HYDROData_Polyline3D) aPolylineObj = Handle(HYDROData_Polyline3D)::DownCast( doc()->CreateObject( KIND_POLYLINE ) ); + + Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( doc()->CreateObject( KIND_BATHYMETRY ) ); + HYDROData_Bathymetry::AltitudePoints aAPoints; + + int aNSect = myCurveBlocks.size(); + for ( int i = 0 ; i < aNSect ; i++ ) + { + bool aSectClosure = true; + HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; + aPolylineXY->AddSection( TCollection_AsciiString(myCurveBlocks[i].myName.toStdString().c_str()), aSectType, myCurveBlocks[i].myIsConnected ); + + for ( int k = 0 ; k < myCurveBlocks[i].myXYZPoints.size() ; k+=3 ) + { + HYDROData_PolylineXY::Point aSectPoint; + aSectPoint.SetX( myCurveBlocks[i].myXYZPoints[k].X() ); + aSectPoint.SetY( myCurveBlocks[i].myXYZPoints[k].Y() ); + aPolylineXY->AddPoint( i, aSectPoint ); + + aAPoints.Append(myCurveBlocks[i].myXYZPoints[k]); + } + } + QString aFileName = myFileDlg->selectedFile(); + QFileInfo aFileInfo(aFileName); + QString aBaseFileName = aFileInfo.baseName(); + QString aBathName = aBaseFileName + "_bath_1"; + QString aPolyXYName = aBaseFileName + "_polyXY_1"; + QString aPoly3DName = aBaseFileName + "_poly3D_1"; + + int anInd = 2; + for (;HYDROGUI_Tool::FindObjectByName( module(), aBathName, KIND_BATHYMETRY) || + HYDROGUI_Tool::FindObjectByName( module(), aPolyXYName, KIND_POLYLINEXY) || + HYDROGUI_Tool::FindObjectByName( module(), aPoly3DName, KIND_POLYLINE);) + { + aBathName = aBaseFileName + "_bath_" + QString::number(anInd); + aPolyXYName = aBaseFileName + "_polyXY_" + QString::number(anInd); + aPoly3DName = aBaseFileName + "_poly3D_" + QString::number(anInd); + anInd++; + } + + aPolylineXY->SetName( aPolyXYName ); + aPolylineXY->SetWireColor(HYDROData_PolylineXY::DefaultWireColor()); + aPolylineXY->Update(); + + aBath->SetAltitudePoints(aAPoints); + aBath->SetName( aBathName ); + + aPolylineObj->SetPolylineXY (aPolylineXY, false); + aPolylineObj->SetAltitudeObject(aBath); + + aPolylineObj->SetBorderColor( HYDROData_Polyline3D::DefaultBorderColor() ); + aPolylineObj->SetName( aPoly3DName ); + + aPolylineObj->Update(); + + size_t anActiveViewId = HYDROGUI_Tool::GetActiveGraphicsViewId( module() ); + if ( anActiveViewId == 0 ) + anActiveViewId = HYDROGUI_Tool::GetActiveOCCViewId( module() ); + + module()->setObjectVisible( anActiveViewId, aPolylineXY, true ); + module()->setObjectVisible( anActiveViewId, aPolylineObj, true ); + + module()->setIsToUpdate( aPolylineObj ); +} + + +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")) + { + 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 = 2; + + 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.myIsClosed = 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[0] == 'B'*/ ); + if (aTotStat) + myCurveBlocks.push_back(aCurveBlockInfo); + + } + else + { + aLine = theFile.readLine().simplified(); + aList = aLine.split( ' ', QString::SkipEmptyParts ); + } + + } + + return true; + +} + diff --git a/src/HYDROGUI/HYDROGUI_ImportSinusXOp.h b/src/HYDROGUI/HYDROGUI_ImportSinusXOp.h new file mode 100644 index 00000000..0e1d3048 --- /dev/null +++ b/src/HYDROGUI/HYDROGUI_ImportSinusXOp.h @@ -0,0 +1,66 @@ +// 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 HYDROGUI_IMPORTSINUSX_H +#define HYDROGUI_IMPORTSINUSX_H + +#include "HYDROGUI_Operation.h" +#include + +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 myXYZPoints; + int myType; + bool myIsConnected; + bool myIsClosed; + int myCurvePlane; + QString myName; + std::vector myAdditionalCurveInfo; + std::vector myRefCoords; + double myRefRatio; +}; + +class HYDROGUI_ImportSinusXOp : public HYDROGUI_Operation +{ + Q_OBJECT + +public: + HYDROGUI_ImportSinusXOp( HYDROGUI_Module* theModule ); + virtual ~HYDROGUI_ImportSinusXOp(); + +protected: + virtual void startOperation(); + virtual void onApply(); + void ProcessSX(); + bool Parse( QFile& theFile ); +private: + SUIT_FileDlg* myFileDlg; + std::vector myCurveBlocks; +}; + +#endif diff --git a/src/HYDROGUI/HYDROGUI_Operations.cxx b/src/HYDROGUI/HYDROGUI_Operations.cxx index 3ebae572..e5b411ec 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.cxx +++ b/src/HYDROGUI/HYDROGUI_Operations.cxx @@ -29,6 +29,7 @@ #include "HYDROGUI_ExportFileOp.h" #include "HYDROGUI_ImportImageOp.h" #include "HYDROGUI_ImportPolylineOp.h" +#include "HYDROGUI_ImportSinusXOp.h" #include "HYDROGUI_ImportBathymetryOp.h" #include "HYDROGUI_ImmersibleZoneOp.h" #include "HYDROGUI_Module.h" @@ -124,6 +125,7 @@ void HYDROGUI_Module::createActions() createAction( RemoveImageRefsId, "REMOVE_IMAGE_REFERENCE", "REMOVE_IMAGE_REFERENCE_ICO" ); createAction( ImportPolylineId, "IMPORT_POLYLINE", "IMPORT_POLYLINE_ICO" ); + createAction( ImportSinusXId, "IMPORT_SINUSX", "IMPORT_SINUSX_ICO" ); createAction( CreatePolylineId, "CREATE_POLYLINE", "CREATE_POLYLINE_ICO" ); createAction( EditPolylineId, "EDIT_POLYLINE", "EDIT_POLYLINE_ICO" ); @@ -225,6 +227,8 @@ void HYDROGUI_Module::createMenus() int aHydroId = createMenu( tr( "MEN_DESK_HYDRO" ), -1, -1, aHydroMenu ); createMenu( ImportImageId, aHydroId, -1, -1 ); createMenu( ImportPolylineId, aHydroId, -1, -1 ); + createMenu( ImportSinusXId, aHydroId, -1, -1 ); + createMenu( ImportBathymetryId, aHydroId, -1, -1 ); createMenu( ImportStricklerTableFromFileId, aHydroId, -1, -1 ); createMenu( CreatePolylineId, aHydroId, -1, -1 ); @@ -272,6 +276,7 @@ void HYDROGUI_Module::createToolbars() createTool( separator(), aToolBar ); createTool( ImportImageId, aToolBar ); createTool( ImportPolylineId, aToolBar ); + createTool( ImportSinusXId, aToolBar ); createTool( ImportBathymetryId, aToolBar ); createTool( CreatePolylineId, aToolBar ); createTool( CreatePolyline3DId, aToolBar ); @@ -433,6 +438,9 @@ LightApp_Operation* HYDROGUI_Module::createOperation( const int theId ) const case ImportPolylineId: anOp = new HYDROGUI_ImportPolylineOp( aModule/*, theId == EditImportedPolylineId*/ ); break; + case ImportSinusXId: + anOp = new HYDROGUI_ImportSinusXOp( aModule ); + break; case ObserveImageId: anOp = new HYDROGUI_ObserveImageOp( aModule ); break; diff --git a/src/HYDROGUI/HYDROGUI_Operations.h b/src/HYDROGUI/HYDROGUI_Operations.h index 2669cae2..b22ca76e 100644 --- a/src/HYDROGUI/HYDROGUI_Operations.h +++ b/src/HYDROGUI/HYDROGUI_Operations.h @@ -110,6 +110,8 @@ enum OperationId RecognizeContoursId, SubmersibleId, ImportPolylineId, + ImportSinusXId, + ExportPolylineId, ImportStricklerTableFromFileId, diff --git a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts index a33c7cf9..a91b6064 100644 --- a/src/HYDROGUI/resources/HYDROGUI_msg_en.ts +++ b/src/HYDROGUI/resources/HYDROGUI_msg_en.ts @@ -906,6 +906,10 @@ Would you like to remove all references from the image? DSK_IMPORT_POLYLINE Import polyline from file(s) + + DSK_IMPORT_SINUSX + Import entities from SinusX file + DSK_LOAD_VISUAL_STATE Load visual state @@ -1194,6 +1198,10 @@ Would you like to remove all references from the image? MEN_IMPORT_POLYLINE Import polyline + + MEN_IMPORT_SINUSX + Import entities from SinusX file + MEN_LOAD_VISUAL_STATE Load visual state @@ -1459,6 +1467,10 @@ Would you like to remove all references from the image? STB_IMPORT_POLYLINE Import polyline + + STB_IMPORT_SINUSX + Import entities from SinusX file + STB_LOAD_VISUAL_STATE Load visual state @@ -2087,7 +2099,7 @@ file cannot be correctly imported for an Obstacle definition. POLYLINE_FILTER - SinusX Files (*.sx);;Shape files (*.shp) + Shape files (*.shp) BAD_IMPORTED_POLYLINE_FILES_TLT @@ -2106,6 +2118,22 @@ file cannot be correctly imported for an Obstacle definition. + + HYDROGUI_ImportSinusXOp + + IMPORT_SINUSX + Import entities from SinusX file + + + SINUSX_FILTER + SinusX Files (*.sx) + + + NO_ONE_ENTITY_IMPORTED + Entities cant be read + + + HYDROGUI_GeoreferencementDlg -- 2.39.2