X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHYDROGUI%2FHYDROGUI_Polyline.cxx;h=4f070b47c634761832d79a24ef1b43df8269f823;hb=9c947f35615e69e9e54a8c4b074dd1f2be13689c;hp=e624cb3dbd402c3d2fe568a9cb2f04c175436224;hpb=fcd41a745faf1509dda0fd8dc47c2b6a658f87dc;p=modules%2Fhydro.git diff --git a/src/HYDROGUI/HYDROGUI_Polyline.cxx b/src/HYDROGUI/HYDROGUI_Polyline.cxx index e624cb3d..4f070b47 100644 --- a/src/HYDROGUI/HYDROGUI_Polyline.cxx +++ b/src/HYDROGUI/HYDROGUI_Polyline.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,10 @@ #include #include #include +#include +#include +#include +#include IMPLEMENT_STANDARD_HANDLE (HYDROGUI_Polyline, AIS_Shape) IMPLEMENT_STANDARD_RTTIEXT(HYDROGUI_Polyline, AIS_Shape) @@ -53,11 +58,49 @@ HYDROGUI_Polyline::~HYDROGUI_Polyline() { } +Handle( Graphic3d_ArrayOfPolylines ) BuildEdgePresentation( const TopoDS_Edge& theEdge, double theDeviation ) +{ + BRepAdaptor_Curve aCurveAdaptor( theEdge ); + GCPnts_QuasiUniformDeflection aPnts( aCurveAdaptor, theDeviation ); + + Handle( Graphic3d_ArrayOfPolylines ) anArray; + if( !aPnts.IsDone() ) + return anArray; + + int n = aPnts.NbPoints(); + anArray = new Graphic3d_ArrayOfPolylines( n ); + for( int i=1; i<=n; i++ ) + anArray->AddVertex( aPnts.Value( i ) ); + + return anArray; +} + void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentationManager, const Handle(Prs3d_Presentation)& aPrs, const Standard_Integer aMode) { - AIS_Shape::Compute(aPresentationManager, aPrs, aMode); + //AIS_Shape::Compute(aPresentationManager, aPrs, aMode); + + aPrs->Clear(); + Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup( aPrs ); + Quantity_Color aColor; + Aspect_TypeOfLine aType; + Standard_Real anWidth; + Attributes()->LineAspect()->Aspect()->Values( aColor, aType, anWidth ); + Handle(Graphic3d_AspectLine3d) anAspect = new Graphic3d_AspectLine3d( aColor, aType, anWidth ); + + TopExp_Explorer Exp1 ( myshape, TopAbs_EDGE ); + for ( ; Exp1.More(); Exp1.Next() ) + { + TopoDS_Edge anEdge = TopoDS::Edge( Exp1.Current() ); + Handle( Graphic3d_ArrayOfPolylines ) anArray = BuildEdgePresentation( anEdge, 0.1 ); + if( !anArray.IsNull() ) + { + aGroup->SetPrimitivesAspect( anAspect ); + aGroup->AddPrimitiveArray( anArray ); + } + } + TopExp_Explorer Exp ( myshape, TopAbs_EDGE ); for ( ; Exp.More(); Exp.Next() ) { @@ -123,7 +166,7 @@ void HYDROGUI_Polyline::Compute(const Handle(PrsMgr_PresentationManager3d)& aPre aDir = D; } else - C->D1(aMaxRatioStep, C->Value (aMaxRatioStep), aDir); + C->D1(aMaxRatioStep, aPnt1, aDir); if ( anEdge.Orientation() == TopAbs_REVERSED ) aDir = -aDir;