From 0938bf07db7972e18753f4ac51226c4a25053fe2 Mon Sep 17 00:00:00 2001 From: isn Date: Mon, 24 Aug 2015 13:41:27 +0300 Subject: [PATCH] #refs 647 --- src/HYDROData/HYDROData_Bathymetry.cxx | 5 ++++- src/HYDROData/HYDROData_Bathymetry.h | 2 +- src/HYDROData/HYDROData_IPolyline.h | 2 +- src/HYDROData/HYDROData_PolylineXY.cxx | 5 ++++- src/HYDROData/HYDROData_PolylineXY.h | 2 +- src/HYDROData/HYDROData_ProfileUZ.cxx | 2 +- src/HYDROData/HYDROData_ProfileUZ.h | 2 +- src/HYDROData/HYDROData_SinusX.cxx | 24 ++++++++++++------------ 8 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/HYDROData/HYDROData_Bathymetry.cxx b/src/HYDROData/HYDROData_Bathymetry.cxx index a43700c9..e48d04ff 100644 --- a/src/HYDROData/HYDROData_Bathymetry.cxx +++ b/src/HYDROData/HYDROData_Bathymetry.cxx @@ -99,7 +99,7 @@ void HYDROData_Bathymetry::SetAltitudePoints( const AltitudePoints& thePoints ) SetToUpdate( true ); } -HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() const +HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints(bool IsConvertToGlobal) const { AltitudePoints aPoints; @@ -111,6 +111,7 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() c if ( !aLabel.FindAttribute( TDataStd_RealArray::GetID(), aCoordsArray ) ) return aPoints; + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( myLab ); for ( int i = aCoordsArray->Lower(), n = aCoordsArray->Upper(); i <= n; ) { if ( i + 3 > n + 1 ) @@ -121,6 +122,8 @@ HYDROData_Bathymetry::AltitudePoints HYDROData_Bathymetry::GetAltitudePoints() c aPoint.SetY( aCoordsArray->Value( i++ ) ); aPoint.SetZ( aCoordsArray->Value( i++ ) ); + if( IsConvertToGlobal ) + aDoc->Transform( aPoint, false ); aPoints.Append( aPoint ); } diff --git a/src/HYDROData/HYDROData_Bathymetry.h b/src/HYDROData/HYDROData_Bathymetry.h index 9cd17328..5c355199 100644 --- a/src/HYDROData/HYDROData_Bathymetry.h +++ b/src/HYDROData/HYDROData_Bathymetry.h @@ -81,7 +81,7 @@ public: * Returns altitude points list. * \return points list */ - HYDRODATA_EXPORT virtual AltitudePoints GetAltitudePoints() const; + HYDRODATA_EXPORT virtual AltitudePoints GetAltitudePoints(bool IsConvertToGlobal = false) const; /** * Remove all altitude points. diff --git a/src/HYDROData/HYDROData_IPolyline.h b/src/HYDROData/HYDROData_IPolyline.h index 1c472899..5d15d916 100644 --- a/src/HYDROData/HYDROData_IPolyline.h +++ b/src/HYDROData/HYDROData_IPolyline.h @@ -195,7 +195,7 @@ public: * only for section with this index * \return list of points */ - HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const = 0; + HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1, bool IsConvertToGlobal = false ) const = 0; protected: diff --git a/src/HYDROData/HYDROData_PolylineXY.cxx b/src/HYDROData/HYDROData_PolylineXY.cxx index 37559e3f..839e949a 100755 --- a/src/HYDROData/HYDROData_PolylineXY.cxx +++ b/src/HYDROData/HYDROData_PolylineXY.cxx @@ -1076,7 +1076,7 @@ void HYDROData_PolylineXY::RemovePoint( const int theSectionIndex, SetToUpdate( true ); } -HYDROData_PolylineXY::PointsList HYDROData_PolylineXY::GetPoints( const int theSectionIndex ) const +HYDROData_PolylineXY::PointsList HYDROData_PolylineXY::GetPoints( const int theSectionIndex, bool IsConvertToGlobal ) const { PointsList aResList; @@ -1092,9 +1092,12 @@ HYDROData_PolylineXY::PointsList HYDROData_PolylineXY::GetPoints( const int theS TColStd_ListIteratorOfListOfReal anIterX( aListX->List() ); TColStd_ListIteratorOfListOfReal anIterY( aListY->List() ); + Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( myLab ); for ( ; anIterX.More() && anIterY.More(); anIterX.Next(), anIterY.Next() ) { Point aPoint( anIterX.Value(), anIterY.Value() ); + if (IsConvertToGlobal) + aDoc->Transform( aPoint, false ); aResList.Append( aPoint ); } diff --git a/src/HYDROData/HYDROData_PolylineXY.h b/src/HYDROData/HYDROData_PolylineXY.h index c088b987..4e70f42b 100644 --- a/src/HYDROData/HYDROData_PolylineXY.h +++ b/src/HYDROData/HYDROData_PolylineXY.h @@ -280,7 +280,7 @@ public: * only for section with this index * \return list of points */ - HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const; + HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1, bool IsConvertToGlobal = false ) const; /** diff --git a/src/HYDROData/HYDROData_ProfileUZ.cxx b/src/HYDROData/HYDROData_ProfileUZ.cxx index 1189970c..49fa3899 100755 --- a/src/HYDROData/HYDROData_ProfileUZ.cxx +++ b/src/HYDROData/HYDROData_ProfileUZ.cxx @@ -258,7 +258,7 @@ void HYDROData_ProfileUZ::RemovePoint( const int /*theSectionIndex*/, } } -HYDROData_ProfileUZ::PointsList HYDROData_ProfileUZ::GetPoints( const int /*theSectionIndex*/ ) const +HYDROData_ProfileUZ::PointsList HYDROData_ProfileUZ::GetPoints( const int /*theSectionIndex*/, bool /*IsConvertToGlobal*/ ) const { PointsList aResList; diff --git a/src/HYDROData/HYDROData_ProfileUZ.h b/src/HYDROData/HYDROData_ProfileUZ.h index fd543f07..aa9ebbc9 100644 --- a/src/HYDROData/HYDROData_ProfileUZ.h +++ b/src/HYDROData/HYDROData_ProfileUZ.h @@ -168,7 +168,7 @@ public: * only for section with this index * \return list of points */ - HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1 ) const; + HYDRODATA_EXPORT virtual PointsList GetPoints( const int theSectionIndex = -1, bool IsConvertToGlobal = false ) const; HYDRODATA_EXPORT virtual void CalculateAndAddPoints(const NCollection_Sequence& theXYZPoints, Handle_HYDROData_PolylineXY& thePolylineXY); diff --git a/src/HYDROData/HYDROData_SinusX.cxx b/src/HYDROData/HYDROData_SinusX.cxx index 86a5b151..879b12d5 100644 --- a/src/HYDROData/HYDROData_SinusX.cxx +++ b/src/HYDROData/HYDROData_SinusX.cxx @@ -341,17 +341,17 @@ void HYDROData_SinusX::HydroToSX(QFile& theFile, const NCollection_SequenceIsKind( STANDARD_TYPE(HYDROData_Bathymetry) )) { - Handle(HYDROData_Bathymetry) aBathy = Handle(HYDROData_Bathymetry)::DownCast( anEnt ); - HYDROData_Bathymetry::AltitudePoints anXYZPoints = aBathy->GetAltitudePoints(); - //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"; + 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) )) { @@ -363,7 +363,7 @@ void HYDROData_SinusX::HydroToSX(QFile& theFile, const NCollection_SequenceGetSectionType(j) == HYDROData_PolylineXY::SECTION_SPLINE) IsSpline = true; - HYDROData_PolylineXY::PointsList anXYPoints = aPolyXY->GetPoints(j); + HYDROData_PolylineXY::PointsList anXYPoints = aPolyXY->GetPoints(j, true); //Write to stream aTextStream << "B N\n"; aTextStream << "CN " << aPolyXY->GetName() << "\n"; -- 2.39.2