Salome HOME
Implementation a selection of a mesh entries from python.
[modules/smesh.git] / src / SMESH_SWIG_WITHIHM / libSMESH_Swig.h
1 // Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 // SMESH SMESH : GUI for SMESH component
21 // File   : libSMESH_Swig.h
22 // Author : Nicolas REJNERI, Open CASCADE S.A.S.
23 //
24 #ifndef LIBSMESH_SWIG_H
25 #define LIBSMESH_SWIG_H
26
27 #ifdef WIN32
28 #if defined SMESH_SWIG_EXPORTS || defined _libSMESH_Swig_EXPORTS
29   #define SMESH_SWIG_EXPORT __declspec( dllexport )
30  #else
31   #define SMESH_SWIG_EXPORT __declspec( dllimport )
32  #endif
33 #else
34  #define SMESH_SWIG_EXPORT
35 #endif
36
37 // IDL includes
38 #include <SALOMEconfig.h>
39 #include CORBA_SERVER_HEADER(SALOMEDS)
40
41 //std includes
42 #include <vector>
43
44 #include <SVTK_Selection.h>
45
46 #include <SVTK_Selection.h>
47
48 typedef enum
49   {
50     Undefined  = -1,
51     Node       = NodeSelection,
52     Cell       = CellSelection,
53     EdgeOfCell = EdgeOfCellSelection,
54     Edge       = EdgeSelection,
55     Face       = FaceSelection,
56     Volume     = VolumeSelection,
57     Actor      = ActorSelection,
58     Elem0D     = Elem0DSelection,
59     Ball       = BallSelection
60   } SelectionMode;
61
62 typedef struct
63 {
64   double r, g, b;
65   int delta;
66 } surfaceColorStruct;
67
68 typedef struct
69 {
70   double r, g, b;
71   int delta;
72 } volumeColorStruct;
73
74 typedef struct
75 {
76   double r, g, b;
77 } edgeColorStruct;
78
79 typedef struct
80 {
81   double r, g, b;
82 } nodeColorStruct;
83
84 struct actorAspect
85 {
86   surfaceColorStruct surfaceColor;
87   volumeColorStruct volumeColor;
88   edgeColorStruct edgeColor;
89   nodeColorStruct nodeColor;
90   double opacity;
91 };
92
93 class SMESH_SWIG_EXPORT SMESH_Swig
94 {
95 public:
96   SMESH_Swig();
97   ~SMESH_Swig();
98     
99   void                       Init( int );
100
101   const char*                AddNewMesh( const char* );
102
103   const char*                AddNewHypothesis( const char* );
104   const char*                AddNewAlgorithms( const char* );
105
106   void                       SetShape( const char*, const char* );
107
108   void                       SetHypothesis( const char*, const char* );
109   void                       SetAlgorithms( const char*, const char* );
110
111   void                       UnSetHypothesis( const char* );
112
113   const char*                AddSubMesh( const char*, const char*, int );
114   const char*                AddSubMeshOnShape( const char*, const char*, const char*, int );
115
116   void                       CreateAndDisplayActor( const char* );
117
118   void                       SetName( const char*, const char* );
119
120   void                       EraseActor( const char*, const bool allViewers = false );
121
122   /*!
123    * \brief Set mesh icon according to compute status
124     * \param Mesh_Entry - entry of a mesh
125     * \param isComputed - is mesh computed or not
126    */
127   void                       SetMeshIcon( const char*, const bool, const bool );
128
129   actorAspect                GetActorAspect(const char* Mesh_Entry, int viewId = 0 );
130   void                       SetActorAspect( const actorAspect& actorPres, const char* Mesh_Entry, int viewId = 0  );
131
132   void setSelectionMode( SelectionMode selectionMode );
133   std::vector<int> getSelected( const char* Mesh_Entry );
134
135   // --------------------- for the test purposes -----------------------
136   SelectionMode getSelectionMode();
137   void select( const char *id, std::vector<int> ids, bool append = false );
138   void select( const char *id, int id1, bool append = false );
139
140 private:
141   SALOMEDS::Study_var        myStudy;
142   SALOMEDS::StudyBuilder_var myStudyBuilder;
143   SALOMEDS::SComponent_var   mySComponentMesh;
144 };
145
146 #endif // LIBSMESH_SWIG_H