Highlighting an array of colored segments

Hello! I have an array of Graphic3d_ArrayOfPrimitives which contains segments colored with different colors. When highlighting it (using HilightSelected() and HilightOwnerWithColor()), I want to modify only the segment width of each element inside the array, but the colors to remain the same. Which is the best approach? I tried various tests but with no success, I can only modify the complete array color, and no success with modifying the width. This is a test sample:

// init drawers attributes
Handle(Prs3d_ShadingAspect) shasp = new Prs3d_ShadingAspect();

myDynHilightDrawer = new Prs3d_Drawer();

myHilightDrawer = new Prs3d_Drawer();

void MyAISObject::HilightOwnerWithColor(const Handle(PrsMgr_PresentationManager)& thePrsMgr, const Handle(Prs3d_Drawer)& theStyle, const Handle(SelectMgr_EntityOwner)& theOwner)
  thePrsMgr->Color(this, myDynHilightDrawer, myDynHilightDrawer->DisplayMode());

void MyAISObject::HilightSelected(const Handle(PrsMgr_PresentationManager)& thePrsMgr, const SelectMgr_SequenceOfOwner& theSeq)
  thePrsMgr->Color(this, myHilightDrawer, myHilightDrawer->DisplayMode());


gkv311 n's picture

For the moment, highlighting methods like PrsMgr_PresentationManager::Color() has no power to change any attributes of existing presentation other than color of entire presentation. You may change attributes of existing presentation on your own when selection status changes, or compute a dedicated presentation with different style, which will be displayed on top.

bioan m's picture

Hi Kirill!
Thank you for your response!
Can you indicate some sample for both approaches from Open cascade documentation or from Draw Harness plugin command scripts?
Much appreciated!
Best regards!

gkv311 n's picture

For duplicated presentation - it is like AIS_Shape displayed in AIS_Shaded mode and highlighted by AIS_Wireframe presentation. You'll need your ::Compute() to handle different theMode values and set different display mode to highlight style(s).

For changing style of existing presentation - it is like calling SetWidth() or SetColor() to presentation object and redrawing the view, but in sync with selection state changes. I don't recall samples of such logic in OCCT, although this approach has been used in some projects.

bioan m's picture

Everything works as expected!

Thank you very much!