]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
This commit was generated by cvs2git to create tag 'T3_0_0_a1'. T3_0_0_a1
authoradmin <salome-admin@opencascade.com>
Mon, 6 Jun 2005 12:37:13 +0000 (12:37 +0000)
committeradmin <salome-admin@opencascade.com>
Mon, 6 Jun 2005 12:37:13 +0000 (12:37 +0000)
Sprout from master 2005-06-06 07:12:52 UTC smh <smh@opencascade.com> 'SMH: Add again in binary mode'
Cherrypick from master 2005-06-03 09:50:22 UTC apo <apo@opencascade.com> 'To change CASCADE's collections to STL ones (first step)':
    src/SVTK/SVTK_InteractorStyle.cxx
    src/SVTK/SVTK_InteractorStyle.h
    src/SVTK/SVTK_RenderWindowInteractor.cxx
Cherrypick from master 2005-06-06 12:37:12 UTC smh <smh@opencascade.com> 'Instead on *in':
    src/SALOME_SWIG/supervisionexample.py
    src/SALOME_SWIG/supervisiongeomexample.py

src/SALOME_SWIG/supervisionexample.py [new file with mode: 0755]
src/SALOME_SWIG/supervisiongeomexample.py [new file with mode: 0755]
src/SVTK/SVTK_InteractorStyle.cxx
src/SVTK/SVTK_InteractorStyle.h
src/SVTK/SVTK_RenderWindowInteractor.cxx

