Salome HOME
dc10494e084d63a9523531222b5ce59aa6a77fa8
[modules/geom.git] / src / GEOM_SWIG_WITHIHM / libGEOM_Swig.i
1 // Copyright (C) 2007-2023  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 //  File      : libGeometry_Swig.i
21 //  Created   : Tue Mar 26 15:04:48 2002
22 //  Author    : Nicolas REJNERI, Paul RASCLE
23 //  Project   : SALOME
24 //  Module    : GEOM
25 //
26
27
28 %module libGEOM_Swig
29
30 %{
31 #include "libGEOM_Swig.h"
32 %}
33
34 %include "std_vector.i"
35 namespace std {
36   %template(IntVector) vector<int>;
37 }
38
39 #include <vector>
40
41 /*
42   managing C++ exception in the Python API
43 */
44 %exception
45 {
46   class PyAllowThreadsGuard {
47    public:
48     // Py_BEGIN_ALLOW_THREADS
49     PyAllowThreadsGuard() { _save = PyEval_SaveThread(); }
50     // Py_END_ALLOW_THREADS
51     ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); }
52    private:
53     PyThreadState *_save;
54   };
55
56   PyAllowThreadsGuard guard;
57
58   $action
59 }
60
61 class GEOM_Swig
62 {
63  public:
64   GEOM_Swig( bool updateOB = true );
65   ~GEOM_Swig();
66
67   void createAndDisplayGO( const char* theEntry, bool theUpdateViewer = true );
68   void createAndDisplayFitAllGO( const char* theEntry );
69   void eraseGO( const char* theEntry, bool theUpdateViewer = true );
70
71   void UpdateViewer();
72
73   void setDisplayMode( const char* theEntry, int theMode, bool theUpdateViewer = true );
74   void setVectorsMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
75   void setVerticesMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
76   void setNameMode( const char* theEntry, bool theOn, bool theUpdateViewer = true );
77   void setColor( const char* theEntry, int theRed, int theGreen, int theBlue, bool theUpdateViewer = true );
78   void setTransparency( const char* theEntry, float theTransparency, bool theUpdateViewer = true );
79   void setIsos( const char* theEntry, int theNbU, int theNbV, bool theUpdateViewer = true );
80   void setDeflection( const char* theEntry, float theDeflection, bool theUpdateViewer = true );
81   void setMaterial( const char* theEntry, const char* theMaterial, bool theUpdateViewer = true );
82   void setMaterialProperty( const char* theEntry, const char* theMaterial, bool theUpdateViewer = true );
83
84   void initLocalSelection( const char* theEntry, int theMode);
85   std::vector<int> getLocalSelection();
86   void closeLocalSelection();
87
88   int         getIndexTopology( const char* theSubIOR, const char* theMainIOR );
89   const char* getShapeTypeString( const char* theIOR );
90   const char* getShapeTypeIcon( const char* theIOR );
91
92   bool initGeomGen();
93 };
94