1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 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
25 * Copyright (C) 2005 CEA/DEN, EDF R&D
29 * File : SMESHGUI_MeshOp.h
30 * Author : Sergey LITONIN
34 #ifndef SMESHGUI_MeshOp_H
35 #define SMESHGUI_MeshOp_H
37 #include "SMESH_SMESHGUI.hxx"
39 #include "SMESHGUI_SelectionOp.h"
41 #include <SALOMEconfig.h>
42 #include CORBA_CLIENT_HEADER(GEOM_Gen)
43 #include CORBA_CLIENT_HEADER(SMESH_Mesh)
45 #include <qstringlist.h>
47 class SMESHGUI_MeshDlg;
48 class SMESHGUI_ShapeByMeshOp;
52 * \brief Operation for mech creation or editing
54 * This operation is used for mech creation or editing.
56 class SMESHGUI_EXPORT SMESHGUI_MeshOp : public SMESHGUI_SelectionOp
62 enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes };
64 typedef std::pair<SMESH::SMESH_Hypothesis_var, QString> THypItem;
65 typedef QValueList< THypItem > THypList;
68 typedef QMap< THypType, THypList > TType2HypList;
71 typedef QMap< THypDim, TType2HypList > TDim2Type2HypList;
73 SMESHGUI_MeshOp( const bool theToCreate, const bool theIsMesh = true );
74 virtual ~SMESHGUI_MeshOp();
76 virtual LightApp_Dialog* dlg() const;
79 virtual void startOperation();
80 virtual void selectionDone();
81 virtual SUIT_SelectionFilter* createFilter( const int ) const;
82 virtual bool isValid( SUIT_Operation* ) const;
85 virtual bool onApply();
86 void onCreateHyp( const int theHypType, const int theIndex );
87 void onEditHyp( const int theHypType, const int theIndex );
88 void onHypoSet( const QString& theSetName );
89 void onGeomSelectionByMesh( bool );
90 void onPublishShapeByMeshDlg(SUIT_Operation*);
91 void onCloseShapeByMeshDlg(SUIT_Operation*);
92 void onAlgoSelected( const int theIndex,
93 const int theDim = -1);
97 typedef QValueList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
99 bool isValid( QString& ) const;
100 void availableHyps( const int theDim,
101 const int theHypType,
102 QStringList& theHyps,
103 THypDataList& theDataList,
104 HypothesisData* theAlgoData = 0 ) const;
105 static void existingHyps( const int theDim,
106 const int theHypType,
107 _PTR(SObject) theFather,
108 QStringList& theHyps,
109 THypList& theHypList,
110 HypothesisData* theAlgoData = 0);
111 HypothesisData* hypData( const int theDim,
112 const int theHypType,
113 const int theIndex); // access to myAvailableHypData
115 void createHypothesis(const int theDim, const int theType,
116 const QString& theTypeName);
118 bool createMesh( QString& );
119 bool createSubMesh( QString& );
120 bool editMeshOrSubMesh( QString& );
122 int currentHyp( const int, const int ) const;
123 bool isAccessibleDim( const int ) const;
124 void setCurrentHyp( const int, const int, const int );
125 void setDefaultName() const;
126 SMESH::SMESH_Hypothesis_var getAlgo( const int );
128 QString name( _PTR(SObject) ) const;
129 int find( const SMESH::SMESH_Hypothesis_var&,
130 const THypList& theHypList) const;
131 SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString& aHypType,
132 const QString& aServerLib ) const;
133 bool isSubshapeOk() const;
134 char* isSubmeshIgnored() const;
135 _PTR(SObject) getSubmeshByGeom() const;
136 void selectObject( _PTR(SObject) ) const;
139 SMESHGUI_MeshDlg* myDlg;
140 SMESHGUI_ShapeByMeshOp* myShapeByMeshOp;
143 bool myIsOnGeometry; //!< TRUE if edited mesh accotiated with geometrical object
145 TDim2Type2HypList myExistingHyps; //!< all hypothesis of SMESH module
146 TDim2Type2HypList myObjHyps; //!< hypothesis assigned to the current
147 // edited mesh/sub-mesh
149 // hypdata corresponding to hypotheses present in myDlg
150 THypDataList myAvailableHypData[4][NbHypTypes];
152 bool myIgnoreAlgoSelection;