Wed, 08/23/2023 - 07:42
I new myHilightDrawer and myDynHilight Drawer as selected Drawer and focus Drawer.
But after selected the shape, the normal Drawer is not hide. How to hide normal Drawer when selected status?
WireFrameDraw::WireFrameDraw(TopoDS_Shape const& shape)
: AIS_Shape(shape)
{
{
myHilightDrawer = new Prs3d_Drawer();
myHilightDrawer->SetColor(Quantity_NOC_GOLD);
myHilightDrawer->SetDisplayMode(DisplayMode::Selected);
myHilightDrawer->SetOwnLineAspects();
myHilightDrawer->WireAspect()->SetTypeOfLine(Aspect_TOL_DASH);
}
{
myDynHilightDrawer = new Prs3d_Drawer();
myDynHilightDrawer->SetColor(Quantity_NOC_CORAL);
myDynHilightDrawer->SetDisplayMode(DisplayMode::Highlight);
myDynHilightDrawer->SetOwnLineAspects();
myDynHilightDrawer->SetupOwnPointAspect();
{
auto& pointAspect = myDynHilightDrawer->PointAspect();
pointAspect->SetTypeOfMarker(Aspect_TOM_O_PLUS);
pointAspect->SetScale(4.0);
}
}
myDrawer->SetDisplayMode(DisplayMode::Normal);
}
void WireFrameDraw::Compute(Handle(PrsMgr_PresentationManager) const& thePresentationManager,
Handle(Prs3d_Presentation) const& prs,
Standard_Integer const mode)
{
if (myshape.IsNull()) {
return;
}
if (!AcceptDisplayMode(mode)) {
return;
}
switch (mode) {
case DisplayMode::Normal: {
prs->Clear();
thePresentationManager->SetDisplayPriority(this, DisplayMode::Normal, Graphic3d_DisplayPriority_Bottom);
StdPrs_WFShape::Add(prs, myshape, myDrawer);
} break;
case DisplayMode::Highlight: {
prs->Clear();
StdPrs_WFShape::Add(prs, myshape, myDynHilightDrawer);
thePresentationManager->SetDisplayPriority(this, DisplayMode::Highlight, Graphic3d_DisplayPriority_Normal);
} break;
case DisplayMode::Selected: {
prs->Clear();
thePresentationManager->SetDisplayPriority(this, DisplayMode::Selected, Graphic3d_DisplayPriority_Topmost);
//thePresentationManager->SetVisibility(this, DisplayMode::Normal, false);
//thePresentationManager->Clear(this, DisplayMode::Normal);
StdPrs_WFShape::Add(prs, myshape, myHilightDrawer);
} break;
}
}
The Attachments pictures effect as below:(normal, focus, selected)
Thu, 08/24/2023 - 16:40
Please use code tags to insert code snippets on the forum to make it readable.