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 - warnings correction - merge correction
#issue remarks correction
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_ArrayOfTriangles.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <Prs3d_LineAspect.hxx>
|
||||
#include <Prs3d_Root.hxx>
|
||||
#include <Prs3d_ShadingAspect.hxx>
|
||||
@@ -798,13 +798,12 @@ void AIS_ColorScale::drawText (const Handle(Graphic3d_Group)& theGroup,
|
||||
{
|
||||
const Handle(Prs3d_TextAspect)& anAspect = myDrawer->TextAspect();
|
||||
|
||||
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);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (anAspect->Height());
|
||||
aTextParams->SetText (theText.ToExtString());
|
||||
aTextParams->SetOrientation (gp_Ax2 (gp_Pnt (theX, theY, 0.0), gp::DZ()));
|
||||
aTextParams->SetOwnAnchorPoint (Standard_False);
|
||||
aTextParams->SetVAlignment (theVertAlignment);
|
||||
|
||||
theGroup->AddText (aTextParams);
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include <gp_Dir.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Prs3d_Arrow.hxx>
|
||||
#include <Prs3d_ArrowAspect.hxx>
|
||||
@@ -53,10 +53,9 @@ void DsgPrs_XYZAxisPresentation::Add(
|
||||
|
||||
if (*aText != '\0')
|
||||
{
|
||||
Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z());
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (1./81.);
|
||||
aTextParams->Init (aText, a2);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (1./81.);
|
||||
aTextParams->SetText (aText);
|
||||
aTextParams->SetPosition (gp_Pnt (aPlast.X(),aPlast.Y(),aPlast.Z()));
|
||||
Prs3d_Root::CurrentGroup(aPresentation)->AddText (aTextParams);
|
||||
}
|
||||
}
|
||||
@@ -87,9 +86,9 @@ void DsgPrs_XYZAxisPresentation::Add(const Handle(Prs3d_Presentation)& aPresenta
|
||||
|
||||
if (*aText != '\0')
|
||||
{
|
||||
Graphic3d_Vertex a2(aPlast.X(),aPlast.Y(),aPlast.Z());
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (1./81.);
|
||||
aTextParams->Init (aText, a2);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (1./81.);
|
||||
aTextParams->SetText (aText);
|
||||
aTextParams->SetPosition (gp_Pnt (aPlast.X(),aPlast.Y(),aPlast.Z()));
|
||||
Prs3d_Root::CurrentGroup(aPresentation)->AddText(aTextParams);
|
||||
}
|
||||
}
|
||||
|
@@ -132,8 +132,8 @@ Graphic3d_StructureDefinitionError.hxx
|
||||
Graphic3d_StructureManager.cxx
|
||||
Graphic3d_StructureManager.hxx
|
||||
Graphic3d_TextPath.hxx
|
||||
Graphic3d_TextParams.cxx
|
||||
Graphic3d_TextParams.hxx
|
||||
Graphic3d_Text.cxx
|
||||
Graphic3d_Text.hxx
|
||||
Graphic3d_Texture1D.cxx
|
||||
Graphic3d_Texture1D.hxx
|
||||
Graphic3d_Texture1Dmanual.cxx
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include "Graphic3d_Structure.pxx"
|
||||
#include <Graphic3d_StructureManager.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <Graphic3d_TextureMap.hxx>
|
||||
#include <Graphic3d_TransModeFlags.hxx>
|
||||
#include <Message.hxx>
|
||||
@@ -321,8 +321,11 @@ void Graphic3d_Group::Text (const Standard_CString theText,
|
||||
const Graphic3d_VerticalTextAlignment theVta,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (theText, thePoint, theHta, theVta);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (theHeight);
|
||||
aTextParams->SetText (theText);
|
||||
aTextParams->SetPosition (gp_Pnt (thePoint.X(), thePoint.Y(), thePoint.Z()));
|
||||
aTextParams->SetHAlignment (theHta);
|
||||
aTextParams->SetVAlignment (theVta);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
@@ -335,8 +338,9 @@ void Graphic3d_Group::Text (const Standard_CString theText,
|
||||
const Standard_Real theHeight,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (theText, thePoint);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (theHeight);
|
||||
aTextParams->SetText (theText);
|
||||
aTextParams->SetPosition (gp_Pnt (thePoint.X(), thePoint.Y(), thePoint.Z()));
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
@@ -355,8 +359,11 @@ void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
|
||||
{
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (aText, thePoint, theHta, theVta);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (theHeight);
|
||||
aTextParams->SetText (aText);
|
||||
aTextParams->SetPosition (gp_Pnt (thePoint.X(), thePoint.Y(), thePoint.Z()));
|
||||
aTextParams->SetHAlignment (theHta);
|
||||
aTextParams->SetVAlignment (theVta);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
@@ -376,8 +383,12 @@ void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
|
||||
{
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (aText, theOrientation, theHasOwnAnchor, theHta, theVta);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (theHeight);
|
||||
aTextParams->SetText (aText);
|
||||
aTextParams->SetOrientation (theOrientation);
|
||||
aTextParams->SetOwnAnchorPoint (theHasOwnAnchor);
|
||||
aTextParams->SetHAlignment (theHta);
|
||||
aTextParams->SetVAlignment (theVta);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
@@ -395,8 +406,12 @@ void Graphic3d_Group::Text (const Standard_CString theText,
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theHasOwnAnchor)
|
||||
{
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (theText, theOrientation, theHasOwnAnchor, theHta, theVta);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (theHeight);
|
||||
aTextParams->SetText (theText);
|
||||
aTextParams->SetOrientation (theOrientation);
|
||||
aTextParams->SetOwnAnchorPoint (theHasOwnAnchor);
|
||||
aTextParams->SetHAlignment (theHta);
|
||||
aTextParams->SetVAlignment (theVta);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
@@ -412,8 +427,10 @@ void Graphic3d_Group::Text (const Handle(Font_TextFormatter)& theTextForma
|
||||
const Standard_Boolean theToEvalMinMax,
|
||||
const Standard_Boolean theHasOwnAnchor)
|
||||
{
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (theTextFormatter, theOrientation, theHasOwnAnchor);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (theHeight);
|
||||
aTextParams->SetTextFormatter (theTextFormatter);
|
||||
aTextParams->SetOrientation (theOrientation);
|
||||
aTextParams->SetOwnAnchorPoint (theHasOwnAnchor);
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
@@ -428,8 +445,9 @@ void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
|
||||
{
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theHeight);
|
||||
aTextParams->Init (aText, thePoint);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (theHeight);
|
||||
aTextParams->SetText (aText);
|
||||
aTextParams->SetPosition (gp_Pnt (thePoint.X(), thePoint.Y(), thePoint.Z()));
|
||||
AddText (aTextParams, theToEvalMinMax);
|
||||
}
|
||||
|
||||
@@ -437,7 +455,7 @@ void Graphic3d_Group::Text (const TCollection_ExtendedString& theText,
|
||||
// function : AddText
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void Graphic3d_Group::AddText (const Handle(Graphic3d_TextParams)& theTextParams,
|
||||
void Graphic3d_Group::AddText (const Handle(Graphic3d_Text)& theTextParams,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
if (IsDeleted())
|
||||
@@ -447,25 +465,10 @@ void Graphic3d_Group::AddText (const Handle(Graphic3d_TextParams)& theTextParams
|
||||
|
||||
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));
|
||||
}
|
||||
myStructure->CStructure()->Is2dText = !theTextParams->HasPlane();
|
||||
|
||||
gp_Pnt aPosition = theTextParams->Position();
|
||||
myBounds.Add (Graphic3d_Vec4 (aPosition.X(), aPosition.Y(), aPosition.Z(), 1.0f));
|
||||
}
|
||||
|
||||
Update();
|
||||
|
@@ -39,7 +39,7 @@ class Font_TextFormatter;
|
||||
class Graphic3d_Structure;
|
||||
class Graphic3d_ArrayOfPrimitives;
|
||||
class Graphic3d_AspectFillCapping;
|
||||
class Graphic3d_TextParams;
|
||||
class Graphic3d_Text;
|
||||
|
||||
//! This class allows the definition of groups
|
||||
//! of primitives inside of graphic objects (presentations).
|
||||
@@ -116,6 +116,62 @@ public:
|
||||
//! Replace aspects specified in the replacement map.
|
||||
virtual void ReplaceAspects (const Graphic3d_MapOfAspectsToAspects& theMap) = 0;
|
||||
|
||||
//! Adds a text for display
|
||||
Standard_EXPORT virtual void AddText (const Handle(Graphic3d_Text)& 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);
|
||||
|
||||
//! Adds an array of primitives for display
|
||||
Standard_EXPORT void AddPrimitiveArray (const Handle(Graphic3d_ArrayOfPrimitives)& thePrim, const Standard_Boolean theToEvalMinMax = Standard_True);
|
||||
|
||||
//! Creates a primitive array with single marker using AddPrimitiveArray().
|
||||
Standard_EXPORT void Marker (const Graphic3d_Vertex& thePoint, const Standard_Boolean theToEvalMinMax = Standard_True);
|
||||
|
||||
public:
|
||||
|
||||
//! sets the stencil test to theIsEnabled state;
|
||||
Standard_EXPORT virtual void SetStencilTestOptions (const Standard_Boolean theIsEnabled) = 0;
|
||||
|
||||
//! sets the flipping to theIsEnabled state.
|
||||
Standard_EXPORT virtual void SetFlippingOptions (const Standard_Boolean theIsEnabled, const gp_Ax2& theRefPlane) = 0;
|
||||
|
||||
//! Returns true if the group contains Polygons, Triangles or Quadrangles.
|
||||
bool ContainsFacet() const { return myContainsFacet; }
|
||||
|
||||
//! Returns Standard_True if the group <me> is deleted.
|
||||
//! <me> is deleted after the call Remove (me) or the
|
||||
//! associated structure is deleted.
|
||||
Standard_EXPORT Standard_Boolean IsDeleted() const;
|
||||
|
||||
//! Returns Standard_True if the group <me> is empty.
|
||||
Standard_EXPORT Standard_Boolean IsEmpty() const;
|
||||
|
||||
//! Returns the coordinates of the boundary box of the group.
|
||||
Standard_EXPORT void MinMaxValues (Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin,
|
||||
Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax) const;
|
||||
|
||||
//! Sets the coordinates of the boundary box of the group.
|
||||
Standard_EXPORT void SetMinMaxValues (const Standard_Real theXMin, const Standard_Real theYMin, const Standard_Real theZMin,
|
||||
const Standard_Real theXMax, const Standard_Real theYMax, const Standard_Real theZMax);
|
||||
|
||||
//! Returns boundary box of the group <me> without transformation applied,
|
||||
const Graphic3d_BndBox4f& BoundingBox() const { return myBounds; }
|
||||
|
||||
//! Returns non-const boundary box of the group <me> without transformation applied,
|
||||
Graphic3d_BndBox4f& ChangeBoundingBox() { return myBounds; }
|
||||
|
||||
//! Returns the structure containing the group <me>.
|
||||
Standard_EXPORT Handle(Graphic3d_Structure) Structure() const;
|
||||
|
||||
//! Changes property shown that primitive arrays within this group form closed volume (do no contain open shells).
|
||||
void SetClosed (const bool theIsClosed) { myIsClosed = theIsClosed; }
|
||||
|
||||
//! Return true if primitive arrays within this graphic group form closed volume (do no contain open shells).
|
||||
bool IsClosed() const { return myIsClosed; }
|
||||
|
||||
//! @name obsolete methods
|
||||
public:
|
||||
|
||||
//! Creates the string <AText> at position <APoint>.
|
||||
@@ -230,61 +286,6 @@ 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);
|
||||
|
||||
//! Adds an array of primitives for display
|
||||
Standard_EXPORT void AddPrimitiveArray (const Handle(Graphic3d_ArrayOfPrimitives)& thePrim, const Standard_Boolean theToEvalMinMax = Standard_True);
|
||||
|
||||
//! Creates a primitive array with single marker using AddPrimitiveArray().
|
||||
Standard_EXPORT void Marker (const Graphic3d_Vertex& thePoint, const Standard_Boolean theToEvalMinMax = Standard_True);
|
||||
|
||||
public:
|
||||
|
||||
//! sets the stencil test to theIsEnabled state;
|
||||
Standard_EXPORT virtual void SetStencilTestOptions (const Standard_Boolean theIsEnabled) = 0;
|
||||
|
||||
//! sets the flipping to theIsEnabled state.
|
||||
Standard_EXPORT virtual void SetFlippingOptions (const Standard_Boolean theIsEnabled, const gp_Ax2& theRefPlane) = 0;
|
||||
|
||||
//! Returns true if the group contains Polygons, Triangles or Quadrangles.
|
||||
bool ContainsFacet() const { return myContainsFacet; }
|
||||
|
||||
//! Returns Standard_True if the group <me> is deleted.
|
||||
//! <me> is deleted after the call Remove (me) or the
|
||||
//! associated structure is deleted.
|
||||
Standard_EXPORT Standard_Boolean IsDeleted() const;
|
||||
|
||||
//! Returns Standard_True if the group <me> is empty.
|
||||
Standard_EXPORT Standard_Boolean IsEmpty() const;
|
||||
|
||||
//! Returns the coordinates of the boundary box of the group.
|
||||
Standard_EXPORT void MinMaxValues (Standard_Real& theXMin, Standard_Real& theYMin, Standard_Real& theZMin,
|
||||
Standard_Real& theXMax, Standard_Real& theYMax, Standard_Real& theZMax) const;
|
||||
|
||||
//! Sets the coordinates of the boundary box of the group.
|
||||
Standard_EXPORT void SetMinMaxValues (const Standard_Real theXMin, const Standard_Real theYMin, const Standard_Real theZMin,
|
||||
const Standard_Real theXMax, const Standard_Real theYMax, const Standard_Real theZMax);
|
||||
|
||||
//! Returns boundary box of the group <me> without transformation applied,
|
||||
const Graphic3d_BndBox4f& BoundingBox() const { return myBounds; }
|
||||
|
||||
//! Returns non-const boundary box of the group <me> without transformation applied,
|
||||
Graphic3d_BndBox4f& ChangeBoundingBox() { return myBounds; }
|
||||
|
||||
//! Returns the structure containing the group <me>.
|
||||
Standard_EXPORT Handle(Graphic3d_Structure) Structure() const;
|
||||
|
||||
//! Changes property shown that primitive arrays within this group form closed volume (do no contain open shells).
|
||||
void SetClosed (const bool theIsClosed) { myIsClosed = theIsClosed; }
|
||||
|
||||
//! Return true if primitive arrays within this graphic group form closed volume (do no contain open shells).
|
||||
bool IsClosed() const { return myIsClosed; }
|
||||
|
||||
protected:
|
||||
|
||||
//! Creates a group in the structure <AStructure>.
|
||||
|
29
src/Graphic3d/Graphic3d_Text.cxx
Normal file
29
src/Graphic3d/Graphic3d_Text.cxx
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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_Text.hxx>
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Text, Standard_Transient)
|
||||
|
||||
// =======================================================================
|
||||
// function : Graphic3d_Text
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Graphic3d_Text::Graphic3d_Text (const Standard_Real theHeight)
|
||||
: myHeight (theHeight),
|
||||
myHasPlane (Standard_False),
|
||||
myHasOwnAnchor (Standard_True),
|
||||
myHAlign (Graphic3d_HTA_LEFT),
|
||||
myVAlign (Graphic3d_VTA_BOTTOM)
|
||||
{
|
||||
}
|
112
src/Graphic3d/Graphic3d_Text.hxx
Normal file
112
src/Graphic3d/Graphic3d_Text.hxx
Normal file
@@ -0,0 +1,112 @@
|
||||
// Copyright (c) 2019 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 with text parameters.
|
||||
//! The text might be defined in some plane and has own attached point.
|
||||
//! In case if text formatter is used, the text value is store in the formatter.
|
||||
class Graphic3d_Text : public Standard_Transient
|
||||
{
|
||||
DEFINE_STANDARD_RTTIEXT(Graphic3d_Text, Standard_Transient)
|
||||
|
||||
public:
|
||||
|
||||
Standard_EXPORT Graphic3d_Text (const Standard_Real theHeight);
|
||||
|
||||
//! Destructor.
|
||||
Standard_EXPORT virtual ~Graphic3d_Text() {}
|
||||
|
||||
//! Sets text value.
|
||||
const NCollection_String& Text() const { return myText; }
|
||||
|
||||
//! Returns text value.
|
||||
void SetText (const NCollection_String& theText) { myText = theText; }
|
||||
|
||||
//! 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(); }
|
||||
|
||||
//! Sets text point.
|
||||
void SetPosition (const gp_Pnt& thePoint) { myOrientation.SetLocation (thePoint); }
|
||||
|
||||
//! Returns text orientation in 3D space.
|
||||
const gp_Ax2& Orientation() const { return myOrientation; }
|
||||
|
||||
//! Returns true if the text is filled by a point
|
||||
Standard_Boolean HasPlane() const { return myHasPlane; }
|
||||
|
||||
//! Sets text orientation in 3D space.
|
||||
void SetOrientation (const gp_Ax2& theOrientation) { myOrientation = theOrientation; myHasPlane = Standard_True; }
|
||||
|
||||
//! Reset text orientation in 3D space.
|
||||
void ResetOrientation() { myOrientation = gp_Ax2(); myHasPlane = Standard_False; }
|
||||
|
||||
//! Returns true if the text has an anchor point
|
||||
Standard_Boolean HasOwnAnchorPoint() const { return myHasOwnAnchor; }
|
||||
|
||||
//! Returns true if the text has an anchor point
|
||||
void SetOwnAnchorPoint (const Standard_Boolean theHasOwnAnchor) { myHasOwnAnchor = theHasOwnAnchor; }
|
||||
|
||||
//! Sets height of text. (Relative to the Normalized Projection Coordinates (NPC) Space).
|
||||
Standard_Real Height() const { return myHeight; }
|
||||
|
||||
//! Returns height of text
|
||||
void SetHeight (const Standard_Real theHeight) { myHeight = theHeight; }
|
||||
|
||||
//! Returns horizontal alignment of text.
|
||||
Graphic3d_HorizontalTextAlignment HAlignment() const { return myHAlign; }
|
||||
|
||||
//! Sets horizontal alignment of text.
|
||||
void SetHAlignment (const Graphic3d_HorizontalTextAlignment theJustification) { myHAlign = theJustification; }
|
||||
|
||||
//! Returns vertical alignment of text.
|
||||
Graphic3d_VerticalTextAlignment VAlignment() const { return myVAlign; }
|
||||
|
||||
//! Sets vertical alignment of text.
|
||||
void SetVAlignment (const Graphic3d_VerticalTextAlignment theJustification) { myVAlign = theJustification; }
|
||||
|
||||
//! Returns text formatter
|
||||
const Handle(Font_TextFormatter)& TextFormatter() const { return myTextFormatter; }
|
||||
|
||||
//! Sets text formatter
|
||||
void SetTextFormatter (const Handle(Font_TextFormatter)& theTextFormatter) { myTextFormatter = theTextFormatter; }
|
||||
|
||||
private:
|
||||
NCollection_String myText; //!< text value
|
||||
Handle(Font_TextFormatter) myTextFormatter; //!< text formatter collect information about text letter positions
|
||||
|
||||
bool myHasPlane; //!< Check if text have orientation in 3D space.
|
||||
gp_Ax2 myOrientation; //!< Text orientation in 3D space.
|
||||
|
||||
Standard_Real myHeight; //!< height of text
|
||||
Graphic3d_HorizontalTextAlignment myHAlign; //!< horizontal alignment
|
||||
Graphic3d_VerticalTextAlignment myVAlign; //!< vertical alignment
|
||||
Standard_Boolean myHasOwnAnchor; //!< flag if text uses position as point of attach
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(Graphic3d_Text, Standard_Transient)
|
||||
|
||||
#endif // _Graphic3d_TextParams_HeaderFile
|
@@ -1,113 +0,0 @@
|
||||
// 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;
|
||||
}
|
@@ -1,115 +0,0 @@
|
||||
// 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,7 +18,7 @@
|
||||
#include <Graphic3d_ArrayOfPoints.hxx>
|
||||
#include <Graphic3d_AspectMarker3d.hxx>
|
||||
#include <Graphic3d_AspectText3d.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <MeshVS_Buffer.hxx>
|
||||
@@ -252,10 +252,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);
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (aHeight);
|
||||
aTextParams->Init (aStr.ToCString(), aPoint);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (aHeight);
|
||||
aTextParams->SetText (aStr.ToCString());
|
||||
aTextParams->SetPosition (gp_Pnt (X, Y, Z));
|
||||
aTextGroup->AddText(aTextParams);
|
||||
}
|
||||
}
|
||||
|
@@ -91,29 +91,28 @@ void OpenGl_FrameStatsPrs::Update (const Handle(OpenGl_Workspace)& theWorkspace)
|
||||
myTextAspect.SetAspect (aRendParams.StatsTextAspect);
|
||||
|
||||
// adjust text alignment depending on corner
|
||||
OpenGl_TextParam aParams;
|
||||
aParams.Height = aRendParams.StatsTextHeight;
|
||||
aParams.HAlign = Graphic3d_HTA_CENTER;
|
||||
aParams.VAlign = Graphic3d_VTA_CENTER;
|
||||
Graphic3d_Text aParams (aRendParams.StatsTextHeight);
|
||||
aParams.SetHAlignment (Graphic3d_HTA_CENTER);
|
||||
aParams.SetVAlignment (Graphic3d_VTA_CENTER);
|
||||
if (!myCountersTrsfPers.IsNull() && (myCountersTrsfPers->Corner2d() & Aspect_TOTP_LEFT) != 0)
|
||||
{
|
||||
aParams.HAlign = Graphic3d_HTA_LEFT;
|
||||
aParams.SetHAlignment (Graphic3d_HTA_LEFT);
|
||||
}
|
||||
else if (!myCountersTrsfPers.IsNull() && (myCountersTrsfPers->Corner2d() & Aspect_TOTP_RIGHT) != 0)
|
||||
{
|
||||
aParams.HAlign = Graphic3d_HTA_RIGHT;
|
||||
aParams.SetHAlignment (Graphic3d_HTA_RIGHT);
|
||||
}
|
||||
if (!myCountersTrsfPers.IsNull() && (myCountersTrsfPers->Corner2d() & Aspect_TOTP_TOP) != 0)
|
||||
{
|
||||
aParams.VAlign = Graphic3d_VTA_TOP;
|
||||
aParams.SetVAlignment (Graphic3d_VTA_TOP);
|
||||
}
|
||||
else if (!myCountersTrsfPers.IsNull() && (myCountersTrsfPers->Corner2d() & Aspect_TOTP_BOTTOM) != 0)
|
||||
{
|
||||
aParams.VAlign = Graphic3d_VTA_BOTTOM;
|
||||
aParams.SetVAlignment (Graphic3d_VTA_BOTTOM);
|
||||
}
|
||||
if (aParams.Height != myCountersText.FormatParams()->Height()
|
||||
|| aParams.HAlign != myCountersText.FormatParams()->HAlignment()
|
||||
|| aParams.VAlign != myCountersText.FormatParams()->VAlignment())
|
||||
if (aParams.Height() != myCountersText.FormatParams()->Height()
|
||||
|| aParams.HAlignment() != myCountersText.FormatParams()->HAlignment()
|
||||
|| aParams.VAlignment() != myCountersText.FormatParams()->VAlignment())
|
||||
{
|
||||
myCountersText.Release (aCtx.operator->());
|
||||
}
|
||||
@@ -126,7 +125,7 @@ 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),
|
||||
Standard_False, aParams.Height, aParams.HAlign, aParams.VAlign);
|
||||
Standard_False, aParams.Height(), aParams.HAlignment(), aParams.VAlignment());
|
||||
|
||||
updateChart (theWorkspace);
|
||||
}
|
||||
@@ -324,14 +323,13 @@ void OpenGl_FrameStatsPrs::updateChart (const Handle(OpenGl_Workspace)& theWorks
|
||||
}
|
||||
|
||||
{
|
||||
OpenGl_TextParam aParams;
|
||||
aParams.Height = aRendParams.StatsTextHeight;
|
||||
aParams.HAlign = (!myChartTrsfPers.IsNull()
|
||||
Graphic3d_Text aParams (aRendParams.StatsTextHeight);
|
||||
aParams.SetHAlignment ((!myChartTrsfPers.IsNull()
|
||||
&& myChartTrsfPers->IsTrihedronOr2d()
|
||||
&& (myChartTrsfPers->Corner2d() & Aspect_TOTP_RIGHT) != 0)
|
||||
? Graphic3d_HTA_RIGHT
|
||||
: Graphic3d_HTA_LEFT;
|
||||
aParams.VAlign = Graphic3d_VTA_CENTER;
|
||||
: Graphic3d_HTA_LEFT);
|
||||
aParams.SetVAlignment (Graphic3d_VTA_CENTER);
|
||||
TCollection_AsciiString aLabels[3] =
|
||||
{
|
||||
TCollection_AsciiString() + 0 + " ms",
|
||||
@@ -339,21 +337,21 @@ void OpenGl_FrameStatsPrs::updateChart (const Handle(OpenGl_Workspace)& theWorks
|
||||
formatTimeMs(aMaxDuration)
|
||||
};
|
||||
|
||||
const float aLabX = aParams.HAlign == Graphic3d_HTA_RIGHT
|
||||
const float aLabX = aParams.HAlignment() == 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),
|
||||
Standard_False, aParams.Height, aParams.HAlign, aParams.VAlign);
|
||||
Standard_False, aParams.Height(), aParams.HAlignment(), aParams.VAlignment());
|
||||
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);
|
||||
Standard_False, aParams.Height(), aParams.HAlignment(), aParams.VAlignment());
|
||||
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);
|
||||
Standard_False, aParams.Height(), aParams.HAlignment(), aParams.VAlignment());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <Graphic3d_ArrayOfPolylines.hxx>
|
||||
#include <Graphic3d_ArrayOfSegments.hxx>
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <Graphic3d_TransformPers.hxx>
|
||||
#include <Graphic3d_TransformUtils.hxx>
|
||||
#include <gp_Ax3.hxx>
|
||||
@@ -34,10 +34,9 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
static const OpenGl_TextParam THE_LABEL_PARAMS =
|
||||
{
|
||||
16, Graphic3d_HTA_LEFT, Graphic3d_VTA_BOTTOM
|
||||
};
|
||||
static Standard_Real THE_LABEL_HEIGHT = 16;
|
||||
static Graphic3d_HorizontalTextAlignment THE_LABEL_HALIGH = Graphic3d_HTA_LEFT;
|
||||
static Graphic3d_VerticalTextAlignment THE_LABEL_VALIGH = Graphic3d_VTA_BOTTOM;
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -523,7 +522,7 @@ void OpenGl_GraduatedTrihedron::renderTickmarkLabels (const Handle(OpenGl_Worksp
|
||||
|
||||
myAspectLabels.Aspect()->SetColor (anAxis.NameColor);
|
||||
theWorkspace->SetAspects (&myAspectLabels);
|
||||
anAxis.Label.FormatParams()->SetPosition (Graphic3d_Vertex(aMiddle.x(), aMiddle.y(), aMiddle.z()));
|
||||
anAxis.Label.FormatParams()->SetPosition (gp_Pnt (aMiddle.x(), aMiddle.y(), aMiddle.z()));
|
||||
anAxis.Label.Render (theWorkspace);
|
||||
}
|
||||
|
||||
@@ -720,10 +719,11 @@ OpenGl_GraduatedTrihedron::Axis::Axis (const Graphic3d_AxisAspect& theAspect,
|
||||
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);
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (THE_LABEL_HEIGHT);
|
||||
aTextParams->SetText (NCollection_String ((Standard_Utf16Char* )theAspect.Name().ToExtString()));
|
||||
aTextParams->SetPosition (gp_Pnt (theDirection.x(), theDirection.y(), theDirection.z()));
|
||||
aTextParams->SetHAlignment (THE_LABEL_HALIGH);
|
||||
aTextParams->SetVAlignment (THE_LABEL_VALIGH);
|
||||
Label = OpenGl_Text (aTextParams);
|
||||
NameColor = theAspect.NameColor();
|
||||
LineAspect.Aspect()->SetColor (theAspect.Color());
|
||||
|
@@ -517,12 +517,10 @@ void OpenGl_GraphicDriver::TextSize (const Handle(Graphic3d_CView)& theView,
|
||||
}
|
||||
|
||||
const Standard_ShortReal aHeight = (theHeight < 2.0f) ? DefaultTextHeight() : theHeight;
|
||||
OpenGl_TextParam aTextParam;
|
||||
aTextParam.Height = (int )aHeight;
|
||||
OpenGl_Aspects aTextAspect;
|
||||
TCollection_ExtendedString anExtText = theText;
|
||||
NCollection_String aText (anExtText.ToExtString());
|
||||
OpenGl_Text::StringSize(aCtx, aText, aTextAspect, aTextParam, theView->RenderingParams().Resolution, theWidth, theAscent, theDescent);
|
||||
OpenGl_Text::StringSize(aCtx, aText, aTextAspect, aHeight, theView->RenderingParams().Resolution, theWidth, theAscent, theDescent);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@@ -226,7 +226,7 @@ void OpenGl_Group::AddPrimitiveArray (const Graphic3d_TypeOfPrimitiveArray theTy
|
||||
// function : AddText
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Group::AddText (const Handle(Graphic3d_TextParams)& theTextParams,
|
||||
void OpenGl_Group::AddText (const Handle(Graphic3d_Text)& theTextParams,
|
||||
const Standard_Boolean theToEvalMinMax)
|
||||
{
|
||||
if (IsDeleted())
|
||||
|
@@ -75,7 +75,7 @@ public:
|
||||
const Standard_Boolean theToEvalMinMax) Standard_OVERRIDE;
|
||||
|
||||
//! Adds a text for display
|
||||
Standard_EXPORT virtual void AddText (const Handle(Graphic3d_TextParams)& theTextParams,
|
||||
Standard_EXPORT virtual void AddText (const Handle(Graphic3d_Text)& theTextParams,
|
||||
const Standard_Boolean theToEvalMinMax = Standard_True) Standard_OVERRIDE;
|
||||
|
||||
//! Add flipping element
|
||||
|
@@ -87,8 +87,9 @@ OpenGl_Text::OpenGl_Text()
|
||||
myScaleHeight (1.0f),
|
||||
myIs2d (false)
|
||||
{
|
||||
myParams = new Graphic3d_TextParams (10.);
|
||||
myParams->Init ("", Graphic3d_Vertex (0.0f, 0.0f, 0.0f));
|
||||
myParams = new Graphic3d_Text (10.);
|
||||
myParams->SetText ("");
|
||||
myParams->SetPosition (gp_Pnt (0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -97,7 +98,7 @@ OpenGl_Text::OpenGl_Text()
|
||||
// =======================================================================
|
||||
OpenGl_Text::OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const OpenGl_TextParam& theParams)
|
||||
const Graphic3d_Text& theParams)
|
||||
: myWinX (0.0f),
|
||||
myWinY (0.0f),
|
||||
myWinZ (0.0f),
|
||||
@@ -105,8 +106,11 @@ OpenGl_Text::OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
myExportHeight (1.0f),
|
||||
myIs2d (false)
|
||||
{
|
||||
myParams = new Graphic3d_TextParams (theParams.Height);
|
||||
myParams->Init (theText, Graphic3d_Vertex (thePoint.x(), thePoint.y(), thePoint.z()), theParams.HAlign, theParams.VAlign);
|
||||
myParams = new Graphic3d_Text (theParams.Height());
|
||||
myParams->SetText (theText);
|
||||
myParams->SetPosition (gp_Pnt (thePoint.x(), thePoint.y(), thePoint.z()));
|
||||
myParams->SetHAlignment (theParams.HAlignment());
|
||||
myParams->SetVAlignment (theParams.VAlignment());
|
||||
//
|
||||
}
|
||||
|
||||
@@ -116,7 +120,7 @@ OpenGl_Text::OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
// =======================================================================
|
||||
OpenGl_Text::OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
const gp_Ax2& theOrientation,
|
||||
const OpenGl_TextParam& theParams,
|
||||
const Graphic3d_Text& theParams,
|
||||
const bool theHasOwnAnchor)
|
||||
: myWinX (0.0),
|
||||
myWinY (0.0),
|
||||
@@ -125,15 +129,19 @@ OpenGl_Text::OpenGl_Text (const Standard_Utf8Char* theText,
|
||||
myExportHeight (1.0),
|
||||
myIs2d (false)
|
||||
{
|
||||
myParams = new Graphic3d_TextParams (theParams.Height);
|
||||
myParams->Init (theText, theOrientation, theHasOwnAnchor, theParams.HAlign, theParams.VAlign);
|
||||
myParams = new Graphic3d_Text (theParams.Height());
|
||||
myParams->SetText (theText);
|
||||
myParams->SetOrientation (theOrientation);
|
||||
myParams->SetOwnAnchorPoint (theHasOwnAnchor);
|
||||
myParams->SetHAlignment (theParams.HAlignment());
|
||||
myParams->SetVAlignment (theParams.VAlignment());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : OpenGl_Text
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
OpenGl_Text::OpenGl_Text (const Handle(Graphic3d_TextParams)& theTextParams)
|
||||
OpenGl_Text::OpenGl_Text (const Handle(Graphic3d_Text)& theTextParams)
|
||||
: myWinX (0.0f),
|
||||
myWinY (0.0f),
|
||||
myWinZ (0.0f),
|
||||
@@ -149,7 +157,7 @@ OpenGl_Text::OpenGl_Text (const Handle(Graphic3d_TextParams)& theTextParams)
|
||||
// =======================================================================
|
||||
void OpenGl_Text::SetPosition (const OpenGl_Vec3& thePoint)
|
||||
{
|
||||
myParams->SetPosition (Graphic3d_Vertex (thePoint.x(), thePoint.y(), thePoint.z()));
|
||||
myParams->SetPosition (gp_Pnt (thePoint.x(), thePoint.y(), thePoint.z()));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -181,7 +189,8 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
NCollection_String aText;
|
||||
aText.FromUnicode (theText);
|
||||
myParams->Init (aText, Graphic3d_Vertex (thePoint.x(), thePoint.y(), thePoint.z()));
|
||||
myParams->SetText (aText);
|
||||
myParams->SetPosition (gp_Pnt (thePoint.x(), thePoint.y(), thePoint.z()));
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -191,9 +200,9 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const Standard_Utf8Char* theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const OpenGl_TextParam& theParams)
|
||||
const Graphic3d_Text& theParams)
|
||||
{
|
||||
Init (theCtx, theText, thePoint, Standard_False, theParams.Height, theParams.HAlign, theParams.VAlign);
|
||||
Init (theCtx, theText, thePoint, Standard_False, theParams.Height(), theParams.HAlignment(), theParams.VAlignment());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -203,14 +212,14 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const OpenGl_Vec2& thePoint,
|
||||
const OpenGl_TextParam& theParams)
|
||||
const Graphic3d_Text& theParams)
|
||||
{
|
||||
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);
|
||||
Init (theCtx, aText, aPoint, Standard_True, theParams.Height(), theParams.HAlignment(), theParams.VAlignment());
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -235,7 +244,10 @@ void OpenGl_Text::Init (const Handle(OpenGl_Context)& theCtx,
|
||||
}
|
||||
myIs2d = theIs2d;
|
||||
|
||||
myParams->Init (theText, Graphic3d_Vertex (thePoint.x(), thePoint.y(), thePoint.z()), theHta, theVta);
|
||||
myParams->SetText (theText);
|
||||
myParams->SetPosition (gp_Pnt (thePoint.x(), thePoint.y(), thePoint.z()));
|
||||
myParams->SetHAlignment (theHta);
|
||||
myParams->SetVAlignment (theVta);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -303,7 +315,7 @@ void OpenGl_Text::Release (OpenGl_Context* theCtx)
|
||||
void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx,
|
||||
const NCollection_String& theText,
|
||||
const OpenGl_Aspects& theTextAspect,
|
||||
const OpenGl_TextParam& theParams,
|
||||
const Standard_Real& theHeight,
|
||||
const unsigned int theResolution,
|
||||
Standard_ShortReal& theWidth,
|
||||
Standard_ShortReal& theAscent,
|
||||
@@ -312,8 +324,8 @@ void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx,
|
||||
theWidth = 0.0f;
|
||||
theAscent = 0.0f;
|
||||
theDescent = 0.0f;
|
||||
const TCollection_AsciiString aFontKey = FontKey (theTextAspect, theParams.Height, theResolution);
|
||||
Handle(OpenGl_Font) aFont = FindFont (theCtx, theTextAspect, theParams.Height, theResolution, aFontKey);
|
||||
const TCollection_AsciiString aFontKey = FontKey (theTextAspect, (Standard_Integer)theHeight, theResolution);
|
||||
Handle(OpenGl_Font) aFont = FindFont (theCtx, theTextAspect, (Standard_Integer)theHeight, theResolution, aFontKey);
|
||||
if (aFont.IsNull() || !aFont->IsValid())
|
||||
{
|
||||
return;
|
||||
@@ -362,6 +374,22 @@ void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx,
|
||||
aCtx->ReleaseResource (aFontKey, Standard_True);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : StringSize
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void OpenGl_Text::StringSize (const Handle(OpenGl_Context)& theCtx,
|
||||
const NCollection_String& theText,
|
||||
const OpenGl_Aspects& theTextAspect,
|
||||
const Graphic3d_Text& theParams,
|
||||
const unsigned int theResolution,
|
||||
Standard_ShortReal& theWidth,
|
||||
Standard_ShortReal& theAscent,
|
||||
Standard_ShortReal& theDescent)
|
||||
{
|
||||
StringSize (theCtx, theText, theTextAspect, theParams.Height(), theResolution, theWidth, theAscent, theDescent);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : Render
|
||||
// purpose :
|
||||
@@ -443,7 +471,7 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
if (myIs2d)
|
||||
{
|
||||
const Graphic3d_Vertex& aPoint = myParams->Position();
|
||||
const gp_Pnt& 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);
|
||||
@@ -477,7 +505,7 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
|
||||
if (!hasAnchorPoint())
|
||||
{
|
||||
OpenGl_Mat4d aPosMat;
|
||||
const Graphic3d_Vertex& aPoint = myParams->Position();
|
||||
const gp_Pnt& aPoint = myParams->Position();
|
||||
aPosMat.SetColumn (3, OpenGl_Vec3d (aPoint.X(), aPoint.Y(), aPoint.Z()));
|
||||
aPosMat *= aModViewMat;
|
||||
aModViewMat.SetColumn (3, aPosMat.GetColumn (3));
|
||||
@@ -695,7 +723,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
||||
|
||||
// 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, (Standard_Integer)myParams->Height(), theResolution);
|
||||
if (!myFont.IsNull()
|
||||
&& !myFont->ResourceKey().IsEqual (aFontKey))
|
||||
{
|
||||
@@ -705,7 +733,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, (Standard_Integer)myParams->Height(), theResolution, aFontKey);
|
||||
}
|
||||
if (!myFont->WasInitialized())
|
||||
{
|
||||
@@ -755,7 +783,7 @@ void OpenGl_Text::render (const Handle(OpenGl_Context)& theCtx,
|
||||
const GLdouble aPointSize = (GLdouble )myFont->FTFont()->PointSize();
|
||||
if (!myIs2d)
|
||||
{
|
||||
const Graphic3d_Vertex& aPoint = myParams->Position();
|
||||
const gp_Pnt& aPoint = myParams->Position();
|
||||
Graphic3d_TransformUtils::Project<Standard_Real> (aPoint.X(), aPoint.Y(), aPoint.Z(),
|
||||
myModelMatrix, myProjMatrix, theCtx->Viewport(),
|
||||
myWinX, myWinY, myWinZ);
|
||||
|
@@ -21,14 +21,13 @@
|
||||
#include <OpenGl_Aspects.hxx>
|
||||
#include <NCollection_String.hxx>
|
||||
|
||||
#include <OpenGl_TextParam.hxx>
|
||||
#include <OpenGl_TextBuilder.hxx>
|
||||
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Graphic3d_HorizontalTextAlignment.hxx>
|
||||
#include <Graphic3d_RenderingParams.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <Graphic3d_VerticalTextAlignment.hxx>
|
||||
|
||||
#include <gp_Ax2.hxx>
|
||||
@@ -41,21 +40,8 @@ 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);
|
||||
Standard_EXPORT OpenGl_Text (const Handle(Graphic3d_Text)& theTextParams);
|
||||
|
||||
//! Destructor
|
||||
Standard_EXPORT virtual ~OpenGl_Text();
|
||||
@@ -65,13 +51,6 @@ public:
|
||||
const Standard_Utf8Char* theText,
|
||||
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 new string and parameters
|
||||
Standard_EXPORT void Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const NCollection_String theText,
|
||||
@@ -81,10 +60,6 @@ public:
|
||||
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
|
||||
Standard_EXPORT void SetFontSize (const Handle(OpenGl_Context)& theContext,
|
||||
const Standard_Integer theFontSize);
|
||||
@@ -96,7 +71,7 @@ public:
|
||||
const NCollection_String& Text() const { return myParams->Text(); }
|
||||
|
||||
//! Return text formatting parameters.
|
||||
const Handle(Graphic3d_TextParams)& FormatParams() const { return myParams; }
|
||||
const Handle(Graphic3d_Text)& FormatParams() const { return myParams; }
|
||||
|
||||
public: //! @name methods for compatibility with layers
|
||||
|
||||
@@ -119,24 +94,61 @@ public: //! @name methods for compatibility with layers
|
||||
Standard_EXPORT static void StringSize (const Handle(OpenGl_Context)& theCtx,
|
||||
const NCollection_String& theText,
|
||||
const OpenGl_Aspects& theTextAspect,
|
||||
const OpenGl_TextParam& theParams,
|
||||
const Standard_Real& theHeight,
|
||||
const unsigned int theResolution,
|
||||
Standard_ShortReal& theWidth,
|
||||
Standard_ShortReal& theAscent,
|
||||
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,
|
||||
const OpenGl_TextParam& theParams);
|
||||
|
||||
//! Perform rendering
|
||||
Standard_EXPORT void Render (const Handle(OpenGl_Context)& theCtx,
|
||||
const OpenGl_Aspects& theTextAspect,
|
||||
unsigned int theResolution = Graphic3d_RenderingParams::THE_DEFAULT_RESOLUTION) const;
|
||||
|
||||
//! @name obsolete methods
|
||||
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 Graphic3d_Text& 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 Graphic3d_Text& theParams,
|
||||
const bool theHasOwnAnchor = true);
|
||||
|
||||
//! Setup new string and parameters
|
||||
Standard_DEPRECATED("Deprecated method Init(), obsolete parameter Graphic3d_Text, use Graphic3d_Text instead of it")
|
||||
Standard_EXPORT void Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const Standard_Utf8Char* theText,
|
||||
const OpenGl_Vec3& thePoint,
|
||||
const Graphic3d_Text& theParams);
|
||||
|
||||
//! Setup new position
|
||||
Standard_DEPRECATED("Deprecated method SetPosition(), use Graphic3d_Text for it")
|
||||
Standard_EXPORT void SetPosition (const OpenGl_Vec3& thePoint);
|
||||
|
||||
//! Setup new string and parameters
|
||||
Standard_DEPRECATED("Deprecated method Init(), obsolete parameter Graphic3d_Text, use Graphic3d_Text instead of it")
|
||||
Standard_EXPORT void Init (const Handle(OpenGl_Context)& theCtx,
|
||||
const TCollection_ExtendedString& theText,
|
||||
const OpenGl_Vec2& thePoint,
|
||||
const Graphic3d_Text& theParams);
|
||||
|
||||
//! Compute text width
|
||||
Standard_DEPRECATED("Deprecated method StringSize() with obsolete Graphic3d_Text argument")
|
||||
Standard_EXPORT static void StringSize (const Handle(OpenGl_Context)& theCtx,
|
||||
const NCollection_String& theText,
|
||||
const OpenGl_Aspects& theTextAspect,
|
||||
const Graphic3d_Text& theParams,
|
||||
const unsigned int theResolution,
|
||||
Standard_ShortReal& theWidth,
|
||||
Standard_ShortReal& theAscent,
|
||||
Standard_ShortReal& theDescent);
|
||||
|
||||
protected:
|
||||
|
||||
friend class OpenGl_Trihedron;
|
||||
@@ -192,7 +204,7 @@ protected:
|
||||
|
||||
protected:
|
||||
|
||||
Handle(Graphic3d_TextParams) myParams;
|
||||
Handle(Graphic3d_Text) myParams;
|
||||
bool myIs2d;
|
||||
|
||||
public:
|
||||
|
@@ -16,15 +16,9 @@
|
||||
#ifndef _OpenGl_TextParam_Header
|
||||
#define _OpenGl_TextParam_Header
|
||||
|
||||
#include <Graphic3d_HorizontalTextAlignment.hxx>
|
||||
#include <Graphic3d_VerticalTextAlignment.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
|
||||
struct OpenGl_TextParam
|
||||
{
|
||||
int Height;
|
||||
Graphic3d_HorizontalTextAlignment HAlign;
|
||||
Graphic3d_VerticalTextAlignment VAlign;
|
||||
DEFINE_STANDARD_ALLOC
|
||||
};
|
||||
Standard_DEPRECATED("This type name is deprecated - Graphic3d_Text should be used instead")
|
||||
typedef Graphic3d_Text OpenGl_TextParam;
|
||||
|
||||
#endif //_OpenGl_TextParam_Header
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <Graphic3d_Vertex.hxx>
|
||||
#include <Prs3d_Presentation.hxx>
|
||||
#include <Prs3d_TextAspect.hxx>
|
||||
@@ -39,12 +39,12 @@ void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
|
||||
|
||||
theGroup->SetPrimitivesAspect (theAspect->Aspect());
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theAspect->Height());
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (theAspect->Height());
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
aTextParams->Init (aText,
|
||||
Graphic3d_Vertex(x,y,z),
|
||||
theAspect->HorizontalJustification(),
|
||||
theAspect->VerticalJustification());
|
||||
aTextParams->SetText (aText);
|
||||
aTextParams->SetPosition (gp_Pnt (x,y,z));
|
||||
aTextParams->SetHAlignment (theAspect->HorizontalJustification());
|
||||
aTextParams->SetVAlignment (theAspect->VerticalJustification());
|
||||
theGroup->AddText (aTextParams);
|
||||
}
|
||||
|
||||
@@ -60,12 +60,12 @@ void Prs3d_Text::Draw (const Handle(Graphic3d_Group)& theGroup,
|
||||
{
|
||||
theGroup->SetPrimitivesAspect (theAspect->Aspect());
|
||||
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (theAspect->Height());
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (theAspect->Height());
|
||||
const NCollection_String aText (theText.ToExtString());
|
||||
aTextParams->Init (aText,
|
||||
theOrientation,
|
||||
theHasOwnAnchor,
|
||||
theAspect->HorizontalJustification(),
|
||||
theAspect->VerticalJustification());
|
||||
aTextParams->SetText (aText);
|
||||
aTextParams->SetOrientation (theOrientation);
|
||||
aTextParams->SetOwnAnchorPoint (theHasOwnAnchor);
|
||||
aTextParams->SetHAlignment (theAspect->HorizontalJustification());
|
||||
aTextParams->SetVAlignment (theAspect->VerticalJustification());
|
||||
theGroup->AddText (aTextParams);
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include <Graphic3d_GraphicDriver.hxx>
|
||||
#include <Graphic3d_Group.hxx>
|
||||
#include <Graphic3d_Structure.hxx>
|
||||
#include <Graphic3d_TextParams.hxx>
|
||||
#include <Graphic3d_Text.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Type.hxx>
|
||||
#include <V3d.hxx>
|
||||
@@ -537,22 +537,25 @@ 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);
|
||||
Handle(Graphic3d_TextParams) aTextParams = new Graphic3d_TextParams (1.0 / 81.0);
|
||||
aTextParams->Init ("X", Graphic3d_Vertex (pX.X(), pX.Y(), pX.Z()));
|
||||
Handle(Graphic3d_Text) aTextParams = new Graphic3d_Text (1.0 / 81.0);
|
||||
aTextParams->SetText ("X");
|
||||
aTextParams->SetPosition (gp_Pnt (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);
|
||||
aTextParams = new Graphic3d_TextParams (1.0 / 81.0);
|
||||
aTextParams->Init ("Y", Graphic3d_Vertex (pY.X(), pY.Y(), pY.Z()));
|
||||
aTextParams = new Graphic3d_Text (1.0 / 81.0);
|
||||
aTextParams->SetText ("Y");
|
||||
aTextParams->SetPosition (gp_Pnt (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);
|
||||
aTextParams = new Graphic3d_TextParams (1.0 / 81.0);
|
||||
aTextParams->Init ("Z", Graphic3d_Vertex (pZ.X(), pZ.Y(), pZ.Z()));
|
||||
aTextParams = new Graphic3d_Text (1.0 / 81.0);
|
||||
aTextParams->SetText ("Z");
|
||||
aTextParams->SetPosition (gp_Pnt (pZ.X(), pZ.Y(), pZ.Z()));
|
||||
aGroup->AddText (aTextParams);
|
||||
|
||||
aGroup->AddPrimitiveArray (aPrims);
|
||||
|
Reference in New Issue
Block a user