myFont ("Courier"),
myFontAspect (Font_FA_Regular),
myHasOrientation3D (Standard_False),
+ myHasOwnAnchorPoint (Standard_True),
myHasFlipping (Standard_False)
{
myDrawer->SetTextAspect (new Prs3d_TextAspect());
gp_Ax2 anOrientation = myOrientation3D;
anOrientation.SetLocation (aPosition);
- Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePrs), anAsp, myText, myOrientation3D, !myHasFlipping);
+
+ Standard_Boolean aHasOwnAnchor = HasOwnAnchorPoint();
+ if (myHasFlipping)
+ aHasOwnAnchor = Standard_False; // always not using own anchor if flipping
+
+ Prs3d_Text::Draw (Prs3d_Root::CurrentGroup (thePrs), anAsp, myText, myOrientation3D, aHasOwnAnchor);
if (myHasFlipping && isInit)
{
Prs3d_Root::CurrentGroup (thePrs)->SetFlippingOptions (Standard_False, gp_Ax2());
Standard_EXPORT Standard_Boolean HasFlipping() const;
+ //! Returns flag if text uses position as point of attach
+ Standard_Boolean HasOwnAnchorPoint() const { return myHasOwnAnchorPoint; }
+
+ //! Set flag if text uses position as point of attach
+ void SetOwnAnchorPoint (const Standard_Boolean theOwnAnchorPoint) { myHasOwnAnchorPoint = theOwnAnchorPoint; }
+
//! Define the display type of the text.
//!
//! TODT_NORMAL Default display. Text only.
Font_FontAspect myFontAspect;
gp_Ax2 myOrientation3D;
Standard_Boolean myHasOrientation3D;
+ Standard_Boolean myHasOwnAnchorPoint;
Standard_Boolean myHasFlipping;
public:
{
OpenGl_Mat4d aCurrentWorldViewMat;
aCurrentWorldViewMat.Convert (theCtx->WorldViewState.Current());
+
+ // apply local transformation
+ OpenGl_Mat4d aModelWorld;
+ aModelWorld.Convert (theCtx->ModelWorldState.Current());
+ aCurrentWorldViewMat = aCurrentWorldViewMat * aModelWorld;
+
theCtx->WorldViewState.SetCurrent<Standard_Real> (aCurrentWorldViewMat * aModViewMat);
}
else
{
aTextPrs->SetFlipping (Standard_True);
}
+ else if (aParam == "-ownanchor")
+ {
+ if (++anArgIt >= theArgsNb)
+ {
+ std::cout << "Error: wrong number of values for parameter '" << aParam.ToCString() << "'.\n";
+ return 1;
+ }
+ aTextPrs->SetOwnAnchorPoint (Draw::Atoi (theArgVec[anArgIt]) == 1);
+ }
else if (aParam == "-disptype"
|| aParam == "-displaytype")
{
"\n\t\t: [-noupdate]"
"\n\t\t: [-plane NormX NormY NormZ DirX DirY DirZ]"
"\n\t\t: [-flipping]"
+ "\n\t\t: [-ownanchor {0|1}=1]"
"\n\t\t: Display text label at specified position.",
__FILE__, VDrawText, group);