1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 * Copyright (C) 2005 CEA/DEN, EDF R&D
27 * File : SMESHGUI_MeshOp.h
28 * Author : Sergey LITONIN
32 #ifndef SMESHGUI_MeshOp_H
33 #define SMESHGUI_MeshOp_H
35 #include "SMESH_SMESHGUI.hxx"
37 #include "SMESHGUI_SelectionOp.h"
38 #include <qstringlist.h>
40 #include <SALOMEconfig.h>
41 #include CORBA_SERVER_HEADER(GEOM_Gen)
42 #include CORBA_SERVER_HEADER(SMESH_Mesh)
44 class SMESHGUI_MeshDlg;
45 class SMESHGUI_ShapeByMeshOp;
49 * \brief Operation for mech creation or editing
51 * This operation is used for mech creation or editing.
53 class SMESHGUI_EXPORT SMESHGUI_MeshOp : public SMESHGUI_SelectionOp
59 enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes };
61 SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh = true );
62 virtual ~SMESHGUI_MeshOp();
64 virtual LightApp_Dialog* dlg() const;
67 virtual void startOperation();
68 virtual void selectionDone();
69 virtual SUIT_SelectionFilter* createFilter( const int ) const;
70 virtual bool isValid( SUIT_Operation* ) const;
73 virtual bool onApply();
74 void onCreateHyp( const int theHypType, const int theIndex );
75 void onEditHyp( const int theHypType, const int theIndex );
76 void onHypoSet( const QString& theSetName );
77 void onGeomSelectionByMesh( bool );
78 void onPublishShapeByMeshDlg(SUIT_Operation*);
79 void onCloseShapeByMeshDlg(SUIT_Operation*);
80 void onAlgoSelected( const int theIndex,
81 const int theDim = -1);
85 typedef QValueList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
87 bool isValid( QString& ) const;
88 void availableHyps( const int theDim,
91 THypDataList& theDataList,
92 HypothesisData* theAlgoData = 0 ) const;
93 void existingHyps( const int theDim,
95 _PTR(SObject) theFather,
97 QValueList<SMESH::SMESH_Hypothesis_var>& theHypVars,
98 HypothesisData* theAlgoData = 0);
99 HypothesisData* hypData( const int theDim,
100 const int theHypType,
101 const int theIndex); // access to myAvailableHypData
103 void createHypothesis(const int theDim, const int theType,
104 const QString& theTypeName);
106 bool createMesh( QString& );
107 bool createSubMesh( QString& );
108 bool editMeshOrSubMesh( QString& );
110 int currentHyp( const int, const int ) const;
111 bool isAccessibleDim( const int ) const;
112 void setCurrentHyp( const int, const int, const int );
113 void setDefaultName() const;
114 SMESH::SMESH_Hypothesis_var getAlgo( const int );
116 QString name( _PTR(SObject) ) const;
117 int find( const SMESH::SMESH_Hypothesis_var&,
118 const QValueList<SMESH::SMESH_Hypothesis_var>& ) const;
119 SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString& aHypType,
120 const QString& aServerLib ) const;
121 bool isSubshapeOk() const;
122 _PTR(SObject) getSubmeshByGeom() const;
123 void selectObject( _PTR(SObject) ) const;
126 typedef QMap< int, QValueList<SMESH::SMESH_Hypothesis_var> > IdToHypListMap;
127 typedef QMap< int, IdToHypListMap > DimToHypMap;
129 SMESHGUI_MeshDlg* myDlg;
130 SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
134 DimToHypMap myExistingHyps; //!< all hypothesis of SMESH module
135 DimToHypMap myObjHyps; //!< hypothesis assigned to the current
136 // edited mesh/sub-mesh
138 // hypdata corresponding to hypotheses present in myDlg
139 THypDataList myAvailableHypData[3][NbHypTypes];
141 bool myIgnoreAlgoSelection;