mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-13 02:00:35 +05:00
Fix for the "0021580: GEOM EDF: SetColor does not work" issue.
This commit is contained in:
parent
d5971b8b43
commit
17ec6b3223
@ -1041,6 +1041,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
return;
|
||||
|
||||
bool useStudy = false;
|
||||
bool useObjCol = false;
|
||||
PropMap aPropMap;
|
||||
|
||||
vtkActorCollection* theActors = 0;
|
||||
@ -1092,6 +1093,8 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
|
||||
if(useStudy) {
|
||||
aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
|
||||
if(!aPropMap.contains(COLOR_PROP))
|
||||
useObjCol = true;
|
||||
MergePropertyMaps(aPropMap, aDefPropMap);
|
||||
}
|
||||
}
|
||||
@ -1175,10 +1178,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
aGeomGActor->SetMaterial(aProps);
|
||||
|
||||
vtkFloatingPointType aColor[3] = {1.,0.,0.};
|
||||
if(aPropMap.contains(COLOR_PROP)) {
|
||||
QColor c = aPropMap.value(COLOR_PROP).value<QColor>();
|
||||
aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
|
||||
} else { //Get Color from geom object
|
||||
if ( useObjCol ) { //Get Color from geom object
|
||||
Handle( SALOME_InteractiveObject ) anIO = aGeomGActor->getIO();
|
||||
if ( !anIO.IsNull() ) {
|
||||
_PTR(SObject) SO ( aStudy->studyDS()->FindObjectID( anIO->getEntry() ) );
|
||||
@ -1197,13 +1197,17 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
if(aResMgr) {
|
||||
QColor c = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
|
||||
aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
|
||||
aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, c );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, QColor( aColor[0] *255, aColor[1] * 255, aColor[2]* 255) );
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
QColor c = aPropMap.value(COLOR_PROP).value<QColor>();
|
||||
aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
|
||||
}
|
||||
|
||||
if ( !material.isPhysical() )
|
||||
aGeomGActor->SetColor(aColor[0],aColor[1],aColor[2]);
|
||||
}
|
||||
@ -1224,7 +1228,6 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( aGeomGActor )
|
||||
{
|
||||
if ( HasWidth() )
|
||||
|
@ -302,6 +302,17 @@ void GEOMToolsGUI::OnColor()
|
||||
aView->SetColor( It.Value(), c );
|
||||
appStudy->setObjectProperty(mgrId,It.Value()->getEntry(),COLOR_PROP, c);
|
||||
}
|
||||
// store color to GEOM_Object
|
||||
_PTR(Study) aStudy = appStudy->studyDS();
|
||||
_PTR(SObject) aSObject( aStudy->FindObjectID( It.Value()->getEntry() ) );
|
||||
GEOM::GEOM_Object_var anObject =
|
||||
GEOM::GEOM_Object::_narrow(GeometryGUI::ClientSObjectToObject(aSObject));
|
||||
SALOMEDS::Color aSColor;
|
||||
aSColor.R = (double)c.red() / 255.0;
|
||||
aSColor.G = (double)c.green() / 255.0;
|
||||
aSColor.B = (double)c.blue() / 255.0;
|
||||
anObject->SetColor( aSColor );
|
||||
anObject->SetAutoColor( false );
|
||||
}
|
||||
GeometryGUI::Modified();
|
||||
}
|
||||
|
@ -269,22 +269,7 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
||||
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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
QColor c = propMap.value(COLOR_PROP).value<QColor>();
|
||||
if ( c.isValid() )
|
||||
myColor->setColor( c );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user