]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
minor changes
authorsmh <smh@opencascade.com>
Fri, 23 Apr 2004 08:20:49 +0000 (08:20 +0000)
committersmh <smh@opencascade.com>
Fri, 23 Apr 2004 08:20:49 +0000 (08:20 +0000)
src/VISU_I/VISU_Prs3d_i.cc
src/VISU_I/VISU_ViewManager_i.cc
src/VISU_SWIG/batchmode_visu_view3d.py
src/VISU_SWIG/visu_view3d.py

index 5046a1fe13f11b9a6b8cf453484bd0fb5c3f9a0b..9a71122e5e8036b9ae58e39effee308c4c478a19 100644 (file)
@@ -51,7 +51,7 @@ VISU::Prs3d_i::Prs3d_i(Result_i* theResult, SALOMEDS::SObject_ptr theSObject) :
   myAddToStudy = true;
   myPipeLine = NULL;
   CORBA::String_var aName = myStudy->Name();
-  MESSAGE("Prs3d_i - this = "<<this<<"; StudyId = "<<myStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
+  if(MYDEBUG) MESSAGE("Prs3d_i - this = "<<this<<"; StudyId = "<<myStudy->StudyId()<<"; Name = '"<<aName.in()<<"'");
 }
 
 void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
@@ -61,7 +61,7 @@ void VISU::Prs3d_i::SameAs(const Prs3d_i* theOrigin)
 }
 
 VISU::Prs3d_i::~Prs3d_i() {
-  MESSAGE("~Prs3d_i() - this = "<<this<<"; GetReferenceCount() = "<<myPipeLine->GetReferenceCount());
+  if(MYDEBUG) MESSAGE("~Prs3d_i() - this = "<<this<<"; GetReferenceCount() = "<<myPipeLine->GetReferenceCount());
   myPipeLine->Delete();
   myResult->Destroy();
 }
