How to change AIS_Point Selected Color?

I copied AIS_ The code for Point rewritten this function to add color, but it failed。。。。。。。

void AIS_SketchPoint::Compute(const Handle(PrsMgr_PresentationManager3d)& /*aPresentationManager*/,
const Handle(Prs3d_Presentation)& aPresentation,
const Standard_Integer aMode)
{
aPresentation->SetInfiniteState(myInfiniteState);

if (aMode == 0)
{
std::cout StdPrs_Point::Add(aPresentation, myComponent, myDrawer);
std::cout PointAspect()->Aspect()->Color() }
else if (aMode == -99)
{
std::cout myHilightDrawer->PointAspect()->SetColor(Quantity_NOC_RED);
Handle(Graphic3d_Group) TheGroup = aPresentation->CurrentGroup();
TheGroup->SetPrimitivesAspect(myHilightDrawer->PointAspect()->Aspect());
Handle(Graphic3d_ArrayOfPoints) aPoint = new Graphic3d_ArrayOfPoints(1);
aPoint->AddVertex(myComponent->X(), myComponent->Y(), myComponent->Z());
TheGroup->AddPrimitiveArray(aPoint);
std::cout PointAspect()->Aspect()->Color() }
}

I Try to Set。。。。

void SetColor(Handle(Prs3d_Drawer) aDrawer, Quantity_Color Color)
{
Quantity_Color HiColor = Color;
aDrawer->SetZLayer(Graphic3d_ZLayerId_Topmost);
aDrawer->SetColor(HiColor);
aDrawer->PointAspect()->SetColor(HiColor);
aDrawer->LineAspect()->SetColor(HiColor);
aDrawer->LineAspect()->Aspect()->SetColor(HiColor);
aDrawer->ShadingAspect()->SetColor(HiColor);
aDrawer->ShadingAspect()->Aspect()->SetColor(HiColor);
aDrawer->PlaneAspect()->EdgesAspect()->SetColor(HiColor);
aDrawer->PlaneAspect()->EdgesAspect()->Aspect()->SetColor(HiColor);
aDrawer->PlaneAspect()->IsoAspect()->SetColor(HiColor);
aDrawer->PlaneAspect()->IsoAspect()->Aspect()->SetColor(HiColor);
aDrawer->PlaneAspect()->ArrowAspect()->SetColor(HiColor);
aDrawer->PlaneAspect()->ArrowAspect()->Aspect()->SetColor(HiColor);
for (long long i = 0; i {
if (aDrawer->DatumAspect()->LineAspect((Prs3d_DatumParts)i))
aDrawer->DatumAspect()->LineAspect((Prs3d_DatumParts)i)->SetColor(HiColor);
}
for (long long i = 0; i {
if (aDrawer->DatumAspect()->ShadingAspect((Prs3d_DatumParts)i))
aDrawer->DatumAspect()->ShadingAspect((Prs3d_DatumParts)i)->SetColor(HiColor);
}
aDrawer->DatumAspect()->TextAspect()->SetColor(HiColor);
}

{//设置高亮颜色
Handle(Prs3d_Drawer) aDrawer = mAisContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalSelected);
SetColor(aDrawer,Quantity_NOC_RED);
}
{
Handle(Prs3d_Drawer) aDrawer = mAisContext->SelectionStyle();
SetColor(aDrawer, Quantity_NOC_RED);
}

still gray color.........

Attachments: 
gkv311 n's picture

Within default highlighting method Aspect_TOHM_COLOR the color is taken from Prs3d_Drawer::Color() property, which overrides any other colors set for presentation attributes (PointAspect, LineAspect, etc.). So the following code from your sample:

std::cout myHilightDrawer->PointAspect()->SetColor(Quantity_NOC_RED);

has no practical effect. Try calling myHilightDrawer->SetColor(Quantity_NOC_RED) instead, and best practices suggest managing presentation attributes not within ::Compute() (e.g. in class constructor or within some initialization method).