]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
To implement inside/outside Gauss Points representation
authorapo <apo@opencascade.com>
Mon, 26 Sep 2005 14:25:37 +0000 (14:25 +0000)
committerapo <apo@opencascade.com>
Mon, 26 Sep 2005 14:25:37 +0000 (14:25 +0000)
src/VISU_I/VISU_GaussPoints_i.cc
src/VISU_I/VISU_GaussPoints_i.hh
src/VISU_I/VISU_Prs3d_i.cc
src/VVTK/VVTK_Renderer.cxx
src/VVTK/VVTK_Renderer.h
src/VVTK/VVTK_View.cxx
src/VVTK/VVTK_View.h
src/VVTK/VVTK_ViewModel.cxx
src/VVTK/VVTK_ViewWindow.cxx
src/VVTK/VVTK_ViewWindow.h

index 2743288e43723fca299712d3fbbaf7ea316994f8..aad5a8bce0037dfaa41d173f93dd498c3ca3cc21 100644 (file)
@@ -188,6 +188,38 @@ VISU::GaussPoints_i
   myIsColored = theColored; 
 }
 
+bool
+VISU::GaussPoints_i
+::SetMainTexture( const QString& theMainTexture ) 
+{
+  bool update = myMainTexture != theMainTexture;
+  myMainTexture = theMainTexture;
+  return update;
+}
+
+const QString&
+VISU::GaussPoints_i
+::GetMainTexture() 
+{ 
+  return myMainTexture; 
+}
+
+bool
+VISU::GaussPoints_i
+::SetAlphaTexture( const QString& theAlphaTexture ) 
+{
+  bool update = myAlphaTexture != theAlphaTexture;
+  myAlphaTexture = theAlphaTexture;
+  return update;
+}
+
+const QString&
+VISU::GaussPoints_i
+::GetAlphaTexture() 
+{ 
+  return myAlphaTexture; 
+}
+
 
 //----------------------------------------------------------------------------
 void
@@ -234,8 +266,8 @@ VISU_PipeLine*
 VISU::GaussPoints_i
 ::GetPipeLine()
 {
-  // We create a new PipeLine instamce in order to provide
-  //   different representation for different actors (basic and segmented)
+  // We create a new PipeLine instance in order to provide
+  //   different representations for different actors (basic and segmented)
   VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
   aPipeLine->ShallowCopy(myPipeLine);
   aPipeLine->Update();
@@ -244,13 +276,15 @@ VISU::GaussPoints_i
 
 
 //----------------------------------------------------------------------------
-VISU_Actor
+VISU_GaussPtsAct
 VISU::GaussPoints_i
-::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
+::OnCreateActor(bool theIsSegmented,
+               const Handle(SALOME_InteractiveObject)& theIO)
 {
-  VISU_GaussPtsAct* anActor = VISU_GaussPtsAct::New();
+  VISU_GaussPtsAct* anActor = VISU_GaussPtsAct::New(theIsSegmented);
   try{
     VISU::Prs3d_i::CreateActor(anActor,theIO);
+    anActor->GetPipeLine()->Delete();
     anActor->SetRepresentation(VTK_POINTS);
     UpdateActor(anActor);
   }catch(...){
@@ -260,12 +294,20 @@ VISU::GaussPoints_i
   return anActor;
 }
 
+VISU_Actor* 
+VISU::GaussPoints_i
+::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) 
+{
+  return OnCreateActor(false,theIO);
+}
+
 //----------------------------------------------------------------------------
 VISU_GaussPtsAct* 
 VISU::GaussPoints_i
 ::CloneActor(VISU_GaussPtsAct* theActor) 
 {
-  if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(CreateActor())){
+  if(MYDEBUG) MESSAGE("GaussPoints_i::CloneActor - this = "<<this);
+  if(VISU_GaussPtsAct* anActor = OnCreateActor(true)){
     theActor->Connect(anActor);
     return anActor;
   }
@@ -290,7 +332,6 @@ VISU::GaussPoints_i
                                       myColor.blue() / 255.0);
     }
     VISU::ScalarMap_i::UpdateActor(theActor);
-    anActor->GetPSMapper()->ShallowCopy(myGaussPointsPL->GetPSMapper());
   }
 }
 
