Version: 6.3.1

src/OBJECT/VISU_GaussPtsAct.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  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 //  VISU OBJECT : interactive object for VISU entities implementation
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.6.2.4.6.1.8.1 2011-06-02 06:00:17 vsr Exp $
00028 //
00029 #ifndef VISU_GaussPtsAct_HeaderFile
00030 #define VISU_GaussPtsAct_HeaderFile
00031 
00032 #include "VISU_OBJECT.h"
00033 #include "VISU_Actor.h"
00034 #include "VISU_GaussPtsActorFactory.h"
00035 
00036 #include <vtkCommand.h>
00037 #include <vtkSmartPointer.h>
00038 
00039 class VISU_GaussPointsPL;
00040 class VISU_WidgetCtrl;
00041 class VISU_OpenGLPointSpriteMapper;
00042 
00043 class vtkTextMapper;
00044 class vtkTextActor;
00045 
00046 class vtkSphereSource;
00047 class vtkPolyDataMapper;
00048 class vtkActor;
00049 class vtkImageData;
00050 class vtkInteractorStyle;
00051 
00052 class VISU_GaussPtsDeviceActor;
00053 class VISU_CursorPyramid;
00054 
00055 class vtkUnstructuredGrid;
00056 class vtkPolyDataMapper;
00057 class vtkDataArray;
00058 
00059 class vtkCellDataToPointData;
00060 class vtkWarpVector;
00061 
00062 class vtkInteractorObserver;
00063 class vtkCallbackCommand;
00064 
00065 class VISU_ScalarBarCtrl;
00066 class VISU_InsideCursorSettings;
00067 class VISU_OutsideCursorSettings;
00068 
00069 class SALOME_ExtractPolyDataGeometry;
00070 class vtkImplicitBoolean;
00071 
00072 //============================================================================
00074 
00083 class VISU_OBJECT_EXPORT VISU_GaussPtsAct : public VISU_Actor
00084 {
00085  public:
00086   vtkTypeMacro(VISU_GaussPtsAct,VISU_Actor);
00087   typedef vtkSmartPointer<VISU_GaussPtsDeviceActor> PDeviceActor;
00088 
00089   static
00090   VISU_GaussPtsAct* 
00091   New();
00092 
00093   //----------------------------------------------------------------------------
00094   virtual
00095   void
00096   SetPipeLine(VISU_PipeLine* thePipeLine) ;
00097   
00098   VISU_GaussPointsPL*
00099   GetGaussPointsPL();
00100 
00102   virtual
00103   void
00104   DeepCopy(VISU_Actor *theActor);
00105 
00106   virtual
00107   void
00108   ShallowCopyPL(VISU_PipeLine* thePipeLine);
00109 
00110   //----------------------------------------------------------------------------
00112   virtual
00113   vtkMapper* 
00114   GetMapper();
00115 
00117   virtual
00118   vtkFloatingPointType* 
00119   GetBounds();
00120 
00122   virtual
00123   vtkDataSet* 
00124   GetInput(); 
00125 
00127   virtual
00128   unsigned long int
00129   GetMemorySize();
00130  
00131   //----------------------------------------------------------------------------
00132   virtual
00133   void
00134   SetOpacity(vtkFloatingPointType theValue);
00135 
00136   //----------------------------------------------------------------------------
00137   virtual
00138   void
00139   SetFactory(VISU::TActorFactory* theActorFactory);
00140   
00141   VISU::TGaussPtsActorFactory*
00142   GetGaussPtsFactory();    
00143 
00144   virtual
00145   void 
00146   SetPosition(double _arg[3]);
00147 
00148   //----------------------------------------------------------------------------
00150   virtual
00151   void
00152   AddToRender(vtkRenderer* theRenderer); 
00153 
00155   virtual
00156   void
00157   RemoveFromRender(vtkRenderer* theRenderer);
00158 
00160   virtual
00161   void
00162   SetInteractor(vtkRenderWindowInteractor* theInteractor);
00163 
00165   virtual
00166   void
00167   SetTransform(VTKViewer_Transform* theTransform);
00168 
00170   virtual
00171   int
00172   RenderOpaqueGeometry(vtkViewport *viewport);
00173 
00175   virtual
00176   int
00177   RenderTranslucentGeometry(vtkViewport *viewport);
00178 
00179   //----------------------------------------------------------------------------
00181   virtual
00182   void
00183   SetVisibility(int theMode);
00184 
00186   virtual
00187   int
00188   IsSegmentationEnabled();
00189 
00191   VISU_ScalarBarCtrl* 
00192   GetScalarBarCtrl();
00193 
00195   void
00196   SetBarVisibility(bool theMode);
00197 
00199   bool
00200   GetBarVisibility();
00201 
00202   virtual 
00203   void
00204   SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
00205 
00207 
00208   bool
00209   GetChangeMagnification();
00210 
00212   virtual
00213   void
00214   ChangeMagnification( bool );
00215 
00216   //----------------------------------------------------------------------------
00218   virtual
00219   void
00220   Highlight(bool theIsHighlight);
00221  
00223   virtual
00224   bool
00225   PreHighlight(vtkInteractorStyle* theInteractorStyle, 
00226                SVTK_SelectionEvent* theSelectionEvent,
00227                bool theIsHighlight);
00228 
00230   virtual
00231   bool
00232   Highlight(vtkInteractorStyle* theInteractorStyle, 
00233             SVTK_SelectionEvent* theSelectionEvent,
00234             bool theIsHighlight);
00235 
00236   //----------------------------------------------------------------------------
00238   void
00239   SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings);
00240 
00241   virtual void
00242   UpdateInsideCursorSettings();
00243 
00244   virtual void
00245   UpdateInsideCursorSettings( PDeviceActor );
00246 
00247   //----------------------------------------------------------------------------
00249   void
00250   UpdatePickingSettings();
00251 
00252   virtual
00253   bool
00254   IsInfinitive();
00255 
00256   virtual
00257   int
00258   GetPickable();
00259 
00260   //----------------------------------------------------------------------------
00261   virtual
00262   unsigned long int 
00263   GetMTime();
00264 
00265   //----------------------------------------------------------------------------
00266   virtual void RemoveAllClippingPlanes();
00267 
00268   virtual vtkIdType GetNumberOfClippingPlanes();
00269 
00270   virtual bool AddClippingPlane(vtkPlane* thePlane);
00271 
00272   virtual vtkPlane* GetClippingPlane(vtkIdType theID);
00273 
00274   virtual vtkImplicitFunctionCollection* GetClippingPlanes();
00275 
00276   //----------------------------------------------------------------------------
00277   virtual
00278   vtkDataSet*
00279   GetValLabelsInput();
00280  
00281  protected:
00282   //----------------------------------------------------------------------------
00283   VISU_GaussPtsAct();
00284 
00285   virtual 
00286   ~VISU_GaussPtsAct();
00287 
00288   // Redefined method of setting mapper input.
00289   virtual 
00290   void
00291   SetMapperInput(vtkDataSet* theDataSet);
00292 
00293   virtual
00294   VISU_PipeLine* 
00295   GetCurrentPL();
00296 
00298   virtual
00299   vtkFloatingPointType
00300   GetRadius(vtkIdType theObjID,
00301             vtkIdType theVTKID,
00302             vtkDataArray *theScalarArray);
00303 
00305   virtual
00306   vtkFloatingPointType
00307   GetMagnification(vtkIdType theObjID);
00308 
00310   virtual
00311   vtkFloatingPointType
00312   GetClamp(vtkIdType theObjID);
00313 
00314   //----------------------------------------------------------------------------
00315   vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
00316 
00318   static
00319   void
00320   ProcessEvents(vtkObject* theObject, 
00321                 unsigned long theEvent,
00322                 void* theClientData, 
00323                 void* theCallData);
00324 
00325   // To process VTK event method
00326   virtual
00327   void
00328   OnInteractorEvent(unsigned long theEvent);
00329 
00330   vtkFloatingPointType myPriority;
00331   bool myChangeMagnification;
00332   VISU::TGaussPtsActorFactory* myGaussPtsActorFactory;
00333   boost::signal1<void,VISU_GaussPtsAct*> myUpdatePrs3dSignal;
00334 
00335   //----------------------------------------------------------------------------
00336   PDeviceActor myDeviceActor;
00337 
00338   VISU_WidgetCtrl* myWidgetCtrl;
00339 
00340   VISU_GaussPointsPL* myCurrentPL;
00341   vtkSmartPointer<VISU_GaussPointsPL> myGaussPointsPL;
00342 
00343   vtkSmartPointer<vtkPolyDataMapper> myMapper;
00344   vtkSmartPointer<SALOME_ExtractPolyDataGeometry> myPolyDataExtractor;
00345   vtkSmartPointer<vtkImplicitBoolean> myFunction;
00346 
00347   vtkIdType myLastPreHighlightObjID;
00348 
00349   vtkSmartPointer<VISU_CursorPyramid> myCursorPyramid;
00350   vtkSmartPointer<VISU_CursorPyramid> myCursorPyramidSelected;
00351   
00352   vtkSmartPointer<vtkUnstructuredGrid> myCellSource;
00353   vtkSmartPointer<SVTK_Actor> myCellActor;
00354 
00355   vtkSmartPointer<vtkWarpVector> myWarpVector;
00356   vtkSmartPointer<vtkCellDataToPointData> myCellDataToPointData;
00357 
00358   bool myBarVisibility;
00359   vtkSmartPointer<VISU_ScalarBarCtrl> myScalarBarCtrl;
00360 
00361   VISU_InsideCursorSettings* myInsideCursorSettings;
00362 };
00363 
00364 
00365 //============================================================================
00366 class VISU_GaussPtsAct2;
00367 
00369 
00374 class VISU_OBJECT_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
00375 {
00376  public:
00377   vtkTypeMacro(VISU_GaussPtsAct1,VISU_GaussPtsAct);
00378 
00379   static
00380   VISU_GaussPtsAct1* 
00381   New();
00382 
00383   virtual
00384   void
00385   ShallowCopyPL(VISU_PipeLine* thePipeLine);
00386 
00387   //----------------------------------------------------------------------------
00389   virtual
00390   void
00391   SetVisibility(int theMode);
00392 
00393   virtual 
00394   void
00395   Connect(VISU_GaussPtsAct2* theActor);
00396 
00397   //----------------------------------------------------------------------------
00398   virtual void
00399   UpdateInsideCursorSettings();
00400 
00401   //----------------------------------------------------------------------------
00403   void
00404   SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
00405 
00407   void
00408   UpdateOutsideCursorSettings();
00409 
00410   //----------------------------------------------------------------------------
00412   virtual
00413   void
00414   AddToRender(vtkRenderer* theRenderer); 
00415 
00417   virtual
00418   void
00419   RemoveFromRender(vtkRenderer* theRenderer);
00420 
00422   virtual
00423   void
00424   SetTransform(VTKViewer_Transform* theTransform);
00425 
00426   virtual 
00427   void
00428   SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
00429 
00431   virtual
00432   int
00433   RenderOpaqueGeometry(vtkViewport *viewport);
00434 
00436   virtual
00437   int
00438   RenderTranslucentGeometry(vtkViewport *viewport);
00439                       
00440   virtual
00441   void 
00442   SetPosition(double _arg[3]);
00443 
00445   virtual
00446   unsigned long int
00447   GetMemorySize();
00448  
00449  protected:
00450   //----------------------------------------------------------------------------
00451   VISU_GaussPtsAct1();
00452 
00453   virtual 
00454   ~VISU_GaussPtsAct1();
00455 
00456   // Redefined method of setting mapper input.
00457   virtual 
00458   void
00459   SetMapperInput(vtkDataSet* theDataSet);
00460 
00462   virtual
00463   vtkFloatingPointType
00464   GetRadius(vtkIdType theObjID,
00465             vtkIdType theVTKID,
00466             vtkDataArray *theScalarArray);
00467 
00469   virtual
00470   vtkFloatingPointType
00471   GetMagnification(vtkIdType theObjID);
00472 
00474   virtual
00475   vtkFloatingPointType
00476   GetClamp(vtkIdType theObjID);
00477 
00478   //----------------------------------------------------------------------------
00479   // Main process VTK event method
00480   static
00481   void
00482   ProcessEvents(vtkObject* theObject, 
00483                 unsigned long theEvent,
00484                 void* theClientData, 
00485                 void* theCallData);
00486 
00487   // To process VTK event method
00488   virtual 
00489   void
00490   OnInteractorEvent(unsigned long theEvent);
00491 
00492   boost::signal1<void,int> mySetVisibilitySignal;
00493   boost::signal1<void,double*> myUpdatePositionSignal;
00494   VISU_OutsideCursorSettings* myOutsideCursorSettings;
00495 
00496   //----------------------------------------------------------------------------
00497   PDeviceActor myInsideDeviceActor;
00498   PDeviceActor myOutsideDeviceActor;
00499 };
00500 
00501 
00503 class VISU_OBJECT_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
00504 {
00505  public:
00506   vtkTypeMacro(VISU_GaussPtsAct2,VISU_GaussPtsAct);
00507 
00508   static
00509   VISU_GaussPtsAct2* 
00510   New();
00511 
00512   // Redefined method of setting mapper input.
00513   virtual 
00514   void
00515   SetMapperInput(vtkDataSet* theDataSet);
00516 
00517   virtual
00518   void
00519   ShallowCopyPL(VISU_PipeLine* thePipeLine);
00520 
00521   //----------------------------------------------------------------------------
00523   virtual
00524   void
00525   SetVisibility(int theMode);
00526 
00527   virtual 
00528   void
00529   SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
00530 
00532   virtual
00533   unsigned long int
00534   GetMemorySize();
00535                       
00536   virtual
00537   void 
00538   SetPosition(double _arg[3]);
00539   
00540  protected:
00541   //----------------------------------------------------------------------------
00542   VISU_GaussPtsAct2();
00543 
00544   virtual 
00545   ~VISU_GaussPtsAct2();
00546 
00547   //----------------------------------------------------------------------------
00548   // To process VTK event method
00549   virtual 
00550   void
00551   OnInteractorEvent(unsigned long theEvent);
00552 };
00553 
00554 
00555 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS