From: isn Date: Fri, 22 May 2015 11:49:18 +0000 (+0300) Subject: #refs 522 X-Git-Tag: v1.4.1~21^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FBR_IMPROVEMENTS;p=modules%2Fhydro.git #refs 522 object names; translating of all file --- diff --git a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx index f5d365df..f13933dd 100644 --- a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx +++ b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.cxx @@ -39,6 +39,7 @@ #include #include +#include HYDROGUI_ImportPolylineOp::HYDROGUI_ImportPolylineOp( HYDROGUI_Module* theModule ) : HYDROGUI_Operation( theModule ) @@ -108,7 +109,7 @@ void HYDROGUI_ImportPolylineOp::Process() Handle(HYDROData_Polyline3D) aPolylineObj = Handle(HYDROData_Polyline3D)::DownCast( doc()->CreateObject( KIND_POLYLINE ) ); - Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( doc()->CreateObject( KIND_BATHYMETRY ) );; + Handle(HYDROData_Bathymetry) aBath = Handle(HYDROData_Bathymetry)::DownCast( doc()->CreateObject( KIND_BATHYMETRY ) ); HYDROData_Bathymetry::AltitudePoints aAPoints; int aNSect = myCurveBlocks.size(); @@ -116,7 +117,7 @@ void HYDROGUI_ImportPolylineOp::Process() { bool aSectClosure = true; HYDROData_PolylineXY::SectionType aSectType = HYDROData_PolylineXY::SECTION_POLYLINE; - aPolylineXY->AddSection( TCollection_AsciiString(myCurveBlocks[i].myName.toStdString().c_str()), aSectType, myCurveBlocks[i].myIsClosed ); + 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 ) { @@ -128,18 +129,36 @@ void HYDROGUI_ImportPolylineOp::Process() aAPoints.Append(myCurveBlocks[i].myXYZPoints[k]); } } - aPolylineXY->SetName("P_XY"); + 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("P_B"); + aBath->SetName( aBathName ); aPolylineObj->SetPolylineXY (aPolylineXY, false); aPolylineObj->SetAltitudeObject(aBath); aPolylineObj->SetBorderColor( HYDROData_Polyline3D::DefaultBorderColor() ); - aPolylineObj->SetName("P_3D"); + aPolylineObj->SetName( aPoly3DName ); aPolylineObj->Update(); @@ -181,6 +200,13 @@ bool HYDROGUI_ImportPolylineOp::Parse( QFile& theFile) 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 { @@ -191,11 +217,16 @@ bool HYDROGUI_ImportPolylineOp::Parse( QFile& theFile) { if (aBList.size() == 2 && (aBList[1] == "0" || aBList[1] == "1" || aBList[1] == "2")) aCurveBlockInfo.myCurvePlane = aBList[1].toInt(); - if (aBList.size() == 3 && (aBList[1] == "0" || aBList[1] == "1") && (aBList[2] == "0" || aBList[2] == "1")) + 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") { diff --git a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h index 4e7a066e..9dddb0c9 100644 --- a/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h +++ b/src/HYDROGUI/HYDROGUI_ImportPolylineOp.h @@ -31,12 +31,17 @@ 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; - bool myType; + int myType; bool myIsConnected; bool myIsClosed; int myCurvePlane; QString myName; + std::vector myAdditionalCurveInfo; + std::vector myRefCoords; + double myRefRatio; }; class HYDROGUI_ImportPolylineOp : public HYDROGUI_Operation