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"
39 #include <SALOMEconfig.h>
40 #include CORBA_CLIENT_HEADER(GEOM_Gen)
41 #include CORBA_CLIENT_HEADER(SMESH_Mesh)
43 #include <qstringlist.h>
45 class SMESHGUI_MeshDlg;
46 class SMESHGUI_ShapeByMeshOp;
50 * \brief Operation for mech creation or editing
52 * This operation is used for mech creation or editing.
54 class SMESHGUI_EXPORT SMESHGUI_MeshOp : public SMESHGUI_SelectionOp
60 enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes };
62 typedef std::pair<SMESH::SMESH_Hypothesis_var, QString> THypItem;
63 typedef QValueList< THypItem > THypList;
66 typedef QMap< THypType, THypList > TType2HypList;
69 typedef QMap< THypDim, TType2HypList > TDim2Type2HypList;
71 SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh = true );
72 virtual ~SMESHGUI_MeshOp();
74 virtual LightApp_Dialog* dlg() const;
77 virtual void startOperation();
78 virtual void selectionDone();
79 virtual SUIT_SelectionFilter* createFilter( const int ) const;
80 virtual bool isValid( SUIT_Operation* ) const;
83 virtual bool onApply();
84 void onCreateHyp( const int theHypType, const int theIndex );
85 void onEditHyp( const int theHypType, const int theIndex );
86 void onHypoSet( const QString& theSetName );
87 void onGeomSelectionByMesh( bool );
88 void onPublishShapeByMeshDlg(SUIT_Operation*);
89 void onCloseShapeByMeshDlg(SUIT_Operation*);
90 void onAlgoSelected( const int theIndex,
91 const int theDim = -1);
95 typedef QValueList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
97 bool isValid( QString& ) const;
98 void availableHyps( const int theDim,
100 QStringList& theHyps,
101 THypDataList& theDataList,
102 HypothesisData* theAlgoData = 0 ) const;
103 void existingHyps( const int theDim,
104 const int theHypType,
105 _PTR(SObject) theFather,
106 QStringList& theHyps,
107 THypList& theHypList,
108 HypothesisData* theAlgoData = 0);
109 HypothesisData* hypData( const int theDim,
110 const int theHypType,
111 const int theIndex); // access to myAvailableHypData
113 void createHypothesis(const int theDim, const int theType,
114 const QString& theTypeName);
116 bool createMesh( QString& );
117 bool createSubMesh( QString& );
118 bool editMeshOrSubMesh( QString& );
120 int currentHyp( const int, const int ) const;
121 bool isAccessibleDim( const int ) const;
122 void setCurrentHyp( const int, const int, const int );
123 void setDefaultName() const;
124 SMESH::SMESH_Hypothesis_var getAlgo( const int );
126 QString name( _PTR(SObject) ) const;
127 int find( const SMESH::SMESH_Hypothesis_var&,
128 const THypList& theHypList) const;
129 SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString& aHypType,
130 const QString& aServerLib ) const;
131 bool isSubshapeOk() const;
132 _PTR(SObject) getSubmeshByGeom() const;
133 void selectObject( _PTR(SObject) ) const;
136 SMESHGUI_MeshDlg* myDlg;
137 SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
140 bool myIsOnGeometry; //!< TRUE if edited mesh accotiated with geometrical object
142 TDim2Type2HypList myExistingHyps; //!< all hypothesis of SMESH module
143 TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
144 // edited mesh/sub-mesh
146 // hypdata corresponding to hypotheses present in myDlg
147 THypDataList myAvailableHypData[4][NbHypTypes];
149 bool myIgnoreAlgoSelection;