Bug 0020378: EDF 1042 SMESH : Gui of SMESH hypothesis not multi-study ?

This commit is contained in:
jfa 2009-06-17 12:39:17 +00:00
parent 794d868052
commit 6be0ab18d5
5 changed files with 45 additions and 25 deletions

View File

@ -23,7 +23,7 @@
// File : SMESHGUI.cxx // File : SMESHGUI.cxx
// Author : Nicolas REJNERI, Open CASCADE S.A.S. // Author : Nicolas REJNERI, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI.h" #include "SMESHGUI.h"
#include "SMESHGUI_NodesDlg.h" #include "SMESHGUI_NodesDlg.h"
#include "SMESHGUI_TransparencyDlg.h" #include "SMESHGUI_TransparencyDlg.h"
@ -2090,9 +2090,12 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
/* Warning : however by internal mechanism all subMeshes icons are changed ! */ /* Warning : however by internal mechanism all subMeshes icons are changed ! */
if ( !aHypothesis->_is_nil() ) if ( !aHypothesis->_is_nil() )
{ {
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName()); // BUG 0020378
if (aCreator) //SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHypothesis->GetName());
if (aCreator) {
aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop() ); aCreator->edit( aHypothesis.in(), anIObject->getName(), desktop() );
}
else else
{ {
// report error // report error

View File

@ -22,8 +22,8 @@
// SMESH SMESHGUI : GUI for SMESH component // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_HypothesesUtils.cxx // File : SMESHGUI_HypothesesUtils.cxx
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI_HypothesesUtils.h" #include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
@ -82,8 +82,9 @@ namespace SMESH
THypothesisDataMap myHypothesesMap; THypothesisDataMap myHypothesesMap;
THypothesisDataMap myAlgorithmsMap; THypothesisDataMap myAlgorithmsMap;
typedef QMap<QString,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap; // BUG 0020378
THypCreatorMap myHypCreatorMap; //typedef QMap<QString,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
//THypCreatorMap myHypCreatorMap;
QList<HypothesesSet*> myListOfHypothesesSets; QList<HypothesesSet*> myListOfHypothesesSets;
@ -319,24 +320,26 @@ namespace SMESH
return false; return false;
} }
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const QString& aHypType) HypothesisCreatorPtr GetHypothesisCreator(const QString& aHypType)
{ {
if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType.toLatin1().data()); if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType.toLatin1().data());
SMESHGUI_GenericHypothesisCreator* aCreator = 0; SMESHGUI_GenericHypothesisCreator* aCreator = 0;
// check, if creator for this hypothesis type already exists // check, if creator for this hypothesis type already exists
if (myHypCreatorMap.find(aHypType) != myHypCreatorMap.end()) { // BUG 0020378
aCreator = myHypCreatorMap[aHypType]; //if (myHypCreatorMap.find(aHypType) != myHypCreatorMap.end()) {
} // aCreator = myHypCreatorMap[aHypType];
else { //}
//else
{
// 1. Init list of available hypotheses, if needed // 1. Init list of available hypotheses, if needed
InitAvailableHypotheses(); InitAvailableHypotheses();
// 2. Get names of plugin libraries // 2. Get names of plugin libraries
HypothesisData* aHypData = GetHypothesisData(aHypType); HypothesisData* aHypData = GetHypothesisData(aHypType);
if (!aHypData) if (!aHypData)
return aCreator; return HypothesisCreatorPtr(aCreator);
QString aClientLibName = aHypData->ClientLibName; QString aClientLibName = aHypData->ClientLibName;
QString aServerLibName = aHypData->ServerLibName; QString aServerLibName = aHypData->ServerLibName;
@ -376,7 +379,8 @@ namespace SMESH
} }
else { else {
// map hypothesis creator to a hypothesis name // map hypothesis creator to a hypothesis name
myHypCreatorMap[aHypType] = aCreator; // BUG 0020378
//myHypCreatorMap[aHypType] = aCreator;
} }
} }
} }
@ -386,7 +390,7 @@ namespace SMESH
} }
} }
return aCreator; return HypothesisCreatorPtr(aCreator);
} }

View File

