File indexing completed on 2026-09-12 09:17:29
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _Graphic3d_Text_HeaderFile
0015 #define _Graphic3d_Text_HeaderFile
0016
0017 #include <gp_Ax2.hxx>
0018
0019 #include <Font_TextFormatter.hxx>
0020 #include <Graphic3d_HorizontalTextAlignment.hxx>
0021 #include <Graphic3d_VerticalTextAlignment.hxx>
0022 #include <NCollection_String.hxx>
0023 #include <Standard_Type.hxx>
0024 #include <Standard_Transient.hxx>
0025 #include <TCollection_AsciiString.hxx>
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 class Graphic3d_Text : public Standard_Transient
0036 {
0037 DEFINE_STANDARD_RTTIEXT(Graphic3d_Text, Standard_Transient)
0038
0039 public:
0040
0041 Standard_EXPORT Graphic3d_Text(const float theHeight);
0042
0043
0044 ~Graphic3d_Text() override = default;
0045
0046
0047 const NCollection_String& Text() const { return myText; }
0048
0049
0050 void SetText(const NCollection_String& theText) { myText = theText; }
0051
0052
0053 void SetText(const TCollection_AsciiString& theText) { myText = theText.ToCString(); }
0054
0055
0056 void SetText(const char* theText) { myText = theText; }
0057
0058
0059 const occ::handle<Font_TextFormatter>& TextFormatter() const { return myFormatter; }
0060
0061
0062 void SetTextFormatter(const occ::handle<Font_TextFormatter>& theFormatter)
0063 {
0064 myFormatter = theFormatter;
0065 }
0066
0067
0068
0069 const gp_Pnt& Position() const { return myOrientation.Location(); }
0070
0071
0072 void SetPosition(const gp_Pnt& thePoint) { myOrientation.SetLocation(thePoint); }
0073
0074
0075 const gp_Ax2& Orientation() const { return myOrientation; }
0076
0077
0078 bool HasPlane() const { return myHasPlane; }
0079
0080
0081 Standard_EXPORT void SetOrientation(const gp_Ax2& theOrientation);
0082
0083
0084 Standard_EXPORT void ResetOrientation();
0085
0086
0087 bool HasOwnAnchorPoint() const { return myHasOwnAnchor; }
0088
0089
0090 void SetOwnAnchorPoint(const bool theHasOwnAnchor) { myHasOwnAnchor = theHasOwnAnchor; }
0091
0092
0093 float Height() const { return myHeight; }
0094
0095
0096 void SetHeight(const float theHeight) { myHeight = theHeight; }
0097
0098
0099 Graphic3d_HorizontalTextAlignment HorizontalAlignment() const { return myHAlign; }
0100
0101
0102 void SetHorizontalAlignment(const Graphic3d_HorizontalTextAlignment theJustification)
0103 {
0104 myHAlign = theJustification;
0105 }
0106
0107
0108 Graphic3d_VerticalTextAlignment VerticalAlignment() const { return myVAlign; }
0109
0110
0111 void SetVerticalAlignment(const Graphic3d_VerticalTextAlignment theJustification)
0112 {
0113 myVAlign = theJustification;
0114 }
0115
0116 protected:
0117 occ::handle<Font_TextFormatter> myFormatter;
0118
0119 NCollection_String myText;
0120 gp_Ax2 myOrientation;
0121
0122 float myHeight;
0123 Graphic3d_HorizontalTextAlignment myHAlign;
0124 Graphic3d_VerticalTextAlignment myVAlign;
0125
0126 bool myHasPlane;
0127 bool myHasOwnAnchor;
0128 };
0129
0130 #endif