@@ -91,6 +91,7 @@ void VISU::Prs3d_i::CreateActor(VISU_Actor* theActor, const Handle(SALOME_Intera
 }
 
 void VISU::Prs3d_i::UpdateActor(VISU_Actor* theActor) {
+  if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor() - this = "<<this);
   theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
   theActor->Modified();
 }
@@ -106,6 +107,7 @@ void VISU::Prs3d_i::ToStream(std::ostringstream& theStr){
 }
 
 void VISU::Prs3d_i::Update() {
+  if(MYDEBUG) MESSAGE("Prs3d_i::Update() - this = "<<this);
   try{
     myPipeLine->Update();
   }catch(...){
index 9ad91b5bf4c0b1be1545db89211058b077c14ea9..65d7d1af54dbc23d4306b58a6143df19ff859790 100644 (file)
@@ -70,7 +70,7 @@
 using namespace std;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
 #endif
index 2aa8fa4a076d91c499fae4e12c91166e72ea07df..799ec619d89518955751b92405886afc47460266 100644 (file)
@@ -9,36 +9,17 @@
 
 import os
 import time
+import math
 import VISU
 import SALOMEDS
 from batchmode_visu import *
 
-aDelay = 1
+aDelay = 0
 
 #mySession = batchmode_visu.mySession
 
-medFile = "fra.med"
-myFieldName = "VITESSE";
-
-medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
-myResult = myVisu.ImportFile(medFile)
-
-
-aMeshName ="LE VOLUME"
-anEntity = VISU.NODE
-aMesh = myVisu.MeshOnEntity(myResult, aMeshName, anEntity)
-
-aTimeStampId = 1
-
-aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
-
-aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
-
-aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
-
 myViewManager = myVisu.GetViewManager();
 
-#myView = myViewManager.GetCurrentView();
 myView = myViewManager.Create3DView();
 myView.SetTitle("The window will be soon destroyed!")
 print "myViewManager.Create3DView()"
@@ -60,19 +41,73 @@ myViewManager.Destroy(myView)
 print "myViewManager.Destroy(myView)"
 time.sleep(aDelay)
 
+
+
+medFile = "fra.med"
+myFieldName = "VITESSE";
+
+aMeshName ="LE VOLUME"
+anEntity = VISU.NODE
+aTimeStampId = 1
+
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
+myResult = myVisu.ImportFile(medFile)
+
+
+
 myView = myViewManager.Create3DView();
-myView.SetTitle("The window will be set to 'AAA' view params")
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(0.0,0.3,1.0)
+myView.SetBackground(aColor);
+
+myView.SetTitle("The viewer will display ScalarMap")
 print "myViewManager.Create3DView()"
-time.sleep(aDelay)
+
+aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
 
 myView.Display(aScalarMap);
 print "myView.Display(aScalarMap)"
 myView.SetFocalPoint([0,0,0]);
 print "myView.SetFocalPoint(...)"
-time.sleep(aDelay)
 myView.SetParallelScale(2);
 print "myView.SetParallelScale(...)"
-time.sleep(aDelay)
+myView.FitAll();
+
+aMax = aScalarMap.GetMax()
+aMin = aScalarMap.GetMin()
+aDelta = (aMax - aMin)/2.0
+aNbColors = aScalarMap.GetNbColors()
+aNbColors = 64
+for i in range(2,aNbColors) :
+    aScalarMap.SetNbColors(i)
+    aX = aMin + aDelta*i/aNbColors
+    aY = aMax - aDelta*i/aNbColors
+    aScalarMap.SetRange(aX,aY)
+    myView.Update();
+    time.sleep(aDelay)
+
+aScalarMap.SetRange(aMin,aMax)
+
+print "myView.Update()"
+myView.Update();
+print "myView.FitAll()"
+myView.FitAll();
+
+
+
+myView = myViewManager.Create3DView();
+myView.SetTitle("Here we will display CutPlanes")
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(0.0,0.7,0.0)
+myView.SetBackground(aColor);
+
+aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
+print "myVisu.CutPlanesOnField(...)"
+
+myView.DisplayOnly(aCutPlanes);
+print "myView.DisplayOnly(aCutPlanes)"
 
 aPoint = myView.GetPointOfView();
 aPoint[0] = aPoint[0] + 10;
@@ -83,64 +118,125 @@ myView.ScaleView(VISU.View3D.XAxis,3.0);
 print "myView.ScaleView(...)"
 time.sleep(aDelay)
 
-aColor = SALOMEDS.Color(0.0,0.3,1.0)
-myView.SetBackground(aColor);
-print "myView.SetBackground(...)"
-myView.Update();
-print "myView.Update()"
-time.sleep(aDelay)
-
 myView.FitAll();
-print "myView.FitAll()"
-time.sleep(aDelay)
 
-myView.Erase(aScalarMap);
-print "myView.Erase(aScalarMap)"
-time.sleep(aDelay)
+aNbPlanes = aCutPlanes.GetNbPlanes()
+aNbPlanes = 30
+aXAngle = aCutPlanes.GetRotateX()
+aYAngle = aCutPlanes.GetRotateY()
+anOrientation = aCutPlanes.GetOrientationType()
+for i in range(aNbPlanes,1,-1) :
+    aCutPlanes.SetNbPlanes(i)
+    aX = math.pi/2.0*(aNbPlanes-i)/aNbPlanes
+    aY = math.pi/2.0*(aNbPlanes-i)/aNbPlanes
+    aCutPlanes.SetOrientation(anOrientation,aX,aY)
+    myView.Update();
+    time.sleep(aDelay)
+
+aNbPlanes = 10
+aCutPlanes.SetOrientation(VISU.CutPlanes.ZX,0,0)
+for i in range(1,aNbPlanes) :
+    aCutPlanes.SetNbPlanes(i)
+    myView.Update();
+    time.sleep(aDelay)
 
-myView.DisplayOnly(aCutPlanes);
-print "myView.DisplayOnly(aCutPlanes)"
 myView.SaveViewParams('AAA')
 print "myView.SaveViewParams('AAA')"
 time.sleep(aDelay)
 
+aCutPlanes.SetOrientation(VISU.CutPlanes.XY,0,0)
+myView.RemoveScale();
+
+print "myView.Update()"
+myView.Update();
+print "myView.FitAll()"
+myView.FitAll();
+
+
+
 myView = myViewManager.Create3DView();
-myView.SetTitle("The window will be set to 'BBB' view params")
 print "myViewManager.Create3DView()"
+
+myView.SetTitle("IsoSurface's viewer")
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(1.0,0.7,0.0)
+myView.SetBackground(aColor);
 time.sleep(aDelay)
 
+aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
+
 myView.DisplayOnly(aIsoSurfaces);
+myView.FitAll();
 print "myView.DisplayOnly(aCutPlanes)"
 time.sleep(aDelay)
 
-myView.RestoreViewParams('AAA')
-myView.RemoveScale();
-print "myView.RemoveScale()"
+aNbSurfaces = aIsoSurfaces.GetNbSurfaces()
+aNbSurfaces = 64
+for i in range(2,aNbSurfaces) :
+    aIsoSurfaces.SetNbSurfaces(i)
+    myView.Update();
+    time.sleep(aDelay)
+
+aIsoSurfaces.SetNbSurfaces(10)
+
+print "myView.Update()"
+myView.Update();
+print "myView.FitAll()"
+myView.FitAll();
+
+
+
+myView = myViewManager.Create3DView();
+myView.SetTitle("The viewer for CutLines")
+print "myViewManager.Create3DView()"
 time.sleep(aDelay)
 
-aColor = SALOMEDS.Color(0.0,0.0,0.0)
-myView.SetBackground(aColor);
 print "myView.SetBackground(...)"
-myView.SaveViewParams('BBB');
-print "myView.SaveViewParams('BBB')"
+aColor = SALOMEDS.Color(0.7,0.7,0.7)
+myView.SetBackground(aColor);
 time.sleep(aDelay)
 
-aColor = SALOMEDS.Color(1.0,1.0,1.0)
-myView.SetBackground(aColor);
-print "myView.SetBackground(...)"
+aCutLines = myVisu.CutLinesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
+aCutLines.SetOrientation(VISU.CutPlanes.ZX,0,0)
+aCutLines.SetOrientation2(VISU.CutPlanes.YZ,0,0)
+
+myView.DisplayOnly(aCutLines);
+myView.FitAll();
+print "myView.DisplayOnly(aCutLines)"
 time.sleep(aDelay)
 
-myView.ScaleView(VISU.View3D.ZAxis,0.5);
-print "myView.SetBackground(...)"
-myView.SaveViewParams('CCC');
-print "myView.SaveViewParams('CCC')"
+aSObj = myStudy.FindObjectIOR(aCutLines.GetID())
+aTable = myVisu.CreateTable( aSObj.GetID() )
+print "myVisu.CreateTable(...)"
+
+aTableView = myViewManager.CreateTableView(aTable)
+aTableView.SetTitle('Changed Title')
+
+aContainer = myVisu.CreateContainer()
+print "myVisu.CreateContainer(...)"
+
+aNbCurve = aTable.GetNbRows() - 1
+for i in range(2,aNbCurve):
+   aCurve = myVisu.CreateCurve( aTable, 1, i )
+   print i, aCurve
+   aContainer.AddCurve(aCurve)
+
+
+myView = myViewManager.CreateXYPlot();
+myView.SetTitle("The viewer for Curves from CutLines")
+print "myViewManager.CreateXYPlot()"
 time.sleep(aDelay)
 
-myView.RestoreViewParams('BBB');
-print "myView.RestoreViewParams('BBB')"
+myView.Display(aContainer)
+
+
+
+myView = myViewManager.Create3DView();
+myView.SetTitle("The viewer for Animation")
+print "myViewManager.Create3DView()"
+time.sleep(aDelay)
 
-# Time animation
-myView.EraseAll()
 medFile = "TimeStamps.med"
 myFieldName = "vitesse";
 
@@ -159,8 +255,7 @@ anAnim.generatePresentations(0)
 print "Generate frames"
 anAnim.generateFrames()
 print "Start Animation"
-anAnim.setSpeed(12)
-#anAnim.setCycling(1)
+anAnim.setSpeed(99)
+anAnim.setCycling(1)
 anAnim.startAnimation()
 myView.FitAll()
-#anAnim.clearView()
index 92c0b2b68d00a9c8798161ff1794a034bbc91160..b41578726156936c1e1bb4029af97a435b8959ec 100644 (file)
@@ -9,36 +9,17 @@
 
 import os
 import time
+import math
 import VISU
 import SALOMEDS
 from visu_gui import *
 
-aDelay = 1
+aDelay = 0
 
 #mySession = batchmode_visu.mySession
 
-medFile = "fra.med"
-myFieldName = "VITESSE";
-
-medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
-myResult = myVisu.ImportFile(medFile)
-
-
-aMeshName ="LE VOLUME"
-anEntity = VISU.NODE
-aMesh = myVisu.MeshOnEntity(myResult, aMeshName, anEntity)
-
-aTimeStampId = 1
-
-aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
-
-aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
-
-aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
-
 myViewManager = myVisu.GetViewManager();
 
-#myView = myViewManager.GetCurrentView();
 myView = myViewManager.Create3DView();
 myView.SetTitle("The window will be soon destroyed!")
 print "myViewManager.Create3DView()"
@@ -60,19 +41,73 @@ myViewManager.Destroy(myView)
 print "myViewManager.Destroy(myView)"
 time.sleep(aDelay)
 
+
+
+medFile = "fra.med"
+myFieldName = "VITESSE";
+
+aMeshName ="LE VOLUME"
+anEntity = VISU.NODE
+aTimeStampId = 1
+
+medFile = os.getenv('KERNEL_ROOT_DIR') + '/examples/' + medFile
+myResult = myVisu.ImportFile(medFile)
+
+
+
 myView = myViewManager.Create3DView();
-myView.SetTitle("The window will be set to 'AAA' view params")
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(0.0,0.3,1.0)
+myView.SetBackground(aColor);
+
+myView.SetTitle("The viewer will display ScalarMap")
 print "myViewManager.Create3DView()"
-time.sleep(aDelay)
+
+aScalarMap = myVisu.ScalarMapOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
 
 myView.Display(aScalarMap);
 print "myView.Display(aScalarMap)"
 myView.SetFocalPoint([0,0,0]);
 print "myView.SetFocalPoint(...)"
-time.sleep(aDelay)
 myView.SetParallelScale(2);
 print "myView.SetParallelScale(...)"
-time.sleep(aDelay)
+myView.FitAll();
+
+aMax = aScalarMap.GetMax()
+aMin = aScalarMap.GetMin()
+aDelta = (aMax - aMin)/2.0
+aNbColors = aScalarMap.GetNbColors()
+aNbColors = 64
+for i in range(2,aNbColors) :
+    aScalarMap.SetNbColors(i)
+    aX = aMin + aDelta*i/aNbColors
+    aY = aMax - aDelta*i/aNbColors
+    aScalarMap.SetRange(aX,aY)
+    myView.Update();
+    time.sleep(aDelay)
+
+aScalarMap.SetRange(aMin,aMax)
+
+print "myView.Update()"
+myView.Update();
+print "myView.FitAll()"
+myView.FitAll();
+
+
+
+myView = myViewManager.Create3DView();
+myView.SetTitle("Here we will display CutPlanes")
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(0.0,0.7,0.0)
+myView.SetBackground(aColor);
+
+aCutPlanes = myVisu.CutPlanesOnField(myResult,aMeshName,anEntity,myFieldName,aTimeStampId)
+print "myVisu.CutPlanesOnField(...)"
+
+myView.DisplayOnly(aCutPlanes);
+print "myView.DisplayOnly(aCutPlanes)"
 
 aPoint = myView.GetPointOfView();
 aPoint[0] = aPoint[0] + 10;
@@ -83,64 +118,125 @@ myView.ScaleView(VISU.View3D.XAxis,3.0);
 print "myView.ScaleView(...)"
 time.sleep(aDelay)
 
-aColor = SALOMEDS.Color(0.0,0.3,1.0)
-myView.SetBackground(aColor);
-print "myView.SetBackground(...)"
-myView.Update();
-print "myView.Update()"
-time.sleep(aDelay)
-
 myView.FitAll();
-print "myView.FitAll()"
-time.sleep(aDelay)
 
-myView.Erase(aScalarMap);
-print "myView.Erase(aScalarMap)"
-time.sleep(aDelay)
+aNbPlanes = aCutPlanes.GetNbPlanes()
+aNbPlanes = 30
+aXAngle = aCutPlanes.GetRotateX()
+aYAngle = aCutPlanes.GetRotateY()
+anOrientation = aCutPlanes.GetOrientationType()
+for i in range(aNbPlanes,1,-1) :
+    aCutPlanes.SetNbPlanes(i)
+    aX = math.pi/2.0*(aNbPlanes-i)/aNbPlanes
+    aY = math.pi/2.0*(aNbPlanes-i)/aNbPlanes
+    aCutPlanes.SetOrientation(anOrientation,aX,aY)
+    myView.Update();
+    time.sleep(aDelay)
+
+aNbPlanes = 10
+aCutPlanes.SetOrientation(VISU.CutPlanes.ZX,0,0)
+for i in range(1,aNbPlanes) :
+    aCutPlanes.SetNbPlanes(i)
+    myView.Update();
+    time.sleep(aDelay)
 
-myView.DisplayOnly(aCutPlanes);
-print "myView.DisplayOnly(aCutPlanes)"
 myView.SaveViewParams('AAA')
 print "myView.SaveViewParams('AAA')"
 time.sleep(aDelay)
 
+aCutPlanes.SetOrientation(VISU.CutPlanes.XY,0,0)
+myView.RemoveScale();
+
+print "myView.Update()"
+myView.Update();
+print "myView.FitAll()"
+myView.FitAll();
+
+
+
 myView = myViewManager.Create3DView();
-myView.SetTitle("The window will be set to 'BBB' view params")
 print "myViewManager.Create3DView()"
+
+myView.SetTitle("IsoSurface's viewer")
+
+print "myView.SetBackground(...)"
+aColor = SALOMEDS.Color(1.0,0.7,0.0)
+myView.SetBackground(aColor);
 time.sleep(aDelay)
 
+aIsoSurfaces = myVisu.IsoSurfacesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
+
 myView.DisplayOnly(aIsoSurfaces);
+myView.FitAll();
 print "myView.DisplayOnly(aCutPlanes)"
 time.sleep(aDelay)
 
-myView.RestoreViewParams('AAA')
-myView.RemoveScale();
-print "myView.RemoveScale()"
+aNbSurfaces = aIsoSurfaces.GetNbSurfaces()
+aNbSurfaces = 64
+for i in range(2,aNbSurfaces) :
+    aIsoSurfaces.SetNbSurfaces(i)
+    myView.Update();
+    time.sleep(aDelay)
+
+aIsoSurfaces.SetNbSurfaces(10)
+
+print "myView.Update()"
+myView.Update();
+print "myView.FitAll()"
+myView.FitAll();
+
+
+
+myView = myViewManager.Create3DView();
+myView.SetTitle("The viewer for CutLines")
+print "myViewManager.Create3DView()"
 time.sleep(aDelay)
 
-aColor = SALOMEDS.Color(0.0,0.0,0.0)
-myView.SetBackground(aColor);
 print "myView.SetBackground(...)"
-myView.SaveViewParams('BBB');
-print "myView.SaveViewParams('BBB')"
+aColor = SALOMEDS.Color(0.7,0.7,0.7)
+myView.SetBackground(aColor);
 time.sleep(aDelay)
 
-aColor = SALOMEDS.Color(1.0,1.0,1.0)
-myView.SetBackground(aColor);
-print "myView.SetBackground(...)"
+aCutLines = myVisu.CutLinesOnField(myResult, aMeshName, anEntity, myFieldName, aTimeStampId)
+aCutLines.SetOrientation(VISU.CutPlanes.ZX,0,0)
+aCutLines.SetOrientation2(VISU.CutPlanes.YZ,0,0)
+
+myView.DisplayOnly(aCutLines);
+myView.FitAll();
+print "myView.DisplayOnly(aCutLines)"
 time.sleep(aDelay)
 
-myView.ScaleView(VISU.View3D.ZAxis,0.5);
-print "myView.SetBackground(...)"
-myView.SaveViewParams('CCC');
-print "myView.SaveViewParams('CCC')"
+aSObj = myStudy.FindObjectIOR(aCutLines.GetID())
+aTable = myVisu.CreateTable( aSObj.GetID() )
+print "myVisu.CreateTable(...)"
+
+aTableView = myViewManager.CreateTableView(aTable)
+aTableView.SetTitle('Changed Title')
+
+aContainer = myVisu.CreateContainer()
+print "myVisu.CreateContainer(...)"
+
+aNbCurve = aTable.GetNbRows() - 1
+for i in range(2,aNbCurve):
+   aCurve = myVisu.CreateCurve( aTable, 1, i )
+   print i, aCurve
+   aContainer.AddCurve(aCurve)
+
+
+myView = myViewManager.CreateXYPlot();
+myView.SetTitle("The viewer for Curves from CutLines")
+print "myViewManager.CreateXYPlot()"
 time.sleep(aDelay)
 
-myView.RestoreViewParams('BBB');
-print "myView.RestoreViewParams('BBB')"
+myView.Display(aContainer)
+
+
+
+myView = myViewManager.Create3DView();
+myView.SetTitle("The viewer for Animation")
+print "myViewManager.Create3DView()"
+time.sleep(aDelay)
 
-# Time animation
-myView.EraseAll()
 medFile = "TimeStamps.med"
 myFieldName = "vitesse";
 
@@ -159,8 +255,7 @@ anAnim.generatePresentations(0)
 print "Generate frames"
 anAnim.generateFrames()
 print "Start Animation"
-anAnim.setSpeed(12)
-#anAnim.setCycling(1)
+anAnim.setSpeed(99)
+anAnim.setCycling(1)
 anAnim.startAnimation()
 myView.FitAll()
-#anAnim.clearView()