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