mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
0021684: EDF 2221 : Display the arguments and the name of the operations
+ void updateCreationInfo();
This commit is contained in:
parent
7961d43ecf
commit
c9f33420c0
@ -31,6 +31,7 @@
|
|||||||
#include "GeometryGUI_Operations.h"
|
#include "GeometryGUI_Operations.h"
|
||||||
#include "GEOMGUI_OCCSelector.h"
|
#include "GEOMGUI_OCCSelector.h"
|
||||||
#include "GEOMGUI_Selection.h"
|
#include "GEOMGUI_Selection.h"
|
||||||
|
#include "GEOMGUI_CreationInfoWdg.h"
|
||||||
#include "GEOM_Constants.h"
|
#include "GEOM_Constants.h"
|
||||||
#include "GEOM_Displayer.h"
|
#include "GEOM_Displayer.h"
|
||||||
#include "GEOM_AISShape.hxx"
|
#include "GEOM_AISShape.hxx"
|
||||||
@ -107,9 +108,11 @@
|
|||||||
#include <vtkCamera.h>
|
#include <vtkCamera.h>
|
||||||
#include <vtkRenderer.h>
|
#include <vtkRenderer.h>
|
||||||
|
|
||||||
#include <GEOM_version.h>
|
#include <Standard_Failure.hxx>
|
||||||
|
#include <Standard_ErrorHandler.hxx>
|
||||||
|
|
||||||
#include "GEOMImpl_Types.hxx"
|
#include "GEOM_version.h"
|
||||||
|
#include "GEOMImpl_Types.hxx" // dangerous hxx (defines short-name macros) - include after all
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
Standard_EXPORT CAM_Module* createModule() {
|
Standard_EXPORT CAM_Module* createModule() {
|
||||||
@ -208,6 +211,8 @@ GeometryGUI::GeometryGUI() :
|
|||||||
myDisplayer = 0;
|
myDisplayer = 0;
|
||||||
myLocalSelectionMode = GEOM_ALLOBJECTS;
|
myLocalSelectionMode = GEOM_ALLOBJECTS;
|
||||||
|
|
||||||
|
myCreationInfoWdg = 0;
|
||||||
|
|
||||||
connect( Material_ResourceMgr::resourceMgr(), SIGNAL( changed() ), this, SLOT( updateMaterials() ) );
|
connect( Material_ResourceMgr::resourceMgr(), SIGNAL( changed() ), this, SLOT( updateMaterials() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,6 +616,8 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) );
|
SUIT_MessageBox::critical( desk, tr( "GEOM_ERROR" ), tr( "GEOM_ERR_LIB_NOT_FOUND" ), tr( "GEOM_BUT_OK" ) );
|
||||||
|
|
||||||
|
updateCreationInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -1450,6 +1457,12 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
|
|||||||
|
|
||||||
LightApp_SelectionMgr* sm = getApp()->selectionMgr();
|
LightApp_SelectionMgr* sm = getApp()->selectionMgr();
|
||||||
|
|
||||||
|
connect( sm, SIGNAL( currentSelectionChanged() ), this, SLOT( updateCreationInfo() ));
|
||||||
|
if ( !myCreationInfoWdg )
|
||||||
|
myCreationInfoWdg = new GEOMGUI_CreationInfoWdg( getApp() );
|
||||||
|
getApp()->insertDockWindow( myCreationInfoWdg->getWinID(), myCreationInfoWdg );
|
||||||
|
getApp()->placeDockWindow( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
|
||||||
|
|
||||||
SUIT_ViewManager* vm;
|
SUIT_ViewManager* vm;
|
||||||
ViewManagerList OCCViewManagers, VTKViewManagers;
|
ViewManagerList OCCViewManagers, VTKViewManagers;
|
||||||
|
|
||||||
@ -1521,6 +1534,12 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
|
|||||||
disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
|
disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
|
||||||
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
|
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
|
||||||
|
|
||||||
|
LightApp_SelectionMgr* selMrg = getApp()->selectionMgr();
|
||||||
|
|
||||||
|
disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateCreationInfo() ));
|
||||||
|
getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
|
||||||
|
myCreationInfoWdg = 0;
|
||||||
|
|
||||||
EmitSignalCloseAllDialogs();
|
EmitSignalCloseAllDialogs();
|
||||||
|
|
||||||
GUIMap::Iterator it;
|
GUIMap::Iterator it;
|
||||||
@ -1534,11 +1553,11 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
|
|||||||
|
|
||||||
qDeleteAll(myOCCSelectors);
|
qDeleteAll(myOCCSelectors);
|
||||||
myOCCSelectors.clear();
|
myOCCSelectors.clear();
|
||||||
getApp()->selectionMgr()->setEnabled( true, OCCViewer_Viewer::Type() );
|
selMrg->setEnabled( true, OCCViewer_Viewer::Type() );
|
||||||
|
|
||||||
qDeleteAll(myVTKSelectors);
|
qDeleteAll(myVTKSelectors);
|
||||||
myVTKSelectors.clear();
|
myVTKSelectors.clear();
|
||||||
getApp()->selectionMgr()->setEnabled( true, SVTK_Viewer::Type() );
|
selMrg->setEnabled( true, SVTK_Viewer::Type() );
|
||||||
|
|
||||||
return SalomeApp_Module::deactivateModule( study );
|
return SalomeApp_Module::deactivateModule( study );
|
||||||
}
|
}
|
||||||
@ -1574,6 +1593,8 @@ void GeometryGUI::windows( QMap<int, int>& mappa ) const
|
|||||||
{
|
{
|
||||||
mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
|
mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
|
||||||
mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
|
mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
|
||||||
|
if ( myCreationInfoWdg )
|
||||||
|
mappa.insert( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeometryGUI::viewManagers( QStringList& lst ) const
|
void GeometryGUI::viewManagers( QStringList& lst ) const
|
||||||
@ -1646,6 +1667,78 @@ void GeometryGUI::onViewManagerRemoved( SUIT_ViewManager* vm )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Slot called when selection changed. Shows creation info of a selected object
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void GeometryGUI::updateCreationInfo()
|
||||||
|
{
|
||||||
|
myCreationInfoWdg->clear();
|
||||||
|
|
||||||
|
// Code below is commented to have myCreationInfoWdg filled as soon as it is shown again
|
||||||
|
// if ( !myCreationInfoWdg->isVisible() )
|
||||||
|
// return;
|
||||||
|
|
||||||
|
// look for a sole selected GEOM_Object
|
||||||
|
GEOM::GEOM_Object_var geomObj;
|
||||||
|
|
||||||
|
SALOME_ListIO selected;
|
||||||
|
getApp()->selectionMgr()->selectedObjects( selected );
|
||||||
|
|
||||||
|
_PTR(Study) study = dynamic_cast<SalomeApp_Study*>( getApp()->activeStudy() )->studyDS();
|
||||||
|
SALOME_ListIteratorOfListIO selIt( selected );
|
||||||
|
for ( ; selIt.More(); selIt.Next() )
|
||||||
|
{
|
||||||
|
Handle(SALOME_InteractiveObject) io = selIt.Value();
|
||||||
|
if ( !io->hasEntry() ) continue;
|
||||||
|
_PTR(SObject) sobj = study->FindObjectID( io->getEntry() );
|
||||||
|
if ( !sobj ) continue;
|
||||||
|
CORBA::Object_var obj = GeometryGUI::ClientSObjectToObject( sobj );
|
||||||
|
GEOM::GEOM_Object_var gobj = GEOM::GEOM_Object::_narrow( obj );
|
||||||
|
if ( !gobj->_is_nil() )
|
||||||
|
{
|
||||||
|
if ( !geomObj->_is_nil() )
|
||||||
|
return; // several GEOM objects selected
|
||||||
|
geomObj = gobj;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( geomObj->_is_nil() ) return;
|
||||||
|
|
||||||
|
// pass creation info of geomObj to myCreationInfoWdg
|
||||||
|
|
||||||
|
QPixmap icon;
|
||||||
|
QString operationName;
|
||||||
|
myCreationInfoWdg->setOperation( icon, operationName );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OCC_CATCH_SIGNALS;
|
||||||
|
GEOM::CreationInformation_var info = geomObj->GetCreationInformation();
|
||||||
|
if ( &info.in() )
|
||||||
|
{
|
||||||
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
|
QString name = info->operationName.in();
|
||||||
|
if ( !name.isEmpty() )
|
||||||
|
{
|
||||||
|
icon = resMgr->loadPixmap( "GEOM", tr( ("ICO_"+name).toLatin1().constData() ), false );
|
||||||
|
operationName = tr( ("MEN_"+name).toLatin1().constData() );
|
||||||
|
if ( operationName.startsWith( "MEN_" ))
|
||||||
|
operationName = name; // no translation
|
||||||
|
myCreationInfoWdg->setOperation( icon, operationName );
|
||||||
|
|
||||||
|
for ( size_t i = 0; i < info->params.length(); ++i )
|
||||||
|
myCreationInfoWdg->addParam( info->params[i].name.in(),
|
||||||
|
info->params[i].value.in() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString GeometryGUI::engineIOR() const
|
QString GeometryGUI::engineIOR() const
|
||||||
{
|
{
|
||||||
if ( !CORBA::is_nil( GetGeomGen() ) )
|
if ( !CORBA::is_nil( GetGeomGen() ) )
|
||||||
@ -1745,10 +1838,10 @@ void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString&
|
|||||||
// Set checked if this material is current
|
// Set checked if this material is current
|
||||||
Material_Model aModel;
|
Material_Model aModel;
|
||||||
aModel.fromResources( material );
|
aModel.fromResources( material );
|
||||||
if ( !found && aModel.toProperties() == curModel ) {
|
if ( !found && aModel.toProperties() == curModel ) {
|
||||||
menAct->setChecked( true );
|
menAct->setChecked( true );
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
matMenu->insertAction( matMenu->addSeparator(), action( GEOMOp::OpPredefMaterCustom ) );
|
matMenu->insertAction( matMenu->addSeparator(), action( GEOMOp::OpPredefMaterCustom ) );
|
||||||
matMenu->insertSeparator( action( GEOMOp::OpPredefMaterCustom ) );
|
matMenu->insertSeparator( action( GEOMOp::OpPredefMaterCustom ) );
|
||||||
@ -1822,11 +1915,11 @@ void GeometryGUI::createPreferences()
|
|||||||
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
|
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
|
||||||
|
|
||||||
addPreference( tr( "PREF_PREDEF_MATERIALS" ), genGroup,
|
addPreference( tr( "PREF_PREDEF_MATERIALS" ), genGroup,
|
||||||
LightApp_Preferences::Bool, "Geometry", "predef_materials" );
|
LightApp_Preferences::Bool, "Geometry", "predef_materials" );
|
||||||
|
|
||||||
int material = addPreference( tr( "PREF_MATERIAL" ), genGroup,
|
int material = addPreference( tr( "PREF_MATERIAL" ), genGroup,
|
||||||
LightApp_Preferences::Selector,
|
LightApp_Preferences::Selector,
|
||||||
"Geometry", "material" );
|
"Geometry", "material" );
|
||||||
|
|
||||||
addPreference( tr( "PREF_EDITGROUP_COLOR" ), genGroup,
|
addPreference( tr( "PREF_EDITGROUP_COLOR" ), genGroup,
|
||||||
LightApp_Preferences::Color, "Geometry", "editgroup_color" );
|
LightApp_Preferences::Color, "Geometry", "editgroup_color" );
|
||||||
@ -2103,10 +2196,10 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
|||||||
|
|
||||||
if (aProps.contains(GEOM::propertyName( GEOM::Color ))) {
|
if (aProps.contains(GEOM::propertyName( GEOM::Color ))) {
|
||||||
QColor c = aProps.value(GEOM::propertyName( GEOM::Color )).value<QColor>();
|
QColor c = aProps.value(GEOM::propertyName( GEOM::Color )).value<QColor>();
|
||||||
QStringList val;
|
QStringList val;
|
||||||
val << QString::number(c.redF());
|
val << QString::number(c.redF());
|
||||||
val << QString::number(c.greenF());
|
val << QString::number(c.greenF());
|
||||||
val << QString::number(c.blueF());
|
val << QString::number(c.blueF());
|
||||||
param = occParam + GEOM::propertyName( GEOM::Color );
|
param = occParam + GEOM::propertyName( GEOM::Color );
|
||||||
ip->setParameter(entry, param.toStdString(), val.join( GEOM::subSectionSeparator()).toStdString());
|
ip->setParameter(entry, param.toStdString(), val.join( GEOM::subSectionSeparator()).toStdString());
|
||||||
}
|
}
|
||||||
@ -2249,7 +2342,7 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
|||||||
} else if (paramNameStr == GEOM::propertyName( GEOM::Transparency )) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::Transparency )) {
|
||||||
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Transparency ), val.toDouble() );
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Transparency ), val.toDouble() );
|
||||||
} else if (paramNameStr == GEOM::propertyName( GEOM::TopLevel )) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::TopLevel )) {
|
||||||
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::TopLevel ), val == "true" || val == "1");
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::TopLevel ), val == "true" || val == "1");
|
||||||
} else if (paramNameStr == GEOM::propertyName( GEOM::DisplayMode )) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::DisplayMode )) {
|
||||||
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::DisplayMode ), val.toInt());
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::DisplayMode ), val.toInt());
|
||||||
} else if (paramNameStr == GEOM::propertyName( GEOM::NbIsos )) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::NbIsos )) {
|
||||||
@ -2522,7 +2615,7 @@ void GeometryGUI::updateMaterials()
|
|||||||
QtxPreferenceItem* prefItem = pref->rootItem()->findItem( tr( "PREF_MATERIAL" ), true );
|
QtxPreferenceItem* prefItem = pref->rootItem()->findItem( tr( "PREF_MATERIAL" ), true );
|
||||||
if ( prefItem ) {
|
if ( prefItem ) {
|
||||||
setPreferenceProperty( prefItem->id(),
|
setPreferenceProperty( prefItem->id(),
|
||||||
"strings", materials );
|
"strings", materials );
|
||||||
prefItem->retrieve();
|
prefItem->retrieve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ class LightApp_VTKSelector;
|
|||||||
class LightApp_Selection;
|
class LightApp_Selection;
|
||||||
class SUIT_ViewManager;
|
class SUIT_ViewManager;
|
||||||
class SalomeApp_Study;
|
class SalomeApp_Study;
|
||||||
|
class GEOMGUI_CreationInfoWdg;
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : GeometryGUI
|
// class : GeometryGUI
|
||||||
@ -161,6 +162,7 @@ private slots:
|
|||||||
void onViewAboutToShow();
|
void onViewAboutToShow();
|
||||||
void OnSetMaterial( const QString& );
|
void OnSetMaterial( const QString& );
|
||||||
void updateMaterials();
|
void updateMaterials();
|
||||||
|
void updateCreationInfo();
|
||||||
|
|
||||||
signals :
|
signals :
|
||||||
void SignalDeactivateActiveDialog();
|
void SignalDeactivateActiveDialog();
|
||||||
@ -175,7 +177,7 @@ private:
|
|||||||
void createGeomAction( const int id, const QString& po_id,
|
void createGeomAction( const int id, const QString& po_id,
|
||||||
const QString& icon_id = QString(""),
|
const QString& icon_id = QString(""),
|
||||||
const int key = 0, const bool toggle = false,
|
const int key = 0, const bool toggle = false,
|
||||||
const QString& shortcutAction = QString() );
|
const QString& shortcutAction = QString() );
|
||||||
void createPopupItem( const int, const QString& clients, const QString& types,
|
void createPopupItem( const int, const QString& clients, const QString& types,
|
||||||
const bool isSingle = false, const int isVisible = -1,
|
const bool isSingle = false, const int isVisible = -1,
|
||||||
const bool isExpandAll = false, const bool isOCC = false,
|
const bool isExpandAll = false, const bool isOCC = false,
|
||||||
@ -209,6 +211,8 @@ private:
|
|||||||
LightApp_Displayer* myDisplayer;
|
LightApp_Displayer* myDisplayer;
|
||||||
int myLocalSelectionMode; //Select Only
|
int myLocalSelectionMode; //Select Only
|
||||||
|
|
||||||
|
GEOMGUI_CreationInfoWdg* myCreationInfoWdg;
|
||||||
|
|
||||||
friend class DisplayGUI;
|
friend class DisplayGUI;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user