]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To introduce generic testing over all types of VISU presentations
authorapo <apo@opencascade.com>
Tue, 31 Oct 2006 05:59:02 +0000 (05:59 +0000)
committerapo <apo@opencascade.com>
Tue, 31 Oct 2006 05:59:02 +0000 (05:59 +0000)
src/VISU_SWIG/visu_change_input.py

index 3cda8ddea7502d49ce30989629457495a0c1b8ff..44c428506dfbe759ee38b676656826771f7444df 100644 (file)
@@ -4,38 +4,99 @@ import VISU
 import SALOMEDS
 from batchmode_visu import *
 
-myViewManager = myVisu.GetViewManager();
+#---------------------------------------------------------------
+def GetPrsType2OldFactoryMethod(theVISUType):
+  if theVISUType == VISU.TGAUSSPOINTS:
+    return myVisu.GaussPointsOnField
+  if theVISUType == VISU.TSCALARMAP:
+    return myVisu.ScalarMapOnField
+  if theVISUType == VISU.TISOSURFACE:
+    return myVisu.IsoSurfacesOnField
+  if theVISUType == VISU.TCUTPLANES:
+    return myVisu.CutPlanesOnField
+  if theVISUType == VISU.TCUTLINES:
+    return myVisu.CutLinesOnField
+  if theVISUType == VISU.TPLOT3D:
+    return myVisu.Plot3DOnField
+  if theVISUType == VISU.TDEFORMEDSHAPE:
+    return myVisu.DeformedShapeOnField
+  if theVISUType == VISU.TVECTORS:
+    return myVisu.VectorsOnField
+  if theVISUType == VISU.TSTREAMLINES:
+    return myVisu.StreamLinesOnField
+  if theVISUType == VISU.TSCALARMAPONDEFORMEDSHAPE:
+    return myVisu.ScalarMapOnDeformedShapeOnField
+  return None
 
-myView = myViewManager.Create3DView();
-myView.SetTitle("The window will be soon destroyed!")
 
-medFile = "TimeStamps.med"
-myFieldName = "vitesse";
+#---------------------------------------------------------------
+def WalkTroughTimeStamps(theVISUType,
+                         theResult, theMeshName,theEntity, theFieldName, theTimeStampNumber,
+                         theViewManager):
+  anOldFactoryMethod = GetPrsType2OldFactoryMethod(theVISUType)
+  
+  aPrs3d = anOldFactoryMethod(theResult, theMeshName, theEntity, theFieldName, theTimeStampNumber)
+  aPrs3d = myVisu.CreatePrs3d(theVISUType, myVisu.GetCurrentStudy())
+  aPrs3d.SetResultObject(theResult)
+  aPrs3d.SetMeshName(theMeshName)
+  aPrs3d.SetEntity(theEntity)
+  aPrs3d.SetFieldName(theFieldName)
+  aPrs3d.SetTimeStampNumber(theTimeStampNumber)
+  if not aPrs3d.Apply():
+    print "It is impossible to create such kind of presentation (%s) with the given parameters" % theVISUType
+    print "\ttheMeshName = '%s'" % theMeshName
+    print "\ttheEntity = %s" % theEntity
+    print "\ttheFieldName = '%s'" % theFieldName
+    print "\ttheTimeStampNumber = %s" % theTimeStampNumber
+    return
+  
+  aView = theViewManager.Create3DView();
+  aView.SetTitle("To test presentation of %s type" % theVISUType)
+  aView.Display(aPrs3d);
+  aView.FitAll()
+
+  aDelay = 0.0
+  for aTimeStampNumber in xrange(1,3):
+    aPrs3d.SetTimeStampNumber(aTimeStampNumber)
+    aPrs3d.Apply()
+    aView.Update();
+    time.sleep(aDelay)
+    pass
+  pass
+
+
+#---------------------------------------------------------------
+PRS3D_TYPE_LIST = []
+PRS3D_TYPE_LIST.append(VISU.TGAUSSPOINTS)
+PRS3D_TYPE_LIST.append(VISU.TSCALARMAP)
+PRS3D_TYPE_LIST.append(VISU.TISOSURFACE)
+PRS3D_TYPE_LIST.append(VISU.TCUTPLANES)
+PRS3D_TYPE_LIST.append(VISU.TCUTLINES)
+PRS3D_TYPE_LIST.append(VISU.TPLOT3D)
+PRS3D_TYPE_LIST.append(VISU.TDEFORMEDSHAPE)
+PRS3D_TYPE_LIST.append(VISU.TVECTORS)
+PRS3D_TYPE_LIST.append(VISU.TSTREAMLINES)
+PRS3D_TYPE_LIST.append(VISU.TSCALARMAPONDEFORMEDSHAPE)
+
+
+#---------------------------------------------------------------
+aMedFile = "TimeStamps.med"
+aMedFile = "ResOK_0000.med"
+aMedFile = os.getenv('DATA_DIR') + '/MedFiles/' + aMedFile
+aResult = myVisu.ImportFile(aMedFile)
 
 aMeshName ="dom"
 anEntity = VISU.NODE
-aTimeStampId = 1
-
-medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile
-myResult = myVisu.ImportFile(medFile)
-
-aPrs3d = myVisu.IsoSurfacesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
-
-aPrs3d = myVisu.CreatePrs3d(VISU.TISOSURFACE,myVisu.GetCurrentStudy())
-aPrs3d.SetResultObject(myResult)
-aPrs3d.SetMeshName(aMeshName)
-aPrs3d.SetEntity(anEntity)
-aPrs3d.SetFieldName(myFieldName)
-aPrs3d.SetTimeStampNumber(aTimeStampId)
-print aPrs3d.Apply()
-
-myView.Display(aPrs3d);
-print "myView.Display(aPrs3d)"
-myView.FitAll()
-
-aDelay = 0.0
-for aTimeStampId in xrange(1,100):
-  aPrs3d.SetTimeStampNumber(aTimeStampId)
-  print aPrs3d.Apply()
-  myView.Update();
-  time.sleep(aDelay)
+aFieldName = "vitesse";
+aTimeStampNumber = 1
+
+aViewManager = myVisu.GetViewManager();
+
+for aVISUType in PRS3D_TYPE_LIST:
+  WalkTroughTimeStamps(aVISUType, aResult, aMeshName, anEntity, aFieldName, aTimeStampNumber, aViewManager)
+  pass
+
+anEntity = VISU.CELL
+aFieldName = "pression";
+
+WalkTroughTimeStamps(VISU.TGAUSSPOINTS, aResult, aMeshName, anEntity, aFieldName, aTimeStampNumber, aViewManager)