@@ -299,9 +340,8 @@ void
 VISU::GaussPoints_i
 ::UpdateFromActor(VISU_GaussPtsAct* theActor) 
 {
-  bool aChangeMagnification = theActor->ChangeMagnification();
   if(MYDEBUG) MESSAGE("GaussPoints_i::UpdateFromActor - this = "<<this);
-  myGaussPointsPL->ChangeMagnification(aChangeMagnification);
+  myGaussPointsPL->ChangeMagnification(theActor->ChangeMagnification());
   UpdateActors();
 }
 
@@ -331,8 +371,12 @@ VISU::GaussPoints_i
   //cout << command2.latin1() << endl;
   bool convertAlphaTexture = system( command2.latin1() ) == 0;
 
-  if( convertMainTexture && convertAlphaTexture )
-    myGaussPointsPL->SetImageData( VISU_GaussPointsPL::MakeTexture( mainTextureVTI.latin1(),
-                                                                   alphaTextureVTI.latin1() ) );
+  if( convertMainTexture && convertAlphaTexture ){
+    vtkImageData* anImageData = 
+      VISU_GaussPointsPL::MakeTexture( mainTextureVTI.latin1(), 
+                                      alphaTextureVTI.latin1());
+    myGaussPointsPL->SetImageData( anImageData );
+    anImageData->Delete();
+  }
 }
 
index 59ba0d05b8c038acc70155f74f28811c3116b208..b0daf2b536a417484a00d706a74b3e40cda8be88 100644 (file)
@@ -49,9 +49,16 @@ namespace VISU
     explicit
     GaussPoints_i(Result_i* theResult,
                  SALOMEDS::SObject_ptr theSObject);
-    virtual ~GaussPoints_i();
 
-    virtual VISU::VISUType GetType() { return VISU::TGAUSSPOINTS;};
+    virtual
+    ~GaussPoints_i();
+
+    virtual 
+    VISU::VISUType 
+    GetType() 
+    {
+      return VISU::TGAUSSPOINTS;
+    }
 
     typedef VISU::GaussPoints TInterface;
 
@@ -71,23 +78,16 @@ namespace VISU
     ShowColored( bool theColored );
 
     bool
-    SetMainTexture( const QString& theMainTexture ) {
-      bool update = myMainTexture != theMainTexture;
-      myMainTexture = theMainTexture;
-      return update;
-    }
+    SetMainTexture( const QString& theMainTexture );
 
-    QString GetMainTexture() { return myMainTexture; }
+    const QString&
+    GetMainTexture();
 
     bool
-    SetAlphaTexture( const QString& theAlphaTexture ) {
-      bool update = myAlphaTexture != theAlphaTexture;
-      myAlphaTexture = theAlphaTexture;
-      return update;
-    }
+    SetAlphaTexture( const QString& theAlphaTexture );
 
-    QString
-    GetAlphaTexture() { return myAlphaTexture; }
+    const QString&
+    GetAlphaTexture();
 
     void
     SetTextures( const QString& theMainTexture,
@@ -106,6 +106,10 @@ namespace VISU
     VISU_PipeLine* 
     GetPipeLine();
 
+    VISU_GaussPtsAct* 
+    OnCreateActor(bool theIsSegmented,
+                 const Handle(SALOME_InteractiveObject)& theIO = NULL);
+
     VISU_GaussPointsPL *myGaussPointsPL;
 
     bool myIsColored;
index 4ef9bfdee1fc26d0ad8ac7630770c5e9384b07f5..3d6fea4d641ad1ebb9e2fa7163862e712bb1999b 100644 (file)
@@ -40,7 +40,7 @@ using namespace VISU;
 using namespace std;
 
 #ifdef _DEBUG_
-static int MYDEBUG = 0;
+static int MYDEBUG = 1;
 #else
 static int MYDEBUG = 0;
 #endif
@@ -233,7 +233,7 @@ VISU::Prs3d_i
 ::UpdateActor(VISU_Actor* theActor) 
 {
   if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "<<this<<"; theActor = "<<theActor);
-  theActor->GetMapper()->ShallowCopy(myPipeLine->GetMapper());
+  theActor->ShallowCopyPL(myPipeLine);
   theActor->SetPosition(myOffset);
   theActor->Modified();
 }
index 4e8b9f13a8d922e773117ad322fcef8c81406017..8060c0ec7dee891b5f9b1d775e29cee1b0b49631 100644 (file)
@@ -75,6 +75,27 @@ VVTK_Renderer1
   myImplicitFunctionWidget->SetInteractor(NULL);
 }
 
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer1
+::AddActor(VTKViewer_Actor* theActor)
+{
+  if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+    anActor->SetImplicitFunctionWidget(GetImplicitFunctionWidget());
+    SVTK_Renderer::AddActor(anActor);
+  }
+}
+
+//----------------------------------------------------------------------------
+void
+VVTK_Renderer1
+::RemoveActor(VTKViewer_Actor* theActor)
+{
+  using namespace VISU;  
+  if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
+    SVTK_Renderer::RemoveActor(theActor);
+  }
+}
 //----------------------------------------------------------------------------
 void 
 VVTK_Renderer1
