src/OBJECT/VISU_GaussPtsAct.h

Go to the documentation of this file.
00001 //  VISU OBJECT : interactive object for VISU entities implementation
00002 //
00003 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
00005 // 
00006 //  This library is free software; you can redistribute it and/or 
00007 //  modify it under the terms of the GNU Lesser General Public 
00008 //  License as published by the Free Software Foundation; either 
00009 //  version 2.1 of the License. 
00010 // 
00011 //  This library is distributed in the hope that it will be useful, 
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00014 //  Lesser General Public License for more details. 
00015 // 
00016 //  You should have received a copy of the GNU Lesser General Public 
00017 //  License along with this library; if not, write to the Free Software 
00018 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
00019 // 
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 //
00023 //
00024 //  File   : VISU_ScalarMapAct.h
00025 //  Author : Laurent CORNABE with help of Nicolas REJNERI
00026 //  Module : VISU
00027 //  $Header: /home/server/cvs/VISU/VISU_SRC/src/OBJECT/VISU_GaussPtsAct.h,v 1.4 2006/06/01 11:36:04 jfa Exp $
00028 
00029 #ifndef VISU_GaussPtsAct_HeaderFile
00030 #define VISU_GaussPtsAct_HeaderFile
00031 
00032 #include "VISU_Actor.h"
00033 #include "VISU_GaussPtsActorFactory.h"
00034 
00035 #include <vtkCommand.h>
00036 #include <vtkSmartPointer.h>
00037 
00038 class VISU_GaussPointsPL;
00039 class VISU_WidgetCtrl;
00040 class VISU_OpenGLPointSpriteMapper;
00041 
00042 class vtkTextMapper;
00043 class vtkTextActor;
00044 
00045 class vtkSphereSource;
00046 class vtkPolyDataMapper;
00047 class vtkActor;
00048 class vtkImageData;
00049 class vtkInteractorStyle;
00050 
00051 class VISU_GaussPtsDeviceActor;
00052 class VISU_CursorPyramid;
00053 class VISU_FramedTextActor;
00054 
00055 class vtkUnstructuredGrid;
00056 class vtkDataSetMapper;
00057 class vtkDataArray;
00058 
00059 class vtkInteractorObserver;
00060 class vtkCallbackCommand;
00061 
00062 class VISU_ScalarBarCtrl;
00063 class VISU_PickingSettings;
00064 class VISU_InsideCursorSettings;
00065 class VISU_OutsideCursorSettings;
00066 
00067 
00068 //============================================================================
00070 
00079 class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
00080 {
00081  public:
00082   vtkTypeMacro(VISU_GaussPtsAct,VISU_Actor);
00083   typedef vtkSmartPointer<VISU_GaussPtsDeviceActor> PDeviceActor;
00084 
00085   static
00086   VISU_GaussPtsAct* 
00087   New();
00088 
00089   //----------------------------------------------------------------------------
00090   virtual
00091   void
00092   SetPipeLine(VISU_PipeLine* thePipeLine) ;
00093   
00094   VISU_GaussPointsPL*
00095   GetGaussPointsPL();
00096 
00097   virtual
00098   void
00099   ShallowCopyPL(VISU_PipeLine* thePipeLine);
00100 
00101   //----------------------------------------------------------------------------
00103   virtual
00104   vtkMapper* 
00105   GetMapper();
00106 
00108   virtual
00109   vtkFloatingPointType* 
00110   GetBounds();
00111 
00113   virtual
00114   vtkDataSet* 
00115   GetInput(); 
00116 
00117   //----------------------------------------------------------------------------
00118   virtual
00119   void
00120   SetFactory(VISU::TActorFactory* theActorFactory);
00121   
00122   VISU::TGaussPtsActorFactory*
00123   GetGaussPtsFactory();    
00124 
00125   //----------------------------------------------------------------------------
00127   virtual
00128   void
00129   AddToRender(vtkRenderer* theRenderer); 
00130 
00132   virtual
00133   void
00134   RemoveFromRender(vtkRenderer* theRenderer);
00135 
00137   virtual
00138   void
00139   SetInteractor(vtkRenderWindowInteractor* theInteractor);
00140 
00142   virtual
00143   void
00144   SetTransform(VTKViewer_Transform* theTransform);
00145 
00147   virtual
00148   int
00149   RenderOpaqueGeometry(vtkViewport *viewport);
00150 
00152   virtual
00153   int
00154   RenderTranslucentGeometry(vtkViewport *viewport);
00155 
00156   //----------------------------------------------------------------------------
00158   virtual
00159   void
00160   SetVisibility(int theMode);
00161 
00163   virtual
00164   int
00165   IsSegmentationEnabled();
00166 
00168   VISU_ScalarBarCtrl* 
00169   GetScalarBarCtrl();
00170 
00172   void
00173   SetBarVisibility(bool theMode);
00174 
00176   bool
00177   GetBarVisibility();
00178 
00179   virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
00180 
00182 
00183   bool
00184   GetChangeMagnification();
00185 
00187   virtual
00188   void
00189   ChangeMagnification( bool );
00190 
00191   //----------------------------------------------------------------------------
00193   virtual
00194   void
00195   Highlight(bool theIsHighlight);
00196  
00198   virtual
00199   bool
00200   PreHighlight(vtkInteractorStyle* theInteractorStyle, 
00201             SVTK_SelectionEvent* theSelectionEvent,
00202             bool theIsHighlight);
00203 
00205   virtual
00206   bool
00207   Highlight(vtkInteractorStyle* theInteractorStyle, 
00208          SVTK_SelectionEvent* theSelectionEvent,
00209          bool theIsHighlight);
00210 
00211   //----------------------------------------------------------------------------
00213   void
00214   SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings);
00215 
00216   virtual void
00217   UpdateInsideCursorSettings();
00218 
00219   virtual void
00220   UpdateInsideCursorSettings( PDeviceActor );
00221 
00222   //----------------------------------------------------------------------------
00223   void
00224   SetPickingSettings(VISU_PickingSettings* thePickingSettings);
00225 
00227   void
00228   UpdatePickingSettings();
00229 
00230   virtual
00231   bool
00232   IsInfinitive();
00233 
00234   virtual
00235   int
00236   GetPickable();
00237 
00238  protected:
00239   //----------------------------------------------------------------------------
00240   VISU_GaussPtsAct();
00241 
00242   virtual 
00243   ~VISU_GaussPtsAct();
00244 
00245   // Redefined method of setting mapper input.
00246   virtual 
00247   void
00248   SetMapperInput(vtkDataSet* theDataSet);
00249 
00250   virtual
00251   VISU_PipeLine* 
00252   GetCurrentPL();
00253 
00255   virtual
00256   vtkFloatingPointType
00257   GetRadius(vtkIdType theObjID,
00258          vtkIdType theVTKID,
00259          vtkDataArray *theScalarArray);
00260 
00262   virtual
00263   vtkFloatingPointType
00264   GetMagnification(vtkIdType theObjID);
00265 
00267   virtual
00268   vtkFloatingPointType
00269   GetClamp(vtkIdType theObjID);
00270 
00271   //----------------------------------------------------------------------------
00272   vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
00273 
00275   static
00276   void
00277   ProcessEvents(vtkObject* theObject, 
00278           unsigned long theEvent,
00279           void* theClientData, 
00280           void* theCallData);
00281 
00282   // To process VTK event method
00283   virtual
00284   void
00285   OnInteractorEvent(unsigned long theEvent);
00286 
00287   vtkFloatingPointType myPriority;
00288   bool myChangeMagnification;
00289   VISU::TGaussPtsActorFactory* myGaussPtsActorFactory;
00290   boost::signal1<void,VISU_GaussPtsAct*> myUpdatePrs3dSignal;
00291 
00292   //----------------------------------------------------------------------------
00293   PDeviceActor myDeviceActor;
00294 
00295   VISU_WidgetCtrl* myWidgetCtrl;
00296 
00297   VISU_GaussPointsPL* myCurrentPL;
00298   vtkSmartPointer<VISU_GaussPointsPL> myGaussPointsPL;
00299 
00300   vtkIdType myLastObjPointID;
00301 
00302   vtkSmartPointer<VISU_FramedTextActor> myTextActor;
00303 
00304   vtkSmartPointer<VISU_CursorPyramid> myCursorPyramid;
00305   vtkSmartPointer<VISU_CursorPyramid> myCursorPyramidSelected;
00306   
00307   vtkSmartPointer<vtkUnstructuredGrid> myCellSource;
00308   vtkSmartPointer<SVTK_Actor> myCellActor;
00309 
00310   bool myBarVisibility;
00311   vtkSmartPointer<VISU_ScalarBarCtrl> myScalarBarCtrl;
00312 
00313   VISU_InsideCursorSettings* myInsideCursorSettings;
00314   VISU_PickingSettings* myPickingSettings;
00315 };
00316 
00317 
00318 //============================================================================
00319 class VISU_GaussPtsAct2;
00320 
00322 
00327 class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
00328 {
00329  public:
00330   vtkTypeMacro(VISU_GaussPtsAct1,VISU_GaussPtsAct);
00331 
00332   static
00333   VISU_GaussPtsAct1* 
00334   New();
00335 
00336   virtual
00337   void
00338   ShallowCopyPL(VISU_PipeLine* thePipeLine);
00339 
00340   //----------------------------------------------------------------------------
00342   virtual
00343   void
00344   SetVisibility(int theMode);
00345 
00346   virtual 
00347   void
00348   Connect(VISU_GaussPtsAct2* theActor);
00349 
00350   //----------------------------------------------------------------------------
00351   virtual void
00352   UpdateInsideCursorSettings();
00353 
00354   //----------------------------------------------------------------------------
00356   void
00357   SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
00358 
00360   void
00361   UpdateOutsideCursorSettings();
00362 
00363   //----------------------------------------------------------------------------
00365   virtual
00366   void
00367   AddToRender(vtkRenderer* theRenderer); 
00368 
00370   virtual
00371   void
00372   RemoveFromRender(vtkRenderer* theRenderer);
00373 
00375   virtual
00376   void
00377   SetTransform(VTKViewer_Transform* theTransform);
00378 
00379   virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
00380 
00381  protected:
00382   //----------------------------------------------------------------------------
00383   VISU_GaussPtsAct1();
00384 
00385   virtual 
00386   ~VISU_GaussPtsAct1();
00387 
00388   // Redefined method of setting mapper input.
00389   virtual 
00390   void
00391   SetMapperInput(vtkDataSet* theDataSet);
00392 
00394   virtual
00395   vtkFloatingPointType
00396   GetRadius(vtkIdType theObjID,
00397          vtkIdType theVTKID,
00398          vtkDataArray *theScalarArray);
00399 
00401   virtual
00402   vtkFloatingPointType
00403   GetMagnification(vtkIdType theObjID);
00404 
00406   virtual
00407   vtkFloatingPointType
00408   GetClamp(vtkIdType theObjID);
00409 
00410   //----------------------------------------------------------------------------
00411   // Main process VTK event method
00412   static
00413   void
00414   ProcessEvents(vtkObject* theObject, 
00415           unsigned long theEvent,
00416           void* theClientData, 
00417           void* theCallData);
00418 
00419   // To process VTK event method
00420   virtual 
00421   void
00422   OnInteractorEvent(unsigned long theEvent);
00423 
00424   boost::signal1<void,int> mySetVisibilitySignal;
00425   VISU_OutsideCursorSettings* myOutsideCursorSettings;
00426 
00427   //----------------------------------------------------------------------------
00428   PDeviceActor myInsideDeviceActor;
00429   PDeviceActor myOutsideDeviceActor;
00430 };
00431 
00432 
00434 class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
00435 {
00436  public:
00437   vtkTypeMacro(VISU_GaussPtsAct2,VISU_GaussPtsAct);
00438 
00439   static
00440   VISU_GaussPtsAct2* 
00441   New();
00442 
00443   // Redefined method of setting mapper input.
00444   virtual 
00445   void
00446   SetMapperInput(vtkDataSet* theDataSet);
00447 
00448   virtual
00449   void
00450   ShallowCopyPL(VISU_PipeLine* thePipeLine);
00451 
00452   //----------------------------------------------------------------------------
00454   virtual
00455   void
00456   SetVisibility(int theMode);
00457 
00458   virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
00459 
00460  protected:
00461   //----------------------------------------------------------------------------
00462   VISU_GaussPtsAct2();
00463 
00464   virtual 
00465   ~VISU_GaussPtsAct2();
00466 
00467   //----------------------------------------------------------------------------
00468   // To process VTK event method
00469   virtual 
00470   void
00471   OnInteractorEvent(unsigned long theEvent);
00472 };
00473 
00474 
00475 #endif