1 // SMESH SMESHGUI : GUI for SMESH component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : SMESHGUI_MeshOp.h
23 // Author : Sergey LITONIN, Open CASCADE S.A.S.
26 #ifndef SMESHGUI_MESHOP_H
27 #define SMESHGUI_MESHOP_H
30 #include "SMESH_SMESHGUI.hxx"
32 #include "SMESHGUI_SelectionOp.h"
34 class SMESHGUI_MeshDlg;
35 class SMESHGUI_ShapeByMeshOp;
39 * \brief Operation for mech creation or editing
41 * This operation is used for mech creation or editing.
43 class SMESHGUI_EXPORT SMESHGUI_MeshOp : public SMESHGUI_SelectionOp
48 enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes };
50 typedef std::pair<SMESH::SMESH_Hypothesis_var, QString> THypItem;
51 typedef QList< THypItem > THypList;
54 typedef QMap< THypType, THypList > TType2HypList;
57 typedef QMap< THypDim, TType2HypList > TDim2Type2HypList;
60 SMESHGUI_MeshOp( const bool, const bool = true );
61 virtual ~SMESHGUI_MeshOp();
63 virtual LightApp_Dialog* dlg() const;
66 virtual void startOperation();
67 virtual void selectionDone();
68 virtual SUIT_SelectionFilter* createFilter( const int ) const;
69 virtual bool isValid( SUIT_Operation* ) const;
72 virtual bool onApply();
73 void onCreateHyp( const int, const int );
74 void onEditHyp( const int, const int );
75 void onHypoSet( const QString& );
76 void onGeomSelectionByMesh( bool );
77 void onPublishShapeByMeshDlg( SUIT_Operation* );
78 void onCloseShapeByMeshDlg( SUIT_Operation* );
79 void onAlgoSelected( const int, const int = -1 );
82 typedef QList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
84 bool isValid( QString& ) const;
85 void availableHyps( const int,
89 HypothesisData* = 0 ) const;
90 static void existingHyps( const int,
95 HypothesisData* = 0 );
96 HypothesisData* hypData( const int,
98 const int ); // access to myAvailableHypData
100 void createHypothesis( const int, const int,
103 bool createMesh( QString& );
104 bool createSubMesh( QString& );
105 bool editMeshOrSubMesh( QString& );
107 int currentHyp( const int, const int ) const;
108 bool isAccessibleDim( const int ) const;
109 void setCurrentHyp( const int, const int, const int );
110 void setDefaultName() const;
111 SMESH::SMESH_Hypothesis_var getAlgo( const int );
113 QString name( _PTR(SObject) ) const;
114 int find( const SMESH::SMESH_Hypothesis_var&,
115 const THypList& ) const;
116 SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString&,
117 const QString& ) const;
118 bool isSubshapeOk() const;
119 char* isSubmeshIgnored() const;
120 _PTR(SObject) getSubmeshByGeom() const;
121 void selectObject( _PTR(SObject) ) const;
124 SMESHGUI_MeshDlg* myDlg;
125 SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
128 bool myIsOnGeometry; //!< TRUE if edited mesh accotiated with geometrical object
130 TDim2Type2HypList myExistingHyps; //!< all hypothesis of SMESH module
131 TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
132 // edited mesh/sub-mesh
134 // hypdata corresponding to hypotheses present in myDlg
135 THypDataList myAvailableHypData[4][NbHypTypes];
137 bool myIgnoreAlgoSelection;
140 #endif // SMESHGUI_MESHOP_H