diff --git a/src/SALOME_SWIG/supervisionexample.py b/src/SALOME_SWIG/supervisionexample.py
new file mode 100755 (executable)
index 0000000..56bdd9b
--- /dev/null
@@ -0,0 +1,85 @@
+#==============================================================================
+#  File      : supervisionexample.py
+#  Created   : 23 nov 2001
+#  Author    : Jean Rahuel
+#  Project   : SALOME
+#  Copyright : CEA
+#==============================================================================
+
+from SuperV import *
+
+
+
+# load this object with Nodes, Links and Datas stored in GraphEssai.xml
+# (GraphEssai.xml was created with python in SuperVisionTest and GraphEssai.py)
+myGraph = Graph("@ROOT_BUILDDIR@/share/salome/resources/GraphEssai.xml")
+
+#myGraph = Graph("/home/data/jr_HEAD/build/share/salome/resources/GraphEssai.xml")
+# This DataFlow is "valid" : no loop, correct links between Nodes etc...
+
+print myGraph.IsValid()
+
+# Get Nodes
+myGraph.PrintNodes()
+Add,Sub,Mul,Div = myGraph.Nodes()
+
+# Load Datas
+Addx = Add.Input("x",3.)
+Addy = Add.Input("y",4.5)
+Subx = Sub.Input("x",1.5)
+
+# Get Output Port
+Addz = Add.Port('z')
+Subz = Sub.Port('z')
+Mulz = Mul.Port('z')
+Divz = Div.Port('z')
+
+# This DataFlow is "executable" : all pending Ports are defined with Datas
+print myGraph.IsExecutable()
+
+# Starts only execution of that DataFlow and gets control immediatly
+print myGraph.Run()
+
+# That DataFlow is running ==> 0 (false)
+print myGraph.IsDone()
+
+# Events of execution :
+aStatus,aNode,anEvent,aState = myGraph.Event()
+while aStatus :
+    print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState
+    aStatus,aNode,anEvent,aState = myGraph.Event()
+print myGraph.IsDone()
+
+# Wait for Completion (but it is already done after event loop ...)
+print "Done : ",myGraph.DoneW()
+
+# Get result
+print "Result : ",Divz.ToString()
+
+# Intermediate results :
+print "Intermediate Result Add\z : ",Addz.ToString()
+print "Intermediate Result Sub\z : ",Subz.ToString()
+print "Intermediate Result Mul\z : ",Mulz.ToString()
+
+print " "
+print "Type : print myGraph.IsDone()"
+print "       If execution is finished ==> 1 (true)"
+print " "
+print "Type : print Divz.ToString()"
+print "       You will get the result"
+print " "
+print "Type : myGraph.PrintPorts()"
+print "       to see input and output values of the graph"
+print " "
+print "Type : Add.PrintPorts()"
+print "Type : Sub.PrintPorts()"
+print "Type : Mul.PrintPorts()"
+print "Type : Div.PrintPorts()"
+print "       to see input and output values of nodes"
+
+# Export will create newsupervisionexample.xml and the corresponding .py file
+print myGraph.Export("@ROOT_BUILDDIR@/share/salome/resources/newsupervisionexample.xml")
+
+print " "
+print "See file @ROOT_BUILDDIR@/share/salome/resources/newsupervisionexample.xml"
+print "See file @ROOT_BUILDDIR@/share/salome/resources/newsupervisionexample.py"
diff --git a/src/SALOME_SWIG/supervisiongeomexample.py b/src/SALOME_SWIG/supervisiongeomexample.py
new file mode 100755 (executable)
index 0000000..8c56bb1
--- /dev/null
@@ -0,0 +1,103 @@
+
+# Generated python file of Graph GraphGeom2Essai
+
+from SuperV import *
+
+import salome
+
+import geompy
+
+
+geom = lcc.FindOrLoadComponent("FactoryServer", "Geometry")
+geom.GetCurrentStudy(salome.myStudyId)
+
+myBuilder = salome.myStudy.NewBuilder()
+
+# Graph creation 
+GraphGeom2Essai = Graph( 'GraphGeom2Essai' )
+print GraphGeom2Essai.SetAuthor( '' )
+print GraphGeom2Essai.SetComment( '' )
+GraphGeom2Essai.Coords( 0 , 0 )
+
+# Creation of Nodes
+MakeSphere = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeSphere' )
+print MakeSphere.SetAuthor( '' )
+print MakeSphere.SetContainer( 'FactoryServer' )
+print MakeSphere.SetComment( '' )
+MakeSphere.Coords( 26 , 13 )
+MakeCopy = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeCopy' )
+print MakeCopy.SetAuthor( '' )
+print MakeCopy.SetContainer( 'FactoryServer' )
+print MakeCopy.SetComment( '' )
+MakeCopy.Coords( 219 , 12 )
+MakeTranslation = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeTranslation' )
+print MakeTranslation.SetAuthor( '' )
+print MakeTranslation.SetContainer( 'FactoryServer' )
+print MakeTranslation.SetComment( '' )
+MakeTranslation.Coords( 219 , 159 )
+MakeFuse = GraphGeom2Essai.Node( 'Geometry' , 'Geometry' , 'MakeFuse' )
+print MakeFuse.SetAuthor( '' )
+print MakeFuse.SetContainer( 'FactoryServer' )
+print MakeFuse.SetComment( '' )
+MakeFuse.Coords( 465 , 106 )
+
+# Creation of intermediate Output variables and of links
+MakeSphereshape = MakeSphere.Port( 'shape' )
+MakeCopyshape1 = GraphGeom2Essai.Link( MakeSphereshape , MakeCopy.Port( 'shape1' ) )
+MakeTranslationshape1 = GraphGeom2Essai.Link( MakeSphereshape , MakeTranslation.Port( 'shape1' ) )
+MakeCopyshape = MakeCopy.Port( 'shape' )
+MakeFuseshape1 = GraphGeom2Essai.Link( MakeCopyshape , MakeFuse.Port( 'shape1' ) )
+MakeTranslationshape = MakeTranslation.Port( 'shape' )
+MakeFuseshape2 = GraphGeom2Essai.Link( MakeTranslationshape , MakeFuse.Port( 'shape2' ) )
+
+# Creation of Input datas
+MakeSpherex1 = MakeSphere.Input( 'x1' , 0)
+MakeSpherey1 = MakeSphere.Input( 'y1' , 0)
+MakeSpherez1 = MakeSphere.Input( 'z1' , 0)
+MakeSphereradius = MakeSphere.Input( 'radius' , 50)
+MakeTranslationx1 = MakeTranslation.Input( 'x1' , 80)
+MakeTranslationy1 = MakeTranslation.Input( 'y1' , 0)
+MakeTranslationz1 = MakeTranslation.Input( 'z1' , 0)
+
+# Missing Input datas : None
+
+# Creation of Output variables
+MakeFuseshape = MakeFuse.Port( 'shape' )
+
+# State of Ports of the Graph
+GraphGeom2Essai.PrintPorts()
+
+# Start asynchronous run
+print GraphGeom2Essai.Run()
+
+# Done ?
+print GraphGeom2Essai.IsDone()
+
+# Events of execution :
+aStatus,aNode,anEvent,aState = GraphGeom2Essai.Event()
+while aStatus :
+    print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState
+    aStatus,aNode,anEvent,aState = GraphGeom2Essai.Event()
+print GraphGeom2Essai.IsDone()
+
+# Waiting end of execution :
+print GraphGeom2Essai.DoneW()
+
+print " "
+print "Type print GraphGeom2Essai.IsDone()"
+print "1 <==> It's done"
+print " "
+print "Type print GraphGeom2Essai.DoneW()"
+print "Wait until end of execution : 1(success)"
+print " "
+print "Type GraphGeom2Essai.PrintPorts()"
+print "     to see input and output values of the graph"
+print " "
+print "Type MakeSphere.PrintPorts()"
+print "Type MakeCopy.PrintPorts()"
+print "Type MakeTranslation.PrintPorts()"
+print "Type MakeFuse.PrintPorts()"
+print "     to see input and output values of nodes"
+print " "
+print "Type print GraphGeom2Essai.Export('File-Name')"
+print "You will get a .py and a .xml file of this graph"
index 77338f4b1cfb7c071c3b38f2d4074f4a573c703a..2508794c34dfbdb2f40e9594994491fd89354785 100644 (file)
@@ -185,14 +185,6 @@ SVTK_InteractorStyle
   Superclass::SetInteractor(theInteractor);
 }
 
