#include <QApplication>
#include <QFile>
+#include <QFileInfo>
HYDROGUI_ImportPolylineOp::HYDROGUI_ImportPolylineOp( HYDROGUI_Module* theModule )
: HYDROGUI_Operation( theModule )
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();
{
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 )
{
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();
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
{
{
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")
{