0024355: Compiler Warning level 4 for MFC samples
[occt.git] / samples / mfc / standard / 01_Geometry / src / ISession2D / ISession_Direction.cpp
CommitLineData
7fd59977 1// ISession_Direction.cpp: implementation of the ISession_Direction class.
2//
3//////////////////////////////////////////////////////////////////////
4
5#include "stdafx.h"
6#include "..\\GeometryApp.h"
7#include "ISession_Direction.h"
234e52be 8#include <Prs3d_ArrowAspect.hxx>
9#include <DsgPrs_LengthPresentation.hxx>
7fd59977 10
11#ifdef _DEBUG
12#undef THIS_FILE
13static char THIS_FILE[]=__FILE__;
14#endif
15
16IMPLEMENT_STANDARD_HANDLE(ISession_Direction,AIS_InteractiveObject)
17IMPLEMENT_STANDARD_RTTIEXT(ISession_Direction,AIS_InteractiveObject)
18
7fd59977 19//////////////////////////////////////////////////////////////////////
20// Construction/Destruction
21//////////////////////////////////////////////////////////////////////
22
23ISession_Direction::ISession_Direction()
24{
25
26}
27
5c573e69 28ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Dir& aDir,Standard_Real aLength,Standard_Real anArrowLength)
7fd59977 29:myPnt(aPnt),myDir(aDir),myLength(aLength),myArrowLength(anArrowLength)
30{}
31
5c573e69 32ISession_Direction::ISession_Direction(const gp_Pnt& aPnt,const gp_Vec& aVec,Standard_Real anArrowLength)
7fd59977 33:myPnt(aPnt),myDir(aVec),myArrowLength(anArrowLength)
34{
35 myLength = aVec.Magnitude();
36}
37
5c573e69 38ISession_Direction::ISession_Direction(const gp_Pnt2d& aPnt2d,
39 const gp_Dir2d& aDir2d,
7fd59977 40 Standard_Real aLength)
41:myPnt(gp_Pnt(aPnt2d.X(),aPnt2d.Y(),0)),myDir(gp_Dir(aDir2d.X(),aDir2d.Y(),0)),myLength(aLength)
42{}
43
5c573e69 44ISession_Direction::ISession_Direction(const gp_Pnt2d& aPnt2d,
45 const gp_Vec2d& aVec2d)
7fd59977 46:myPnt(gp_Pnt(aPnt2d.X(),aPnt2d.Y(),0)),myDir(gp_Dir(aVec2d.X(),aVec2d.Y(),0))
47{
48 myLength = aVec2d.Magnitude();
49}
50
51
52ISession_Direction::~ISession_Direction()
53{
54
55}
56
5c573e69 57void ISession_Direction::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
7fd59977 58 const Handle(Prs3d_Presentation)& aPresentation,
5c573e69 59 const Standard_Integer /*aMode*/)
7fd59977 60{
61 Handle(Prs3d_ArrowAspect) anArrowAspect = myDrawer->ArrowAspect();
62 anArrowAspect->SetLength(myArrowLength);
63 myDrawer->SetArrowAspect(anArrowAspect);
64
65 gp_Pnt LastPoint = myPnt ;
66 LastPoint.Translate (myLength*gp_Vec(myDir)) ;
67
68 if (myText.Length() == 0)
69 DsgPrs_LengthPresentation::Add(aPresentation,myDrawer,myPnt,LastPoint,DsgPrs_AS_LASTAR);
70 else
71 {
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);
75 }
76}
77
78
5c573e69 79void ISession_Direction::Compute(const Handle(Prs3d_Projector)& /*aProjector*/,
80 const Handle(Prs3d_Presentation)& /*aPresentation*/)
7fd59977 81 {
82 }
83
5c573e69 84void ISession_Direction::ComputeSelection(const Handle(SelectMgr_Selection)& /*aSelection*/,
85 const Standard_Integer /*aMode*/)
7fd59977 86{
87}
88
89void ISession_Direction::SetText(TCollection_ExtendedString & aText)
90{
91 myText = aText;
92}
5c573e69 93
94void ISession_Direction::SetText(Standard_CString aText)
95{
96 myText = aText;
97}