Issue 0019818: EDF 703 SMESH VISU : Display Mesh Groups names in viewer (as a caption)

This commit is contained in:
ouv 2009-05-27 07:24:39 +00:00
parent cead6d7aed
commit daf3ca87d0
3 changed files with 21 additions and 0 deletions

View File

@ -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<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();
}

View 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();
}
}

View 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;