0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input...
[occt.git] / src / AIS / AIS_TextLabel.hxx
CommitLineData
29e2c6d2 1// Created on: 2014-11-10
2// Copyright (c) 2014 OPEN CASCADE SAS
3//
4// This file is part of Open CASCADE Technology software library.
5//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License version 2.1 as published
8// by the Free Software Foundation, with special exception defined in the file
9// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
10// distribution for complete text of the license and disclaimer of any warranty.
11//
12// Alternatively, this file may be used under the terms of Open CASCADE
13// commercial license or contractual agreement.
14
15#ifndef _AIS_TextLabel_HeaderFile
16#define _AIS_TextLabel_HeaderFile
17
18#include <AIS_InteractiveObject.hxx>
19
20#include <gp_Pnt.hxx>
ce01ec26 21#include <gp_Ax2.hxx>
29e2c6d2 22#include <Graphic3d_VerticalTextAlignment.hxx>
23#include <Graphic3d_HorizontalTextAlignment.hxx>
24#include <Font_FontAspect.hxx>
25#include <TCollection_ExtendedString.hxx>
26
27//! Presentation of the text.
28class AIS_TextLabel : public AIS_InteractiveObject
29{
30public:
31
32 //! Default constructor
33 Standard_EXPORT AIS_TextLabel();
34
35 //! Setup color of entire text.
36 Standard_EXPORT virtual void SetColor (const Quantity_Color& theColor) Standard_OVERRIDE;
37
85719f0e 38 //! Setup transparency within [0, 1] range.
39 Standard_EXPORT virtual void SetTransparency (const Standard_Real theValue) Standard_OVERRIDE;
40
41 //! Removes the transparency setting.
42 virtual void UnsetTransparency() Standard_OVERRIDE { SetTransparency (0.0); }
29e2c6d2 43
b6472664 44 //! Material has no effect for text label.
b6472664 45 virtual void SetMaterial (const Graphic3d_MaterialAspect& ) Standard_OVERRIDE {}
46
29e2c6d2 47 //! Setup text.
48 Standard_EXPORT void SetText (const TCollection_ExtendedString& theText);
49
50 //! Setup position.
51 Standard_EXPORT void SetPosition (const gp_Pnt& thePosition);
52
53 //! Setup horizontal justification.
54 Standard_EXPORT void SetHJustification (const Graphic3d_HorizontalTextAlignment theHJust);
55
56 //! Setup vertical justification.
57 Standard_EXPORT void SetVJustification (const Graphic3d_VerticalTextAlignment theVJust);
58
59 //! Setup angle.
60 Standard_EXPORT void SetAngle (const Standard_Real theAngle);
61
62 //! Setup zoomable property.
63 Standard_EXPORT void SetZoomable (const Standard_Boolean theIsZoomable);
64
65 //! Setup height.
66 Standard_EXPORT void SetHeight (const Standard_Real theHeight);
67
68 //! Setup font aspect.
69 Standard_EXPORT void SetFontAspect (const Font_FontAspect theFontAspect);
70
71 //! Setup font.
72 Standard_EXPORT void SetFont (Standard_CString theFont);
73
ce01ec26 74 //! Setup label orientation in the model 3D space.
75 Standard_EXPORT void SetOrientation3D (const gp_Ax2& theOrientation);
76
77 //! Reset label orientation in the model 3D space.
78 Standard_EXPORT void UnsetOrientation3D ();
79
80 //! Returns position.
81 Standard_EXPORT const gp_Pnt& Position() const;
82
83 //! Returns label orientation in the model 3D space.
84 Standard_EXPORT const gp_Ax2& Orientation3D() const;
85
86 //! Returns true if the current text placement mode uses text orientation in the model 3D space.
87 Standard_EXPORT Standard_Boolean HasOrientation3D() const;
88
3f1eb0ab 89 Standard_EXPORT void SetFlipping (const Standard_Boolean theIsFlipping);
90
91 Standard_EXPORT Standard_Boolean HasFlipping() const;
92
61b0191c 93 //! Define the display type of the text.
94 //!
95 //! TODT_NORMAL Default display. Text only.
96 //! TODT_SUBTITLE There is a subtitle under the text.
97 //! TODT_DEKALE The text is displayed with a 3D style.
98 //! TODT_BLEND The text is displayed in XOR.
99 //! TODT_DIMENSION Dimension line under text will be invisible.
100 Standard_EXPORT void SetDisplayType (const Aspect_TypeOfDisplayText theDisplayType);
101
102 //! Modifies the colour of the subtitle for the TODT_SUBTITLE TextDisplayType
103 //! and the colour of backgroubd for the TODT_DEKALE TextDisplayType.
104 Standard_EXPORT void SetColorSubTitle (const Quantity_Color& theColor);
105
29e2c6d2 106private:
107
108 //! Compute
109 Standard_EXPORT virtual void Compute (const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
110 const Handle(Prs3d_Presentation)& thePresentation,
111 const Standard_Integer theMode) Standard_OVERRIDE;
112
113 //! Compute selection
114 Standard_EXPORT virtual void ComputeSelection (const Handle(SelectMgr_Selection)& theSelection,
115 const Standard_Integer theMode) Standard_OVERRIDE;
116
117protected:
118
119 TCollection_ExtendedString myText;
29e2c6d2 120 TCollection_AsciiString myFont;
121 Font_FontAspect myFontAspect;
ce01ec26 122 gp_Ax2 myOrientation3D;
123 Standard_Boolean myHasOrientation3D;
3f1eb0ab 124 Standard_Boolean myHasFlipping;
29e2c6d2 125
126public:
127
128 //! CASCADE RTTI
a3f6f591 129 DEFINE_STANDARD_RTTIEXT(AIS_TextLabel,AIS_InteractiveObject)
29e2c6d2 130
131};
132
133DEFINE_STANDARD_HANDLE(AIS_TextLabel, AIS_InteractiveObject)
134
135#endif // _AIS_TextLabel_HeaderFile