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 |
10 | static char THIS_FILE[]=__FILE__; |
11 | #endif |
12 | |
7fd59977 |
13 | IMPLEMENT_STANDARD_RTTIEXT(ISession_Direction,AIS_InteractiveObject) |
14 | |
15 | #include "DsgPrs_LengthPresentation.hxx" |
16 | #include "Prs3d_ArrowAspect.hxx" |
6262338c |
17 | #include "Prs3d_Drawer.hxx" |
7fd59977 |
18 | ////////////////////////////////////////////////////////////////////// |
19 | // Construction/Destruction |
20 | ////////////////////////////////////////////////////////////////////// |
21 | |
22 | |
5c573e69 |
23 | ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Pnt& aPnt2) |
7fd59977 |
24 | :myStartPnt(aPnt),myEndPnt(aPnt2) |
25 | {} |
26 | |
5c573e69 |
27 | ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Vec& aVec) |
7fd59977 |
28 | :myStartPnt(aPnt) |
29 | { |
30 | myEndPnt = myStartPnt.Translated(aVec); |
31 | } |
32 | |
33 | |
5c573e69 |
34 | void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/, |
35 | const Handle(Prs3d_Presentation)& aPresentation, |
36 | const Standard_Integer /*aMode*/) |
7fd59977 |
37 | { |
e5b32824 |
38 | // Set style for arrow |
39 | Handle(Prs3d_ArrowAspect) anArrowAspect = myDrawer->ArrowAspect(); |
40 | |
41 | // Draw Line |
42 | Handle(Graphic3d_ArrayOfSegments) aPrims = new Graphic3d_ArrayOfSegments (2); |
43 | aPrims->AddVertex (myStartPnt); |
44 | aPrims->AddVertex (myEndPnt); |
45 | Prs3d_Root::CurrentGroup (aPresentation)->SetPrimitivesAspect (myDrawer->LineAspect()->Aspect()); |
46 | Prs3d_Root::CurrentGroup (aPresentation)->AddPrimitiveArray (aPrims); |
47 | // Draw arrow |
48 | Prs3d_Arrow::Draw (aPresentation, |
49 | myEndPnt, |
50 | gp_Dir (gp_Vec(myStartPnt, myEndPnt)), |
51 | anArrowAspect->Angle(), |
52 | anArrowAspect->Length()); |
7fd59977 |
53 | } |