@@ -137,17 +158,16 @@ VVTK_Renderer2
 ::SetRenderer1(VVTK_Renderer1* theRenderer)
 {
   myRenderer1 = theRenderer;
-  VISU_ImplicitFunctionWidget* aWidget = myRenderer1->GetImplicitFunctionWidget();
-  aWidget->AddObserver(vtkCommand::EndInteractionEvent, 
+  myWidget = myRenderer1->GetImplicitFunctionWidget();
+  myWidget->AddObserver(vtkCommand::EndInteractionEvent, 
                       myEventCallbackCommand.GetPointer(), 
                       myPriority);
-  aWidget->AddObserver(vtkCommand::EnableEvent, 
+  myWidget->AddObserver(vtkCommand::EnableEvent, 
                       myEventCallbackCommand.GetPointer(), 
                       myPriority);
-  aWidget->AddObserver(vtkCommand::DisableEvent, 
+  myWidget->AddObserver(vtkCommand::DisableEvent, 
                       myEventCallbackCommand.GetPointer(), 
                       myPriority);
-  myImplicitFunction = aWidget->ImplicitFunction();
 }
 
 void 
@@ -179,11 +199,10 @@ void
 VVTK_Renderer2
 ::AddActor(VTKViewer_Actor* theActor)
 {
-  using namespace VISU;  
   if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
-    if(TGaussPtsActorFactory* aFactory = anActor->GetGaussPtsFactory()){
+    if(VISU::TGaussPtsActorFactory* aFactory = anActor->GetGaussPtsFactory()){
       if(VISU_GaussPtsAct* anActor2 = aFactory->CloneActor(anActor)){
-       anActor2->GetGaussPointsPL()->SetImplicitFunction(myImplicitFunction.GetPointer());
+       anActor2->SetImplicitFunctionWidget(myWidget);
        SVTK_Renderer::AddActor(anActor2);
       }
     }
@@ -197,7 +216,6 @@ VVTK_Renderer2
 {
   using namespace VISU;  
   if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
-    anActor->GetGaussPointsPL()->SetImplicitFunction(NULL);
     SVTK_Renderer::RemoveActor(theActor);
   }
 }
index 797a9ee5e563599d51c824ad223a18709df28d76..543a919afcdf911a81abcb84631776be1c8cc93a 100644 (file)
@@ -43,6 +43,14 @@ class VVTK_EXPORT VVTK_Renderer1 : public SVTK_Renderer
   vtkTypeMacro(VVTK_Renderer1,SVTK_Renderer);
   static VVTK_Renderer1* New();
 
+  virtual
+  void 
+  AddActor(VTKViewer_Actor* theActor);
+
+  virtual
+  void 
+  RemoveActor(VTKViewer_Actor* theActor);
+
   virtual
   void 
   SetInteractor(vtkRenderWindowInteractor* theInteractor);
@@ -101,7 +109,7 @@ class VVTK_EXPORT VVTK_Renderer2 : public SVTK_Renderer
   // Priority at which events are processed
   float myPriority;
 
-  vtkSmartPointer<vtkImplicitFunction> myImplicitFunction;
+  VISU_ImplicitFunctionWidget* myWidget;
   VVTK_Renderer1* myRenderer1;
 };
 
index d126b21e316d08fff001e48c9dc592b2a4bbf2cd..519b23260da5ac31fbac8dea6176e9cdfb80e167 100644 (file)
@@ -35,6 +35,7 @@
 #include "VVTK_SegmentationCursorDlg.h"
 
 #include "SUIT_ResourceMgr.h"
+#include "SUIT_Accel.h"
 #include "QtxAction.h"
 
 #include <qtoolbar.h>
@@ -50,12 +51,13 @@ VVTK_MainWindowBase
 {
   myInteractorStyle->Delete();
 
-  this->moveDockWindow(myToolBar,Qt::DockLeft);
+  moveDockWindow(myToolBar,Qt::DockLeft);
+  myActionsMap[NonIsometric]->removeFrom(myToolBar);
 
   myPtsToolBar = new QToolBar(this);
   myPtsToolBar->setCloseMode(QDockWindow::Undocked);
   myPtsToolBar->setLabel(tr("LBL_TOOLBAR_LABEL"));
-  this->moveDockWindow(myPtsToolBar,Qt::DockLeft);
+  moveDockWindow(myPtsToolBar,Qt::DockLeft);
 
   QPixmap aPixmap;
   QtxAction* anAction;
@@ -119,6 +121,22 @@ VVTK_MainWindowBase
   SetSelectionMode(theIsSelectionOn? NodeSelection: ActorSelection);
 }
 
+//----------------------------------------------------------------------------
+int 
+convertAction( const int accelAction );
+
+void 
+VVTK_MainWindowBase
+::action( const int accelAction  )
+{
+  if ( accelAction == SUIT_Accel::ZoomFit )
+    onFitAll();
+  else {
+    int anEvent = convertAction( accelAction );
+    InvokeEvent( anEvent, 0 );
+  }
+}
+
 
 //----------------------------------------------------------------------------
 VVTK_MainWindow1
index 8802bebdb4552233ab7fc07cfcd4cdc87b7437e1..22993d4b2ba6645ef4092289125c9bcb9ce9787f 100644 (file)
@@ -6,7 +6,7 @@
 #endif
 
 #include "VVTK.h"
-#include "SVTK_View.h"
+#include "SVTK_MainWindow.h"
 
 class VVTK_Renderer1;
 class VVTK_Renderer2;
@@ -34,6 +34,10 @@ public:
   void OnInteractorStyleSwitch(bool theIsGaussStyleOn); 
   void OnSelectionModeSwitch(bool theIsSelectionOn); 
 
+  virtual 
+  void
+  action( const int );
+
  protected:
   QToolBar* myPtsToolBar;
   vtkSmartPointer<vtkInteractorStyle> myInteractorStyle;
index cb58635a76ceea21bac19c06fb36f875e15c74d8..e9dd58555e99eca8eab4360b68e82d59a5f5e24a 100644 (file)
@@ -4,8 +4,9 @@
 #include "VVTK_ViewModel.h"
 #include "VVTK_ViewWindow.h"
 
-#include "SVTK_RenderWindowInteractor.h"
 #include "SVTK_View.h"
+#include "SVTK_MainWindow.h"
+#include "SVTK_RenderWindowInteractor.h"
 
 #include "VTKViewer_ViewModel.h"
 
index e27caf2327d128a369e035855dfa612913a4f053..4ec356c8aa81b751a54265268a99d9d1f4e1ccc8 100755 (executable)
@@ -29,6 +29,7 @@
 #include "VVTK_ViewWindow.h"
 #include "VVTK_ViewModel.h"
 #include "VVTK_View.h"
+#include "SVTK_View.h"
 
 #include "SUIT_Session.h"
 
@@ -210,3 +211,14 @@ VVTK_ViewWindow
   myMainWindow1->onFitAll();
   myMainWindow2->onFitAll();
 }
+
+//----------------------------------------------------------------------------
+void 
+VVTK_ViewWindow
+::action( const int accelAction  )
+{
+  if(myMainWindow1->hasFocus())
+    myMainWindow1->action(accelAction);
+  if(myMainWindow2->hasFocus())
+    myMainWindow2->action(accelAction);
+}
index 472420f832c17cbdd1ae481d99aec0320d32cf23..bbfb50c1146b25905d720fb6293c8d7dcdbfc8ea 100755 (executable)
@@ -64,6 +64,10 @@ public slots:
   onFitAll();
 
 protected:
+  virtual 
+  void
+  action( const int );
+
   VVTK_MainWindow1* myMainWindow1;
   SVTK_View* myView1;