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

View File

@ -22,8 +22,8 @@
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_HypothesesUtils.cxx
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_HypothesesUtils.h"
#include "SMESHGUI.h"
@ -82,8 +82,9 @@ namespace SMESH
THypothesisDataMap myHypothesesMap;
THypothesisDataMap myAlgorithmsMap;
typedef QMap<QString,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
THypCreatorMap myHypCreatorMap;
// BUG 0020378
//typedef QMap<QString,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
//THypCreatorMap myHypCreatorMap;
QList<HypothesesSet*> myListOfHypothesesSets;
@ -319,24 +320,26 @@ namespace SMESH
return false;
}
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const QString& aHypType)
HypothesisCreatorPtr GetHypothesisCreator(const QString& aHypType)
{
if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType.toLatin1().data());
SMESHGUI_GenericHypothesisCreator* aCreator = 0;
// check, if creator for this hypothesis type already exists
if (myHypCreatorMap.find(aHypType) != myHypCreatorMap.end()) {
aCreator = myHypCreatorMap[aHypType];
}
else {
// BUG 0020378
//if (myHypCreatorMap.find(aHypType) != myHypCreatorMap.end()) {
// aCreator = myHypCreatorMap[aHypType];
//}
//else
{
// 1. Init list of available hypotheses, if needed
InitAvailableHypotheses();
// 2. Get names of plugin libraries
HypothesisData* aHypData = GetHypothesisData(aHypType);
if (!aHypData)
return aCreator;
return HypothesisCreatorPtr(aCreator);
QString aClientLibName = aHypData->ClientLibName;
QString aServerLibName = aHypData->ServerLibName;
@ -376,7 +379,8 @@ namespace SMESH
}
else {
// 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
// File : SMESHGUI_HypothesesUtils.h
// Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
//
#ifndef SMESHGUI_HYPOTHESESUTILS_H
#define SMESHGUI_HYPOTHESESUTILS_H
@ -47,6 +47,9 @@
// STL includes
#include <vector>
// boost includes
#include <boost/shared_ptr.hpp>
class HypothesisData;
class HypothesesSet;
class SMESHGUI_GenericHypothesisCreator;
@ -55,6 +58,8 @@ class algo_error_array;
namespace SMESH
{
typedef boost::shared_ptr<SMESHGUI_GenericHypothesisCreator> HypothesisCreatorPtr;
SMESHGUI_EXPORT
void InitAvailableHypotheses();
@ -82,12 +87,12 @@ namespace SMESH
const HypothesisData* );
SMESHGUI_EXPORT
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& );
HypothesisCreatorPtr GetHypothesisCreator( const QString& );
SMESHGUI_EXPORT
SMESH::SMESH_Hypothesis_ptr CreateHypothesis( const QString&,
const QString&,
const bool = false);
const QString&,
const bool = false );
SMESHGUI_EXPORT
bool AddHypothesisOnMesh( SMESH::SMESH_Mesh_ptr, SMESH::SMESH_Hypothesis_ptr );

View File

@ -22,8 +22,8 @@
// SMESH SMESHGUI : GUI for SMESH component
// File : SMESHGUI_MeshOp.cxx
// Author : Sergey LITONIN, Open CASCADE S.A.S.
// SMESH includes
//
#include "SMESHGUI_MeshOp.h"
#include "SMESHGUI.h"
@ -1053,7 +1053,9 @@ void SMESHGUI_MeshOp::createHypothesis (const int theDim,
SMESH::CreateHypothesis(theTypeName, aHypName, false);
} else {
// 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
if (aCreator) {
@ -1108,7 +1110,9 @@ void SMESHGUI_MeshOp::onEditHyp( const int theHypType, const int theIndex )
if ( aHyp->_is_nil() )
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 )
{
// Get initial parameters
@ -1682,11 +1686,14 @@ SMESH::SMESH_Hypothesis_var SMESHGUI_MeshOp::getAlgo( const int theDim )
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
} else {
// 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
if (aCreator)
if (aCreator) {
aCreator->create(true, aHypName, myDlg);
}
else
SMESH::CreateHypothesis(aHypName, aHypData->Label, true);
}

View File

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