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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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.
109 vtkFloatingPointType*
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();
239 //----------------------------------------------------------------------------
245 // Redefined method of setting mapper input.
248 SetMapperInput(vtkDataSet* theDataSet);
254 //! To get current value of the radius of the Point Sprite
257 GetRadius(vtkIdType theObjID,
259 vtkDataArray *theScalarArray);
261 //! To get current value of the magnification
264 GetMagnification(vtkIdType theObjID);
266 //! To get current value of the clamp
269 GetClamp(vtkIdType theObjID);
271 //----------------------------------------------------------------------------
272 vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
274 //! Main process VTK event method
277 ProcessEvents(vtkObject* theObject,
278 unsigned long theEvent,
282 // To process VTK event method
285 OnInteractorEvent(unsigned long theEvent);
287 vtkFloatingPointType myPriority;
288 bool myChangeMagnification;
289 VISU::TGaussPtsActorFactory* myGaussPtsActorFactory;
290 boost::signal1<void,VISU_GaussPtsAct*> myUpdatePrs3dSignal;
292 //----------------------------------------------------------------------------
293 PDeviceActor myDeviceActor;
295 VISU_WidgetCtrl* myWidgetCtrl;
297 VISU_GaussPointsPL* myCurrentPL;
298 vtkSmartPointer<VISU_GaussPointsPL> myGaussPointsPL;
300 vtkIdType myLastObjPointID;
302 vtkSmartPointer<VISU_FramedTextActor> myTextActor;
304 vtkSmartPointer<VISU_CursorPyramid> myCursorPyramid;
305 vtkSmartPointer<VISU_CursorPyramid> myCursorPyramidSelected;
307 vtkSmartPointer<vtkUnstructuredGrid> myCellSource;
308 vtkSmartPointer<SVTK_Actor> myCellActor;
310 bool myBarVisibility;
311 vtkSmartPointer<VISU_ScalarBarCtrl> myScalarBarCtrl;
313 VISU_InsideCursorSettings* myInsideCursorSettings;
314 VISU_PickingSettings* myPickingSettings;
318 //============================================================================
319 class VISU_GaussPtsAct2;
321 //! Gauss Points Actor, displayed in the Base View.
323 * Contains device actor (VISU_GaussPtsDeviceActor),
324 * which has two representation modes - outside and
325 * inside segmentation cursor.
327 class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
330 vtkTypeMacro(VISU_GaussPtsAct1,VISU_GaussPtsAct);
338 ShallowCopyPL(VISU_PipeLine* thePipeLine);
340 //----------------------------------------------------------------------------
341 //! Set actor visibility.
344 SetVisibility(int theMode);
348 Connect(VISU_GaussPtsAct2* theActor);
350 //----------------------------------------------------------------------------
352 UpdateInsideCursorSettings();
354 //----------------------------------------------------------------------------
355 //! Set the Outside Cursor Gauss Points settings to the actor.
357 SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
359 //! Apply the Outside Cursor Gauss Points settings on the actor.
361 UpdateOutsideCursorSettings();
363 //----------------------------------------------------------------------------
364 //! Add actor to the renderer.
367 AddToRender(vtkRenderer* theRenderer);
369 //! Remove actor from the renderer.
372 RemoveFromRender(vtkRenderer* theRenderer);
374 //! Apply the transform on the actor.
377 SetTransform(VTKViewer_Transform* theTransform);
379 virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
382 //----------------------------------------------------------------------------
386 ~VISU_GaussPtsAct1();
388 // Redefined method of setting mapper input.
391 SetMapperInput(vtkDataSet* theDataSet);
393 //! To get current value of the radius of the Point Sprite
396 GetRadius(vtkIdType theObjID,
398 vtkDataArray *theScalarArray);
400 //! To get current value of the magnification
403 GetMagnification(vtkIdType theObjID);
405 //! To get current value of the clamp
408 GetClamp(vtkIdType theObjID);
410 //----------------------------------------------------------------------------
411 // Main process VTK event method
414 ProcessEvents(vtkObject* theObject,
415 unsigned long theEvent,
419 // To process VTK event method
422 OnInteractorEvent(unsigned long theEvent);
424 boost::signal1<void,int> mySetVisibilitySignal;
425 VISU_OutsideCursorSettings* myOutsideCursorSettings;
427 //----------------------------------------------------------------------------
428 PDeviceActor myInsideDeviceActor;
429 PDeviceActor myOutsideDeviceActor;
433 //! Gauss Points Actor, displayed in the Segmented View.
434 class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
437 vtkTypeMacro(VISU_GaussPtsAct2,VISU_GaussPtsAct);
443 // Redefined method of setting mapper input.
446 SetMapperInput(vtkDataSet* theDataSet);
450 ShallowCopyPL(VISU_PipeLine* thePipeLine);
452 //----------------------------------------------------------------------------
453 //! Set actor visibility.
456 SetVisibility(int theMode);
458 virtual void SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
461 //----------------------------------------------------------------------------
465 ~VISU_GaussPtsAct2();
467 //----------------------------------------------------------------------------
468 // To process VTK event method
471 OnInteractorEvent(unsigned long theEvent);