IMP 0019918: Re-open popup for imported shapes. Enable for multiple selection.

This commit is contained in:
jfa 2008-10-16 13:04:24 +00:00
parent 64d087cbe6
commit e2fd9a3715
2 changed files with 51 additions and 50 deletions

View File

@ -1433,26 +1433,37 @@ LightApp_Selection* GeometryGUI::createSelection() const
void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title ) void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& title )
{ {
SalomeApp_Module::contextMenuPopup(client, menu, title); SalomeApp_Module::contextMenuPopup(client, menu, title);
SALOME_ListIO lst; SALOME_ListIO lst;
getApp()->selectionMgr()->selectedObjects(lst); getApp()->selectionMgr()->selectedObjects(lst);
if (lst.Extent() < 1)
return;
if (lst.Extent() == 1) { SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
Handle(SALOME_InteractiveObject) io = lst.First(); _PTR(Study) study = appStudy->studyDS();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
_PTR(Study) study = appStudy->studyDS(); bool isImported = true;
SALOME_ListIteratorOfListIO anIt (lst);
for (; anIt.More() && isImported; anIt.Next()) {
Handle(SALOME_InteractiveObject) io = anIt.Value();
_PTR(SObject) aSObj = study->FindObjectID(io->getEntry()); _PTR(SObject) aSObj = study->FindObjectID(io->getEntry());
if (aSObj) { if (aSObj) {
// Set context menu title if (lst.Extent() == 1) {
if (client == "OCCViewer" || client == "VTKViewer") // Set context menu title
title = QString(aSObj->GetName().c_str()); if (client == "OCCViewer" || client == "VTKViewer")
title = QString(aSObj->GetName().c_str());
}
// Reload imported shape
CORBA::Object_var anObj = GeometryGUI::ClientSObjectToObject(aSObj); CORBA::Object_var anObj = GeometryGUI::ClientSObjectToObject(aSObj);
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(anObj); GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(anObj);
if (!CORBA::is_nil(aGeomObj) && aGeomObj->GetType() == GEOM_IMPORT) if (CORBA::is_nil(aGeomObj) || aGeomObj->GetType() != GEOM_IMPORT)
menu->addAction(action(5029)); isImported = false;
} }
} }
if (isImported) {
menu->addAction(action(5029)); // Reload imported shape
}
} }
void GeometryGUI::createPreferences() void GeometryGUI::createPreferences()

View File

@ -35,6 +35,7 @@
#include <LightApp_SelectionMgr.h> #include <LightApp_SelectionMgr.h>
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <SalomeApp_Study.h> #include <SalomeApp_Study.h>
#include <SALOME_ListIteratorOfListIO.hxx>
#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION #include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION
#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION #include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION
@ -102,57 +103,46 @@ bool TransformationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
break; break;
case 5029: // RELOAD IMPORTED SHAPE case 5029: // RELOAD IMPORTED SHAPE
{ {
SalomeApp_Study* anAppStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
GEOM::GEOM_ITransformOperations_var anOp =
GeometryGUI::GetGeomGen()->GetITransformOperations(anAppStudy->id());
if (anOp->_is_nil()) return false;
GEOM_Displayer aDisp (anAppStudy);
SUIT_Desktop* desk = app->desktop();
QList<SUIT_ViewWindow*> wnds = desk->windows();
LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
SALOME_ListIO aSelList; SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList); aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) {
SALOME_ListIteratorOfListIO aSelIt (aSelList);
for (; aSelIt.More(); aSelIt.Next()) {
Handle(SALOME_InteractiveObject) io = aSelIt.Value();
Standard_Boolean testResult = Standard_False; Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object_var aGeomObj = GEOMBase::ConvertIOinGEOMObject(io, testResult);
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (testResult) { if (testResult) {
SalomeApp_Study* anAppStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy()); anOp->RecomputeObject(aGeomObj);
GEOM::GEOM_ITransformOperations_var anOp =
GeometryGUI::GetGeomGen()->GetITransformOperations(anAppStudy->id()); SUIT_ViewWindow* wnd;
if (!anOp->_is_nil()) { QListIterator<SUIT_ViewWindow*> it (wnds);
anOp->RecomputeObject(aGeomObj); while (it.hasNext() && (wnd = it.next()))
GEOM_Displayer aDisp (anAppStudy); {
//aDisp.Redisplay(aSelList.First()); if (SUIT_ViewManager* vman = wnd->getViewManager()) {
//aDisp.Display(aSelList.First()); if (SUIT_ViewModel* vmodel = vman->getViewModel()) {
Handle(SALOME_InteractiveObject) theIO = aSelList.First(); if (SALOME_View* view = dynamic_cast<SALOME_View*>(vmodel)) {
SUIT_Desktop* desk = app->desktop(); if (view->isVisible(io)) {
QList<SUIT_ViewWindow*> wnds = desk->windows(); aDisp.Erase(io, false, false, view);
SUIT_ViewWindow* wnd; aDisp.Display(io, true, view);
QListIterator<SUIT_ViewWindow*> it( wnds );
while ( it.hasNext() && (wnd = it.next()) )
{
SUIT_ViewManager* vman = wnd->getViewManager();
if ( vman )
{
SUIT_ViewModel* vmodel = vman->getViewModel();
if ( vmodel )
{
SALOME_View* view = dynamic_cast<SALOME_View*>(vmodel);
if ( view )
{
//if (view->isVisible(theIO) || view == GetActiveView())
if (view->isVisible(theIO))
{
//SALOME_Prs* prs = view->CreatePrs( theIO->getEntry() );
//if ( prs ) {
// prs->Update(&aDisp);
// view->Repaint();
//}
aDisp.Erase(theIO, false, false, view);
aDisp.Display(theIO, true, view);
}
} }
// ? Redisplay subshapes ?
} }
} }
} }
// ? Redisplay subshapes ?
} }
} }
} } // for (; aSelIt.More(); aSelIt.Next())
} }
break; break;
default: default: