From: ana Date: Thu, 17 May 2012 13:43:49 +0000 (+0000) Subject: Fix for the "0021580: GEOM EDF: SetColor does not work" issue. X-Git-Tag: V6_5_0~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d0aa43b5c23d7d0c950117b8d670351be64768f7;p=modules%2Fgeom.git Fix for the "0021580: GEOM EDF: SetColor does not work" issue. --- diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.cxx index e7a6bcc6b..9ee86323d 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_MaterialPropertiesDlg.cxx @@ -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(); - 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(); + 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 ); + } } } }