0023776: Redesign of MFC samples after V2d viewer removing
[occt.git] / samples / mfc / standard / Common / Primitive / Sample2D_Text.cpp
CommitLineData
7fd59977 1#include "stdafx.h"
2
3#include "Sample2D_Text.h"
4
5c1f974e 5IMPLEMENT_STANDARD_HANDLE(Sample2D_Text,AIS_InteractiveObject)
6IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Text,AIS_InteractiveObject)
7fd59977 7
5c1f974e 8Sample2D_Text::Sample2D_Text (const TCollection_AsciiString& theText,
9 const gp_Pnt& thePosition,
10 const Aspect_TypeOfText theType,
11 const Quantity_PlaneAngle theAngle,
12 const Quantity_Color theColor,
13 const Font_FontAspect theFontAspect,
14 const Standard_CString theFont,
15 const Standard_Real theHeight,
16 const Graphic3d_HorizontalTextAlignment theHAlign,
17 const Graphic3d_VerticalTextAlignment theVAlign,
18 const Standard_Boolean theIsZoomable)
19:AIS_InteractiveObject()
7fd59977 20{
5c1f974e 21 myText = theText ;
22 myPosition = thePosition ;
23 myTypeOfText = theType ;
24 myAngle = theAngle ;
25 myColor = theColor ;
26 myFontAspect = theFontAspect;
27 myFont = theFont ;
28 myColor = theColor ;
29 myHeight = theHeight ;
30 myIsZoomable = theIsZoomable ;
31 myHAlign = theHAlign ;
32 myVAlign = theVAlign ;
7fd59977 33}
34
5c1f974e 35void Sample2D_Text::Compute ( const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
36 const Handle(Prs3d_Presentation)& aPresentation,
37 const Standard_Integer aMode)
7fd59977 38{
5c1f974e 39 aPresentation->Clear();
7fd59977 40
5c1f974e 41 Handle_Prs3d_TextAspect asp = myDrawer->TextAspect();
7fd59977 42
5c1f974e 43 asp->SetFont(myFont);
44 asp->SetColor(myColor);
45 asp->SetHeight(myHeight);
46
47 asp->SetHorizontalJustification(myHAlign);
48 asp->SetVerticalJustification(myVAlign);
49 asp->Aspect()->SetTextZoomable(myIsZoomable);
50 asp->Aspect()->SetTextAngle(myAngle);
51 asp->Aspect()->SetTextFontAspect(myFontAspect);
52 asp->SetHeight(myHeight);
53 Prs3d_Text::Draw(aPresentation, asp, myText, myPosition);
54}