Version: 9.16.0
SMESHGUI_MeshOp.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
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, or (at your option) any later version.
10//
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.
15//
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
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23// SMESH SMESHGUI : GUI for SMESH component
24// File : SMESHGUI_MeshOp.h
25// Author : Sergey LITONIN, Open CASCADE S.A.S.
26//
27#ifndef SMESHGUI_MESHOP_H
28#define SMESHGUI_MESHOP_H
29
30// SMESH includes
31#include "SMESH_SMESHGUI.hxx"
32
34
35// IDL includes
36#include <SALOMEconfig.h>
37#include CORBA_CLIENT_HEADER(SMESH_Gen)
38#include CORBA_CLIENT_HEADER(GEOM_Gen)
39
40class HypothesesSet;
43class HypothesisData;
45
52{
53 Q_OBJECT
54
55public:
56 enum HypType{ Algo = 0, MainHyp, AddHyp, NbHypTypes };
57 enum MeshType{ MT_ANY = 0, MT_TRIANGULAR, MT_QUADRILATERAL, MT_TETRAHEDRAL, MT_HEXAHEDRAL };
58
59 typedef std::pair<SMESH::SMESH_Hypothesis_var, QString> THypItem;
60 typedef QList< THypItem > THypList;
61
62 typedef int THypType;
63 typedef QMap< THypType, THypList > TType2HypList;
64
65 typedef int THypDim;
66 typedef QMap< THypDim, TType2HypList > TDim2Type2HypList;
67
68public:
69 SMESHGUI_MeshOp( const bool, const bool = true );
70 virtual ~SMESHGUI_MeshOp();
71
72 virtual LightApp_Dialog* dlg() const;
73
74protected:
75 virtual void startOperation();
76 virtual void commitOperation();
77 virtual void selectionDone();
78 virtual SUIT_SelectionFilter* createFilter( const int ) const;
79 virtual bool isValid( SUIT_Operation* ) const;
80
81protected slots:
82 virtual bool onApply();
83 void onCreateHyp( const int, const int );
84 void onEditHyp( const int, const int );
85 void onHypoSet( const QString& );
86 void onGeomSelectionByMesh( bool );
87 void onPublishShapeByMeshDlg( SUIT_Operation* );
88 void onCloseShapeByMeshDlg( SUIT_Operation* );
89 void onAlgoSelected( const int, const int = -1 );
90 void onHypoCreated( int );
91 void onHypoEdited( int );
92 void onAlgoSetByMeshType( const int, const int );
93
94private:
95 typedef QList<HypothesisData*> THypDataList; // typedef: list of hypothesis data
96 typedef QMap<QString, bool> THypLabelIsAppMap; // typedef: map of hypothesis is applicable
97
98 bool isValid( QString& ) const;
99 bool isCompatibleToGeometry( HypothesisData* , const int);
100 bool isCompatibleToMeshType( HypothesisData* , const int);
101 void availableHyps( const int,
102 const int,
103 QStringList&,
105 HypothesisData* = 0,
106 HypothesisData* = 0,
107 const QString& = "");
108 void existingHyps( const int,
109 const int,
110 _PTR(SObject),
111 QStringList&,
112 THypList&,
113 HypothesisData* = 0 ) const;
114 HypothesisData* hypData( const int,
115 const int,
116 const int ); // access to myAvailableHypData
117
118 void createHypothesis( const int, const int,
119 const QString& );
120
121 bool createMesh( QString&, QStringList& );
122 bool createSubMesh( QString&, QStringList& );
123 bool editMeshOrSubMesh( QString&, QStringList& );
124 void createSubMeshOnInternalEdges( SMESH::SMESH_Mesh_ptr mesh,
125 GEOM::GEOM_Object_ptr mainShape );
126 bool checkSubMeshConcurrency( SMESH::SMESH_Mesh_ptr mesh,
127 SMESH::SMESH_subMesh_ptr submesh,
128 bool askUser=false);
129
130 int currentHyp( const int, const int ) const;
131 bool isSelectedHyp( int, int, int ) const;
132 int nbDlgHypTypes( const int ) const;
133 bool isAccessibleDim( const int ) const;
134 void setCurrentHyp( const int, const int, const int, const bool=false);
135 void setDefaultName( const QString& prefix="" ) const;
136 SMESH::SMESH_Hypothesis_var getAlgo( const int );
137 void readMesh();
138 QString name( _PTR(SObject) ) const;
139 int find( const SMESH::SMESH_Hypothesis_var&,
140 const THypList& ) const;
141 SMESH::SMESH_Hypothesis_var getInitParamsHypothesis( const QString&,
142 const QString&,
143 const SMESH::HypInitParams* prm=0) const;
144 void initHypCreator( SMESHGUI_GenericHypothesisCreator* aCreator );
145 bool getAverageSize( double & averageSize );
146 bool isSubshapeOk() const;
147 char* isSubmeshIgnored() const;
148 _PTR(SObject) getSubmeshByGeom() const;
149 void selectObject( _PTR(SObject) ) const;
150 void updateMeshTypeList();
151 void updateHypoSets();
152 void setFilteredAlgoData();
153 QStringList getHypoNames();
154 void logSmeshParams();
155
156private:
157
165 // The geometry of "invalid sub-mesh" is not a sub-shape of the main shape;
166 // it is created for the case where a valid sub-shape not found by CopyMeshWithGeom()
167
168 QString myGeomEntry;
169 GEOM::GEOM_Object_var myGeom;
170
173 // edited mesh/sub-mesh
174 // hypdata corresponding to hypotheses present in myDlg
175 THypDataList myAvailableHypData[4][NbHypTypes];
179 int myDim, myType, myMaxShapeDim;
180
181 HypothesesSet* myHypoSet; // applied hypo-set
182 double myAverageSize; // entered at hypo-set processing
183
185};
186
187#endif // SMESHGUI_MESHOP_H
#define SMESHGUI_EXPORT
Definition: SMESH_SMESHGUI.hxx:36
Class containing set of hypotheses.
Definition: SMESHGUI_Hypotheses.h:219
Auxiliary class for creation of hypotheses.
Definition: SMESHGUI_Hypotheses.h:48
Dialog for mech creation or editing.
Definition: SMESHGUI_MeshDlg.h:56
Operation for mech creation or editing.
Definition: SMESHGUI_MeshOp.h:52
HypType
Definition: SMESHGUI_MeshOp.h:56
@ AddHyp
Definition: SMESHGUI_MeshOp.h:56
bool myHasConcurrentSubBefore
Definition: SMESHGUI_MeshOp.h:163
GEOM::GEOM_Object_var myGeom
Definition: SMESHGUI_MeshOp.h:169
int THypType
Definition: SMESHGUI_MeshOp.h:62
SMESHGUI_ShapeByMeshOp * myShapeByMeshOp
Definition: SMESHGUI_MeshOp.h:159
THypLabelIsAppMap myHypMapIsApplicable
Definition: SMESHGUI_MeshOp.h:177
HypothesesSet * myHypoSet
Definition: SMESHGUI_MeshOp.h:181
int THypDim
Definition: SMESHGUI_MeshOp.h:65
bool myToCreate
Definition: SMESHGUI_MeshOp.h:160
QMap< THypType, THypList > TType2HypList
Definition: SMESHGUI_MeshOp.h:63
QList< THypItem > THypList
Definition: SMESHGUI_MeshOp.h:60
virtual void selectionDone()
MeshType
Definition: SMESHGUI_MeshOp.h:57
SMESHGUI_MeshDlg * myDlg
Definition: SMESHGUI_MeshOp.h:158
std::pair< SMESH::SMESH_Hypothesis_var, QString > THypItem
Definition: SMESHGUI_MeshOp.h:59
QString myObjectToSelect
Definition: SMESHGUI_MeshOp.h:184
TDim2Type2HypList myObjHyps
hypothesis assigned to the current
Definition: SMESHGUI_MeshOp.h:172
QMap< QString, bool > THypLabelIsAppMap
Definition: SMESHGUI_MeshOp.h:96
bool myIsInvalidSubMesh
"invalid sub-mesh" is edited
Definition: SMESHGUI_MeshOp.h:164
bool myIsMesh
Definition: SMESHGUI_MeshOp.h:161
QMap< THypDim, TType2HypList > TDim2Type2HypList
Definition: SMESHGUI_MeshOp.h:66
TDim2Type2HypList myExistingHyps
all hypothesis of SMESH module
Definition: SMESHGUI_MeshOp.h:171
_PTR(SObject) getSubmeshByGeom() const
bool myIgnoreAlgoSelection
Definition: SMESHGUI_MeshOp.h:178
QString myGeomEntry
Definition: SMESHGUI_MeshOp.h:168
bool myIsOnGeometry
TRUE if edited mesh is based on geometry.
Definition: SMESHGUI_MeshOp.h:162
double myAverageSize
Definition: SMESHGUI_MeshOp.h:182
QString myLastGeomEntry
Definition: SMESHGUI_MeshOp.h:176
int myDim
Definition: SMESHGUI_MeshOp.h:179
QList< HypothesisData * > THypDataList
Definition: SMESHGUI_MeshOp.h:95
virtual bool isValid(SUIT_Operation *) const
Verifies whether given operator is valid for this one.
Definition: SMESHGUI_Operation.cxx:242
virtual bool onApply()
Definition: SMESHGUI_Operation.cxx:166
Definition: SMESHGUI_SelectionOp.h:58
virtual void startOperation()
This enumeration is used in typeById method to distinguish objects, mesh nodes and mesh elements,...
Definition: SMESHGUI_SelectionOp.cxx:79
virtual SUIT_SelectionFilter * createFilter(const int) const
Creates filter being used when certain object selection widget is active If no filter must be used,...
Definition: SMESHGUI_SelectionOp.cxx:170
virtual void commitOperation()
Definition: SMESHGUI_SelectionOp.cxx:121
Operation to publish a sub-shape of the mesh main shape by selecting mesh elements.
Definition: SMESHGUI_ShapeByMeshDlg.h:76
_PTR(SObject) getSubShapeSO(int subShapeID
Return SO of a sub-shape.
Definition: SMESHGUI_Utils.cxx:122
Information about a hypothesis.
Definition: SMESHGUI_Hypotheses.h:180
Way to initialize hypothesis.
Definition: SMESH_Gen.idl:131