1 // Copyright (C) 2007-2021 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, or (at your option) any later version.
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
23 #ifndef SMESHGUI_SELECTIONPROXY_H
24 #define SMESHGUI_SELECTIONPROXY_H
26 #include "SMESH_SMESHGUI.hxx"
28 #include <SALOME_InteractiveObject.hxx>
29 #include <SALOMEconfig.h>
30 #include CORBA_SERVER_HEADER(SMESH_Mesh)
31 #include CORBA_SERVER_HEADER(GEOM_Gen)
45 class SMESHGUI_EXPORT MeshInfo
47 QMap<int, long> myInfo;
50 uint info( int ) const;
51 uint operator[] ( int );
52 uint count( int, int ) const;
54 void addInfo( int, long );
55 friend class SelectionProxy;
58 class SMESHGUI_EXPORT MedInfo
62 uint myMajor, myMinor, myRelease;
66 QString fileName() const;
68 QString version() const;
70 void setFileName( const QString& );
72 void setVersion( uint, uint, uint );
73 friend class SelectionProxy;
76 class SMESHGUI_EXPORT Position
86 int shapeType() const;
92 void setShapeId( int );
93 void setShapeType( int );
96 friend class SelectionProxy;
101 double myX, myY, myZ;
104 XYZ( double, double, double );
105 XYZ( const gp_XYZ& );
106 void add( double, double, double );
107 void divide( double );
111 operator gp_XYZ() const;
114 typedef QMap< int, QList<int> > Connectivity;
116 class SMESHGUI_EXPORT SelectionProxy
118 Handle(SALOME_InteractiveObject) myIO;
119 SMESH::SMESH_IDSource_var myObject;
120 SMESH_Actor* myActor;
137 SelectionProxy( const Handle(SALOME_InteractiveObject)& );
138 SelectionProxy( SMESH::SMESH_IDSource_ptr );
139 SelectionProxy( const SelectionProxy& );
141 SelectionProxy& operator= ( const SelectionProxy& );
144 bool operator== ( const SelectionProxy& );
146 // general purpose methods
150 operator bool() const;
152 SMESH::SMESH_IDSource_ptr object() const;
153 const Handle(SALOME_InteractiveObject)& io() const;
154 SMESH_Actor* actor() const;
156 bool isValid() const;
159 // methods common to all types of proxy
160 QString name() 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;
171 bool nodeCoordinates( int, XYZ& );
172 bool nodeConnectivity( int, Connectivity& );
173 bool nodePosition( int, Position& );
174 QList<SelectionProxy> nodeGroups( int ) const;
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;
187 // methods that work for mesh only
188 MedInfo medFileInfo() const;
189 QList<SelectionProxy> submeshes() const;
190 QList<SelectionProxy> groups() const;
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;
204 #endif // SMESHGUI_SELECTIONPROXY_H