X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FStdMeshersGUI%2FStdMeshersGUI.cxx;h=79980c763a6a1cf80bb26cf8c6c00a9f7500fe1b;hp=93322c3e76b3255dd93e481f1e3bd45ddf2d953b;hb=20d9e162bd67182cbfa841bbfc9319919f4703e3;hpb=a2f0f70d5912ea83c868916f06eaefb58a32ec2e diff --git a/src/StdMeshersGUI/StdMeshersGUI.cxx b/src/StdMeshersGUI/StdMeshersGUI.cxx index 93322c3e7..79980c763 100644 --- a/src/StdMeshersGUI/StdMeshersGUI.cxx +++ b/src/StdMeshersGUI/StdMeshersGUI.cxx @@ -1,165 +1,51 @@ -// SMESH StdMeshersGUI : GUI for plugged-in meshers +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003 CEA -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// File : StdMeshersGUI.cxx -// Author : Julia DOROVSKIKH -// Module : SMESH -// $Header$ - -#include "SALOMEconfig.h" -#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis) - -#include "SMESHGUI.h" -#include "SMESHGUI_Utils.h" -#include "SMESHGUI_Hypotheses.h" -#include "SMESHGUI_HypothesesUtils.h" - -#include "SMESHGUI_aParameterDlg.h" -#include "StdMeshersGUI_Parameters.h" -#include "StdMeshersGUI_CreateStdHypothesisDlg.h" - -#include "SUIT_Desktop.h" -#include "SUIT_ResourceMgr.h" - -#include - -#include "utilities.h" - -using namespace std; - -//============================================================================= -/*! class HypothesisCreator - * - */ -//============================================================================= -class StdMeshersGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator -{ - public: - StdMeshersGUI_HypothesisCreator (const QString& aHypType, - const QString& aServerLibName, - SMESHGUI* aSMESHGUI) - : myHypType(aHypType), - myServerLibName(aServerLibName), - mySMESHGUI(aSMESHGUI) {} - - virtual void CreateHypothesis (const bool isAlgo, QWidget* parent = 0); - virtual void EditHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp); - private: - QString myHypType; - QString myServerLibName; - SMESHGUI* mySMESHGUI; -}; +// File : StdMeshersGUI.cxx +// Author : Alexander SOLOVYOV, Open CASCADE S.A.S. +// SMESH includes +// +#include "StdMeshersGUI_StdHypothesisCreator.h" +#include "StdMeshersGUI_NbSegmentsCreator.h" +#include "StdMeshersGUI_CartesianParamCreator.h" +#include "StdMeshersGUI_QuadrangleParamWdg.h" //============================================================================= -/*! HypothesisCreator::CreateHypothesis +/*! GetHypothesisCreator * */ //============================================================================= -void StdMeshersGUI_HypothesisCreator::CreateHypothesis - (bool isAlgo, QWidget* parent) +extern "C" { - MESSAGE("StdMeshersGUI_HypothesisCreator::CreateHypothesis"); - - // Get default name for hypothesis/algorithm creation - char* sHypType = (char*)myHypType.latin1(); - HypothesisData* aHypData = SMESH::GetHypothesisData(sHypType); - QString aHypName; - if (aHypData) - aHypName = aHypData->Label; - else - aHypName = myHypType; - - // Create hypothesis/algorithm - if (isAlgo) - { - SMESH::CreateHypothesis(myHypType, aHypName, isAlgo); - } - else + STDMESHERSGUI_EXPORT + SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType ) { - if ( StdMeshersGUI_Parameters::HasParameters( myHypType )) - // Show Dialog for hypothesis creation - //StdMeshersGUI_CreateStdHypothesisDlg *aDlg = - new StdMeshersGUI_CreateStdHypothesisDlg(myHypType, parent, ""); + if( aHypType=="NumberOfSegments" ) + return new StdMeshersGUI_NbSegmentsCreator(); + else if ( aHypType=="CartesianParameters3D" ) + return new StdMeshersGUI_CartesianParamCreator( aHypType ); + else if ( aHypType=="QuadrangleParams" ) + return new StdMeshersGUI_QuadrangleParamCreator( aHypType ); else - SMESH::CreateHypothesis(myHypType, aHypName, isAlgo); // without GUI + return new StdMeshersGUI_StdHypothesisCreator( aHypType ); } } - -//============================================================================= -/*! HypothesisCreator::EditHypothesis - * - */ -//============================================================================= -void StdMeshersGUI_HypothesisCreator::EditHypothesis - (SMESH::SMESH_Hypothesis_ptr theHyp) -{ - MESSAGE("StdMeshersGUI_HypothesisCreator::EditHypothesis"); - - SMESH::SObjectList listSOmesh = SMESH::GetMeshesUsingAlgoOrHypothesis(theHyp); - - list paramList; - StdMeshersGUI_Parameters::GetParameters( theHyp, paramList ); - - bool modified = false; - if ( SMESHGUI_aParameterDlg::Parameters( SMESHGUI::GetSMESHGUI(), paramList, QObject::tr("SMESH_VALUE")) ) - modified = StdMeshersGUI_Parameters::SetParameters( theHyp, paramList ); - - if ( modified ) { - //set new Attribute Comment for hypothesis which parameters were modified - QString aParams = ""; - StdMeshersGUI_Parameters::GetParameters( theHyp, paramList, aParams ); - _PTR(SObject) SHyp = SMESH::FindSObject(theHyp); - if (SHyp) - if (!aParams.isEmpty()) { - SMESH::SetValue(SHyp, aParams); - //mySMESHGUI->GetActiveStudy()->updateObjBrowser(true); - } - - if ( listSOmesh.size() > 0 ) { - _PTR(SObject) submSO = listSOmesh[0]; - SMESH::SMESH_Mesh_var aMesh = - SMESH::SObjectToInterface(submSO); - SMESH::SMESH_subMesh_var aSubMesh = - SMESH::SObjectToInterface(submSO); - if ( !aSubMesh->_is_nil() ) - aMesh = aSubMesh->GetFather(); - _PTR(SObject) meshSO = SMESH::FindSObject( aMesh ); - SMESH::ModifiedMesh( meshSO, false); - } - } -} - -//============================================================================= -/*! GetHypothesisCreator - * - */ -//============================================================================= -extern "C" -{ - SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator - (QString aHypType, QString aServerLibName, SMESHGUI* aSMESHGUI) - { - return new StdMeshersGUI_HypothesisCreator - (aHypType, aServerLibName, aSMESHGUI); - } -}