0023776: Redesign of MFC samples after V2d viewer removing
[occt.git] / samples / mfc / standard / Common / Primitive / Sample2D_Text.cpp
1 #include "stdafx.h"
2
3 #include "Sample2D_Text.h"
4
5 IMPLEMENT_STANDARD_HANDLE(Sample2D_Text,AIS_InteractiveObject)
6 IMPLEMENT_STANDARD_RTTIEXT(Sample2D_Text,AIS_InteractiveObject)
7
8 Sample2D_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()
20 {
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     ;
33 }
34
35 void Sample2D_Text::Compute (  const Handle(PrsMgr_PresentationManager3d)& aPresentationManager,
36                   const Handle(Prs3d_Presentation)& aPresentation,
37                   const Standard_Integer aMode)
38 {
39   aPresentation->Clear();
40
41   Handle_Prs3d_TextAspect asp = myDrawer->TextAspect();
42
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 }