}
-bool HYDROData_SinusX::Export(const QString& theFilePath, NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
+bool HYDROData_SinusX::Export(const QString& theFilePath, const NCollection_Sequence<Handle_HYDROData_Entity>& theEntities)
{
if ( theFilePath.isEmpty() )
{
}
-void HYDROData_SinusX::HydroToSX(QFile& theFile, 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";
Handle_HYDROData_Entity anEnt = theEntities.Value(i);
if (anEnt->IsKind( STANDARD_TYPE(HYDROData_Bathymetry) ))
{
- Handle(HYDROData_Bathymetry) aBathy = Handle(HYDROData_Bathymetry)::DownCast( anEnt );
- HYDROData_Bathymetry::AltitudePoints anXYZPoints = aBathy->GetAltitudePoints();
- aTextStream << "B S\n";
- aTextStream << "CN " << aBathy->GetName() << "\n";
- aTextStream << "CP 0 0\n";
- aTextStream << "CP 0\n";
- for (int j = 1; j <= anXYZPoints.Size(); j++)
- aTextStream << " " << QString::number(anXYZPoints(j).X(), 'f', 3)
- << " " << QString::number(anXYZPoints(j).Y(), 'f', 3)
- << " " << QString::number(anXYZPoints(j).Z(), 'f', 3) << "\n";
+ Handle(HYDROData_Bathymetry) aBathy = Handle(HYDROData_Bathymetry)::DownCast( anEnt );
+ HYDROData_Bathymetry::AltitudePoints anXYZPoints = aBathy->GetAltitudePoints(true);
+ //Write to stream
+ aTextStream << "B S\n";
+ aTextStream << "CN " << aBathy->GetName() << "\n";
+ aTextStream << "CP 0 0\n";
+ aTextStream << "CP 0\n";
+ for (int j = anXYZPoints.Lower(); j <= anXYZPoints.Upper(); j++)
+ aTextStream << " " << QString::number(anXYZPoints(j).X(), 'f', 3)
+ << " " << QString::number(anXYZPoints(j).Y(), 'f', 3)
+ << " " << QString::number(anXYZPoints(j).Z(), 'f', 3) << "\n";
+ }
+ else if (anEnt->IsKind( STANDARD_TYPE(HYDROData_PolylineXY) ))
+ {
+ Handle(HYDROData_PolylineXY) aPolyXY = Handle(HYDROData_PolylineXY)::DownCast( anEnt );
+ for (int j = 0; j < aPolyXY->NbSections(); j++)
+ {
+ //Collect data
+ bool IsClosed = aPolyXY->IsClosedSection(j);
+ bool IsSpline = false;
+ if (aPolyXY->GetSectionType(j) == HYDROData_PolylineXY::SECTION_SPLINE)
+ IsSpline = true;
+ HYDROData_PolylineXY::PointsList anXYPoints = aPolyXY->GetPoints(j, true);
+ //Write to stream
+ aTextStream << "B N\n";
+ aTextStream << "CN " << aPolyXY->GetName() << "\n";
+ aTextStream << "CP " << IsClosed << " " << IsSpline << "\n";
+ aTextStream << "CP 0.0\n";
+ aTextStream << "CP 0\n";
+ if (aPolyXY->NbSections() > 1)
+ aTextStream << "C " << aPolyXY->GetName() << "_section_" << QString::number(j) << "\n";
+ for (int k = anXYPoints.Lower(); k <= anXYPoints.Upper(); k++)
+ aTextStream << " " << QString::number(anXYPoints(k).X(), 'f', 3)
+ << " " << QString::number(anXYPoints(k).Y(), 'f', 3)
+ << " 0.000\n";
+ }
+ }
+ else if (anEnt->IsKind( STANDARD_TYPE(HYDROData_Profile) ))
+ {
+ //Collect data
+ Handle(HYDROData_Profile) aProfile = Handle(HYDROData_Profile)::DownCast( anEnt );
+ HYDROData_ProfileUZ::PointsList aPointList = aProfile->GetParametricPoints();
+ bool IsClosed = aProfile->GetProfileUZ(false)->IsClosedSection(0);;
+ bool IsSpline = false;
+ if (aProfile->GetProfileUZ(false)->GetSectionType(0) == HYDROData_PolylineXY::SECTION_SPLINE)
+ IsSpline = true;
+ //Write to stream
+ aTextStream << "B P\n";
+ aTextStream << "CN " << aProfile->GetName() << "\n";
+ aTextStream << "CP " << IsClosed << " " << IsSpline << "\n";
+ gp_XY aLeftPoint(0.0, 0.0);
+ gp_XY aRightPoint(0.0, 0.0);
+ if (aProfile->GetLeftPoint(aLeftPoint, true) && aProfile->GetRightPoint(aRightPoint, true))
+ aTextStream << "CP " << QString::number(aLeftPoint.X(), 'f', 3) << " " <<
+ QString::number(aLeftPoint.Y(), 'f', 3) << " " <<
+ QString::number(aRightPoint.X(), 'f', 3) << " " <<
+ QString::number(aRightPoint.Y(), 'f', 3) << "\n";
+ else
+ aTextStream << "CP 0.0 0.0 0.0 0.0\n";
+ aTextStream << "CP 2\n";
+ for (int k = aPointList.Lower(); k <= aPointList.Upper(); k++)
+ aTextStream << " " << QString::number(aPointList(k).X(), 'f', 3)
+ << " 0.000 "
+ << QString::number(aPointList(k).Y(), 'f', 3) << "\n";
}
}
}
\ No newline at end of file