1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : VISU_ScalarMapAct.h
25 // Author : Laurent CORNABE with help of Nicolas REJNERI
29 #ifndef VISU_GaussPtsAct_HeaderFile
30 #define VISU_GaussPtsAct_HeaderFile
32 #include "VISU_Actor.h"
33 #include "VISU_GaussPtsActorFactory.h"
35 #include <vtkCommand.h>
36 #include <vtkSmartPointer.h>
38 class VISU_GaussPointsPL;
39 class VISU_WidgetCtrl;
40 class VISU_OpenGLPointSpriteMapper;
45 class vtkSphereSource;
46 class vtkPolyDataMapper;
49 class vtkInteractorStyle;
51 class VISU_GaussPtsDeviceActor;
52 class VISU_CursorPyramid;
53 class VISU_FramedTextActor;
55 class vtkUnstructuredGrid;
56 class vtkDataSetMapper;
59 class vtkInteractorObserver;
60 class vtkCallbackCommand;
62 class VISU_ScalarBarCtrl;
63 class VISU_PickingSettings;
64 class VISU_InsideCursorSettings;
65 class VISU_OutsideCursorSettings;
68 //============================================================================
69 //! Base class for Gauss Points Actors.
71 The actor is responsible for representation of Gauss Points.
72 It render corresponding presentation by usage of corresponding VISU_GaussPtsDeviceActor.
73 Usage of such technic of rendering gives addititional flexibility to change its behaviour in run-time.
74 Also, the base class implements the following functionality:
75 - implements a highlight and prehighlight functionality;
76 - defining a way to handle VISU_ImplicitFunctionWidget;
77 - global / local scalar bar mamangement.
79 class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
82 vtkTypeMacro(VISU_GaussPtsAct,VISU_Actor);
83 typedef vtkSmartPointer<VISU_GaussPtsDeviceActor> PDeviceActor;
89 //----------------------------------------------------------------------------
92 SetPipeLine(VISU_PipeLine* thePipeLine) ;
99 ShallowCopyPL(VISU_PipeLine* thePipeLine);
101 //----------------------------------------------------------------------------
102 //! Redefined method of getting a native mapper of the actor.
107 //! Redefined method of getting an actor bounds.
112 //! Redefined method of getting an actor input.
117 //----------------------------------------------------------------------------
120 SetFactory(VISU::TActorFactory* theActorFactory);
122 VISU::TGaussPtsActorFactory*
123 GetGaussPtsFactory();
125 //----------------------------------------------------------------------------
126 //! Add actor to the renderer.
129 AddToRender(vtkRenderer* theRenderer);
131 //! Remove actor from the renderer.
134 RemoveFromRender(vtkRenderer* theRenderer);
136 //! Set the Render Window Interactor to the actor.
139 SetInteractor(vtkRenderWindowInteractor* theInteractor);
141 //! Apply the transform on the actor.
144 SetTransform(VTKViewer_Transform* theTransform);
146 //! Redefined method of rendering the Opaque Geometry.
149 RenderOpaqueGeometry(vtkViewport *viewport);
151 //! Redefined method of rendering the Translucent Geometry.
154 RenderTranslucentGeometry(vtkViewport *viewport);
156 //----------------------------------------------------------------------------
157 //! Set actor visibility.
160 SetVisibility(int theMode);
162 //! Get segmentation visibility.
165 IsSegmentationEnabled();
167 //! Set Scalar Bar Control to the actor.
171 //! Set the Scalar Bar Control visibility.
173 SetBarVisibility(bool theMode);
175 //! Get the Scalar Bar Control visibility.
179 virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
181 //! Return the information about pipeline magnification changing.
182 /*! True indicates that magnification is increased, false - decreased. */
184 GetChangeMagnification();
186 //! Change the pipeline magnification.
189 ChangeMagnification( bool );
191 //----------------------------------------------------------------------------
192 //! Internal highlight.
195 Highlight(bool theIsHighlight);
197 //! Redefined method of the actor's prehighlighting
200 PreHighlight(vtkInteractorStyle* theInteractorStyle,
201 SVTK_SelectionEvent* theSelectionEvent,
202 bool theIsHighlight);
204 //! Redefined method of the actor's highlighting
207 Highlight(vtkInteractorStyle* theInteractorStyle,
208 SVTK_SelectionEvent* theSelectionEvent,
209 bool theIsHighlight);
211 //----------------------------------------------------------------------------
212 //! Set the picking settings to the actor.
214 SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings);
217 UpdateInsideCursorSettings();
220 UpdateInsideCursorSettings( PDeviceActor );
222 //----------------------------------------------------------------------------
224 SetPickingSettings(VISU_PickingSettings* thePickingSettings);
226 //! Apply the picking settings on the actor.
228 UpdatePickingSettings();
235 //----------------------------------------------------------------------------
241 // Redefined method of setting mapper input.
244 SetMapperInput(vtkDataSet* theDataSet);
250 //! To get current value of the radius of the Point Sprite
253 GetRadius(vtkIdType theObjID,
255 vtkDataArray *theScalarArray);
257 //! To get current value of the magnification
260 GetMagnification(vtkIdType theObjID);
262 //! To get current value of the clamp
265 GetClamp(vtkIdType theObjID);
267 //----------------------------------------------------------------------------
268 vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
270 //! Main process VTK event method
273 ProcessEvents(vtkObject* theObject,
274 unsigned long theEvent,
278 // To process VTK event method
281 OnInteractorEvent(unsigned long theEvent);
284 bool myChangeMagnification;
285 VISU::TGaussPtsActorFactory* myGaussPtsActorFactory;
286 boost::signal1<void,VISU_GaussPtsAct*> myUpdatePrs3dSignal;
288 //----------------------------------------------------------------------------
289 PDeviceActor myDeviceActor;
291 VISU_WidgetCtrl* myWidgetCtrl;
293 VISU_GaussPointsPL* myCurrentPL;
294 vtkSmartPointer<VISU_GaussPointsPL> myGaussPointsPL;
296 vtkIdType myLastObjPointID;
298 vtkSmartPointer<VISU_FramedTextActor> myTextActor;
300 vtkSmartPointer<VISU_CursorPyramid> myCursorPyramid;
301 vtkSmartPointer<VISU_CursorPyramid> myCursorPyramidSelected;
303 vtkSmartPointer<vtkUnstructuredGrid> myCellSource;
304 vtkSmartPointer<SVTK_Actor> myCellActor;
306 bool myBarVisibility;
307 vtkSmartPointer<VISU_ScalarBarCtrl> myScalarBarCtrl;
309 VISU_InsideCursorSettings* myInsideCursorSettings;
310 VISU_PickingSettings* myPickingSettings;
314 //============================================================================
315 class VISU_GaussPtsAct2;
317 //! Gauss Points Actor, displayed in the Base View.
319 * Contains device actor (VISU_GaussPtsDeviceActor),
320 * which has two representation modes - outside and
321 * inside segmentation cursor.
323 class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
326 vtkTypeMacro(VISU_GaussPtsAct1,VISU_GaussPtsAct);
334 ShallowCopyPL(VISU_PipeLine* thePipeLine);
336 //----------------------------------------------------------------------------
337 //! Set actor visibility.
340 SetVisibility(int theMode);
344 Connect(VISU_GaussPtsAct2* theActor);
346 //----------------------------------------------------------------------------
348 UpdateInsideCursorSettings();
350 //----------------------------------------------------------------------------
351 //! Set the Outside Cursor Gauss Points settings to the actor.
353 SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
355 //! Apply the Outside Cursor Gauss Points settings on the actor.
357 UpdateOutsideCursorSettings();
359 //----------------------------------------------------------------------------
360 //! Add actor to the renderer.
363 AddToRender(vtkRenderer* theRenderer);
365 //! Remove actor from the renderer.
368 RemoveFromRender(vtkRenderer* theRenderer);
370 //! Apply the transform on the actor.
373 SetTransform(VTKViewer_Transform* theTransform);
375 virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
378 //----------------------------------------------------------------------------
382 ~VISU_GaussPtsAct1();
384 // Redefined method of setting mapper input.
387 SetMapperInput(vtkDataSet* theDataSet);
389 //! To get current value of the radius of the Point Sprite
392 GetRadius(vtkIdType theObjID,
394 vtkDataArray *theScalarArray);
396 //! To get current value of the magnification
399 GetMagnification(vtkIdType theObjID);
401 //! To get current value of the clamp
404 GetClamp(vtkIdType theObjID);
406 //----------------------------------------------------------------------------
407 // Main process VTK event method
410 ProcessEvents(vtkObject* theObject,
411 unsigned long theEvent,
415 // To process VTK event method
418 OnInteractorEvent(unsigned long theEvent);
420 boost::signal1<void,int> mySetVisibilitySignal;
421 VISU_OutsideCursorSettings* myOutsideCursorSettings;
423 //----------------------------------------------------------------------------
424 PDeviceActor myInsideDeviceActor;
425 PDeviceActor myOutsideDeviceActor;
429 //! Gauss Points Actor, displayed in the Segmented View.
430 class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
433 vtkTypeMacro(VISU_GaussPtsAct2,VISU_GaussPtsAct);
439 // Redefined method of setting mapper input.
442 SetMapperInput(vtkDataSet* theDataSet);
446 ShallowCopyPL(VISU_PipeLine* thePipeLine);
448 //----------------------------------------------------------------------------
449 //! Set actor visibility.
452 SetVisibility(int theMode);
454 virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
457 //----------------------------------------------------------------------------
461 ~VISU_GaussPtsAct2();
463 //----------------------------------------------------------------------------
464 // To process VTK event method
467 OnInteractorEvent(unsigned long theEvent);