#include <BRep_Tool.hxx>
#include <Geom_BSplineCurve.hxx>
+#include <GeomAdaptor_Curve.hxx>
+#include <GCPnts_QuasiUniformAbscissa.hxx>
+#include <GCPnts_AbscissaPoint.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_XY.hxx>
#include <TopTools_SequenceOfShape.hxx>
+#define _DEVDEBUG_
+#include "HYDRO_trace.hxx"
+
#include <QColor>
#include <QStringList>
{
}
-QStringList HYDROData_Polyline3D::DumpToPython( MapOfTreatedObjects& theTreatedObjects ) const
+QStringList HYDROData_Polyline3D::DumpToPython( const QString& thePyScriptPath,
+ MapOfTreatedObjects& theTreatedObjects ) const
{
QStringList aResList = dumpObjectCreation( theTreatedObjects );
QString aPolylineName = GetObjPyName();
Handle(HYDROData_PolylineXY) aRefPolyline = GetPolylineXY();
- setPythonReferenceObject( theTreatedObjects, aResList, aRefPolyline, "SetPolylineXY" );
+ setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRefPolyline, "SetPolylineXY" );
Handle(HYDROData_ProfileUZ) aRefProfileUZ = GetProfileUZ();
if ( !aRefProfileUZ.IsNull() )
{
Handle(HYDROData_Profile) aProfile =
Handle(HYDROData_Profile)::DownCast( aRefProfileUZ->GetFatherObject() );
- if ( checkObjectPythonDefinition( theTreatedObjects, aResList, aProfile ) )
+ if ( checkObjectPythonDefinition( thePyScriptPath, theTreatedObjects, aResList, aProfile ) )
{
QString aProfileName = aProfile->GetObjPyName();
if ( !aProfileName.isEmpty() )
{
- aResList << QString( "%1.SetProfileUZ( %2.GetProfileUZ() );" )
+ aResList << QString( "%1.SetProfileUZ( %2.GetProfileUZ() )" )
.arg( aPolylineName ).arg( aProfileName );
}
}
{
Handle(HYDROData_Profile) aProfile =
Handle(HYDROData_Profile)::DownCast( aChildProfileUZ->GetFatherObject() );
- if ( checkObjectPythonDefinition( theTreatedObjects, aResList, aProfile ) )
+ if ( checkObjectPythonDefinition( thePyScriptPath, theTreatedObjects, aResList, aProfile ) )
{
QString aProfileName = aProfile->GetObjPyName();
if ( !aProfileName.isEmpty() )
{
- aResList << QString( "%1.SetChildProfileUZ( %2.GetProfileUZ() );" )
+ aResList << QString( "%1.SetChildProfileUZ( %2.GetProfileUZ() )" )
.arg( aPolylineName ).arg( aProfileName );
}
}
}
- setPythonReferenceObject( theTreatedObjects, aResList, aRefBathymetry, "SetAltitudeObject" );
+ setPythonReferenceObject( thePyScriptPath, theTreatedObjects, aResList, aRefBathymetry, "SetAltitudeObject" );
}
}
aResList << QString( "" );
- aResList << QString( "%1.Update();" ).arg( aPolylineName );
+ aResList << QString( "%1.Update()" ).arg( aPolylineName );
aResList << QString( "" );
return aResList;
return aResSeq;
}
-TopoDS_Shape HYDROData_Polyline3D::GetTopShape() const
-{
- return getTopShape();
-}
-
-TopoDS_Shape HYDROData_Polyline3D::GetShape3D() const
-{
- return getShape3D();
-}
-
void HYDROData_Polyline3D::Update()
{
HYDROData_Object::Update();
SetShape3D( aResWire );
}
-QColor HYDROData_Polyline3D::DefaultFillingColor()
+QColor HYDROData_Polyline3D::DefaultFillingColor() const
{
return QColor( Qt::transparent );
}
-QColor HYDROData_Polyline3D::DefaultBorderColor()
+QColor HYDROData_Polyline3D::DefaultBorderColor() const
{
return QColor( Qt::red );
}
-QColor HYDROData_Polyline3D::getDefaultFillingColor() const
-{
- return DefaultFillingColor();
-}
-
-QColor HYDROData_Polyline3D::getDefaultBorderColor() const
-{
- return DefaultBorderColor();
-}
-
bool HYDROData_Polyline3D::SetPolylineXY( const Handle(HYDROData_PolylineXY)& thePolyline,
const bool theIsUpdateProfile )
{
*/
}
-HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetPoints() const
+HYDROData_Polyline3D::Polyline3DPoints HYDROData_Polyline3D::GetPoints( double theEqDistance ) const
{
Polyline3DPoints aPoints;
} else {
// Get points from spline curve
Standard_Real aStart, anEnd;
- Handle(Geom_Curve) aCurve = BRep_Tool::Curve( TopoDS::Edge( anEdges.First() ), aStart, anEnd );
+ TopoDS_Edge anEdge = TopoDS::Edge( anEdges.First() );
+ Handle(Geom_Curve) aCurve = BRep_Tool::Curve( anEdge, aStart, anEnd );
+
+ if( theEqDistance > 0 )
+ {
+ GeomAdaptor_Curve anAdaptorCurve( aCurve );
+ double aLength = GCPnts_AbscissaPoint::Length( anAdaptorCurve );
+ int aNbPoints = ceil( aLength / theEqDistance );
+ GCPnts_QuasiUniformAbscissa aDist( anAdaptorCurve, aNbPoints );
+ if( aDist.IsDone() )
+ {
+ aNbPoints = aDist.NbPoints();
+ for( int i=1; i<=aNbPoints; i++ )
+ {
+ double p = aDist.Parameter( i );
+ gp_Pnt aPnt;
+ aCurve->D0( p, aPnt );
+ aPoints.Append( aPnt.XYZ() );
+ }
+ return aPoints;
+ }
+ }
+
Handle(Geom_BSplineCurve) aGeomSpline = Handle(Geom_BSplineCurve)::DownCast( aCurve );
if ( !aGeomSpline.IsNull() ) {