From: isn Date: Thu, 18 Jun 2015 14:38:04 +0000 (+0300) Subject: sinusX p.8 // Export of polyXY X-Git-Tag: v1.4.2~54^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=362974bb559565ed8d260261e3c0f411dd18baef;p=modules%2Fhydro.git sinusX p.8 // Export of polyXY --- diff --git a/src/HYDROData/HYDROData_SinusX.cxx b/src/HYDROData/HYDROData_SinusX.cxx index c4645975..3c8ff3cf 100644 --- a/src/HYDROData/HYDROData_SinusX.cxx +++ b/src/HYDROData/HYDROData_SinusX.cxx @@ -343,14 +343,40 @@ void HYDROData_SinusX::HydroToSX(QFile& theFile, NCollection_SequenceGetAltitudePoints(); + //Write to stream 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++) + 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); + //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"; + } + } } } \ No newline at end of file