1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0030857: Visualization - using one implementation of Text in graphic group

Graphic3d_Group::Text(...) are obsolete, AddText() should be used instead of these methods.
Graphic3d_Text is a new class for parameters necessary to fill OpenGl_Text. All parameters of Graphic3d_Group::Text() are moved into this class.

OpenGl_TextParam is removed, these fields were moved into Graphic3d_Text.
OpenGl_Text constructors/Init with OpenGl_TextParam parameter were removed. Constructor with Graphic3d_Text should be used instead of it.
Using OpenGl_Text Init() with OpenGl_TextParam should be now replaced on two cases. The first case is setting values into Graphic3d_Text and the second case is calling Reset() after. As example, look at modification in OpenGl_FrameStatsPrs.
This commit is contained in:
nds
2019-08-23 14:28:04 +03:00
committed by apn
parent 077a220c51
commit 8ed0708507
21 changed files with 608 additions and 490 deletions

View File

@@ -18,6 +18,7 @@
#include <gp_Pnt.hxx>
#include <Graphic3d_Group.hxx>
#include <Graphic3d_Text.hxx>
#include <Graphic3d_Vertex.hxx>
#include <Prs3d_Presentation.hxx>
#include <Prs3d_TextAspect.hxx>
@@ -33,17 +34,14 @@ void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
const TCollection_ExtendedString& theText,
const gp_Pnt& theAttachmentPoint)
{
Standard_Real x, y, z;
theAttachmentPoint.Coord(x,y,z);
theGroup->SetPrimitivesAspect (theAspect->Aspect());
theGroup->Text (theText,
Graphic3d_Vertex(x,y,z),
theAspect->Height(),
theAspect->Angle(),
theAspect->Orientation(),
theAspect->HorizontalJustification(),
theAspect->VerticalJustification());
Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)theAspect->Height());
aText->SetText (theText.ToExtString());
aText->SetPosition (theAttachmentPoint);
aText->SetHorizontalAlignment (theAspect->HorizontalJustification());
aText->SetVerticalAlignment (theAspect->VerticalJustification());
theGroup->AddText (aText);
}
// =======================================================================
@@ -57,13 +55,12 @@ void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
const Standard_Boolean theHasOwnAnchor)
{
theGroup->SetPrimitivesAspect (theAspect->Aspect());
theGroup->Text (theText,
theOrientation,
theAspect->Height(),
theAspect->Angle(),
theAspect->Orientation(),
theAspect->HorizontalJustification(),
theAspect->VerticalJustification(),
Standard_True,
theHasOwnAnchor);
Handle(Graphic3d_Text) aText = new Graphic3d_Text ((Standard_ShortReal)theAspect->Height());
aText->SetText (theText.ToExtString());
aText->SetOrientation (theOrientation);
aText->SetOwnAnchorPoint (theHasOwnAnchor);
aText->SetHorizontalAlignment (theAspect->HorizontalJustification());
aText->SetVerticalAlignment (theAspect->VerticalJustification());
theGroup->AddText (aText);
}