From daf3ca87d0410590f861c85192484f454ae9a453 Mon Sep 17 00:00:00 2001 From: ouv Date: Wed, 27 May 2009 07:24:39 +0000 Subject: [PATCH] Issue 0019818: EDF 703 SMESH VISU : Display Mesh Groups names in viewer (as a caption) --- src/OBJECT/SMESH_Actor.cxx | 10 ++++++++++ src/SMESHGUI/SMESHGUI.cxx | 9 +++++++++ src/SMESHGUI/SMESHGUI_GroupDlg.cxx | 2 ++ 3 files changed, 21 insertions(+) diff --git a/src/OBJECT/SMESH_Actor.cxx b/src/OBJECT/SMESH_Actor.cxx index 49d838bac..0bd5e0dac 100644 --- a/src/OBJECT/SMESH_Actor.cxx +++ b/src/OBJECT/SMESH_Actor.cxx @@ -28,8 +28,10 @@ #include "SMESH_ActorDef.h" #include "SMESH_ActorUtils.h" #include "SMESH_DeviceActor.h" +#include "SMESH_ObjectDef.h" #include "SMESH_ControlsDef.hxx" #include "VTKViewer_ExtractUnstructuredGrid.h" +#include "VTKViewer_FramedTextActor.h" #include "SALOME_InteractiveObject.hxx" #include "SUIT_Session.h" @@ -415,6 +417,10 @@ SMESH_ActorDef::SMESH_ActorDef() // Clipping planes myImplicitBoolean = vtkImplicitBoolean::New(); myImplicitBoolean->SetOperationTypeToIntersection(); + + // Set color of the name actor + SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) ); + myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]); } @@ -875,6 +881,9 @@ bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj, SetShrink(); } + if( dynamic_cast( myVisualObj.get() ) ) + SetIsDisplayNameActor( true ); + myTimeStamp->Modified(); Modified(); return true; @@ -1416,6 +1425,7 @@ vtkFloatingPointType SMESH_ActorDef::GetOpacity(){ void SMESH_ActorDef::SetSufaceColor(vtkFloatingPointType r,vtkFloatingPointType g,vtkFloatingPointType b){ mySurfaceProp->SetColor(r,g,b); + myNameActor->SetBackgroundColor(r,g,b); Modified(); } diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 64398d225..1e32987ca 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -2120,6 +2120,15 @@ bool SMESHGUI::OnGUIEvent( int theCommandID ) { SMESHGUI::GetSMESHGen()->SetName(obj->GetIOR().c_str(), newName.toLatin1().data()); + // update name of group object and its actor + SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface(IObject); + if( !aGroupObject->_is_nil() ) + { + aGroupObject->SetName( newName.toLatin1().data() ); + if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( IObject->getEntry() ) ) + anActor->setName( newName.toLatin1().data() ); + } + updateObjBrowser(); } } diff --git a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx index 24246eec6..dc98cd310 100644 --- a/src/SMESHGUI/SMESHGUI_GroupDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_GroupDlg.cxx @@ -798,6 +798,7 @@ bool SMESHGUI_GroupDlg::onApply() _PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroup); if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) { + anActor->setName(myName->text().toLatin1().data()); switch ( myTypeId ) { case 0: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break; case 1: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break; @@ -935,6 +936,7 @@ bool SMESHGUI_GroupDlg::onApply() _PTR(SObject) aMeshGroupSO = SMESH::FindSObject(myGroupOnGeom); if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aMeshGroupSO->GetID().c_str())) { + anActor->setName(myName->text().toLatin1().data()); switch ( myTypeId ) { case 0: anActor->SetNodeColor( aColor.R, aColor.G, aColor.B ); break; case 1: anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B ); break; -- 2.30.2