0025773: Visualization - remove AIS_Drawer class and transfer its Link() logic to...
[occt.git] / samples / mfc / standard / 02_Modeling / src / ISession_Direction.cpp
CommitLineData
7fd59977 1// ISession_Direction.cpp: implementation of the ISession_Direction class.
2//
3//////////////////////////////////////////////////////////////////////
4
5#include "stdafx.h"
6#include "ISession_Direction.h"
7
8#ifdef _DEBUG
9#undef THIS_FILE
10static char THIS_FILE[]=__FILE__;
11#endif
12
13IMPLEMENT_STANDARD_HANDLE(ISession_Direction,AIS_InteractiveObject)
14IMPLEMENT_STANDARD_RTTIEXT(ISession_Direction,AIS_InteractiveObject)
15
16#include "DsgPrs_LengthPresentation.hxx"
17#include "Prs3d_ArrowAspect.hxx"
6262338c 18#include "Prs3d_Drawer.hxx"
7fd59977 19//////////////////////////////////////////////////////////////////////
20// Construction/Destruction
21//////////////////////////////////////////////////////////////////////
22
23
5c573e69 24ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Pnt& aPnt2)
7fd59977 25:myStartPnt(aPnt),myEndPnt(aPnt2)
26{}
27
5c573e69 28ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Vec& aVec)
7fd59977 29:myStartPnt(aPnt)
30{
31 myEndPnt = myStartPnt.Translated(aVec);
32}
33
34
5c573e69 35void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
36 const Handle(Prs3d_Presentation)& aPresentation,
37 const Standard_Integer /*aMode*/)
7fd59977 38{
e5b32824 39 // Set style for arrow
40 Handle(Prs3d_ArrowAspect) anArrowAspect = myDrawer->ArrowAspect();
41
42 // Draw Line
43 Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments (2);
44 aPrims->AddVertex (myStartPnt);
45 aPrims->AddVertex (myEndPnt);
46 Prs3d_Root::CurrentGroup (aPresentation)->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect());
47 Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (aPrims);
48 // Draw arrow
49 Prs3d_Arrow::Draw (aPresentation,
50 myEndPnt,
51 gp_Dir (gp_Vec(myStartPnt, myEndPnt)),
52 anArrowAspect->Angle(),
53 anArrowAspect->Length());
7fd59977 54}