1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

2 Commits

Author SHA1 Message Date
alex
ba382e61db temporary patch to avoid deactivate selection on children after the parent's hiding 2019-10-15 14:59:45 +03:00
nds
05ac0c7d75 0030922: Visualization - OpenGl_Text wrong local transformation if text has not own attach point
(cherry picked from commit d149bbcbaf7d237425b574a1977acb07db299bea)
(cherry picked from commit 95a4927b5b2b9310de6ebe36f0fe6523cebe52c6)
(cherry picked from commit f414985732fb8084363d543e65fc4d7232e22488)
2019-10-10 08:49:23 +03:00
5 changed files with 35 additions and 3 deletions

View File

@@ -41,6 +41,7 @@ AIS_TextLabel::AIS_TextLabel()
myFont ("Courier"),
myFontAspect (Font_FA_Regular),
myHasOrientation3D (Standard_False),
myHasOwnAnchorPoint (Standard_True),
myHasFlipping (Standard_False)
{
myDrawer->SetTextAspect (new Prs3d_TextAspect());
@@ -308,7 +309,12 @@ void AIS_TextLabel::Compute (const Handle(PrsMgr_PresentationManager3d)& /*thePr
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());

View File

@@ -90,6 +90,12 @@ public:
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.
@@ -121,6 +127,7 @@ protected:
Font_FontAspect myFontAspect;
gp_Ax2 myOrientation3D;
Standard_Boolean myHasOrientation3D;
Standard_Boolean myHasOwnAnchorPoint;
Standard_Boolean myHasFlipping;
public:

View File

@@ -426,6 +426,12 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_Context)& theCtx,
{
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

View File

@@ -185,9 +185,12 @@ void SelectMgr_SelectionManager::Activate (const Handle(SelectMgr_SelectableObje
void SelectMgr_SelectionManager::Deactivate (const Handle(SelectMgr_SelectableObject)& theObject,
const Standard_Integer theMode)
{
for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter (theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
if (theObject->ToPropagateVisualState())
{
Deactivate (Handle(SelectMgr_SelectableObject)::DownCast (anChildrenIter.Value()), theMode);
for (PrsMgr_ListOfPresentableObjectsIter anChildrenIter(theObject->Children()); anChildrenIter.More(); anChildrenIter.Next())
{
Deactivate(Handle(SelectMgr_SelectableObject)::DownCast(anChildrenIter.Value()), theMode);
}
}
if (!theObject->HasOwnPresentations())
{

View File

@@ -2542,6 +2542,15 @@ static int VDrawText (Draw_Interpretor& theDI,
{
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")
{
@@ -6459,6 +6468,7 @@ void ViewerTest::ObjectCommands(Draw_Interpretor& theCommands)
"\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);