From: jfa Date: Wed, 17 Jun 2009 12:39:17 +0000 (+0000) Subject: Bug 0020378: EDF 1042 SMESH : Gui of SMESH hypothesis not multi-study ? X-Git-Tag: V5_1_2rc3~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6be0ab18d503fe0efbbe18e75d0e0fb9bd69bc3c;p=modules%2Fsmesh.git Bug 0020378: EDF 1042 SMESH : Gui of SMESH hypothesis not multi-study ? --- diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index 6f2bc5d95..2d1f630b5 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -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 diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index 5f3500230..50de8b762 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -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 THypCreatorMap; - THypCreatorMap myHypCreatorMap; + // BUG 0020378 + //typedef QMap THypCreatorMap; + //THypCreatorMap myHypCreatorMap; QList 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); } diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h index 18813f4c8..89c1335df 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h @@ -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 +// boost includes +#include + class HypothesisData; class HypothesesSet; class SMESHGUI_GenericHypothesisCreator; @@ -55,6 +58,8 @@ class algo_error_array; namespace SMESH { + typedef boost::shared_ptr 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 ); diff --git a/src/SMESHGUI/SMESHGUI_MeshOp.cxx b/src/SMESHGUI/SMESHGUI_MeshOp.cxx index ae29fc4b1..d1a19e9ce 100644 --- a/src/SMESHGUI/SMESHGUI_MeshOp.cxx +++ b/src/SMESHGUI/SMESHGUI_MeshOp.cxx @@ -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); } diff --git a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx index ffdc4a7f1..481d34e02 100644 --- a/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI_LayerDistributionParamWdg.cxx @@ -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();