Salome HOME
sources v1.2c
[modules/visu.git] / src / VISU_I / VISU_ViewManager_i.cc
index f93106df75988359da56207404875a65cfe781c1..1035f51fbacc903f6230498966482ff7f912a986 100644 (file)
@@ -1,14 +1,44 @@
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//  VISU OBJECT : interactive object for VISU entities implementation
 //
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
 //
 //
-//  File   : VISU_ViewManager_i.cxx
+//  File   : VISU_ViewManager_i.cc
 //  Author : Alexey PETROV
 //  Module : VISU
 
-using namespace std;
 #include "VISU_ViewManager_i.hh"
+
 #include "VISU_PrsObject_i.hh"
+#include "VISU_Result_i.hh"
+
+#include "VISU_Prs3d_i.hh"
+#include "VISU_Mesh_i.hh"
+#include "VISU_ScalarMap_i.hh"
+#include "VISU_IsoSurfaces_i.hh"
+#include "VISU_DeformedShape_i.hh"
+#include "VISU_CutPlanes_i.hh"
+#include "VISU_CutLines_i.hh"
+#include "VISU_Vectors_i.hh"
+#include "VISU_StreamLines_i.hh"
+
 #include "VISU_Table_i.hh"
 #include "VISU_ScalarBarActor.hxx"
 #include "VISU_Actor.h"
@@ -19,24 +49,25 @@ using namespace std;
 #include "QAD_Study.h"
 #include "QAD_RightFrame.h"
 #include "QAD_StudyFrame.h"
-#include <qstring.h>
-#include <qfileinfo.h>
 
+#include "VTKViewer_ViewFrame.h"
 #include "SALOMEGUI_TableDlg.h"
 #include "Plot2d_CurveContainer.h"
 #include "Plot2d_ViewFrame.h"
-//#include "SALOMEGUI_SetupCurveDlg.h"
-//#include "SALOMEGUI_SetupPlot2dDlg.h"
 
-#include "VTKViewer_ViewFrame.h"
+#include <memory>
+
+#include <qstring.h>
+#include <qfileinfo.h>
+
 #include <vtkTransformPolyDataFilter.h>
 #include <vtkDataSetMapper.h>
 #include <vtkRenderer.h>
 #include <vtkCamera.h>
 
-#include <memory>
+using namespace std;
 
-#ifdef DEBUG
+#ifdef _DEBUG_
 static int MYDEBUG = 0;
 #else
 static int MYDEBUG = 0;
@@ -72,7 +103,7 @@ namespace VISU{
     for(anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL;){
       if(anActor->IsA("VISU_Actor")){ 
        anVISUActor = VISU_Actor::SafeDownCast(anActor);
-       if (thePrs == anVISUActor->getPrs3d()) {
+       if (thePrs == anVISUActor->GetPrs3d()) {
          aResActor = anVISUActor->GetParent();
          if(theDisplaing < eErase)
            aResActor->VisibilityOn();
@@ -91,11 +122,11 @@ namespace VISU{
       return aResActor;
     }
     if(thePrs != NULL && theDisplaing < eErase){
-      anVISUActor = thePrs->CreateActor();
-      if(anVISUActor)
+      try{
+       anVISUActor = thePrs->CreateActor();
        vf->AddActor(anVISUActor);
-      else{
-       MESSAGE ("Null actor is created");
+      }catch(std::runtime_error& exc){
+       INFOS("Null actor is created");
        return NULL;
       }
     }
@@ -289,6 +320,20 @@ namespace VISU{
       return;
     }
   }
+
+
+  void ViewManager_i::ProcessEvents() {
+    while (true) {
+      qApp->lock();
+      qApp->syncX();
+      qApp->flushX(); 
+      qApp->processEvents();
+      qApp->unlock();
+      //sleep(1);
+    }
+  }
+
+
   //===========================================================================
   View_i::View_i(SALOMEDS::Study_ptr theStudy) {
     if(MYDEBUG) MESSAGE("View_i::View_i");
@@ -348,7 +393,7 @@ namespace VISU{
   void XYPlot_i::Update() {
     if(MYDEBUG) MESSAGE("XYPlot_i::Update");
     Mutex mt(myMutex,qApp,MYDELAY);
-    myName = myStudyFrame->title();
+    myName = (const char*)(myStudyFrame->title());
     myView->Repaint();
   }
   void XYPlot_i::Close(){
@@ -767,7 +812,7 @@ namespace VISU{
     vtkActor *actor;
     while(actor = theActors->GetNextActor()){
       if(VISU_Actor* anActor = dynamic_cast<VISU_Actor*>(actor)){
-       VISU::Prs3d_i* aPrs3d  = anActor->getPrs3d();
+       VISU::Prs3d_i* aPrs3d  = anActor->GetPrs3d();
        if(anActor->GetVisibility() && aPrs3d){
          aPrs3d->Update();
          aPrs3d->UpdateActor(anActor);