Version: 9.16.0
SMESHGUI_SelectionProxy.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#ifndef SMESHGUI_SELECTIONPROXY_H
24#define SMESHGUI_SELECTIONPROXY_H
25
26#include "SMESH_SMESHGUI.hxx"
27
28#include <SALOME_InteractiveObject.hxx>
29#include <SALOMEconfig.h>
30#include CORBA_SERVER_HEADER(SMESH_Mesh)
31#include CORBA_SERVER_HEADER(GEOM_Gen)
32
33#include <QColor>
34#include <QList>
35#include <QMap>
36#include <QSet>
37#include <QString>
38
39#include <gp_XYZ.hxx>
40
41class SMESH_Actor;
42
43namespace SMESH
44{
46 {
47 QMap<int, long> myInfo;
48 public:
49 MeshInfo();
50 uint info( int ) const;
51 uint operator[] ( int );
52 uint count( int, int ) const;
53 private:
54 void addInfo( int, long );
55 friend class SelectionProxy;
56 };
57
59 {
60 QString myFileName;
61 uint mySize;
62 uint myMajor, myMinor, myRelease;
63 public:
64 MedInfo();
65 bool isValid() const;
66 QString fileName() const;
67 uint size() const;
68 QString version() const;
69 private:
70 void setFileName( const QString& );
71 void setSize( uint );
72 void setVersion( uint, uint, uint );
73 friend class SelectionProxy;
74 };
75
77 {
80 double myU, myV;
81 bool myHasU, myHasV;
82 public:
83 Position();
84 bool isValid() const;
85 int shapeId() const;
86 int shapeType() const;
87 bool hasU() const;
88 double u() const;
89 bool hasV() const;
90 double v() const;
91 private:
92 void setShapeId( int );
93 void setShapeType( int );
94 void setU( double );
95 void setV( double );
96 friend class SelectionProxy;
97 };
98
99 class XYZ
100 {
101 double myX, myY, myZ;
102 public:
103 XYZ();
104 XYZ( double, double, double );
105 XYZ( const gp_XYZ& );
106 void add( double, double, double );
107 void divide( double );
108 double x() const;
109 double y() const;
110 double z() const;
111 operator gp_XYZ() const;
112 };
113
114 typedef QMap< int, QList<int> > Connectivity;
115
117 {
118 Handle(SALOME_InteractiveObject) myIO;
119 SMESH::SMESH_IDSource_var myObject;
122
123 public:
124 enum Type
125 {
132 GroupFilter
133 };
134
135 // construction
137 SelectionProxy( const Handle(SALOME_InteractiveObject)& );
138 SelectionProxy( SMESH::SMESH_IDSource_ptr );
140
141 SelectionProxy& operator= ( const SelectionProxy& );
142
143 // comparison
144 bool operator== ( const SelectionProxy& );
145
146 // general purpose methods
147 void refresh();
148
149 bool isNull() const;
150 operator bool() const;
151
152 SMESH::SMESH_IDSource_ptr object() const;
153 const Handle(SALOME_InteractiveObject)& io() const;
155
156 bool isValid() const;
157 void load();
158
159 // methods common to all types of proxy
160 QString name() const;
161 Type type() const;
162 MeshInfo meshInfo() const;
163 SelectionProxy mesh() const;
164 bool hasShapeToMesh() const;
165 GEOM::GEOM_Object_ptr shape() const;
166 QString shapeName() const;
167 int shapeType() const;
168 bool isMeshLoaded() const;
169
170 bool hasNode( int );
171 bool nodeCoordinates( int, XYZ& );
172 bool nodeConnectivity( int, Connectivity& );
173 bool nodePosition( int, Position& );
174 QList<SelectionProxy> nodeGroups( int ) const;
175
176 bool hasElement( int );
177 SMESH::ElementType elementType( int ) const;
178 int elementEntityType( int ) const;
179 bool elementConnectivity( SMESH::smIdType, Connectivity& );
180 bool perFaceConnectivity( int, Connectivity&, int& );
181 bool elementPosition( int, Position& );
182 bool elementGravityCenter( int, XYZ& );
183 bool elementNormal( int, XYZ& );
184 bool elementControl( int, int, double, double& ) const;
185 QList<SelectionProxy> elementGroups( int ) const;
186
187 // methods that work for mesh only
188 MedInfo medFileInfo() const;
189 QList<SelectionProxy> submeshes() const;
190 QList<SelectionProxy> groups() const;
191
192 // methods that work for group only
193 SMESH::ElementType groupElementType() const;
194 QColor color() const;
195 SMESH::smIdType size( bool = false ) const;
196 SMESH::smIdType nbNodes( bool = false ) const;
197 QSet<uint> ids() const;
198
199 private:
200 void init();
201 };
202}
203
204#endif // SMESHGUI_SELECTIONPROXY_H
#define SMESHGUI_EXPORT
Definition: SMESH_SMESHGUI.hxx:36
Provide operations over the selected object.
Definition: SMESHGUI_SelectionProxy.h:59
uint myMajor
Definition: SMESHGUI_SelectionProxy.h:62
QString myFileName
Definition: SMESHGUI_SelectionProxy.h:60
uint mySize
Definition: SMESHGUI_SelectionProxy.h:61
Store statistics on mesh object.
Definition: SMESHGUI_SelectionProxy.h:46
QMap< int, long > myInfo
Definition: SMESHGUI_SelectionProxy.h:47
Describes position of mesh node or element on a reference shape.
Definition: SMESHGUI_SelectionProxy.h:77
int myShapeId
Definition: SMESHGUI_SelectionProxy.h:78
int myShapeType
Definition: SMESHGUI_SelectionProxy.h:79
double myU
Definition: SMESHGUI_SelectionProxy.h:80
bool myHasU
Definition: SMESHGUI_SelectionProxy.h:81
Provide operations over the selected object.
Definition: SMESHGUI_SelectionProxy.h:117
const Handle(SALOME_InteractiveObject) &io() const
SMESH_Actor * actor() const
SMESH::SMESH_IDSource_var myObject
Definition: SMESHGUI_SelectionProxy.h:119
SMESH::SMESH_IDSource_ptr object() const
SMESH_Actor * myActor
Definition: SMESHGUI_SelectionProxy.h:120
Type
Definition: SMESHGUI_SelectionProxy.h:125
@ Submesh
Definition: SMESHGUI_SelectionProxy.h:128
@ GroupGeom
Definition: SMESHGUI_SelectionProxy.h:131
@ GroupStd
Definition: SMESHGUI_SelectionProxy.h:130
@ Unknown
Definition: SMESHGUI_SelectionProxy.h:126
@ Group
Definition: SMESHGUI_SelectionProxy.h:129
@ Mesh
Definition: SMESHGUI_SelectionProxy.h:127
bool myDirty
Definition: SMESHGUI_SelectionProxy.h:121
Handle(SALOME_InteractiveObject) myIO
bool isValid() const
Simple structure to manage 3D coordinate.
Definition: SMESHGUI_SelectionProxy.h:100
double myX
Definition: SMESHGUI_SelectionProxy.h:101
double myY
Definition: SMESHGUI_SelectionProxy.h:101
void divide(double)
Divide point to given coefficient.
Definition: SMESHGUI_SelectionProxy.cxx:1553
double z() const
Get Z coordinate.
Definition: SMESHGUI_SelectionProxy.cxx:1585
double myZ
Definition: SMESHGUI_SelectionProxy.h:101
double x() const
Get X coordinate.
Definition: SMESHGUI_SelectionProxy.cxx:1567
void add(double, double, double)
Add a point.
Definition: SMESHGUI_SelectionProxy.cxx:1542
double y() const
Get Y coordinate.
Definition: SMESHGUI_SelectionProxy.cxx:1576
XYZ()
Default constructor.
Definition: SMESHGUI_SelectionProxy.cxx:1507
Definition: SMESH_Actor.h:56
Definition: SMESH_ControlsClassifier.cxx:39
Handle(VTKViewer_Filter) GetFilter(int theId
void setFileName(_PTR(SObject) theSObject, const QString &theValue)
Definition: SMESHGUI_Utils.cxx:154
QMap< int, QList< int > > Connectivity
Definition: SMESHGUI_SelectionProxy.h:114
ElementType
Enumeration for element type, like in SMDS.
Definition: SMESH_Mesh.idl:128