mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +03:00
0030857: Visualization - using one implementation of Text in graphic group
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
@@ -796,16 +797,15 @@ void AIS_ColorScale::drawText (const Handle(Graphic3d_Group)& theGroup,
|
||||
const Graphic3d_VerticalTextAlignment theVertAlignment)
|
||||
{
|
||||
const Handle(Prs3d_TextAspect)& anAspect = myDrawer->TextAspect();
|
||||
theGroup->Text (theText,
|
||||
gp_Ax2 (gp_Pnt (theX, theY, 0.0), gp::DZ()),
|
||||
anAspect->Height(),
|
||||
anAspect->Angle(),
|
||||
anAspect->Orientation(),
|
||||
Graphic3d_HTA_LEFT,
|
||||
theVertAlignment,
|
||||
Standard_True,
|
||||
Standard_False); // has own anchor
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (anAspect->Height());
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
aTextParams->Init (aText,
|
||||
gp_Ax2 (gp_Pnt (theX, theY, 0.0), gp::DZ()),
|
||||
Standard_False, // has own anchor
|
||||
Graphic3d_HTA_LEFT,
|
||||
theVertAlignment);
|
||||
theGroup->AddText (aTextParams);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -19,6 +19,7 @@
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Prs3d_Arrow.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
@@ -53,7 +54,10 @@ void DsgPrs_XYZAxisPresentation::Add(
|
||||
if (*aText != '\0')
|
||||
{
|
||||
Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z());
|
||||
Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,a2,1./81.);
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (1./81.);
|
||||
aTextParams->Init (aText, a2);
|
||||
Prs3d_Root::CurrentGroup(aPresentation)->AddText (aTextParams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,6 +88,8 @@ void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
|
||||
if (*aText != '\0')
|
||||
{
|
||||
Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z());
|
||||
Prs3d_Root::CurrentGroup(aPresentation)->Text(aText,a2,1./81.);
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (1./81.);
|
||||
aTextParams->Init (aText, a2);
|
||||
Prs3d_Root::CurrentGroup(aPresentation)->AddText(aTextParams);
|
||||
}
|
||||
}
|
||||
|
@@ -132,6 +132,8 @@ Graphic3d_StructureDefinitionError.hxx
|
||||
Graphic3d_StructureManager.cxx
|
||||
Graphic3d_StructureManager.hxx
|
||||
Graphic3d_TextPath.hxx
|
||||
Graphic3d_TextParams.cxx
|
||||
Graphic3d_TextParams.hxx
|
||||
Graphic3d_Texture1D.cxx
|
||||
Graphic3d_Texture1D.hxx
|
||||
Graphic3d_Texture1Dmanual.cxx
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include "Graphic3d_Structure.pxx"
|
||||
#include <Graphic3d_StructureManager.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_TextureMap.hxx>
|
||||
#include <Graphic3d_TransModeFlags.hxx>
|
||||
#include <Message.hxx>
|
||||
@@ -311,31 +312,18 @@ void Graphic3d_Group::Marker (const Graphic3d_Vertex& thePoint,
|
||||
// function : Text
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_Group::Text (const Standard_CString /*theText*/,
|
||||
void Graphic3d_Group::Text (const Standard_CString theText,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Real /*theHeight*/,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Real /*theAngle*/,
|
||||
const Graphic3d_TextPath /*theTp*/,
|
||||
const Graphic3d_HorizontalTextAlignment /*theHta*/,
|
||||
const Graphic3d_VerticalTextAlignment /*theVta*/,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
if (IsDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (theToEvalMinMax)
|
||||
{
|
||||
Standard_ShortReal x, y, z;
|
||||
thePoint.Coord (x, y, z);
|
||||
myStructure->CStructure()->Is2dText = Standard_True;
|
||||
myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (x),
|
||||
static_cast<Standard_ShortReal> (y),
|
||||
static_cast<Standard_ShortReal> (z),
|
||||
1.0f));
|
||||
}
|
||||
Update();
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (theText, thePoint, theHta, theVta);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -347,8 +335,9 @@ void Graphic3d_Group::Text (const Standard_CString theText,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
Text (theText, thePoint, theHeight, 0.0,
|
||||
Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (theText, thePoint);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -358,15 +347,17 @@ void Graphic3d_Group::Text (const Standard_CString theText,
|
||||
void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Real theAngle,
|
||||
const Graphic3d_TextPath theTp,
|
||||
const Standard_Real /*theAngle*/,
|
||||
const Graphic3d_TextPath /*theTp*/,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
Text (aText.ToCString(), thePoint, theHeight, theAngle,
|
||||
theTp, theHta, theVta, theToEvalMinMax);
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (aText, thePoint, theHta, theVta);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -378,51 +369,35 @@ void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Real theAngle,
|
||||
const Graphic3d_TextPath theTP,
|
||||
const Graphic3d_HorizontalTextAlignment theHTA,
|
||||
const Graphic3d_VerticalTextAlignment theVTA,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theHasOwnAnchor)
|
||||
{
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
Text (aText.ToCString(),
|
||||
theOrientation,
|
||||
theHeight,
|
||||
theAngle,
|
||||
theTP,
|
||||
theHTA,
|
||||
theVTA,
|
||||
theToEvalMinMax,
|
||||
theHasOwnAnchor);
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (aText, theOrientation, theHasOwnAnchor, theHta, theVta);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Text
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_Group::Text (const Standard_CString /*theText*/,
|
||||
void Graphic3d_Group::Text (const Standard_CString theText,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Real /*theHeight*/,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Real /*theAngle*/,
|
||||
const Graphic3d_TextPath /*theTp*/,
|
||||
const Graphic3d_HorizontalTextAlignment /*theHta*/,
|
||||
const Graphic3d_VerticalTextAlignment /*theVta*/,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean /*theHasOwnAnchor*/)
|
||||
const Standard_Boolean theHasOwnAnchor)
|
||||
{
|
||||
if (IsDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (theToEvalMinMax)
|
||||
{
|
||||
myStructure->CStructure()->Is2dText = Standard_False;
|
||||
myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (theOrientation.Location().X()),
|
||||
static_cast<Standard_ShortReal> (theOrientation.Location().Y()),
|
||||
static_cast<Standard_ShortReal> (theOrientation.Location().Z()),
|
||||
1.0f));
|
||||
}
|
||||
Update();
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (theText, theOrientation, theHasOwnAnchor, theHta, theVta);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -437,16 +412,9 @@ void Graphic3d_Group::Text (const Handle(Font_TextFormatter)& theTextForma
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theHasOwnAnchor)
|
||||
{
|
||||
|
||||
Text ("", //theTextFormatter->String().ToCString(),
|
||||
theOrientation,
|
||||
theHeight,
|
||||
theAngle,
|
||||
theTp,
|
||||
theTextFormatter->HorizontalTextAlignment(),
|
||||
theTextFormatter->VerticalTextAlignment(),
|
||||
theToEvalMinMax,
|
||||
theHasOwnAnchor);
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (theTextFormatter, theOrientation, theHasOwnAnchor);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -459,6 +427,46 @@ void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
Text (aText.ToCString(), thePoint, theHeight, 0.0,
|
||||
Graphic3d_TP_RIGHT, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM, theToEvalMinMax);
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (aText, thePoint);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : AddText
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_Group::AddText (const Handle(Graphic3d_TextParams)& theTextParams,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
if (IsDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (theToEvalMinMax)
|
||||
{
|
||||
if (theTextParams->HasPlane())
|
||||
{
|
||||
myStructure->CStructure()->Is2dText = Standard_False;
|
||||
const gp_Ax2& anOrientation = theTextParams->Orientation();
|
||||
myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (anOrientation.Location().X()),
|
||||
static_cast<Standard_ShortReal> (anOrientation.Location().Y()),
|
||||
static_cast<Standard_ShortReal> (anOrientation.Location().Z()),
|
||||
1.0f));
|
||||
}
|
||||
else
|
||||
{
|
||||
Standard_ShortReal x, y, z;
|
||||
theTextParams->Position().Coord (x, y, z);
|
||||
myStructure->CStructure()->Is2dText = Standard_True;
|
||||
myBounds.Add (Graphic3d_Vec4 (static_cast<Standard_ShortReal> (x),
|
||||
static_cast<Standard_ShortReal> (y),
|
||||
static_cast<Standard_ShortReal> (z),
|
||||
1.0f));
|
||||
}
|
||||
}
|
||||
|
||||
Update();
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@ class Font_TextFormatter;
|
||||
class Graphic3d_Structure;
|
||||
class Graphic3d_ArrayOfPrimitives;
|
||||
class Graphic3d_AspectFillCapping;
|
||||
class Graphic3d_TextParams;
|
||||
|
||||
//! This class allows the definition of groups
|
||||
//! of primitives inside of graphic objects (presentations).
|
||||
@@ -127,7 +128,15 @@ public:
|
||||
//! Coordinates (NPC) Space).
|
||||
//! AAngle : Orientation of the text
|
||||
//! (with respect to the horizontal).
|
||||
Standard_EXPORT virtual void Text (const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Real AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
|
||||
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
|
||||
Standard_EXPORT virtual void Text (const Standard_CString AText,
|
||||
const Graphic3d_Vertex& APoint,
|
||||
const Standard_Real AHeight,
|
||||
const Standard_Real AAngle,
|
||||
const Graphic3d_TextPath ATp,
|
||||
const Graphic3d_HorizontalTextAlignment AHta,
|
||||
const Graphic3d_VerticalTextAlignment AVta,
|
||||
const Standard_Boolean EvalMinMax = Standard_True);
|
||||
|
||||
//! Creates the string <AText> at position <APoint>.
|
||||
//! The 3D point of attachment is projected. The text is
|
||||
@@ -142,7 +151,11 @@ public:
|
||||
//! ATp : TP_RIGHT
|
||||
//! AHta : HTA_LEFT
|
||||
//! AVta : VTA_BOTTOM
|
||||
Standard_EXPORT void Text (const Standard_CString AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
|
||||
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
|
||||
Standard_EXPORT void Text (const Standard_CString AText,
|
||||
const Graphic3d_Vertex& APoint,
|
||||
const Standard_Real AHeight,
|
||||
const Standard_Boolean EvalMinMax = Standard_True);
|
||||
|
||||
//! Creates the string <AText> at position <APoint>.
|
||||
//! The 3D point of attachment is projected. The text is
|
||||
@@ -154,7 +167,15 @@ public:
|
||||
//! Coordinates (NPC) Space).
|
||||
//! AAngle : Orientation of the text
|
||||
//! (with respect to the horizontal).
|
||||
Standard_EXPORT void Text (const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Real AAngle, const Graphic3d_TextPath ATp, const Graphic3d_HorizontalTextAlignment AHta, const Graphic3d_VerticalTextAlignment AVta, const Standard_Boolean EvalMinMax = Standard_True);
|
||||
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
|
||||
Standard_EXPORT void Text (const TCollection_ExtendedString& AText,
|
||||
const Graphic3d_Vertex& APoint,
|
||||
const Standard_Real AHeight,
|
||||
const Standard_Real AAngle,
|
||||
const Graphic3d_TextPath ATp,
|
||||
const Graphic3d_HorizontalTextAlignment AHta,
|
||||
const Graphic3d_VerticalTextAlignment AVta,
|
||||
const Standard_Boolean EvalMinMax = Standard_True);
|
||||
|
||||
//! Creates the string <AText> at position <APoint>.
|
||||
//! The 3D point of attachment is projected. The text is
|
||||
@@ -169,9 +190,14 @@ public:
|
||||
//! ATp : TP_RIGHT
|
||||
//! AHta : HTA_LEFT
|
||||
//! AVta : VTA_BOTTOM
|
||||
Standard_EXPORT void Text (const TCollection_ExtendedString& AText, const Graphic3d_Vertex& APoint, const Standard_Real AHeight, const Standard_Boolean EvalMinMax = Standard_True);
|
||||
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
|
||||
Standard_EXPORT void Text (const TCollection_ExtendedString& AText,
|
||||
const Graphic3d_Vertex& APoint,
|
||||
const Standard_Real AHeight,
|
||||
const Standard_Boolean EvalMinMax = Standard_True);
|
||||
|
||||
//! Creates the string <theText> at orientation <theOrientation> in 3D space.
|
||||
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
|
||||
Standard_EXPORT virtual void Text (const Standard_CString theTextUtf,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Real theHeight,
|
||||
@@ -183,6 +209,7 @@ public:
|
||||
const Standard_Boolean theHasOwnAnchor = Standard_True);
|
||||
|
||||
//! Creates the string <theText> at orientation <theOrientation> in 3D space.
|
||||
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
|
||||
Standard_EXPORT virtual void Text (const TCollection_ExtendedString& theText,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Real theHeight,
|
||||
@@ -194,6 +221,7 @@ public:
|
||||
const Standard_Boolean theHasOwnAnchor = Standard_True);
|
||||
|
||||
//! Add text element in 3D space.
|
||||
Standard_DEPRECATED("Deprecated method Text() with obsolete arguments, use AddText() instead of it")
|
||||
Standard_EXPORT virtual void Text (const Handle(Font_TextFormatter)& theTextFormatter,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Real theHeight,
|
||||
@@ -202,6 +230,9 @@ public:
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theHasOwnAnchor = Standard_True);
|
||||
|
||||
//! Adds a text for display
|
||||
Standard_EXPORT virtual void AddText (const Handle(Graphic3d_TextParams)& theTextParams,
|
||||
const Standard_Boolean theToEvalMinMax = Standard_True);
|
||||
|
||||
//! Adds an array of primitives for display
|
||||
Standard_EXPORT virtual void AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theType, const Handle(Graphic3d_IndexBuffer)& theIndices, const Handle(Graphic3d_Buffer)& theAttribs, const Handle(Graphic3d_BoundBuffer)& theBounds, const Standard_Boolean theToEvalMinMax = Standard_True);
|
||||
|
113
src/Graphic3d/Graphic3d_TextParams.cxx
Normal file
113
src/Graphic3d/Graphic3d_TextParams.cxx
Normal file
@@ -0,0 +1,113 @@
|
||||
// Copyright (c) 2013-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_TextParams, Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_TextParams
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_TextParams::Graphic3d_TextParams (const Standard_Real theHeight)
|
||||
: myHeight (theHeight)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_TextParams::Init (const NCollection_String theText,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta)
|
||||
{
|
||||
reset();
|
||||
|
||||
myHasPlane = Standard_False;
|
||||
myHasOwnAnchor = Standard_True;
|
||||
|
||||
myText = theText;
|
||||
myPoint = thePoint;
|
||||
|
||||
myHAlign = theHta;
|
||||
myVAlign = theVta;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_TextParams::Init (const NCollection_String theText,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Boolean theHasOwnAnchor,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta)
|
||||
{
|
||||
reset();
|
||||
|
||||
myHasPlane = Standard_True;
|
||||
myHasOwnAnchor = theHasOwnAnchor;
|
||||
|
||||
myText = theText;
|
||||
myOrientation = theOrientation;
|
||||
const gp_Pnt& aPoint = theOrientation.Location();
|
||||
myPoint = Graphic3d_Vertex (static_cast<Standard_ShortReal> (aPoint.X()),
|
||||
static_cast<Standard_ShortReal> (aPoint.Y()),
|
||||
static_cast<Standard_ShortReal> (aPoint.Z()));
|
||||
|
||||
myHAlign = theHta;
|
||||
myVAlign = theVta;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_TextParams::Init (const Handle(Font_TextFormatter)& theTextFormatter,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Boolean theHasOwnAnchor)
|
||||
{
|
||||
reset();
|
||||
|
||||
myHasPlane = Standard_True;
|
||||
myHasOwnAnchor = theHasOwnAnchor;
|
||||
|
||||
myText = "";
|
||||
myTextFormatter = theTextFormatter;
|
||||
myOrientation = theOrientation;
|
||||
const gp_Pnt& aPoint = theOrientation.Location();
|
||||
myPoint = Graphic3d_Vertex (static_cast<Standard_ShortReal> (aPoint.X()),
|
||||
static_cast<Standard_ShortReal> (aPoint.Y()),
|
||||
static_cast<Standard_ShortReal> (aPoint.Z()));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : reset
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_TextParams::reset()
|
||||
{
|
||||
myHasPlane = Standard_False;
|
||||
myHasOwnAnchor = Standard_True;
|
||||
|
||||
myText = "";
|
||||
myTextFormatter = NULL;
|
||||
myPoint = Graphic3d_Vertex (0.0f, 0.0f, 0.0f);
|
||||
myOrientation = gp_Ax2();
|
||||
|
||||
myHAlign = Graphic3d_HTA_LEFT;
|
||||
myVAlign = Graphic3d_VTA_BOTTOM;
|
||||
}
|
115
src/Graphic3d/Graphic3d_TextParams.hxx
Normal file
115
src/Graphic3d/Graphic3d_TextParams.hxx
Normal file
@@ -0,0 +1,115 @@
|
||||
// Copyright (c) 2013-2014 OPEN CASCADE SAS
|
||||
//
|
||||
// This file is part of Open CASCADE Technology software library.
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU Lesser General Public License version 2.1 as published
|
||||
// by the Free Software Foundation, with special exception defined in the file
|
||||
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#ifndef _Graphic3d_TextParams_HeaderFile
|
||||
#define _Graphic3d_TextParams_HeaderFile
|
||||
|
||||
#include <gp_Ax2.hxx>
|
||||
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Graphic3d_TextPath.hxx>
|
||||
#include <Graphic3d_HorizontalTextAlignment.hxx>
|
||||
#include <Graphic3d_VerticalTextAlignment.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <Standard_Transient.hxx>
|
||||
|
||||
#include <Font_TextFormatter.hxx>
|
||||
|
||||
//! This class describes texture parameters.
|
||||
class Graphic3d_TextParams : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_TextParams, Standard_Transient)
|
||||
public:
|
||||
|
||||
//! Creates the string <AText> at position <APoint>.
|
||||
//! The 3D point of attachment is projected. The text is
|
||||
//! written in the plane of projection.
|
||||
//! The attributes are given with respect to the plane of
|
||||
//! projection.
|
||||
//! AHeight : Height of text.
|
||||
//! (Relative to the Normalized Projection
|
||||
//! Coordinates (NPC) Space).
|
||||
//! AAngle : Orientation of the text
|
||||
//! (with respect to the horizontal).
|
||||
Standard_EXPORT Graphic3d_TextParams (const Standard_Real theHeight);
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~Graphic3d_TextParams() {}
|
||||
|
||||
//! Fill with text and point
|
||||
Standard_EXPORT void Init (const NCollection_String theText,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Graphic3d_HorizontalTextAlignment theHta = Graphic3d_HTA_LEFT,
|
||||
const Graphic3d_VerticalTextAlignment theVta = Graphic3d_VTA_BOTTOM);
|
||||
|
||||
//! Fill with text and orientation
|
||||
Standard_EXPORT void Init (const NCollection_String theText,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Boolean theHasOwnAnchor = Standard_True,
|
||||
const Graphic3d_HorizontalTextAlignment theHta = Graphic3d_HTA_LEFT,
|
||||
const Graphic3d_VerticalTextAlignment theVta = Graphic3d_VTA_BOTTOM);
|
||||
|
||||
//! Fill by text formatter
|
||||
Standard_EXPORT void Init (const Handle(Font_TextFormatter)& theTextFormatter,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Boolean theHasOwnAnchor = Standard_True);
|
||||
|
||||
//! Returns true if the text is filled by a point
|
||||
Standard_Boolean HasPlane() const { return myHasPlane; }
|
||||
|
||||
const NCollection_String& Text() const { return myText; }
|
||||
|
||||
//! Returns text point.
|
||||
const Graphic3d_Vertex& Position() const { return myPoint; }
|
||||
|
||||
//! Sets text point.
|
||||
void SetPosition (const Graphic3d_Vertex& thePoint) { myPoint.SetCoord (thePoint.X(), thePoint.Y(), thePoint.Z()); }
|
||||
|
||||
//! Returns true if the text has an anchor point
|
||||
Standard_Boolean HasOwnAnchorPoint() const { return myHasOwnAnchor; }
|
||||
|
||||
//! Returns text orientation in 3D space.
|
||||
const gp_Ax2& Orientation() const { return myOrientation; }
|
||||
|
||||
Standard_Integer Height() const { return myHeight; }
|
||||
void SetHeight (const Standard_Integer theHeight) { myHeight = theHeight; }
|
||||
|
||||
Graphic3d_HorizontalTextAlignment HAlignment() const { return myHAlign; }
|
||||
Graphic3d_VerticalTextAlignment VAlignment() const { return myVAlign; }
|
||||
|
||||
//! Returns text formatter
|
||||
const Handle(Font_TextFormatter)& TextFormatter() const { return myTextFormatter; }
|
||||
|
||||
protected:
|
||||
//! Resets parameters to default
|
||||
void reset();
|
||||
|
||||
private:
|
||||
NCollection_String myText;
|
||||
Handle(Font_TextFormatter) myTextFormatter;
|
||||
|
||||
bool myHasPlane; //!< Check if text have orientation in 3D space.
|
||||
Graphic3d_Vertex myPoint;
|
||||
gp_Ax2 myOrientation; //!< Text orientation in 3D space.
|
||||
|
||||
private:
|
||||
// general properties
|
||||
Standard_Integer myHeight;
|
||||
Graphic3d_HorizontalTextAlignment myHAlign;
|
||||
Graphic3d_VerticalTextAlignment myVAlign;
|
||||
Standard_Boolean myHasOwnAnchor;
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_TextParams, Standard_Transient)
|
||||
|
||||
#endif // _Graphic3d_TextParams_HeaderFile
|
@@ -18,6 +18,7 @@
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <MeshVS_Buffer.hxx>
|
||||
@@ -252,7 +253,10 @@ void MeshVS_TextPrsBuilder::Build ( const Handle(Prs3d_Presentation)& Prs,
|
||||
|
||||
aPnts.Append (Graphic3d_Vec3 ((float )X, (float )Y, (float )Z));
|
||||
Graphic3d_Vertex aPoint (X, Y, Z);
|
||||
aTextGroup->Text (aStr.ToCString(), aPoint, aHeight);
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (aHeight);
|
||||
aTextParams->Init (aStr.ToCString(), aPoint);
|
||||
aTextGroup->AddText(aTextParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -111,9 +111,9 @@ void OpenGl_FrameStatsPrs::Update (const Handle(OpenGl_Workspace)& theWorkspace)
|
||||
{
|
||||
aParams.VAlign = Graphic3d_VTA_BOTTOM;
|
||||
}
|
||||
if (aParams.Height != myCountersText.FormatParams().Height
|
||||
|| aParams.HAlign != myCountersText.FormatParams().HAlign
|
||||
|| aParams.VAlign != myCountersText.FormatParams().VAlign)
|
||||
if (aParams.Height != myCountersText.FormatParams()->Height()
|
||||
|| aParams.HAlign != myCountersText.FormatParams()->HAlignment()
|
||||
|| aParams.VAlign != myCountersText.FormatParams()->VAlignment())
|
||||
{
|
||||
myCountersText.Release (aCtx.operator->());
|
||||
}
|
||||
@@ -125,7 +125,8 @@ void OpenGl_FrameStatsPrs::Update (const Handle(OpenGl_Workspace)& theWorkspace)
|
||||
}
|
||||
|
||||
TCollection_AsciiString aText = aStats->FormatStats (aRendParams.CollectedStats);
|
||||
myCountersText.Init (aCtx, aText.ToCString(), OpenGl_Vec3 (0.0f, 0.0f, 0.0f), aParams);
|
||||
myCountersText.Init (aCtx, aText.ToCString(), OpenGl_Vec3 (0.0f, 0.0f, 0.0f),
|
||||
Standard_False, aParams.Height, aParams.HAlign, aParams.VAlign);
|
||||
|
||||
updateChart (theWorkspace);
|
||||
}
|
||||
@@ -341,9 +342,18 @@ void OpenGl_FrameStatsPrs::updateChart (const Handle(OpenGl_Workspace)& theWorks
|
||||
const float aLabX = aParams.HAlign == Graphic3d_HTA_RIGHT
|
||||
? float(anOffset.x())
|
||||
: float(anOffset.x() + aCharSize.x());
|
||||
myChartLabels[0].Init (aCtx, aLabels[isTopDown ? 0 : 2].ToCString(), OpenGl_Vec3 (aLabX, float(anOffset.y()), 0.0f), aParams);
|
||||
myChartLabels[1].Init (aCtx, aLabels[isTopDown ? 1 : 1].ToCString(), OpenGl_Vec3 (aLabX, float(anOffset.y() - aBinSize.y() / 2), 0.0f), aParams);
|
||||
myChartLabels[2].Init (aCtx, aLabels[isTopDown ? 2 : 0].ToCString(), OpenGl_Vec3 (aLabX, float(anOffset.y() - aBinSize.y()), 0.0f), aParams);
|
||||
myChartLabels[0].Init (aCtx,
|
||||
aLabels[isTopDown ? 0 : 2].ToCString(),
|
||||
OpenGl_Vec3 (aLabX, float(anOffset.y()), 0.0f),
|
||||
Standard_False, aParams.Height, aParams.HAlign, aParams.VAlign);
|
||||
myChartLabels[1].Init (aCtx,
|
||||
aLabels[isTopDown ? 1 : 1].ToCString(),
|
||||
OpenGl_Vec3 (aLabX, float(anOffset.y() - aBinSize.y() / 2), 0.0f),
|
||||
Standard_False, aParams.Height, aParams.HAlign, aParams.VAlign);
|
||||
myChartLabels[2].Init (aCtx,
|
||||
aLabels[isTopDown ? 2 : 0].ToCString(),
|
||||
OpenGl_Vec3 (aLabX, float(anOffset.y() - aBinSize.y()), 0.0f),
|
||||
Standard_False, aParams.Height, aParams.HAlign, aParams.VAlign);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_TransformPers.hxx>
|
||||
#include <Graphic3d_TransformUtils.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
@@ -522,7 +523,7 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels (const Handle(OpenGl_Worksp
|
||||
|
||||
myAspectLabels.Aspect()->SetColor (anAxis.NameColor);
|
||||
theWorkspace->SetAspects (&myAspectLabels);
|
||||
anAxis.Label.SetPosition (aMiddle);
|
||||
anAxis.Label.FormatParams()->SetPosition (Graphic3d_Vertex(aMiddle.x(), aMiddle.y(), aMiddle.z()));
|
||||
anAxis.Label.Render (theWorkspace);
|
||||
}
|
||||
|
||||
@@ -715,11 +716,15 @@ void OpenGl_GraduatedTrihedron::SetMinMax (const OpenGl_Vec3& theMin, const Open
|
||||
OpenGl_GraduatedTrihedron::Axis::Axis (const Graphic3d_AxisAspect& theAspect,
|
||||
const OpenGl_Vec3& theDirection)
|
||||
: Direction (theDirection),
|
||||
Label (NCollection_String ((Standard_Utf16Char* )theAspect.Name().ToExtString()).ToCString(), theDirection, THE_LABEL_PARAMS),
|
||||
Tickmark (NULL),
|
||||
Line (NULL),
|
||||
Arrow (NULL)
|
||||
{
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (THE_LABEL_PARAMS.Height);
|
||||
aTextParams->Init (NCollection_String ((Standard_Utf16Char* )theAspect.Name().ToExtString()),
|
||||
Graphic3d_Vertex (theDirection.x(), theDirection.y(), theDirection.z()),
|
||||
THE_LABEL_PARAMS.HAlign, THE_LABEL_PARAMS.VAlign);
|
||||
Label = OpenGl_Text (aTextParams);
|
||||
NameColor = theAspect.NameColor();
|
||||
LineAspect.Aspect()->SetColor (theAspect.Color());
|
||||
}
|
||||
|
@@ -223,107 +223,24 @@ void OpenGl_Group::AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theTy
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Text
|
||||
// function : AddText
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::Text (const Standard_CString theTextUtf,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Real theAngle,
|
||||
const Graphic3d_TextPath theTp,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
void OpenGl_Group::AddText (const Handle(Graphic3d_TextParams)& theTextParams,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
if (IsDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OpenGl_TextParam aParams;
|
||||
OpenGl_Structure* aStruct = GlStruct();
|
||||
aParams.Height = int ((theHeight < 2.0) ? aStruct->GlDriver()->DefaultTextHeight() : theHeight);
|
||||
aParams.HAlign = theHta;
|
||||
aParams.VAlign = theVta;
|
||||
const OpenGl_Vec3 aPoint (thePoint.X(), thePoint.Y(), thePoint.Z());
|
||||
OpenGl_Text* aText = new OpenGl_Text (theTextUtf, aPoint, aParams);
|
||||
if (theTextParams->Height() < 2.0)
|
||||
theTextParams->SetHeight (int (aStruct->GlDriver()->DefaultTextHeight()));
|
||||
|
||||
OpenGl_Text* aText = new OpenGl_Text (theTextParams);
|
||||
AddElement (aText);
|
||||
Graphic3d_Group::Text (theTextUtf, thePoint, theHeight, theAngle,
|
||||
theTp, theHta, theVta, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Text
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::Text (const Standard_CString theTextUtf,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Real theAngle,
|
||||
const Graphic3d_TextPath theTp,
|
||||
const Graphic3d_HorizontalTextAlignment theHTA,
|
||||
const Graphic3d_VerticalTextAlignment theVTA,
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theHasOwnAnchor)
|
||||
{
|
||||
if (IsDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OpenGl_TextParam aParams;
|
||||
OpenGl_Structure* aStruct = GlStruct();
|
||||
|
||||
aParams.Height = int ((theHeight < 2.0) ? aStruct->GlDriver()->DefaultTextHeight() : theHeight);
|
||||
aParams.HAlign = theHTA;
|
||||
aParams.VAlign = theVTA;
|
||||
|
||||
OpenGl_Text* aText = new OpenGl_Text (theTextUtf, theOrientation, aParams, theHasOwnAnchor != Standard_False);
|
||||
|
||||
AddElement (aText);
|
||||
|
||||
Graphic3d_Group::Text (theTextUtf,
|
||||
theOrientation,
|
||||
theHeight,
|
||||
theAngle,
|
||||
theTp,
|
||||
theHTA,
|
||||
theVTA,
|
||||
theToEvalMinMax,
|
||||
theHasOwnAnchor);
|
||||
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetFlippingOptions
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::Text (const Handle(Font_TextFormatter)& theTextFormatter,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Real theAngle,
|
||||
const Graphic3d_TextPath theTp,
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theHasOwnAnchor)
|
||||
{
|
||||
if (IsDeleted())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
OpenGl_TextParam aParams;
|
||||
OpenGl_Structure* aStruct = GlStruct();
|
||||
|
||||
aParams.Height = int ((theHeight < 2.0) ? aStruct->GlDriver()->DefaultTextHeight() : theHeight);
|
||||
|
||||
OpenGl_Text* aText = new OpenGl_Text ("", theOrientation, aParams, theHasOwnAnchor != Standard_False);
|
||||
aText->SetTextFormatter (theTextFormatter);
|
||||
|
||||
AddElement (aText);
|
||||
|
||||
Graphic3d_Group::Text ("", theOrientation, theHeight, theAngle,
|
||||
theTp, theTextFormatter->HorizontalTextAlignment(), theTextFormatter->VerticalTextAlignment(),
|
||||
theToEvalMinMax, theHasOwnAnchor);
|
||||
Graphic3d_Group::AddText (theTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
|
@@ -74,35 +74,9 @@ public:
|
||||
const Handle(Graphic3d_BoundBuffer)& theBounds,
|
||||
const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE;
|
||||
|
||||
//! Add text element
|
||||
Standard_EXPORT virtual void Text (const Standard_CString theTextUtf,
|
||||
const Graphic3d_Vertex& thePoint,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Real theAngle,
|
||||
const Graphic3d_TextPath theTp,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE;
|
||||
|
||||
//! Add text element in 3D space.
|
||||
Standard_EXPORT virtual void Text (const Standard_CString theTextUtf,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Real theAngle,
|
||||
const Graphic3d_TextPath theTp,
|
||||
const Graphic3d_HorizontalTextAlignment theHTA,
|
||||
const Graphic3d_VerticalTextAlignment theVTA,
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theHasOwnAnchor = Standard_True) Standard_OVERRIDE;
|
||||
|
||||
//! Add text element in 3D space.
|
||||
Standard_EXPORT virtual void Text (const Handle(Font_TextFormatter)& theTextFormatter,
|
||||
const gp_Ax2& theOrientation,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Real theAngle,
|
||||
const Graphic3d_TextPath theTp,
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theHasOwnAnchor = Standard_True) Standard_OVERRIDE;
|
||||
//! Adds a text for display
|
||||
Standard_EXPORT virtual void AddText (const Handle(Graphic3d_TextParams)& theTextParams,
|
||||
const Standard_Boolean theToEvalMinMax = Standard_True) Standard_OVERRIDE;
|
||||
|
||||
//! Add flipping element
|
||||
Standard_EXPORT virtual void SetFlippingOptions (const Standard_Boolean theIsEnabled,
|
||||
|
@@ -85,14 +85,10 @@ OpenGl_Text::OpenGl_Text()
|
||||
myWinY (0.0f),
|
||||
myWinZ (0.0f),
|
||||
myScaleHeight (1.0f),
|
||||
myPoint (0.0f, 0.0f, 0.0f),
|
||||
myIs2d (false),
|
||||
myHasPlane (false),
|
||||
myHasAnchorPoint (true)
|
||||
myIs2d (false)
|
||||
{
|
||||
myParams.Height = 10;
|
||||
myParams.HAlign = Graphic3d_HTA_LEFT;
|
||||
myParams.VAlign = Graphic3d_VTA_BOTTOM;
|
||||
myParams = new Graphic3d_TextParams (10.);
|
||||
myParams->Init ("", Graphic3d_Vertex (0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -107,13 +103,10 @@ OpenGl_Text::OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
myWinZ (0.0f),
|
||||
myScaleHeight (1.0f),
|
||||
myExportHeight (1.0f),
|
||||
myParams (theParams),
|
||||
myString (theText),
|
||||
myPoint (thePoint),
|
||||
myIs2d (false),
|
||||
myHasPlane (false),
|
||||
myHasAnchorPoint (true)
|
||||
myIs2d (false)
|
||||
{
|
||||
myParams = new Graphic3d_TextParams (theParams.Height);
|
||||
myParams->Init (theText, Graphic3d_Vertex (thePoint.x(), thePoint.y(), thePoint.z()), theParams.HAlign, theParams.VAlign);
|
||||
//
|
||||
}
|
||||
|
||||
@@ -130,17 +123,24 @@ OpenGl_Text::OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
myWinZ (0.0),
|
||||
myScaleHeight (1.0),
|
||||
myExportHeight (1.0),
|
||||
myParams (theParams),
|
||||
myString (theText),
|
||||
myIs2d (false),
|
||||
myOrientation (theOrientation),
|
||||
myHasPlane (true),
|
||||
myHasAnchorPoint (theHasOwnAnchor)
|
||||
myIs2d (false)
|
||||
{
|
||||
myParams = new Graphic3d_TextParams (theParams.Height);
|
||||
myParams->Init (theText, theOrientation, theHasOwnAnchor, theParams.HAlign, theParams.VAlign);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_Text
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_Text::OpenGl_Text (const Handle(Graphic3d_TextParams)& theTextParams)
|
||||
: myWinX (0.0f),
|
||||
myWinY (0.0f),
|
||||
myWinZ (0.0f),
|
||||
myScaleHeight (1.0f),
|
||||
myExportHeight (1.0f),
|
||||
myParams (theTextParams)
|
||||
{
|
||||
const gp_Pnt& aPoint = theOrientation.Location();
|
||||
myPoint = OpenGl_Vec3 (static_cast<Standard_ShortReal> (aPoint.X()),
|
||||
static_cast<Standard_ShortReal> (aPoint.Y()),
|
||||
static_cast<Standard_ShortReal> (aPoint.Z()));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -149,7 +149,7 @@ OpenGl_Text::OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
// =======================================================================
|
||||
void OpenGl_Text::SetPosition (const OpenGl_Vec3& thePoint)
|
||||
{
|
||||
myPoint = thePoint;
|
||||
myParams->SetPosition (Graphic3d_Vertex (thePoint.x(), thePoint.y(), thePoint.z()));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -159,11 +159,11 @@ void OpenGl_Text::SetPosition (const OpenGl_Vec3& thePoint)
|
||||
void OpenGl_Text::SetFontSize (const Handle(OpenGl_Context)& theCtx,
|
||||
const Standard_Integer theFontSize)
|
||||
{
|
||||
if (myParams.Height != theFontSize)
|
||||
if (myParams->Height() != theFontSize)
|
||||
{
|
||||
Release (theCtx.operator->());
|
||||
}
|
||||
myParams.Height = theFontSize;
|
||||
myParams->SetHeight (theFontSize);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -174,10 +174,14 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const Standard_Utf8Char* theText,
|
||||
const OpenGl_Vec3& thePoint)
|
||||
{
|
||||
Init (theCtx, theText, thePoint, Standard_False, myParams->Height(), myParams->HAlignment(), myParams->VAlignment());
|
||||
|
||||
releaseVbos (theCtx.operator->());
|
||||
myIs2d = false;
|
||||
myPoint = thePoint;
|
||||
myString.FromUnicode (theText);
|
||||
|
||||
NCollection_String aText;
|
||||
aText.FromUnicode (theText);
|
||||
myParams->Init (aText, Graphic3d_Vertex (thePoint.x(), thePoint.y(), thePoint.z()));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -189,18 +193,7 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const OpenGl_TextParam& theParams)
|
||||
{
|
||||
if (myParams.Height != theParams.Height)
|
||||
{
|
||||
Release (theCtx.operator->());
|
||||
}
|
||||
else
|
||||
{
|
||||
releaseVbos (theCtx.operator->());
|
||||
}
|
||||
myIs2d = false;
|
||||
myParams = theParams;
|
||||
myPoint = thePoint;
|
||||
myString.FromUnicode (theText);
|
||||
Init (theCtx, theText, thePoint, Standard_False, theParams.Height, theParams.HAlign, theParams.VAlign);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -212,7 +205,27 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const OpenGl_Vec2& thePoint,
|
||||
const OpenGl_TextParam& theParams)
|
||||
{
|
||||
if (myParams.Height != theParams.Height)
|
||||
OpenGl_Vec3 aPoint;
|
||||
aPoint.SetValues (thePoint, 0.0f);
|
||||
|
||||
NCollection_String aText;
|
||||
aText.FromUnicode (theText.ToExtString());
|
||||
Init (theCtx, aText, aPoint, Standard_True, theParams.Height, theParams.HAlign, theParams.VAlign);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Init
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const NCollection_String theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const Standard_Boolean theIs2d,
|
||||
const Standard_Real theHeight,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta)
|
||||
{
|
||||
if (myParams->Height() != theHeight)
|
||||
{
|
||||
Release (theCtx.operator->());
|
||||
}
|
||||
@@ -220,10 +233,9 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
{
|
||||
releaseVbos (theCtx.operator->());
|
||||
}
|
||||
myIs2d = true;
|
||||
myParams = theParams;
|
||||
myPoint.SetValues (thePoint, 0.0f);
|
||||
myString.FromUnicode (theText.ToExtString());
|
||||
myIs2d = theIs2d;
|
||||
|
||||
myParams->Init (theText, Graphic3d_Vertex (thePoint.x(), thePoint.y(), thePoint.z()), theHta, theVta);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -420,7 +432,7 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
||||
{
|
||||
OpenGl_Mat4d aModViewMat;
|
||||
OpenGl_Mat4d aProjectMat;
|
||||
if (myHasPlane && myHasAnchorPoint)
|
||||
if (myParams->HasPlane() && hasAnchorPoint())
|
||||
{
|
||||
aProjectMat = myProjMatrix * myOrientationMatrix;
|
||||
}
|
||||
@@ -431,7 +443,8 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
if (myIs2d)
|
||||
{
|
||||
Graphic3d_TransformUtils::Translate<GLdouble> (aModViewMat, myPoint.x() + theDVec.x(), myPoint.y() + theDVec.y(), 0.f);
|
||||
const Graphic3d_Vertex& aPoint = myParams->Position();
|
||||
Graphic3d_TransformUtils::Translate<GLdouble> (aModViewMat, aPoint.X() + theDVec.x(), aPoint.Y() + theDVec.y(), 0.f);
|
||||
Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, 1.f, -1.f, 1.f);
|
||||
Graphic3d_TransformUtils::Rotate<GLdouble> (aModViewMat, theTextAspect.Aspect()->TextAngle(), 0.f, 0.f, 1.f);
|
||||
}
|
||||
@@ -450,20 +463,22 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
||||
anObjY,
|
||||
anObjZ);
|
||||
|
||||
if (myHasPlane)
|
||||
if (myParams->HasPlane())
|
||||
{
|
||||
const gp_Dir& aVectorDir = myOrientation.XDirection();
|
||||
const gp_Dir& aVectorUp = myOrientation.Direction();
|
||||
const gp_Dir& aVectorRight = myOrientation.YDirection();
|
||||
const gp_Ax2& anOrientation = myParams->Orientation();
|
||||
const gp_Dir& aVectorDir = anOrientation.XDirection();
|
||||
const gp_Dir& aVectorUp = anOrientation.Direction();
|
||||
const gp_Dir& aVectorRight = anOrientation.YDirection();
|
||||
|
||||
aModViewMat.SetColumn (2, OpenGl_Vec3d (aVectorUp.X(), aVectorUp.Y(), aVectorUp.Z()));
|
||||
aModViewMat.SetColumn (1, OpenGl_Vec3d (aVectorRight.X(), aVectorRight.Y(), aVectorRight.Z()));
|
||||
aModViewMat.SetColumn (0, OpenGl_Vec3d (aVectorDir.X(), aVectorDir.Y(), aVectorDir.Z()));
|
||||
|
||||
if (!myHasAnchorPoint)
|
||||
if (!hasAnchorPoint())
|
||||
{
|
||||
OpenGl_Mat4d aPosMat;
|
||||
aPosMat.SetColumn (3, OpenGl_Vec3d (myPoint.x(), myPoint.y(), myPoint.z()));
|
||||
const Graphic3d_Vertex& aPoint = myParams->Position();
|
||||
aPosMat.SetColumn (3, OpenGl_Vec3d (aPoint.X(), aPoint.Y(), aPoint.Z()));
|
||||
aPosMat *= aModViewMat;
|
||||
aModViewMat.SetColumn (3, aPosMat.GetColumn (3));
|
||||
}
|
||||
@@ -488,7 +503,7 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
}
|
||||
|
||||
if (myHasPlane && !myHasAnchorPoint)
|
||||
if (myParams->HasPlane() && !hasAnchorPoint())
|
||||
{
|
||||
OpenGl_Mat4d aCurrentWorldViewMat;
|
||||
aCurrentWorldViewMat.Convert (theCtx->WorldViewState.Current());
|
||||
@@ -673,14 +688,14 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
||||
const OpenGl_Vec4& theColorSubs,
|
||||
unsigned int theResolution) const
|
||||
{
|
||||
if (myString.IsEmpty() && myFormatter.IsNull())
|
||||
if (myParams->Text().IsEmpty() && myParams->TextFormatter().IsNull())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Note that using difference resolution in different Views in same Viewer
|
||||
// will lead to performance regression (for example, text will be recreated every time).
|
||||
const TCollection_AsciiString aFontKey = FontKey (theTextAspect, myParams.Height, theResolution);
|
||||
const TCollection_AsciiString aFontKey = FontKey (theTextAspect, myParams->Height(), theResolution);
|
||||
if (!myFont.IsNull()
|
||||
&& !myFont->ResourceKey().IsEqual (aFontKey))
|
||||
{
|
||||
@@ -690,7 +705,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
if (myFont.IsNull())
|
||||
{
|
||||
myFont = FindFont (theCtx, theTextAspect, myParams.Height, theResolution, aFontKey);
|
||||
myFont = FindFont (theCtx, theTextAspect, myParams->Height(), theResolution, aFontKey);
|
||||
}
|
||||
if (!myFont->WasInitialized())
|
||||
{
|
||||
@@ -699,14 +714,14 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
if (myTextures.IsEmpty())
|
||||
{
|
||||
Handle(Font_TextFormatter) aFormatter = myFormatter;
|
||||
if (myFormatter.IsNull())
|
||||
Handle(Font_TextFormatter) aFormatter = myParams->TextFormatter();
|
||||
if (aFormatter.IsNull())
|
||||
{
|
||||
aFormatter = theCtx->DefaultTextFormatter();
|
||||
aFormatter->SetupAlignment (myParams.HAlign, myParams.VAlign);
|
||||
aFormatter->SetupAlignment (myParams->HAlignment(), myParams->VAlignment());
|
||||
aFormatter->Reset();
|
||||
|
||||
aFormatter->Append (myString, *myFont->FTFont().operator->());
|
||||
aFormatter->Append (myParams->Text(), *myFont->FTFont().operator->());
|
||||
aFormatter->Format();
|
||||
}
|
||||
|
||||
@@ -740,7 +755,8 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
||||
const GLdouble aPointSize = (GLdouble )myFont->FTFont()->PointSize();
|
||||
if (!myIs2d)
|
||||
{
|
||||
Graphic3d_TransformUtils::Project<Standard_Real> (myPoint.x(), myPoint.y(), myPoint.z(),
|
||||
const Graphic3d_Vertex& aPoint = myParams->Position();
|
||||
Graphic3d_TransformUtils::Project<Standard_Real> (aPoint.X(), aPoint.Y(), aPoint.Z(),
|
||||
myModelMatrix, myProjMatrix, theCtx->Viewport(),
|
||||
myWinX, myWinY, myWinZ);
|
||||
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Graphic3d_HorizontalTextAlignment.hxx>
|
||||
#include <Graphic3d_RenderingParams.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_VerticalTextAlignment.hxx>
|
||||
|
||||
#include <gp_Ax2.hxx>
|
||||
@@ -41,16 +42,21 @@ class OpenGl_Text : public OpenGl_Element
|
||||
public:
|
||||
|
||||
//! Main constructor
|
||||
Standard_DEPRECATED("Deprecated method OpenGl_Text() with obsolete arguments")
|
||||
Standard_EXPORT OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const OpenGl_TextParam& theParams);
|
||||
|
||||
//! Creates new text in 3D space.
|
||||
Standard_DEPRECATED("Deprecated method OpenGl_Text() with obsolete arguments")
|
||||
Standard_EXPORT OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
const gp_Ax2& theOrientation,
|
||||
const OpenGl_TextParam& theParams,
|
||||
const bool theHasOwnAnchor = true);
|
||||
|
||||
//! Creates new text in 3D space.
|
||||
Standard_EXPORT OpenGl_Text (const Handle(Graphic3d_TextParams)& theTextParams);
|
||||
|
||||
//! Destructor
|
||||
Standard_EXPORT virtual ~OpenGl_Text();
|
||||
|
||||
@@ -60,15 +66,23 @@ public:
|
||||
const OpenGl_Vec3& thePoint);
|
||||
|
||||
//! Setup new string and parameters
|
||||
Standard_DEPRECATED("Deprecated method Init(), obsolete parameter OpenGl_TextParam, use Graphic3d_TextParams instead of it")
|
||||
Standard_EXPORT void Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const Standard_Utf8Char* theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const OpenGl_TextParam& theParams);
|
||||
|
||||
//! Setup text formatter
|
||||
Standard_EXPORT void SetTextFormatter (const Handle(Font_TextFormatter)& theFormatter) { myFormatter = theFormatter; }
|
||||
//! Setup new string and parameters
|
||||
Standard_EXPORT void Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const NCollection_String theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const Standard_Boolean theIs2d,
|
||||
const Standard_Real theHeight,
|
||||
const Graphic3d_HorizontalTextAlignment theHta,
|
||||
const Graphic3d_VerticalTextAlignment theVta);
|
||||
|
||||
//! Setup new position
|
||||
Standard_DEPRECATED("Deprecated method SetPosition(), use Graphic3d_TextParams for it")
|
||||
Standard_EXPORT void SetPosition (const OpenGl_Vec3& thePoint);
|
||||
|
||||
//! Setup new font size
|
||||
@@ -79,10 +93,10 @@ public:
|
||||
Standard_EXPORT virtual void Release (OpenGl_Context* theContext);
|
||||
|
||||
//! Return defined text.
|
||||
const NCollection_String& Text() const { return myString; }
|
||||
const NCollection_String& Text() const { return myParams->Text(); }
|
||||
|
||||
//! Return text formatting parameters.
|
||||
const OpenGl_TextParam& FormatParams() const { return myParams; }
|
||||
const Handle(Graphic3d_TextParams)& FormatParams() const { return myParams; }
|
||||
|
||||
public: //! @name methods for compatibility with layers
|
||||
|
||||
@@ -112,6 +126,7 @@ public: //! @name methods for compatibility with layers
|
||||
Standard_ShortReal& theDescent);
|
||||
|
||||
//! Setup new string and parameters
|
||||
Standard_DEPRECATED("Deprecated method Init(), obsolete parameter OpenGl_TextParam, use Graphic3d_TextParams instead of it")
|
||||
Standard_EXPORT void Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const OpenGl_Vec2& thePoint,
|
||||
@@ -130,6 +145,8 @@ protected:
|
||||
//! Release cached VBO resources
|
||||
Standard_EXPORT void releaseVbos (OpenGl_Context* theCtx);
|
||||
|
||||
Standard_Boolean hasAnchorPoint() const { return myParams->HasOwnAnchorPoint() != Standard_False;}
|
||||
|
||||
private:
|
||||
|
||||
//! Setup matrix.
|
||||
@@ -175,15 +192,8 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
OpenGl_TextParam myParams;
|
||||
NCollection_String myString;
|
||||
OpenGl_Vec3 myPoint;
|
||||
bool myIs2d;
|
||||
gp_Ax2 myOrientation; //!< Text orientation in 3D space.
|
||||
bool myHasPlane; //!< Check if text have orientation in 3D space.
|
||||
bool myHasAnchorPoint; //!< Shows if it has own attach point
|
||||
|
||||
Handle(Font_TextFormatter) myFormatter; //!< Text formatter, an alternative to text params
|
||||
Handle(Graphic3d_TextParams) myParams;
|
||||
bool myIs2d;
|
||||
|
||||
public:
|
||||
|
||||
|
@@ -18,6 +18,7 @@
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
@@ -37,13 +38,14 @@ void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
|
||||
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_TextParams) aTextParams = new Graphic3d_TextParams (theAspect->Height());
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
aTextParams->Init (aText,
|
||||
Graphic3d_Vertex(x,y,z),
|
||||
theAspect->HorizontalJustification(),
|
||||
theAspect->VerticalJustification());
|
||||
theGroup->AddText (aTextParams);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -57,13 +59,13 @@ 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_TextParams) aTextParams = new Graphic3d_TextParams (theAspect->Height());
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
aTextParams->Init (aText,
|
||||
theOrientation,
|
||||
theHasOwnAnchor,
|
||||
theAspect->HorizontalJustification(),
|
||||
theAspect->VerticalJustification());
|
||||
theGroup->AddText (aTextParams);
|
||||
}
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <V3d.hxx>
|
||||
@@ -536,17 +537,23 @@ void V3d_Viewer::DisplayPrivilegedPlane (const Standard_Boolean theOnOff, const
|
||||
const gp_Pnt pX (p0.XYZ() + myDisplayPlaneLength * myPrivilegedPlane.XDirection().XYZ());
|
||||
aPrims->AddVertex (p0);
|
||||
aPrims->AddVertex (pX);
|
||||
aGroup->Text ("X", Graphic3d_Vertex (pX.X(), pX.Y(), pX.Z()), 1.0 / 81.0);
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (1.0 / 81.0);
|
||||
aTextParams->Init ("X", Graphic3d_Vertex (pX.X(), pX.Y(), pX.Z()));
|
||||
aGroup->AddText (aTextParams);
|
||||
|
||||
const gp_Pnt pY (p0.XYZ() + myDisplayPlaneLength * myPrivilegedPlane.YDirection().XYZ());
|
||||
aPrims->AddVertex (p0);
|
||||
aPrims->AddVertex (pY);
|
||||
aGroup->Text ("Y", Graphic3d_Vertex (pY.X(), pY.Y(), pY.Z()), 1.0 / 81.0);
|
||||
aTextParams = new Graphic3d_TextParams (1.0 / 81.0);
|
||||
aTextParams->Init ("Y", Graphic3d_Vertex (pY.X(), pY.Y(), pY.Z()));
|
||||
aGroup->AddText (aTextParams);
|
||||
|
||||
const gp_Pnt pZ (p0.XYZ() + myDisplayPlaneLength * myPrivilegedPlane.Direction().XYZ());
|
||||
aPrims->AddVertex (p0);
|
||||
aPrims->AddVertex (pZ);
|
||||
aGroup->Text ("Z", Graphic3d_Vertex (pZ.X(), pZ.Y(), pZ.Z()), 1.0 / 81.0);
|
||||
aTextParams = new Graphic3d_TextParams (1.0 / 81.0);
|
||||
aTextParams->Init ("Z", Graphic3d_Vertex (pZ.X(), pZ.Y(), pZ.Z()));
|
||||
aGroup->AddText (aTextParams);
|
||||
|
||||
aGroup->AddPrimitiveArray (aPrims);
|
||||
|
||||
|
Reference in New Issue
Block a user