-//----------------------------------------------------------------------------
-int
-SVTK_InteractorStyle
-::GetState()
-{
-  return State | ForcedState;
-}
-
 //----------------------------------------------------------------------------
 void 
 SVTK_InteractorStyle
index c82b592d5a6e87bb45f7ddfae726646df02021b8..5d04a131895d3c0e92a52ceb41d8e6eadc84fe93 100644 (file)
@@ -78,8 +78,6 @@ class SVTK_EXPORT SVTK_InteractorStyle : public QObject,
   void setViewWindow(SVTK_ViewWindow* theViewWindow);
   void setGUIWindow(QWidget* theWindow);
 
-  virtual int GetState();
-
   void setTriedron(VTKViewer_Trihedron* theTrihedron);
   void setPreselectionProp(const double& theRed = 0, 
                           const double& theGreen = 1,
@@ -136,6 +134,7 @@ class SVTK_EXPORT SVTK_InteractorStyle : public QObject,
                const int left, const int top, 
                const int right, const int bottom);
 
+  int State;
   float MotionFactor;
   float RadianToDegree;                 // constant: for conv from deg to rad
   double myScale;
index 1b32fc424360a69d8c949849c097f79b80c0edc9..a3ecadfc8dc114dd858220b408affb7eb40b7bb4 100644 (file)
@@ -436,7 +436,7 @@ SVTK_RenderWindowInteractor
                                      (event->state() & ShiftButton), 
                                      event->x(), event->y() ) ;
 
-  if(myInteractorStyle->GetState() == VTK_INTERACTOR_STYLE_CAMERA_NONE && !( event->state() & KeyButtonMask )){
+  if(myInteractorStyle->GetState() == VTK_INTERACTOR_STYLE_CAMERA_NONE){
     QContextMenuEvent aEvent( QContextMenuEvent::Mouse,
                               event->pos(), event->globalPos(),
                               event->state() );