Salome HOME
Merge ASERIS development.
[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 #include <utility>
44
45 #include <SVTK_Selection.h>
46
47 #include <SVTK_Selection.h>
48
49 typedef enum
50   {
51     Undefined  = -1,
52     Node       = NodeSelection,
53     Cell       = CellSelection,
54     EdgeOfCell = EdgeOfCellSelection,
55     Edge       = EdgeSelection,
56     Face       = FaceSelection,
57     Volume     = VolumeSelection,
58     Actor      = ActorSelection,
59     Elem0D     = Elem0DSelection,
60     Ball       = BallSelection
61   } SelectionMode;
62
63 typedef struct
64 {
65   double r, g, b;
66   int delta;
67 } surfaceColorStruct;
68
69 typedef struct
70 {
71   double r, g, b;
72   int delta;
73 } volumeColorStruct;
74
75 typedef struct
76 {
77   double r, g, b;
78 } edgeColorStruct;
79
80 typedef struct
81 {
82   double r, g, b;
83 } nodeColorStruct;
84
85 struct actorAspect
86 {
87   surfaceColorStruct surfaceColor;
88   volumeColorStruct volumeColor;
89   edgeColorStruct edgeColor;
90   nodeColorStruct nodeColor;
91   double opacity;
92 };
93
94 class SMESH_SWIG_EXPORT SMESH_Swig
95 {
96 public:
97   SMESH_Swig();
98   ~SMESH_Swig();
99     
100   void                       Init( int );
101
102   const char*                AddNewMesh( const char* );
103
104   const char*                AddNewHypothesis( const char* );
105   const char*                AddNewAlgorithms( const char* );
106
107   void                       SetShape( const char*, const char* );
108
109   void                       SetHypothesis( const char*, const char* );
110   void                       SetAlgorithms( const char*, const char* );
111
112   void                       UnSetHypothesis( const char* );
113
114   const char*                AddSubMesh( const char*, const char*, int );
115   const char*                AddSubMeshOnShape( const char*, const char*, const char*, int );
116
117   void                       CreateAndDisplayActor( const char* );
118
119   void                       SetName( const char*, const char* );
120
121   void                       EraseActor( const char*, const bool allViewers = false );
122
123   void                       UpdateActor( const char* Mesh_Entry );
124
125   /*!
126    * \brief Set mesh icon according to compute status
127     * \param Mesh_Entry - entry of a mesh
128     * \param isComputed - is mesh computed or not
129    */
130   void                       SetMeshIcon( const char*, const bool, const bool );
131
132   actorAspect                GetActorAspect(const char* Mesh_Entry, int viewId = 0 );
133   void                       SetActorAspect( const actorAspect& actorPres, const char* Mesh_Entry, int viewId = 0  );
134
135   void setSelectionMode( SelectionMode selectionMode );
136   std::vector<int> getSelected( const char* Mesh_Entry );
137   std::vector<std::pair<int, int> > getSelectedEdgeOfCell( const char* Mesh_Entry );
138
139   // --------------------- for the test purposes -----------------------
140   SelectionMode getSelectionMode();
141   void select( const char *id, std::vector<int> ids, bool append = false );
142   void select( const char *id, int id1, bool append = false );
143   void select( const char *id, std::vector<std::pair<int,int> >, bool apend = false );
144
145 private:
146   SALOMEDS::Study_var        myStudy;
147   SALOMEDS::StudyBuilder_var myStudyBuilder;
148   SALOMEDS::SComponent_var   mySComponentMesh;
149 };
150
151 #endif // LIBSMESH_SWIG_H