1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +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

@@ -29,10 +29,10 @@
// function : Draw
// purpose :
// =======================================================================
void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
const Handle(Prs3d_TextAspect)& theAspect,
const TCollection_ExtendedString& theText,
const gp_Pnt& theAttachmentPoint)
Handle(Graphic3d_Text) Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
const Handle(Prs3d_TextAspect)& theAspect,
const TCollection_ExtendedString& theText,
const gp_Pnt& theAttachmentPoint)
{
theGroup->SetPrimitivesAspect (theAspect->Aspect());
@@ -42,17 +42,18 @@ void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
aText->SetHorizontalAlignment (theAspect->HorizontalJustification());
aText->SetVerticalAlignment (theAspect->VerticalJustification());
theGroup->AddText (aText);
return aText;
}
// =======================================================================
// function : Draw
// purpose :
// =======================================================================
void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
const Handle(Prs3d_TextAspect)& theAspect,
const TCollection_ExtendedString& theText,
const gp_Ax2& theOrientation,
const Standard_Boolean theHasOwnAnchor)
Handle(Graphic3d_Text) Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
const Handle(Prs3d_TextAspect)& theAspect,
const TCollection_ExtendedString& theText,
const gp_Ax2& theOrientation,
const Standard_Boolean theHasOwnAnchor)
{
theGroup->SetPrimitivesAspect (theAspect->Aspect());
@@ -63,4 +64,5 @@ void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
aText->SetHorizontalAlignment (theAspect->HorizontalJustification());
aText->SetVerticalAlignment (theAspect->VerticalJustification());
theGroup->AddText (aText);
return aText;
}

View File

@@ -37,10 +37,11 @@ public:
//! @param theAspect presentation attributes
//! @param theText text to draw
//! @param theAttachmentPoint attachment point
Standard_EXPORT static void Draw (const Handle(Graphic3d_Group)& theGroup,
const Handle(Prs3d_TextAspect)& theAspect,
const TCollection_ExtendedString& theText,
const gp_Pnt& theAttachmentPoint);
//! @return text to draw
Standard_EXPORT static Handle(Graphic3d_Text) Draw (const Handle(Graphic3d_Group)& theGroup,
const Handle(Prs3d_TextAspect)& theAspect,
const TCollection_ExtendedString& theText,
const gp_Pnt& theAttachmentPoint);
//! Draws the text label.
//! @param theGroup group to add primitives
@@ -48,11 +49,12 @@ public:
//! @param theText text to draw
//! @param theOrientation location and orientation specified in the model 3D space
//! @param theHasOwnAnchor
Standard_EXPORT static void Draw (const Handle(Graphic3d_Group)& theGroup,
const Handle(Prs3d_TextAspect)& theAspect,
const TCollection_ExtendedString& theText,
const gp_Ax2& theOrientation,
const Standard_Boolean theHasOwnAnchor = Standard_True);
//! @return text to draw
Standard_EXPORT static Handle(Graphic3d_Text) Draw (const Handle(Graphic3d_Group)& theGroup,
const Handle(Prs3d_TextAspect)& theAspect,
const TCollection_ExtendedString& theText,
const gp_Ax2& theOrientation,
const Standard_Boolean theHasOwnAnchor = Standard_True);
public: