return getPolylineShape();
}
+bool HYDROData_PolylineXY::SetShape( const TopoDS_Shape& theShape )
+{
+ setPolylineShape( theShape );
+ return true;
+}
+
bool convertEdgeToSection( const TopoDS_Edge& theEdge,
NCollection_Sequence<TCollection_AsciiString>& theSectNames,
NCollection_Sequence<HYDROData_PolylineXY::SectionType>& theSectTypes,
if ( thePoints.Size() > 1 )
{
- HYDROData_BSplineOperation aBSpline( thePoints, theIsClosed, LOCAL_SELECTION_TOLERANCE );
+ Handle(Geom_BSplineCurve) aCurve =
+ HYDROData_BSplineOperation::ComputeCurve( thePoints, theIsClosed, LOCAL_SELECTION_TOLERANCE );
- TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aBSpline.Curve() ).Edge();
+ TopoDS_Edge anEdge = BRepBuilderAPI_MakeEdge( aCurve ).Edge();
aMakeWire.Add( anEdge );
}
aMakeWire.Build();
}
else
{
- HYDROData_BSplineOperation aBSpline( thePoints, theIsClosed, LOCAL_SELECTION_TOLERANCE );
- aBSpline.ComputePath( thePath );
+ Handle(Geom_BSplineCurve) aCurve =
+ HYDROData_BSplineOperation::ComputeCurve( thePoints, theIsClosed, LOCAL_SELECTION_TOLERANCE );
+ HYDROData_BSplineOperation::ComputePath( aCurve, thePath );
}
}
NCollection_Sequence<bool> aSectClosures;
GetSections( aSectNames, aSectTypes, aSectClosures );
- BRepBuilderAPI_MakeWire aMakeWire;
+ //BRepBuilderAPI_MakeWire aMakeWire;
TopTools_ListOfShape aSectionWiresList;
TopoDS_Wire aSectionWire = BuildWire( aSectionType, anIsSectionClosed, aPoints );
if ( !aSectionWire.IsNull() ) {
aSectionWiresList.Append( aSectionWire );
- aMakeWire.Add( aSectionWire );
+ //aMakeWire.Add( aSectionWire );
}
}
// all input wires in the <aSectionWiresList>
aPointToTest = aPoint;
}
- HYDROData_BSplineOperation aBSpline( aPoints, anIsSectionClosed, LOCAL_SELECTION_TOLERANCE );
+ Handle(Geom_BSplineCurve) aCurve =
+ HYDROData_BSplineOperation::ComputeCurve( aPoints, anIsSectionClosed, LOCAL_SELECTION_TOLERANCE );
- Quantity_Parameter aFirstParam = aBSpline.Curve()->FirstParameter();
- Quantity_Parameter aSecondParam = aBSpline.Curve()->LastParameter();
+ Quantity_Parameter aFirstParam = aCurve->FirstParameter();
+ Quantity_Parameter aSecondParam = aCurve->LastParameter();
if ( thePointIndex != aSectNbPoints - 1 )
{
- GeomAPI_ProjectPointOnCurve aProject( aPointToTest, aBSpline.Curve() );
+ GeomAPI_ProjectPointOnCurve aProject( aPointToTest, aCurve );
aSecondParam = aProject.LowerDistanceParameter();
}
- GeomAdaptor_Curve anAdap( aBSpline.Curve() );
+ GeomAdaptor_Curve anAdap( aCurve );
aResDistance = GCPnts_AbscissaPoint::Length( anAdap, aFirstParam, aSecondParam );
}
{
PointsList aResList;
+ if( IsCustom() )
+ {
+ //TODO: make interpolation to fill the list
+ }
+
Handle(TDataStd_RealList) aListX, aListY;
getPointsLists( theSectionIndex, aListX, aListY, false );
if ( aListX.IsNull() || aListY.IsNull() || aListX->IsEmpty() )
SetToUpdate( true );
}
+void HYDROData_PolylineXY::Transform( const QTransform& theTrsf )
+{
+ NCollection_Sequence<TCollection_AsciiString> aSectNames;
+ NCollection_Sequence<HYDROData_PolylineXY::SectionType> aSectTypes;
+ NCollection_Sequence<bool> aSectClosures;
+ GetSections( aSectNames, aSectTypes, aSectClosures );
+
+ 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 );
+
+ QPointF aTrsfPoint = theTrsf.map( QPointF( aPoint.X(), aPoint.Y() ) );
+
+ aPoint.SetX( aTrsfPoint.x() );
+ aPoint.SetY( aTrsfPoint.y() );
+ }
+ SetPoints( i, aPoints );
+ }
+
+ Update();
+}
+
+bool HYDROData_PolylineXY::IsCustom() const
+{
+ bool isNull = getPolylineShape().IsNull();
+ int aNbPoints = 0;
+ //TODO: to check if there is no points
+ //for( int i=0, n=NbSections(); i<n; i++ )
+ // aNbPoints += NbPoints( i );
+ return !isNull && aNbPoints == 0;
+}