Salome HOME
0023546: [EDF] AsterStudy: add a method to Python API to show/hide orientation vector...
[modules/smesh.git] / src / SMESH_SWIG_WITHIHM / libSMESH_Swig.i
index cb5cc2200bfb49789f0875b97a17e5fd0c593de4..0978eb6bf81db93859e2ddb77385c960dc49adf5 100644 (file)
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
-// SMESH SMESHGUI : GUI for SMESH component
-// File   : libSMESH_Swig.i
-// Author : Nicolas REJNERI, Open CASCADE S.A.S.
-//
 %module libSMESH_Swig
 
 %{
@@ -38,7 +34,7 @@
     // Py_END_ALLOW_THREADS
     ~PyAllowThreadsGuard() { PyEval_RestoreThread(_save); }
   private:
-    PyThreadState *_save;
+    PyThreadState_save;
   };
 
   PyAllowThreadsGuard guard;
 %include "std_vector.i"
 %include "std_pair.i"
 
-namespace std {
-  
-    %template(VectorInt) vector<int>;
-    %template() std::pair<int,int>;
-    %template(PairVector) std::vector<std::pair<int,int> >;
+namespace std
+{
+  %template(VectorInt) vector<int>;
+  %template() std::pair<int,int>;
+  %template(PairVector) std::vector<std::pair<int,int> >;
 };
 
-
-/* Selection mode enumeration (corresponds to constants from the SALOME_Selection.h) */
+// See SMESH_Actor.h
+typedef enum
+{
+  EntityNone    = 0x00,
+  Entity0d      = 0x01,   // SMESH_Actor::e0DElements
+  EntityEdges   = 0x02,   // SMESH_Actor::eEdges
+  EntityFaces   = 0x04,   // SMESH_Actor::eFaces
+  EntityVolumes = 0x08,   // SMESH_Actor::eVolumes
+  EntityBalls   = 0x10,   // SMESH_Actor::eBallElem
+  EntityAll     = 0xff    // SMESH_Actor::eAllEntity
+} EntityMode;
+
+// See SVTK_Selection.h
 enum SelectionMode
-  {
-    Undefined = -1,
-    Node = 0,
-    Cell,
-    EdgeOfCell,
-    Edge,
-    Face,
-    Volume,
-    Actor,
-    Elem0D,
-    Ball
-  };
-
-typedef struct
 {
-  double r, g, b;
-  int delta;
-} surfaceColorStruct;
+  Undefined = -1,
+  Node = 0,       // NodeSelection
+  Cell,           // CellSelection
+  EdgeOfCell,     // EdgeOfCellSelection
+  Edge,           // EdgeSelection
+  Face,           // FaceSelection
+  Volume,         // VolumeSelection
+  Actor,          // ActorSelection
+  Elem0D,         // Elem0DSelection
+  Ball            // BallSelection
+};
 
-typedef struct
+// See SMESH_Actor.h
+enum DisplayMode
 {
-  double r, g, b;
-  int delta;
-} volumeColorStruct;
+  UndefinedMode = -1,
+  PointMode = 0,      // SMESH_Actor::ePoint
+  EdgeMode,           // SMESH_Actor::eEdge
+  SurfaceMode         // SMESH_Actor::eSurface
+};
 
-typedef struct
+struct ColorData
 {
   double r, g, b;
-} edgeColorStruct;
+};
 
-typedef struct
+struct BicolorData
 {
   double r, g, b;
-} nodeColorStruct;
+  int delta;
+};
 
-struct actorAspect
+struct Properties
 {
-  surfaceColorStruct surfaceColor;
-  volumeColorStruct volumeColor;
-  edgeColorStruct edgeColor;
-  nodeColorStruct nodeColor;
+  ColorData nodeColor;
+  int markerType;
+  int markerScale;
+
+  ColorData edgeColor;
+  int edgeWidth;
+
+  BicolorData surfaceColor;
+  BicolorData volumeColor;
+
+  ColorData elem0dColor;
+  int elem0dSize;
+
+  ColorData ballColor;
+  double ballScale;
+
+  ColorData outlineColor;
+  int outlineWidth;
+
+  ColorData orientationColor;
+  double orientationScale;
+  bool orientation3d;
+
+  double shrinkFactor;
   double opacity;
 };
 
