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