0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input...
[occt.git] / src / Prs3d / Prs3d_TextAspect.hxx
1 // Created on: 1993-09-14
2 // Created by: Jean-Louis FRENKEL
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
5 //
6 // This file is part of Open CASCADE Technology software library.
7 //
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
13 //
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
16
17 #ifndef _Prs3d_TextAspect_HeaderFile
18 #define _Prs3d_TextAspect_HeaderFile
19
20 #include <Graphic3d_AspectText3d.hxx>
21 #include <Graphic3d_TextPath.hxx>
22 #include <Graphic3d_HorizontalTextAlignment.hxx>
23 #include <Graphic3d_VerticalTextAlignment.hxx>
24 #include <Prs3d_BasicAspect.hxx>
25 #include <Quantity_Length.hxx>
26 #include <Quantity_PlaneAngle.hxx>
27
28 //! Defines the attributes when displaying a text.
29 class Prs3d_TextAspect : public Prs3d_BasicAspect
30 {
31   DEFINE_STANDARD_RTTIEXT(Prs3d_TextAspect, Prs3d_BasicAspect)
32 public:
33
34   //! Constructs an empty framework for defining display attributes of text.
35   Standard_EXPORT Prs3d_TextAspect();
36   
37   Standard_EXPORT Prs3d_TextAspect(const Handle(Graphic3d_AspectText3d)& theAspect);
38
39   //! Sets the color of the type used in text display.
40   void SetColor (const Quantity_Color& theColor) { myTextAspect->SetColor (theColor); }
41
42   //! Sets the font used in text display.
43   void SetFont (const Standard_CString theFont) { myTextAspect->SetFont (theFont); }
44   
45   //! Returns the height-width ratio, also known as the expansion factor.
46   void SetHeightWidthRatio (const Standard_Real theRatio) { myTextAspect->SetExpansionFactor (theRatio); }
47
48   //! Sets the length of the box which text will occupy.
49   void SetSpace (const Quantity_Length theSpace) { myTextAspect->SetSpace (theSpace); }
50   
51   //! Sets the height of the text.
52   void SetHeight (const Standard_Real theHeight) { myHeight = theHeight; }
53   
54   //! Sets the angle
55   void SetAngle (const Quantity_PlaneAngle theAngle) { myAngle = theAngle; }
56   
57   //! Returns the height of the text box.
58   Standard_Real Height() const { return myHeight; }
59   
60   //! Returns the angle
61   Quantity_PlaneAngle Angle() const { return myAngle; }
62   
63   //! Sets horizontal alignment of text.
64   void SetHorizontalJustification (const Graphic3d_HorizontalTextAlignment theJustification) { myHorizontalJustification = theJustification; }
65   
66   //! Sets the vertical alignment of text.
67   void SetVerticalJustification (const Graphic3d_VerticalTextAlignment theJustification) { myVerticalJustification = theJustification; }
68   
69   //! Sets the orientation of text.
70   void SetOrientation (const Graphic3d_TextPath theOrientation) { myOrientation = theOrientation; }
71   
72   //! Returns the horizontal alignment of the text.
73   //! The range of values includes:
74   //! -   left
75   //! -   center
76   //! -   right, and
77   //! -   normal (justified).
78   Graphic3d_HorizontalTextAlignment HorizontalJustification() const { return myHorizontalJustification; }
79   
80   //! Returns the vertical alignment of the text.
81   //! The range of values includes:
82   //! -   normal
83   //! -   top
84   //! -   cap
85   //! -   half
86   //! -   base
87   //! -   bottom
88   Graphic3d_VerticalTextAlignment VerticalJustification() const { return myVerticalJustification; }
89   
90   //! Returns the orientation of the text.
91   //! Text can be displayed in the following directions:
92   //! -   up
93   //! -   down
94   //! -   left, or
95   //! -   right
96   Graphic3d_TextPath Orientation() const { return myOrientation; }
97
98   //! Returns the purely textual attributes used in the display of text.
99   //! These include:
100   //! -   color
101   //! -   font
102   //! -   height/width ratio, that is, the expansion factor, and
103   //! -   space between characters.
104   const Handle(Graphic3d_AspectText3d)& Aspect() const { return myTextAspect; }
105
106   void SetAspect (const Handle(Graphic3d_AspectText3d)& theAspect) { myTextAspect = theAspect; }
107
108 protected:
109
110   Handle(Graphic3d_AspectText3d) myTextAspect;
111   Quantity_PlaneAngle myAngle;
112   Standard_Real myHeight;
113   Graphic3d_HorizontalTextAlignment myHorizontalJustification;
114   Graphic3d_VerticalTextAlignment myVerticalJustification;
115   Graphic3d_TextPath myOrientation;
116
117 };
118
119 DEFINE_STANDARD_HANDLE(Prs3d_TextAspect, Prs3d_BasicAspect)
120
121 #endif // _Prs3d_TextAspect_HeaderFile