1 // ISession_Direction.cpp: implementation of the ISession_Direction class.
3 //////////////////////////////////////////////////////////////////////
6 #include "..\\GeometryApp.h"
7 #include "ISession_Direction.h"
8 #include <Prs3d_ArrowAspect.hxx>
9 #include <DsgPrs_LengthPresentation.hxx>
13 static char THIS_FILE[]=__FILE__;
16 IMPLEMENT_STANDARD_HANDLE(ISession_Direction,AIS_InteractiveObject)
17 IMPLEMENT_STANDARD_RTTIEXT(ISession_Direction,AIS_InteractiveObject)
19 //////////////////////////////////////////////////////////////////////
20 // Construction/Destruction
21 //////////////////////////////////////////////////////////////////////
23 ISession_Direction::ISession_Direction()
28 ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Dir& aDir,Standard_Real aLength,Standard_Real anArrowLength)
29 :myPnt(aPnt),myDir(aDir),myLength(aLength),myArrowLength(anArrowLength)
32 ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Vec& aVec,Standard_Real anArrowLength)
33 :myPnt(aPnt),myDir(aVec),myArrowLength(anArrowLength)
35 myLength = aVec.Magnitude();
38 ISession_Direction::ISession_Direction(const gp_Pnt2d& aPnt2d,
39 const gp_Dir2d& aDir2d,
40 Standard_Real aLength)
41 :myPnt(gp_Pnt(aPnt2d.X(),aPnt2d.Y(),0)),myDir(gp_Dir(aDir2d.X(),aDir2d.Y(),0)),myLength(aLength)
44 ISession_Direction::ISession_Direction(const gp_Pnt2d& aPnt2d,
45 const gp_Vec2d& aVec2d)
46 :myPnt(gp_Pnt(aPnt2d.X(),aPnt2d.Y(),0)),myDir(gp_Dir(aVec2d.X(),aVec2d.Y(),0))
48 myLength = aVec2d.Magnitude();
52 ISession_Direction::~ISession_Direction()
57 void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
58 const Handle(Prs3d_Presentation)& aPresentation,
59 const Standard_Integer /*aMode*/)
61 Handle(Prs3d_ArrowAspect) anArrowAspect = myDrawer->ArrowAspect();
62 anArrowAspect->SetLength(myArrowLength);
63 myDrawer->SetArrowAspect(anArrowAspect);
65 gp_Pnt LastPoint = myPnt ;
66 LastPoint.Translate (myLength*gp_Vec(myDir)) ;
68 if (myText.Length() == 0)
69 DsgPrs_LengthPresentation::Add(aPresentation,myDrawer,myPnt,LastPoint,DsgPrs_AS_LASTAR);
72 gp_Pnt OffsetPoint = myPnt;
73 OffsetPoint.Translate ( (myLength) *gp_Vec(myDir)) ;
74 DsgPrs_LengthPresentation::Add(aPresentation,myDrawer,myText,myPnt,LastPoint, -myDir, OffsetPoint, DsgPrs_AS_LASTAR);
79 void ISession_Direction::Compute(const Handle(Prs3d_Projector)& /*aProjector*/,
80 const Handle(Prs3d_Presentation)& /*aPresentation*/)
84 void ISession_Direction::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
85 const Standard_Integer /*aMode*/)
89 void ISession_Direction::SetText(TCollection_ExtendedString & aText)
94 void ISession_Direction::SetText(Standard_CString aText)