IMP 0019918: Re-open popup for imported shapes.

This commit is contained in:
jfa 2008-10-02 12:00:07 +00:00
parent 6c057505a6
commit 7989a2ef27
6 changed files with 140 additions and 10 deletions

View File

@ -792,6 +792,13 @@ module GEOM
GEOM_Object PositionShapeCopy (in GEOM_Object theObject, GEOM_Object PositionShapeCopy (in GEOM_Object theObject,
in GEOM_Object theStartLCS, in GEOM_Object theStartLCS,
in GEOM_Object theEndLCS); in GEOM_Object theEndLCS);
/*!
* Recompute the shape from its arguments.
* \param theObject The object to be recomputed.
* \return theObject.
*/
GEOM_Object RecomputeObject (in GEOM_Object theObject);
}; };
/*! /*!

View File

@ -2088,6 +2088,10 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_GROUP_EDIT</source> <source>MEN_GROUP_EDIT</source>
<translation>Edit</translation> <translation>Edit</translation>
</message> </message>
<message>
<source>MEN_RELOAD_IMPORTED</source>
<translation>Reload From Disk</translation>
</message>
<message> <message>
<source>MEN_HEX_SOLID</source> <source>MEN_HEX_SOLID</source>
<translation>Hexahedral Solid</translation> <translation>Hexahedral Solid</translation>
@ -2620,6 +2624,10 @@ Please, select face, shell or solid and try again</translation>
<source>STB_GROUP_EDIT</source> <source>STB_GROUP_EDIT</source>
<translation>Edit a group</translation> <translation>Edit a group</translation>
</message> </message>
<message>
<source>STB_RELOAD_IMPORTED</source>
<translation>Reload imported shape from its original place on disk</translation>
</message>
<message> <message>
<source>STB_HEX_SOLID</source> <source>STB_HEX_SOLID</source>
<translation>Hexahedral Solid</translation> <translation>Hexahedral Solid</translation>

View File

@ -66,6 +66,7 @@
#include <SALOMEDSClient_IParameters.hxx> #include <SALOMEDSClient_IParameters.hxx>
// External includes // External includes
#include <QMenu>
#include <QAction> #include <QAction>
#include <QFileInfo> #include <QFileInfo>
#include <QString> #include <QString>
@ -85,6 +86,8 @@
#include <vtkCamera.h> #include <vtkCamera.h>
#include <vtkRenderer.h> #include <vtkRenderer.h>
#include "GEOMImpl_Types.hxx"
using namespace Qt; using namespace Qt;
extern "C" { extern "C" {
@ -474,7 +477,8 @@ void GeometryGUI::OnGUIEvent( int id )
id == 5025 || // MENU TRANSFORMATION - SCALE id == 5025 || // MENU TRANSFORMATION - SCALE
id == 5026 || // MENU TRANSFORMATION - OFFSET id == 5026 || // MENU TRANSFORMATION - OFFSET
id == 5027 || // MENU TRANSFORMATION - MULTI-TRANSLATION id == 5027 || // MENU TRANSFORMATION - MULTI-TRANSLATION
id == 5028 ) { // MENU TRANSFORMATION - MULTI-ROTATION id == 5028 || // MENU TRANSFORMATION - MULTI-ROTATION
id == 5029 ) { // CONTEXT(POPUP) MENU - RELOAD_IMPORTED
#ifndef WNT #ifndef WNT
library = getLibrary( "libTransformationGUI.so" ); library = getLibrary( "libTransformationGUI.so" );
#else #else
@ -522,7 +526,7 @@ void GeometryGUI::OnGUIEvent( int id )
id == 706 || // MENU MEASURE - WHATIS id == 706 || // MENU MEASURE - WHATIS
id == 707 || // MENU MEASURE - CHECK id == 707 || // MENU MEASURE - CHECK
id == 7072 || // MENU MEASURE - CHECK COMPOUND OF BLOCKS id == 7072 || // MENU MEASURE - CHECK COMPOUND OF BLOCKS
id == 708 ) { // MENU MEASURE - POINT COORDINATES id == 708 ) { // MENU MEASURE - POINT COORDINATES
#ifndef WNT #ifndef WNT
library = getLibrary( "libMeasureGUI.so" ); library = getLibrary( "libMeasureGUI.so" );
#else #else
@ -542,7 +546,7 @@ void GeometryGUI::OnGUIEvent( int id )
id == 9998 || // MENU BLOCKS - MULTI-TRANSFORMATION id == 9998 || // MENU BLOCKS - MULTI-TRANSFORMATION
id == 9997 || // MENU BLOCKS - QUADRANGLE FACE id == 9997 || // MENU BLOCKS - QUADRANGLE FACE
id == 99991 || // MENU BLOCKS - PROPAGATE id == 99991 || // MENU BLOCKS - PROPAGATE
id == 9995 ) { // MENU BLOCKS - EXPLODE ON BLOCKS id == 9995 ) { // MENU BLOCKS - EXPLODE ON BLOCKS
#ifndef WNT #ifndef WNT
library = getLibrary( "libBlocksGUI.so" ); library = getLibrary( "libBlocksGUI.so" );
#else #else
@ -787,6 +791,8 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( 800, "GROUP_CREATE" ); createGeomAction( 800, "GROUP_CREATE" );
createGeomAction( 801, "GROUP_EDIT" ); createGeomAction( 801, "GROUP_EDIT" );
createGeomAction( 5029, "RELOAD_IMPORTED" );
createGeomAction( 9997, "Q_FACE" ); createGeomAction( 9997, "Q_FACE" );
createGeomAction( 9999, "HEX_SOLID" ); createGeomAction( 9999, "HEX_SOLID" );
@ -1426,16 +1432,26 @@ 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 ( ( client == "OCCViewer" || client == "VTKViewer" ) && lst.Extent() == 1 ) {
if (lst.Extent() == 1) {
Handle(SALOME_InteractiveObject) io = lst.First(); Handle(SALOME_InteractiveObject) io = lst.First();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(application()->activeStudy());
_PTR(Study) study = appStudy->studyDS(); _PTR(Study) study = appStudy->studyDS();
_PTR(SObject) obj = study->FindObjectID( io->getEntry() ); _PTR(SObject) aSObj = study->FindObjectID(io->getEntry());
if ( obj ) if (aSObj) {
title = QString( obj->GetName().c_str() ); // Set context menu title
if (client == "OCCViewer" || client == "VTKViewer")
title = QString(aSObj->GetName().c_str());
// Reload imported shape
CORBA::Object_var anObj = GeometryGUI::ClientSObjectToObject(aSObj);
GEOM::GEOM_Object_var aGeomObj = GEOM::GEOM_Object::_narrow(anObj);
if (!CORBA::is_nil(aGeomObj) && aGeomObj->GetType() == GEOM_IMPORT)
menu->addAction(action(5029));
}
} }
} }

View File

@ -1252,3 +1252,39 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePointsCopy
return GetObject(anObject); return GetObject(anObject);
} }
//=============================================================================
/*!
* RecomputeObject
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RecomputeObject
(GEOM::GEOM_Object_ptr theObject)
{
//Set a not done flag
GetOperations()->SetNotDone();
GEOM::GEOM_Object_var aGEOMObject;
if (theObject == NULL) return aGEOMObject._retn();
//check if the object is a subshape
//if (!theObject->IsMainShape()) {
// GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
// return aGEOMObject._retn();
//}
aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
//Get the object itself
CORBA::String_var anEntry = theObject->GetEntry();
Handle(GEOM_Object) anObject =
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
if (anObject.IsNull()) return aGEOMObject._retn();
//Perform the recomputation
Handle(GEOM_Function) aLastFunction = anObject->GetLastFunction();
if (aLastFunction.IsNull()) return aGEOMObject._retn();
GetOperations()->GetSolver()->ComputeFunction(aLastFunction);
return aGEOMObject._retn();
}

View File

@ -151,6 +151,8 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
GEOM::GEOM_Object_ptr thePoint1, GEOM::GEOM_Object_ptr thePoint1,
GEOM::GEOM_Object_ptr thePoint2); GEOM::GEOM_Object_ptr thePoint2);
GEOM::GEOM_Object_ptr RecomputeObject (GEOM::GEOM_Object_ptr theObject);
::GEOMImpl_ITransformOperations* GetOperations() { return (::GEOMImpl_ITransformOperations*)GetImpl(); } ::GEOMImpl_ITransformOperations* GetOperations() { return (::GEOMImpl_ITransformOperations*)GetImpl(); }
}; };

View File

@ -25,10 +25,16 @@
#include "TransformationGUI.h" #include "TransformationGUI.h"
#include <GEOMBase.h>
#include <GeometryGUI.h> #include <GeometryGUI.h>
#include <SUIT_Desktop.h> #include <SUIT_Desktop.h>
#include <SUIT_ViewModel.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Application.h> #include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#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
@ -94,6 +100,61 @@ bool TransformationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case 5028: // MULTI ROTATION case 5028: // MULTI ROTATION
aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent ); aDlg = new TransformationGUI_MultiRotationDlg( getGeometryGUI(), parent );
break; break;
case 5029: // RELOAD IMPORTED SHAPE
{
LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() == 1) {
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aGeomObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (testResult) {
SalomeApp_Study* anAppStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
GEOM::GEOM_ITransformOperations_var anOp =
GeometryGUI::GetGeomGen()->GetITransformOperations(anAppStudy->id());
if (!anOp->_is_nil()) {
anOp->RecomputeObject(aGeomObj);
GEOM_Displayer aDisp (anAppStudy);
//aDisp.Redisplay(aSelList.First());
//aDisp.Display(aSelList.First());
Handle(SALOME_InteractiveObject) theIO = aSelList.First();
SUIT_Desktop* desk = app->desktop();
QList<SUIT_ViewWindow*> wnds = desk->windows();
SUIT_ViewWindow* wnd;
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 ?
}
}
}
}
break;
default: default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) ); app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
break; break;