X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROData%2FHYDROData_PolylineXY.cxx;h=9711309a883a4a7c50f99e675f1a9dfab909b87c;hb=81c9f5cdf82909d0aebd2c491c50fa7516cc80b7;hp=d40212e22a6018b713445af69ae6d516bb7512c7;hpb=e5123a9d71157c50c9f1c6f68bccdfadc49f2360;p=modules%2Fhydro.git diff --git a/src/HYDROData/HYDROData_PolylineXY.cxx b/src/HYDROData/HYDROData_PolylineXY.cxx index d40212e2..9711309a 100755 --- a/src/HYDROData/HYDROData_PolylineXY.cxx +++ b/src/HYDROData/HYDROData_PolylineXY.cxx @@ -164,8 +164,10 @@ QStringList HYDROData_PolylineXY::DumpToPython( MapOfTreatedObjects& theTreatedO { const Point& aSectPoint = aSectPointsList.Value( k ); + QString anXStr = QString::number( aSectPoint.X(), 'f', 2 ); + QString anYStr = QString::number( aSectPoint.Y(), 'f', 2 ); aResList << QString( "%1.AddPoint( %2, gp_XY( %3, %4 ) );" ).arg( aPolylineName ) - .arg( i - 1 ).arg( aSectPoint.X() ).arg( aSectPoint.Y() ); + .arg( i - 1 ).arg( anXStr ).arg( anYStr ); } } } @@ -389,14 +391,15 @@ TopoDS_Wire HYDROData_PolylineXY::BuildWire( const SectionType& TopoDS_Wire aWire; if( theType == SECTION_POLYLINE ) { + int aNbPoints = thePoints.Length(); BRepBuilderAPI_MakePolygon aMakeWire; - for ( int i = 1, n = thePoints.Length(); i <= n ; ++i ) + for ( int i = 1, n = aNbPoints; i <= n ; ++i ) { gp_XYZ aPoint = thePoints.Value( i ); gp_Pnt aPnt( aPoint.X(), aPoint.Y(), aPoint.Z() ); aMakeWire.Add( aPnt ); } - if( theIsClosed ) + if( theIsClosed && ( aNbPoints > 2 ) ) aMakeWire.Close(); if ( aMakeWire.IsDone() ) @@ -537,6 +540,11 @@ void HYDROData_PolylineXY::Update() setPolylineShape( aResult ); } +bool HYDROData_PolylineXY::IsHas2dPrs() const +{ + return true; +} + bool HYDROData_PolylineXY::IsEditable() const { return !myLab.IsAttribute( GUID_IS_UNEDITABLE ); @@ -1096,4 +1104,26 @@ QPainterPath HYDROData_PolylineXY::GetPainterPath() const return aPath; } +void HYDROData_PolylineXY::UpdateLocalCS( double theDx, double theDy ) +{ + NCollection_Sequence aSectNames; + NCollection_Sequence aSectTypes; + NCollection_Sequence aSectClosures; + GetSections( aSectNames, aSectTypes, aSectClosures ); + + gp_XY aDelta( theDx, theDy ); + for ( int i = 0, aNbSects = aSectNames.Size(); i < aNbSects; i++ ) + { + PointsList aPoints = GetPoints( i ); + for( int j = 1, n = aPoints.Size(); j <= n; ++j ) + { + Point& aPoint = aPoints.ChangeValue( j ); + aPoint += aDelta; + } + SetPoints( i, aPoints ); + } + SetToUpdate( true ); +} + +