42cf5bc1 |
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 | |
4e1bc39a |
20 | #include <Graphic3d_AspectText3d.hxx> |
21 | #include <Graphic3d_TextPath.hxx> |
42cf5bc1 |
22 | #include <Graphic3d_HorizontalTextAlignment.hxx> |
23 | #include <Graphic3d_VerticalTextAlignment.hxx> |
42cf5bc1 |
24 | #include <Prs3d_BasicAspect.hxx> |
42cf5bc1 |
25 | |
26 | //! Defines the attributes when displaying a text. |
27 | class Prs3d_TextAspect : public Prs3d_BasicAspect |
28 | { |
4e1bc39a |
29 | DEFINE_STANDARD_RTTIEXT(Prs3d_TextAspect, Prs3d_BasicAspect) |
42cf5bc1 |
30 | public: |
31 | |
42cf5bc1 |
32 | //! Constructs an empty framework for defining display attributes of text. |
33 | Standard_EXPORT Prs3d_TextAspect(); |
34 | |
35 | Standard_EXPORT Prs3d_TextAspect(const Handle(Graphic3d_AspectText3d)& theAspect); |
87432b82 |
36 | |
42cf5bc1 |
37 | //! Sets the color of the type used in text display. |
87432b82 |
38 | void SetColor (const Quantity_Color& theColor) { myTextAspect->SetColor (theColor); } |
39 | |
42cf5bc1 |
40 | //! Sets the font used in text display. |
4e1bc39a |
41 | void SetFont (const Standard_CString theFont) { myTextAspect->SetFont (theFont); } |
42cf5bc1 |
42 | |
43 | //! Returns the height-width ratio, also known as the expansion factor. |
4e1bc39a |
44 | void SetHeightWidthRatio (const Standard_Real theRatio) { myTextAspect->SetExpansionFactor (theRatio); } |
45 | |
42cf5bc1 |
46 | //! Sets the length of the box which text will occupy. |
ee2be2a8 |
47 | void SetSpace (const Standard_Real theSpace) { myTextAspect->SetSpace (theSpace); } |
42cf5bc1 |
48 | |
49 | //! Sets the height of the text. |
4e1bc39a |
50 | void SetHeight (const Standard_Real theHeight) { myHeight = theHeight; } |
42cf5bc1 |
51 | |
52 | //! Sets the angle |
ee2be2a8 |
53 | void SetAngle (const Standard_Real theAngle) { myAngle = theAngle; } |
42cf5bc1 |
54 | |
55 | //! Returns the height of the text box. |
4e1bc39a |
56 | Standard_Real Height() const { return myHeight; } |
42cf5bc1 |
57 | |
58 | //! Returns the angle |
ee2be2a8 |
59 | Standard_Real Angle() const { return myAngle; } |
42cf5bc1 |
60 | |
61 | //! Sets horizontal alignment of text. |
4e1bc39a |
62 | void SetHorizontalJustification (const Graphic3d_HorizontalTextAlignment theJustification) { myHorizontalJustification = theJustification; } |
42cf5bc1 |
63 | |
64 | //! Sets the vertical alignment of text. |
4e1bc39a |
65 | void SetVerticalJustification (const Graphic3d_VerticalTextAlignment theJustification) { myVerticalJustification = theJustification; } |
42cf5bc1 |
66 | |
67 | //! Sets the orientation of text. |
4e1bc39a |
68 | void SetOrientation (const Graphic3d_TextPath theOrientation) { myOrientation = theOrientation; } |
42cf5bc1 |
69 | |
70 | //! Returns the horizontal alignment of the text. |
71 | //! The range of values includes: |
72 | //! - left |
73 | //! - center |
74 | //! - right, and |
75 | //! - normal (justified). |
4e1bc39a |
76 | Graphic3d_HorizontalTextAlignment HorizontalJustification() const { return myHorizontalJustification; } |
42cf5bc1 |
77 | |
78 | //! Returns the vertical alignment of the text. |
79 | //! The range of values includes: |
80 | //! - normal |
81 | //! - top |
82 | //! - cap |
83 | //! - half |
84 | //! - base |
85 | //! - bottom |
4e1bc39a |
86 | Graphic3d_VerticalTextAlignment VerticalJustification() const { return myVerticalJustification; } |
42cf5bc1 |
87 | |
88 | //! Returns the orientation of the text. |
89 | //! Text can be displayed in the following directions: |
90 | //! - up |
91 | //! - down |
92 | //! - left, or |
93 | //! - right |
4e1bc39a |
94 | Graphic3d_TextPath Orientation() const { return myOrientation; } |
95 | |
42cf5bc1 |
96 | //! Returns the purely textual attributes used in the display of text. |
97 | //! These include: |
98 | //! - color |
99 | //! - font |
100 | //! - height/width ratio, that is, the expansion factor, and |
101 | //! - space between characters. |
4e1bc39a |
102 | const Handle(Graphic3d_AspectText3d)& Aspect() const { return myTextAspect; } |
42cf5bc1 |
103 | |
4e1bc39a |
104 | void SetAspect (const Handle(Graphic3d_AspectText3d)& theAspect) { myTextAspect = theAspect; } |
42cf5bc1 |
105 | |
106 | protected: |
107 | |
42cf5bc1 |
108 | Handle(Graphic3d_AspectText3d) myTextAspect; |
ee2be2a8 |
109 | Standard_Real myAngle; |
42cf5bc1 |
110 | Standard_Real myHeight; |
111 | Graphic3d_HorizontalTextAlignment myHorizontalJustification; |
112 | Graphic3d_VerticalTextAlignment myVerticalJustification; |
113 | Graphic3d_TextPath myOrientation; |
114 | |
42cf5bc1 |
115 | }; |
116 | |
4e1bc39a |
117 | DEFINE_STANDARD_HANDLE(Prs3d_TextAspect, Prs3d_BasicAspect) |
42cf5bc1 |
118 | |
119 | #endif // _Prs3d_TextAspect_HeaderFile |