+typedef ColorData nodeColorStruct; // deprecated
+typedef ColorData edgeColorStruct; // deprecated
+typedef BicolorData surfaceColorStruct; // deprecated
+typedef BicolorData volumeColorStruct; // deprecated
+typedef Properties actorAspect; // deprecated
+
 class SMESH_Swig
 {
- public:
+public:
   SMESH_Swig();
   ~SMESH_Swig();
 
-  void Init(int studyID);
+  // Initialization =============================================
+
+  void Init(int); // deprecated
+
+  // Publishing =================================================
+  
+  const char* publish(const char*, const char* = 0);
+  void rename(const char*, const char*);
+
+  const char* AddNewMesh(const char*, const char* = 0); // deprecated
+  const char* AddNewHypothesis(const char*, const char* = 0); // deprecated
+  const char* AddNewAlgorithms(const char*, const char* = 0); // deprecated
+  const char* AddNewAlgorithm(const char*, const char* = 0); // deprecated
+
+  void SetShape(const char*, const char*); // deprecated
+
+  void SetHypothesis(const char*, const char*); // deprecated
+  void SetAlgorithms(const char*, const char*); // deprecated
+
+  void UnSetHypothesis(const char*); // deprecated
+
+  const char* AddSubMesh(const char*, const char*, int, const char* = 0); // deprecated
+  const char* AddSubMeshOnShape (const char*, const char*, const char*, int, const char* = 0); // deprecated
+
+  void SetName(const char*, const char*); // deprecated
+
+  void SetMeshIcon(const char*, const bool, const bool); // deprecated
+
+  // Visualization  =============================================
+
+  void display(const char*, int = 0, bool = true);
+  void erase(const char*, int = 0, bool = true);
+  void update(const char*);
 
-  const char* AddNewMesh(const char* IOR);
-  const char* AddNewHypothesis(const char* IOR);
-  const char* AddNewAlgorithms(const char* IOR);
+  Properties properties(const char*, int = 0);
+  void setProperties(const char*, const Properties&, int = 0);
 
-  void SetShape(const char* ShapeEntry, const char* MeshEntry);
+  bool nodesNumbering(const char*, int = 0);
+  void setNodesNumbering(const char*, bool, int = 0);
+  bool elementsNumbering(const char*, int = 0);
+  void setElementsNumbering(const char*, bool, int = 0);
 
-  void SetHypothesis(const char* Mesh_Or_SubMesh_Entry, const char* Hypothesis_Entry);
-  void SetAlgorithms(const char* Mesh_Or_SubMesh_Entry, const char* Algorithms_Entry);
+  DisplayMode displayMode(const char*, int = 0);
+  void setDisplayMode(const char*, DisplayMode, int = 0);
 
-  void UnSetHypothesis(const char* Applied_Hypothesis_Entry );
+  bool shrinkMode(const char*, int = 0);
+  void setShrinkMode(const char*, bool, int = 0);
 
-  const char* AddSubMesh (const char* Mesh_Entry, const char* SM_IOR, int ST);
-  const char* AddSubMeshOnShape (const char* Mesh_Entry, const char* GeomShape_Entry, const char* SM_IOR, int ST);
+  double opacity(const char*, int = 0);
+  void setOpacity(const char*, double, int = 0);
 
-  void SetName(const char* Entry, const char* Name);
+  bool isOrientationShown(const char*, int = 0);
+  void setOrientationShown(const char*, bool, int = 0);
 
-  void SetMeshIcon(const char* Mesh_Entry, const bool isComputed, const bool isEmpty);
+  int entitiesShown(const char*, int = 0);
+  void setEntitiesShown(const char*, int, int = 0);
+  bool isEntityShown(const char*, EntityMode, int = 0);
+  void setEntityShown(const char*, EntityMode, bool, int = 0);
 
-  void CreateAndDisplayActor( const char* Mesh_Entry );
-  void EraseActor( const char* Mesh_Entry, const bool allViewers = false );
-  void UpdateActor( const char* Mesh_Entry );
+  void CreateAndDisplayActor(const char*); // deprecated
+  void EraseActor(const char*, const bool = false); // deprecated
+  void UpdateActor(const char*); // deprecated
 
-  void setSelectionMode( SelectionMode selectionMode);
-  std::vector<int> getSelected( const char* Mesh_Entry );
-  std::vector<std::pair<int,int> > getSelectedEdgeOfCell( const char* Mesh_Entry );
+  actorAspect GetActorAspect(const char*, int = 0); // deprecated
+  void SetActorAspect(const actorAspect&, const char*, int = 0); // deprecated
 
-  actorAspect GetActorAspect(const char* Mesh_Entry, int viewId = 0 );
-  void SetActorAspect( const actorAspect& actorPres, const char* Mesh_Entry, int viewId = 0 );
+  // Selection  =================================================
 
-  void setSelectionMode( SelectionMode selectionMode);
-  std::vector<int> getSelected( const char* Mesh_Entry );
+  SelectionMode getSelectionMode(int = 0);
+  void setSelectionMode(SelectionMode, int = 0);
 
-  // --------------------- for the test purposes -----------------------
-  SelectionMode  getSelectionMode();
-  void select( const char *id, std::vector<int> ids, bool append = false );
-  void select( const char *id, int id1, bool append = false );
-  void select( const char *id, std::vector<std::pair<int,int> >, bool apend = false );
+  std::vector<int> getSelected(const char*);
+  std::vector<std::pair<int,int> > getSelectedEdgeOfCell(const char*);
 
+  void select(const char*, std::vector<int>, bool = false);
+  void select(const char*, int, bool = false);
+  void select(const char*, std::vector<std::pair<int,int> >, bool = false);
 };