{
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 );
}
}
}
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() )
setPolylineShape( aResult );
}
+bool HYDROData_PolylineXY::IsHas2dPrs() const
+{
+ return true;
+}
+
bool HYDROData_PolylineXY::IsEditable() const
{
return !myLab.IsAttribute( GUID_IS_UNEDITABLE );
return aPath;
}
+void HYDROData_PolylineXY::UpdateLocalCS( double theDx, double theDy )
+{
+ NCollection_Sequence<TCollection_AsciiString> aSectNames;
+ NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+ NCollection_Sequence<bool> 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 );
+}
+
+