From 78fdc9e50246bec6cf70248d4631e73720e71cee Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 6 Jun 2005 12:37:13 +0000 Subject: [PATCH] This commit was generated by cvs2git to create tag 'T3_0_0_a1'. Sprout from master 2005-06-06 07:12:52 UTC smh 'SMH: Add again in binary mode' Cherrypick from master 2005-06-03 09:50:22 UTC apo '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 'Instead on *in': src/SALOME_SWIG/supervisionexample.py src/SALOME_SWIG/supervisiongeomexample.py --- src/SALOME_SWIG/supervisionexample.py | 85 ++++++++++++++++++ src/SALOME_SWIG/supervisiongeomexample.py | 103 ++++++++++++++++++++++ src/SVTK/SVTK_InteractorStyle.cxx | 8 -- src/SVTK/SVTK_InteractorStyle.h | 3 +- src/SVTK/SVTK_RenderWindowInteractor.cxx | 2 +- 5 files changed, 190 insertions(+), 11 deletions(-) create mode 100755 src/SALOME_SWIG/supervisionexample.py create mode 100755 src/SALOME_SWIG/supervisiongeomexample.py diff --git a/src/SALOME_SWIG/supervisionexample.py b/src/SALOME_SWIG/supervisionexample.py new file mode 100755 index 000000000..56bdd9bf5 --- /dev/null +++ b/src/SALOME_SWIG/supervisionexample.py @@ -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 index 000000000..8c56bb1f2 --- /dev/null +++ b/src/SALOME_SWIG/supervisiongeomexample.py @@ -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" diff --git a/src/SVTK/SVTK_InteractorStyle.cxx b/src/SVTK/SVTK_InteractorStyle.cxx index 77338f4b1..2508794c3 100644 --- a/src/SVTK/SVTK_InteractorStyle.cxx +++ b/src/SVTK/SVTK_InteractorStyle.cxx @@ -185,14 +185,6 @@ SVTK_InteractorStyle Superclass::SetInteractor(theInteractor); } -//---------------------------------------------------------------------------- -int -SVTK_InteractorStyle -::GetState() -{ - return State | ForcedState; -} - //---------------------------------------------------------------------------- void SVTK_InteractorStyle diff --git a/src/SVTK/SVTK_InteractorStyle.h b/src/SVTK/SVTK_InteractorStyle.h index c82b592d5..5d04a1318 100644 --- a/src/SVTK/SVTK_InteractorStyle.h +++ b/src/SVTK/SVTK_InteractorStyle.h @@ -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; diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index 1b32fc424..a3ecadfc8 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -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() ); -- 2.39.2