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 "SMESHGUI_SelectionOp.h"
37 #include <SALOMEconfig.h>
38 #include CORBA_SERVER_HEADER(GEOM_Gen)
39 #include CORBA_SERVER_HEADER(SMESH_Mesh)
41 #include <qstringlist.h>
43 class SMESHGUI_MeshDlg;
44 class SMESHGUI_ShapeByMeshOp;
48 * \brief Operation for mech creation or editing
50 * This operation is used for mech creation or editing.
52 class SMESHGUI_MeshOp : public SMESHGUI_SelectionOp
58 enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes };
60 typedef std::pair<SMESH::SMESH_Hypothesis_var, QString> THypItem;
61 typedef QValueList< THypItem > THypList;
64 typedef QMap< THypType, THypList > TType2HypList;
67 typedef QMap< THypDim, TType2HypList > TDim2Type2HypList;
69 SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh = true );
70 virtual ~SMESHGUI_MeshOp();
72 virtual LightApp_Dialog* dlg() const;
75 virtual void startOperation();
76 virtual void selectionDone();
77 virtual SUIT_SelectionFilter* createFilter( const int ) const;
78 virtual bool isValid( SUIT_Operation* ) const;
81 virtual bool onApply();
82 void onCreateHyp( const int theHypType, const int theIndex );
83 void onEditHyp( const int theHypType, const int theIndex );
84 void onHypoSet( const QString& theSetName );
85 void onGeomSelectionByMesh( bool );
86 void onPublishShapeByMeshDlg(SUIT_Operation*);
87 void onCloseShapeByMeshDlg(SUIT_Operation*);
88 void onAlgoSelected( const int theIndex,
89 const int theDim = -1);
93 typedef QValueList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
95 bool isValid( QString& ) const;
96 void availableHyps( const int theDim,
99 THypDataList& theDataList,
100 HypothesisData* theAlgoData = 0 ) const;
101 void existingHyps( const int theDim,
102 const int theHypType,
103 _PTR(SObject) theFather,
104 QStringList& theHyps,
105 THypList& theHypList,
106 HypothesisData* theAlgoData = 0);
107 HypothesisData* hypData( const int theDim,
108 const int theHypType,
109 const int theIndex); // access to myAvailableHypData
111 void createHypothesis(const int theDim, const int theType,
112 const QString& theTypeName);
114 bool createMesh( QString& );
115 bool createSubMesh( QString& );
116 bool editMeshOrSubMesh( QString& );
118 int currentHyp( const int, const int ) const;
119 bool isAccessibleDim( const int ) const;
120 void setCurrentHyp( const int, const int, const int );
121 void setDefaultName() const;
122 SMESH::SMESH_Hypothesis_var getAlgo( const int );
124 QString name( _PTR(SObject) ) const;
125 int find( const SMESH::SMESH_Hypothesis_var&,
126 const THypList& theHypList) const;
127 SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString& aHypType,
128 const QString& aServerLib ) const;
129 bool isSubshapeOk() const;
130 _PTR(SObject) getSubmeshByGeom() const;
131 void selectObject( _PTR(SObject) ) const;
134 SMESHGUI_MeshDlg* myDlg;
135 SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
139 TDim2Type2HypList myExistingHyps; //!< all hypothesis of SMESH module
140 TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
141 // edited mesh/sub-mesh
143 // hypdata corresponding to hypotheses present in myDlg
144 THypDataList myAvailableHypData[4][NbHypTypes];
146 bool myIgnoreAlgoSelection;