Fix for the "0021580: GEOM EDF: SetColor does not work" issue.

This commit is contained in:
ana 2012-05-17 13:43:49 +00:00
parent e6e039b1a4
commit d0aa43b5c2

View File

@ -262,17 +262,32 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
if ( selected.Extent() > 0 ) {
Handle(SALOME_InteractiveObject) io = selected.First();
if ( !io.IsNull() ) {
SUIT_ViewWindow* window = app->desktop()->activeWindow();
if ( window ) {
int mgrId = window->getViewManager()->getGlobalId();
PropMap propMap = study->getObjectPropMap( mgrId, io->getEntry() );
QString matProp = propMap.value(MATERIAL_PROP).toString();
if ( !matProp.isEmpty() )
myCurrentModel.fromProperties( matProp );
QColor c = propMap.value(COLOR_PROP).value<QColor>();
if ( c.isValid() )
myColor->setColor( c );
}
SUIT_ViewWindow* window = app->desktop()->activeWindow();
if ( window ) {
int mgrId = window->getViewManager()->getGlobalId();
PropMap propMap = study->getObjectPropMap( mgrId, io->getEntry() );
QString matProp = propMap.value(MATERIAL_PROP).toString();
if ( !matProp.isEmpty() )
myCurrentModel.fromProperties( matProp );
QColor c;
if(propMap.contains(COLOR_PROP))
c = propMap.value(COLOR_PROP).value<QColor>();
else {
_PTR(SObject) SO ( study->studyDS()->FindObjectID( io->getEntry() ) );
if ( SO ) {
// get CORBA reference to data object
CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
if ( !CORBA::is_nil( object ) ) {
// downcast to GEOM object
GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object );
SALOMEDS::Color aSColor = aGeomObject->GetColor();
c.setRgb( 255.*aSColor.R, 255.*aSColor.G, 255.*aSColor.B );
}
}
}
if ( c.isValid() )
myColor->setColor( c );
}
}
}
}