]> SALOME platform Git repositories - modules/smesh.git/commitdiff
Salome HOME
Issue 0019818: EDF 703 SMESH VISU : Display Mesh Groups names in viewer (as a caption)
authorouv <ouv@opencascade.com>
Wed, 27 May 2009 07:24:39 +0000 (07:24 +0000)
committerouv <ouv@opencascade.com>
Wed, 27 May 2009 07:24:39 +0000 (07:24 +0000)
src/OBJECT/SMESH_Actor.cxx
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESHGUI_GroupDlg.cxx

index 49d838bac3d47d7efb04ad0f9d7404b28692f3af..0bd5e0dac8283b447a1918b01d7aa8fc2d1a2d37 100644 (file)
 #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<SMESH_GroupObj*>( 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();
 }
 
index 64398d22536eb8eb14db78a4693417bd91aa6269..1e32987caaaaf34a4044103df4fd8686ba92b53d 100644 (file)
@@ -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<SMESH::SMESH_GroupBase>(IObject);
+               if( !aGroupObject->_is_nil() )
+               {
+                 aGroupObject->SetName( newName.toLatin1().data() );
+                 if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( IObject->getEntry() ) )
+                   anActor->setName( newName.toLatin1().data() );
+               }
+
                 updateObjBrowser();
               }
             }
index 24246eec6491fef2abead7bca158318204ba99af..dc98cd310e49ac380eba41e0c371e4c8dc51c9e8 100644 (file)
@@ -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;