1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +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

@@ -44,8 +44,6 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
: myStructureManager (theManager.operator->()),
myFirstStructureManager (theManager.operator->()),
myComputeVisual (Graphic3d_TOS_ALL),
myHighlightColor (Quantity_NOC_WHITE),
myHighlightMethod (Aspect_TOHM_COLOR),
myOwner (NULL),
myVisual (Graphic3d_TOS_ALL)
{
@@ -61,8 +59,6 @@ Graphic3d_Structure::Graphic3d_Structure (const Handle(Graphic3d_StructureManage
: myStructureManager (theManager.operator->()),
myFirstStructureManager (theManager.operator->()),
myComputeVisual (thePrs->myComputeVisual),
myHighlightColor (thePrs->myHighlightColor),
myHighlightMethod (thePrs->myHighlightMethod),
myOwner (thePrs->myOwner),
myVisual (thePrs->myVisual)
{
@@ -273,17 +269,14 @@ void Graphic3d_Structure::Erase()
//function : Highlight
//purpose :
//=============================================================================
void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMethod,
const Quantity_Color& theColor,
const Standard_Boolean theToUpdateMgr)
void Graphic3d_Structure::Highlight (const Handle(Graphic3d_HighlightStyle)& theStyle,
const Standard_Boolean theToUpdateMgr)
{
if (IsDeleted())
{
return;
}
myHighlightColor = theColor;
// Highlight on already Highlighted structure.
if (myCStructure->highlight)
{
@@ -304,7 +297,7 @@ void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMetho
SetDisplayPriority (Structure_MAX_PRIORITY - 1);
GraphicHighlight (theMethod);
myCStructure->GraphicHighlight (theStyle, this);
if (!theToUpdateMgr)
{
@@ -313,7 +306,7 @@ void Graphic3d_Structure::Highlight (const Aspect_TypeOfHighlightMethod theMetho
if (myCStructure->stick)
{
myStructureManager->Highlight (this, theMethod);
myStructureManager->Highlight (this);
}
Update();
@@ -350,7 +343,7 @@ void Graphic3d_Structure::UnHighlight()
{
myCStructure->highlight = 0;
GraphicUnHighlight();
myCStructure->GraphicUnhighlight();
myStructureManager->UnHighlight (this);
ResetDisplayPriority();
@@ -359,12 +352,12 @@ void Graphic3d_Structure::UnHighlight()
}
//=============================================================================
//function : HighlightColor
//function : HighlightStyle
//purpose :
//=============================================================================
const Quantity_Color& Graphic3d_Structure::HighlightColor() const
const Handle(Graphic3d_HighlightStyle)& Graphic3d_Structure::HighlightStyle() const
{
return myHighlightColor;
return myCStructure->HighlightStyle();
}
//=============================================================================
@@ -1302,30 +1295,6 @@ void Graphic3d_Structure::Update (const bool theUpdateLayer) const
theUpdateLayer ? myCStructure->ZLayer() : Graphic3d_ZLayerId_UNKNOWN);
}
//=============================================================================
//function : GraphicHighlight
//purpose :
//=============================================================================
void Graphic3d_Structure::GraphicHighlight (const Aspect_TypeOfHighlightMethod theMethod)
{
myCStructure->highlight = 1;
myHighlightMethod = theMethod;
switch (theMethod)
{
case Aspect_TOHM_COLOR:
{
myCStructure->HighlightWithColor (myHighlightColor, Standard_True);
break;
}
case Aspect_TOHM_BOUNDBOX:
{
myCStructure->HighlightColor = myHighlightColor;
myCStructure->HighlightWithBndBox (this, Standard_True);
break;
}
}
}
//=============================================================================
//function : GraphicTransform
//purpose :
@@ -1335,24 +1304,6 @@ void Graphic3d_Structure::GraphicTransform (const Handle(Geom_Transformation)& t
myCStructure->SetTransformation (theTrsf);
}
//=============================================================================
//function : GraphicUnHighlight
//purpose :
//=============================================================================
void Graphic3d_Structure::GraphicUnHighlight()
{
myCStructure->highlight = 0;
switch (myHighlightMethod)
{
case Aspect_TOHM_COLOR:
myCStructure->HighlightWithColor (Graphic3d_Vec3 (0.0f, 0.0f, 0.0f), Standard_False);
break;
case Aspect_TOHM_BOUNDBOX:
myCStructure->HighlightWithBndBox (this, Standard_False);
break;
}
}
//=============================================================================
//function : ComputeVisual
//purpose :