Fix bug 17655: 'Show' and 'Display only' don't work on Mesh root object.

This commit is contained in:
jfa 2007-11-26 13:21:41 +00:00
parent 9969477f2e
commit 4a314e77eb

View File

@ -271,14 +271,14 @@ namespace SMESH {
CORBA::String_var aVal = anIOR->Value().c_str(); CORBA::String_var aVal = anIOR->Value().c_str();
CORBA::Object_var anObj = app->orb()->string_to_object( aVal.in() ); CORBA::Object_var anObj = app->orb()->string_to_object( aVal.in() );
if(!CORBA::is_nil(anObj)){ if(!CORBA::is_nil(anObj)){
//Try narrow to SMESH_Mesh interafce //Try narrow to SMESH_Mesh interface
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj); SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow(anObj);
if(!aMesh->_is_nil()){ if(!aMesh->_is_nil()){
aVisualObj.reset(new SMESH_MeshObj(aMesh)); aVisualObj.reset(new SMESH_MeshObj(aMesh));
TVisualObjCont::value_type aValue(aKey,aVisualObj); TVisualObjCont::value_type aValue(aKey,aVisualObj);
VISUAL_OBJ_CONT.insert(aValue); VISUAL_OBJ_CONT.insert(aValue);
} }
//Try narrow to SMESH_Group interafce //Try narrow to SMESH_Group interface
SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObj); SMESH::SMESH_GroupBase_var aGroup = SMESH::SMESH_GroupBase::_narrow(anObj);
if(!aGroup->_is_nil()){ if(!aGroup->_is_nil()){
_PTR(SObject) aFatherSObj = aSObj->GetFather(); _PTR(SObject) aFatherSObj = aSObj->GetFather();
@ -293,7 +293,7 @@ namespace SMESH {
VISUAL_OBJ_CONT.insert(aValue); VISUAL_OBJ_CONT.insert(aValue);
} }
} }
//Try narrow to SMESH_subMesh interafce //Try narrow to SMESH_subMesh interface
SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj); SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj);
if(!aSubMesh->_is_nil()){ if(!aSubMesh->_is_nil()){
_PTR(SObject) aFatherSObj = aSObj->GetFather(); _PTR(SObject) aFatherSObj = aSObj->GetFather();
@ -654,15 +654,20 @@ namespace SMESH {
bool UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry) bool UpdateView(SUIT_ViewWindow *theWnd, EDisplaing theAction, const char* theEntry)
{ {
bool OK = false; bool OK = false;
if(SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd)) { SVTK_ViewWindow* aViewWnd = GetVtkViewWindow(theWnd);
if (!aViewWnd)
return OK;
{
OK = true; OK = true;
vtkRenderer *aRenderer = aViewWnd->getRenderer(); vtkRenderer *aRenderer = aViewWnd->getRenderer();
vtkActorCollection *aCollection = aRenderer->GetActors(); vtkActorCollection *aCollection = aRenderer->GetActors();
aCollection->InitTraversal(); aCollection->InitTraversal();
switch(theAction) {
switch (theAction) {
case eDisplayAll: { case eDisplayAll: {
while(vtkActor *anAct = aCollection->GetNextActor()){ while (vtkActor *anAct = aCollection->GetNextActor()) {
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){ if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
anActor->SetVisibility(true); anActor->SetVisibility(true);
} }
} }
@ -670,15 +675,15 @@ namespace SMESH {
} }
case eDisplayOnly: case eDisplayOnly:
case eEraseAll: { case eEraseAll: {
while(vtkActor *anAct = aCollection->GetNextActor()){ while (vtkActor *anAct = aCollection->GetNextActor()) {
if(SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)){ if (SMESH_Actor *anActor = dynamic_cast<SMESH_Actor*>(anAct)) {
anActor->SetVisibility(false); anActor->SetVisibility(false);
} }
} }
} }
default: { default: {
if(SMESH_Actor *anActor = FindActorByEntry(theWnd,theEntry)) { if (SMESH_Actor *anActor = FindActorByEntry(theWnd,theEntry)) {
switch(theAction) { switch (theAction) {
case eDisplay: case eDisplay:
case eDisplayOnly: case eDisplayOnly:
anActor->SetVisibility(true); anActor->SetVisibility(true);
@ -689,21 +694,27 @@ namespace SMESH {
break; break;
} }
} else { } else {
switch(theAction){ switch (theAction) {
case eDisplay: case eDisplay:
case eDisplayOnly:{ case eDisplayOnly:
SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>( theWnd->getViewManager()->study() ); {
_PTR(Study) aDocument = aStudy->studyDS(); SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(theWnd->getViewManager()->study());
if((anActor = CreateActor(aDocument,theEntry,true))) { _PTR(Study) aDocument = aStudy->studyDS();
bool needFitAll = noSmeshActors(theWnd); // fit for the first object only // Pass non-visual objects (hypotheses, etc.), return true in this case
DisplayActor(theWnd,anActor); CORBA::Long anId = aDocument->StudyId();
// FitAll(); - PAL16770(Display of a group performs an automatic fit all) if (TVisualObjPtr aVisualObj = GetVisualObj(anId,theEntry))
if ( needFitAll ) FitAll(); {
} else { if ((anActor = CreateActor(aDocument,theEntry,true))) {
OK = false; bool needFitAll = noSmeshActors(theWnd); // fit for the first object only
DisplayActor(theWnd,anActor);
// FitAll(); - PAL16770(Display of a group performs an automatic fit all)
if (needFitAll) FitAll();
} else {
OK = false;
}
}
break;
} }
break;
}
} }
} }
} }