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

0027818: Visualization - provide an interface to define highlight presentation properties

- introduces a wrapper for setting up highlight properties: Graphic3d_HighlightStyle;
- API of all methods that use highlight or selection color is changed to deal with Graphic3d_HighlightStyle;
- highlight in shading mode now supports transparency, implemented via blending;
- transparency for selection can also be set, but implementing custom entity owners with additional presentation on application level;
- methods PrsMgr_PresentationManager::Highlight, PrsMgr_PresentationManager::BoundBox that highlight object with hard-coded color are removed;
- deprecated methods of SelectMgr_EntityOwner, that use presentation manager's highlight method, were removed;
- methods of IsHilighted AIS context with selection color checks were replaced;
- added API to store dynamic and selection highlight to Prs3d_Drawer class;
- customization of dynamic and selection highlight for particular objects is now available through SelectMgr_SelectableObject::HilightAttributes();
- AIS_InteractiveContext highlight methods were updated to support individual highlight styles of interactive objects;
- introduced new command - vselprops, that allows to customize global selection and highlight properties like autoactivation, pixel tolerance and colors;
- Draw Harness commands vautoactivatesel and vselprecision were removed, use vselprops instead;
- fixed bug in command's parser;
- test case for issue #27818
This commit is contained in:
vpa
2016-09-28 12:43:17 +03:00
committed by kgv
parent 3a9b5dc86a
commit 8e5fb5eabc
69 changed files with 1381 additions and 1002 deletions

View File

@@ -75,71 +75,18 @@ IsHilighted(const Handle(PrsMgr_PresentationManager)& PM,
}
//=======================================================================
//function : Hilight/Unhilight Methods...
//purpose :
//function : HilightWithColor
//purpose :
//=======================================================================
void StdSelect_BRepOwner::Hilight(const Handle(PrsMgr_PresentationManager)& PM,
const Standard_Integer aMode)
void StdSelect_BRepOwner::HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
const Handle(Graphic3d_HighlightStyle)& theStyle,
const Standard_Integer theMode)
{
Standard_Integer M = (aMode < 0) ? myCurMode : aMode;
Handle(SelectMgr_SelectableObject) aSel = Selectable();
if (myFromDecomposition)
{
// do the update flag check
if (!myPrsSh.IsNull())
{
TColStd_ListOfInteger aModesList;
myPrsSh->ToBeUpdated (aModesList);
if (!aModesList.IsEmpty())
myPrsSh.Nullify();
}
Handle(Prs3d_Drawer) aDrawer;
if (!aSel.IsNull())
{
aDrawer = aSel->HilightAttributes();
}
else
{
aDrawer = new Prs3d_Drawer();
SelectMgr_SelectableObject::InitDefaultHilightAttributes (aDrawer);
}
// generate new presentable shape
if (myPrsSh.IsNull())
{
myPrsSh = new StdSelect_Shape (myShape, aDrawer);
}
if (!aSel.IsNull())
{
myPrsSh->SetZLayer (aSel->ZLayer());
myPrsSh->SetTransformPersistence (aSel->TransformPersistence());
}
// highlight and set layer
PM->Highlight (myPrsSh, M);
}
else
{
if(myPrsSh.IsNull())
PM->Highlight(aSel,M);
else
PM->Highlight(myPrsSh,M);
}
}
void StdSelect_BRepOwner::Hilight()
{}
void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManager3d)& PM,
const Quantity_NameOfColor aCol,
const Standard_Integer aMode)
{
Standard_Integer M = (aMode < 0) ? myCurMode : aMode;
Standard_Integer M = (theMode < 0) ? myCurMode : theMode;
Graphic3d_ZLayerId aHiLayer = this == Selectable()->GlobalSelOwner().get() ?
Graphic3d_ZLayerId_Top : Graphic3d_ZLayerId_Topmost;
Handle(SelectMgr_SelectableObject) aSel = Selectable();
if (myFromDecomposition)
{
// do the update flag check
@@ -181,17 +128,17 @@ void StdSelect_BRepOwner::HilightWithColor(const Handle(PrsMgr_PresentationManag
}
// highlight with color and set layer
PM->Color (myPrsSh, aCol, M, aSel, aHiLayer);
thePM->Color (myPrsSh, theStyle, M, aSel, aHiLayer);
}
else
{
if (!myPrsSh.IsNull())
{
PM->Color (myPrsSh, aCol, M, aSel, aHiLayer);
thePM->Color (myPrsSh, theStyle, M, aSel, aHiLayer);
}
else
{
PM->Color (aSel, aCol, M, NULL, aHiLayer);
thePM->Color (aSel, theStyle, M, NULL, aHiLayer);
}
}
}

View File

@@ -107,13 +107,9 @@ public:
//! aMode is highlighted in the presentation manager aPM.
Standard_EXPORT virtual Standard_Boolean IsHilighted (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) const Standard_OVERRIDE;
Standard_EXPORT virtual void Hilight() Standard_OVERRIDE;
//! Returns the selection mode aMode defining the type
//! of shape highlighted in the presentation manager aPM.
Standard_EXPORT virtual void Hilight (const Handle(PrsMgr_PresentationManager)& aPM, const Standard_Integer aMode = 0) Standard_OVERRIDE;
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& aPM, const Quantity_NameOfColor aCol, const Standard_Integer aMode = 0) Standard_OVERRIDE;
Standard_EXPORT virtual void HilightWithColor (const Handle(PrsMgr_PresentationManager3d)& thePM,
const Handle(Graphic3d_HighlightStyle)& theStyle,
const Standard_Integer theMode = 0) Standard_OVERRIDE;
//! Removes highlighting from the type of shape
//! identified the selection mode aMode in the presentation manager aPM.