GDD & CCAR:

Improve performance of OnColor()
This commit is contained in:
gdd 2011-01-05 16:29:52 +00:00
parent 08ccaeae90
commit d02241355e

View File

@ -340,13 +340,17 @@ void GEOMToolsGUI::OnColor()
if ( c.isValid() ) {
SUIT_OverrideCursor();
aColor = Quantity_Color( c.red() / 255., c.green() / 255., c.blue() / 255., Quantity_TOC_RGB );
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*> ( window->getViewManager()->getViewModel() );
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
io = GEOMBase::GetAIS( It.Value(), true );
if ( !io.IsNull() ) {
if ( io->IsKind( STANDARD_TYPE(AIS_Shape) ) ) {
TopoDS_Shape theShape = Handle(AIS_Shape)::DownCast( io )->Shape();
if (theShape.ShapeType() == TopAbs_VERTEX) {
// Set color for a point
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>
( window->getViewManager()->getViewModel() );
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
Handle(AIS_Drawer) aCurDrawer = io->Attributes();
Handle(Prs3d_PointAspect) aCurPointAspect = aCurDrawer->PointAspect();
Quantity_Color aCurColor;
@ -362,7 +366,9 @@ void GEOMToolsGUI::OnColor()
Handle(Graphic3d_HArray1OfBytes) aTexture = aCurPointAspect->GetTexture();
aCurDrawer->SetPointAspect(new Prs3d_PointAspect(aColor, 1, aWidth, aHeight, aTexture));
}
ic->SetLocalAttributes(io, aCurDrawer);
ic->SetLocalAttributes(io, aCurDrawer, Standard_False);
}
}
io->SetColor( aColor );
if ( io->IsKind( STANDARD_TYPE(GEOM_AISShape) ) )
@ -384,6 +390,7 @@ void GEOMToolsGUI::OnColor()
anObject->SetAutoColor( false );
}
} // for
ic->UpdateCurrentViewer();
GeometryGUI::Modified();
} // if c.isValid()
} // first IO is not null