1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-24 13:50:49 +03:00

0030537: Visualization - wrapping text in font text formatter

Font_TextFormatter inherits Standard_Transient, now it is given as a handle in functions.
Graphic3d_Text - extended with Font_TextFormatter to be able to have it filled out of text render. If it is not defined here, the default text formatter of context is used.
OpenGl_Context - has default Font_TextFormatter for rendering OpenGl_Text.
AIS_TextLabel extending with Font_TextFormatter to prepare test case for text wrapping.
Prs3d_Text returns created graphic text to be able to manage it outside.
This commit is contained in:
nds
2020-09-07 11:10:32 +03:00
parent a516227511
commit 60f7b22536
14 changed files with 538 additions and 210 deletions

View File

@@ -17,6 +17,7 @@
#include <gp_Ax2.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Font_TextFormatter.hxx>
#include <Graphic3d_HorizontalTextAlignment.hxx>
#include <Graphic3d_VerticalTextAlignment.hxx>
#include <NCollection_String.hxx>
@@ -31,6 +32,7 @@
//! - text formatter. Formatter contains text, height and alignment parameter.
//!
//! This class also has parameters of the text height and H/V alignments.
//! Custom formatting is available using Font_TextFormatter.
class Graphic3d_Text : public Standard_Transient
{
DEFINE_STANDARD_RTTIEXT(Graphic3d_Text, Standard_Transient)
@@ -55,6 +57,12 @@ public:
//! Sets text value.
void SetText (Standard_CString theText) { myText = theText; }
//! @return text formatter; NULL by default, which means standard text formatter will be used.
const Handle(Font_TextFormatter)& TextFormatter() const { return myFormatter; }
//! Setup text default formatter for text within this context.
void SetTextFormatter (const Handle(Font_TextFormatter)& theFormatter) { myFormatter = theFormatter; }
//! The 3D point of attachment is projected.
//! If the orientation is defined, the text is written in the plane of projection.
const gp_Pnt& Position() const { return myOrientation.Location(); }
@@ -99,6 +107,8 @@ public:
void SetVerticalAlignment (const Graphic3d_VerticalTextAlignment theJustification) { myVAlign = theJustification; }
protected:
Handle(Font_TextFormatter) myFormatter; //!< text formatter
NCollection_String myText; //!< text value
gp_Ax2 myOrientation; //!< Text orientation in 3D space.