@ -22,7 +22,7 @@
// SMESH SMESHGUI : GUI for SMESH component // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_HypothesesUtils.h // File : SMESHGUI_HypothesesUtils.h
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S. // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
//
#ifndef SMESHGUI_HYPOTHESESUTILS_H #ifndef SMESHGUI_HYPOTHESESUTILS_H
#define SMESHGUI_HYPOTHESESUTILS_H #define SMESHGUI_HYPOTHESESUTILS_H
@ -47,6 +47,9 @@
// STL includes // STL includes
#include <vector> #include <vector>
// boost includes
#include <boost/shared_ptr.hpp>
class HypothesisData; class HypothesisData;
class HypothesesSet; class HypothesesSet;
class SMESHGUI_GenericHypothesisCreator; class SMESHGUI_GenericHypothesisCreator;
@ -55,6 +58,8 @@ class algo_error_array;
namespace SMESH namespace SMESH
{ {
typedef boost::shared_ptr<SMESHGUI_GenericHypothesisCreator> HypothesisCreatorPtr;
SMESHGUI_EXPORT SMESHGUI_EXPORT
void InitAvailableHypotheses(); void InitAvailableHypotheses();
@ -82,12 +87,12 @@ namespace SMESH
const HypothesisData* ); const HypothesisData* );
SMESHGUI_EXPORT SMESHGUI_EXPORT
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& ); HypothesisCreatorPtr GetHypothesisCreator( const QString& );
SMESHGUI_EXPORT SMESHGUI_EXPORT
SMESH::SMESH_Hypothesis_ptr CreateHypothesis( const QString&, SMESH::SMESH_Hypothesis_ptr CreateHypothesis( const QString&,
const QString&, const QString&,
const bool = false); const bool = false );
SMESHGUI_EXPORT SMESHGUI_EXPORT
bool AddHypothesisOnMesh( SMESH::SMESH_Mesh_ptr, SMESH::SMESH_Hypothesis_ptr ); bool AddHypothesisOnMesh( SMESH::SMESH_Mesh_ptr, SMESH::SMESH_Hypothesis_ptr );

View File

@ -22,8 +22,8 @@
// SMESH SMESHGUI : GUI for SMESH component // SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_MeshOp.cxx // File : SMESHGUI_MeshOp.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S. // Author : Sergey LITONIN, Open CASCADE S.A.S.
// SMESH includes // SMESH includes
//
#include "SMESHGUI_MeshOp.h" #include "SMESHGUI_MeshOp.h"
#include "SMESHGUI.h" #include "SMESHGUI.h"
@ -1053,7 +1053,9 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
SMESH::CreateHypothesis(theTypeName, aHypName, false); SMESH::CreateHypothesis(theTypeName, aHypName, false);
} else { } else {
// Get hypotheses creator client (GUI) // Get hypotheses creator client (GUI)
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName); // BUG 0020378
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(theTypeName);
SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(theTypeName);
// Create hypothesis // Create hypothesis
if (aCreator) { if (aCreator) {
@ -1108,7 +1110,9 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
if ( aHyp->_is_nil() ) if ( aHyp->_is_nil() )
return; return;
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator( aHyp->GetName() ); // BUG 0020378
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHyp->GetName());
if ( aCreator ) if ( aCreator )
{ {
// Get initial parameters // Get initial parameters
@ -1682,11 +1686,14 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
SMESH::CreateHypothesis(aHypName, aHypData->Label, true); SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
} else { } else {
// Get hypotheses creator client (GUI) // Get hypotheses creator client (GUI)
SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName); // BUG 0020378
//SMESHGUI_GenericHypothesisCreator* aCreator = SMESH::GetHypothesisCreator(aHypName);
SMESH::HypothesisCreatorPtr aCreator = SMESH::GetHypothesisCreator(aHypName);
// Create algorithm // Create algorithm
if (aCreator) if (aCreator) {
aCreator->create(true, aHypName, myDlg); aCreator->create(true, aHypName, myDlg);
}
else else
SMESH::CreateHypothesis(aHypName, aHypData->Label, true); SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
} }

View File

@ -198,8 +198,9 @@ void StdMeshersGUI_LayerDistributionParamWdg::onEdit()
return; return;
CORBA::String_var hypType = myHyp->GetName(); CORBA::String_var hypType = myHyp->GetName();
SMESHGUI_GenericHypothesisCreator* // BUG 0020378
editor = SMESH::GetHypothesisCreator( hypType.in() ); //SMESHGUI_GenericHypothesisCreator* editor = SMESH::GetHypothesisCreator(hypType.in());
SMESH::HypothesisCreatorPtr editor = SMESH::GetHypothesisCreator(hypType.in());
if ( !editor ) return; if ( !editor ) return;
if ( myDlg ) myDlg->hide(); if ( myDlg ) myDlg->hide();