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 vtkPolyDataMapper;
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) ;
97 //! Copies all properties from the given actor
100 DeepCopy(VISU_Actor *theActor);
104 ShallowCopyPL(VISU_PipeLine* thePipeLine);
106 //----------------------------------------------------------------------------
107 //! Redefined method of getting a native mapper of the actor.
112 //! Redefined method of getting an actor bounds.
114 vtkFloatingPointType*
117 //! Redefined method of getting an actor input.
122 //! Gets memory size used by the instance (bytes).
127 //----------------------------------------------------------------------------
130 SetFactory(VISU::TActorFactory* theActorFactory);
132 VISU::TGaussPtsActorFactory*
133 GetGaussPtsFactory();
135 //----------------------------------------------------------------------------
136 //! Add actor to the renderer.
139 AddToRender(vtkRenderer* theRenderer);
141 //! Remove actor from the renderer.
144 RemoveFromRender(vtkRenderer* theRenderer);
146 //! Set the Render Window Interactor to the actor.
149 SetInteractor(vtkRenderWindowInteractor* theInteractor);
151 //! Apply the transform on the actor.
154 SetTransform(VTKViewer_Transform* theTransform);
156 //! Redefined method of rendering the Opaque Geometry.
159 RenderOpaqueGeometry(vtkViewport *viewport);
161 //! Redefined method of rendering the Translucent Geometry.
164 RenderTranslucentGeometry(vtkViewport *viewport);
166 //----------------------------------------------------------------------------
167 //! Set actor visibility.
170 SetVisibility(int theMode);
172 //! Get segmentation visibility.
175 IsSegmentationEnabled();
177 //! Set Scalar Bar Control to the actor.
181 //! Set the Scalar Bar Control visibility.
183 SetBarVisibility(bool theMode);
185 //! Get the Scalar Bar Control visibility.
191 SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
193 //! Return the information about pipeline magnification changing.
194 /*! True indicates that magnification is increased, false - decreased. */
196 GetChangeMagnification();
198 //! Change the pipeline magnification.
201 ChangeMagnification( bool );
203 //----------------------------------------------------------------------------
204 //! Internal highlight.
207 Highlight(bool theIsHighlight);
209 //! Redefined method of the actor's prehighlighting
212 PreHighlight(vtkInteractorStyle* theInteractorStyle,
213 SVTK_SelectionEvent* theSelectionEvent,
214 bool theIsHighlight);
216 //! Redefined method of the actor's highlighting
219 Highlight(vtkInteractorStyle* theInteractorStyle,
220 SVTK_SelectionEvent* theSelectionEvent,
221 bool theIsHighlight);
223 //----------------------------------------------------------------------------
224 //! Set the picking settings to the actor.
226 SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings);
229 UpdateInsideCursorSettings();
232 UpdateInsideCursorSettings( PDeviceActor );
234 //----------------------------------------------------------------------------
236 SetPickingSettings(VISU_PickingSettings* thePickingSettings);
238 //! Apply the picking settings on the actor.
240 UpdatePickingSettings();
250 //----------------------------------------------------------------------------
256 //----------------------------------------------------------------------------
262 // Redefined method of setting mapper input.
265 SetMapperInput(vtkDataSet* theDataSet);
271 //! To get current value of the radius of the Point Sprite
274 GetRadius(vtkIdType theObjID,
276 vtkDataArray *theScalarArray);
278 //! To get current value of the magnification
281 GetMagnification(vtkIdType theObjID);
283 //! To get current value of the clamp
286 GetClamp(vtkIdType theObjID);
288 //----------------------------------------------------------------------------
289 vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
291 //! Main process VTK event method
294 ProcessEvents(vtkObject* theObject,
295 unsigned long theEvent,
299 // To process VTK event method
302 OnInteractorEvent(unsigned long theEvent);
304 vtkFloatingPointType myPriority;
305 bool myChangeMagnification;
306 VISU::TGaussPtsActorFactory* myGaussPtsActorFactory;
307 boost::signal1<void,VISU_GaussPtsAct*> myUpdatePrs3dSignal;
309 //----------------------------------------------------------------------------
310 PDeviceActor myDeviceActor;
312 VISU_WidgetCtrl* myWidgetCtrl;
314 VISU_GaussPointsPL* myCurrentPL;
315 vtkSmartPointer<VISU_GaussPointsPL> myGaussPointsPL;
317 vtkSmartPointer<vtkPolyDataMapper> myMapper;
319 vtkIdType myLastPreHighlightObjID;
321 vtkSmartPointer<VISU_FramedTextActor> myTextActor;
323 vtkSmartPointer<VISU_CursorPyramid> myCursorPyramid;
324 vtkSmartPointer<VISU_CursorPyramid> myCursorPyramidSelected;
326 vtkSmartPointer<vtkUnstructuredGrid> myCellSource;
327 vtkSmartPointer<SVTK_Actor> myCellActor;
329 bool myBarVisibility;
330 vtkSmartPointer<VISU_ScalarBarCtrl> myScalarBarCtrl;
332 VISU_InsideCursorSettings* myInsideCursorSettings;
333 VISU_PickingSettings* myPickingSettings;
337 //============================================================================
338 class VISU_GaussPtsAct2;
340 //! Gauss Points Actor, displayed in the Base View.
342 * Contains device actor (VISU_GaussPtsDeviceActor),
343 * which has two representation modes - outside and
344 * inside segmentation cursor.
346 class VTKOCC_EXPORT VISU_GaussPtsAct1 : public VISU_GaussPtsAct
349 vtkTypeMacro(VISU_GaussPtsAct1,VISU_GaussPtsAct);
357 ShallowCopyPL(VISU_PipeLine* thePipeLine);
359 //----------------------------------------------------------------------------
360 //! Set actor visibility.
363 SetVisibility(int theMode);
367 Connect(VISU_GaussPtsAct2* theActor);
369 //----------------------------------------------------------------------------
371 UpdateInsideCursorSettings();
373 //----------------------------------------------------------------------------
374 //! Set the Outside Cursor Gauss Points settings to the actor.
376 SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings);
378 //! Apply the Outside Cursor Gauss Points settings on the actor.
380 UpdateOutsideCursorSettings();
382 //----------------------------------------------------------------------------
383 //! Add actor to the renderer.
386 AddToRender(vtkRenderer* theRenderer);
388 //! Remove actor from the renderer.
391 RemoveFromRender(vtkRenderer* theRenderer);
393 //! Apply the transform on the actor.
396 SetTransform(VTKViewer_Transform* theTransform);
400 SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
402 //! Gets memory size used by the instance (bytes).
408 //----------------------------------------------------------------------------
412 ~VISU_GaussPtsAct1();
414 // Redefined method of setting mapper input.
417 SetMapperInput(vtkDataSet* theDataSet);
419 //! To get current value of the radius of the Point Sprite
422 GetRadius(vtkIdType theObjID,
424 vtkDataArray *theScalarArray);
426 //! To get current value of the magnification
429 GetMagnification(vtkIdType theObjID);
431 //! To get current value of the clamp
434 GetClamp(vtkIdType theObjID);
436 //----------------------------------------------------------------------------
437 // Main process VTK event method
440 ProcessEvents(vtkObject* theObject,
441 unsigned long theEvent,
445 // To process VTK event method
448 OnInteractorEvent(unsigned long theEvent);
450 boost::signal1<void,int> mySetVisibilitySignal;
451 VISU_OutsideCursorSettings* myOutsideCursorSettings;
453 //----------------------------------------------------------------------------
454 PDeviceActor myInsideDeviceActor;
455 PDeviceActor myOutsideDeviceActor;
459 //! Gauss Points Actor, displayed in the Segmented View.
460 class VTKOCC_EXPORT VISU_GaussPtsAct2 : public VISU_GaussPtsAct
463 vtkTypeMacro(VISU_GaussPtsAct2,VISU_GaussPtsAct);
469 // Redefined method of setting mapper input.
472 SetMapperInput(vtkDataSet* theDataSet);
476 ShallowCopyPL(VISU_PipeLine* thePipeLine);
478 //----------------------------------------------------------------------------
479 //! Set actor visibility.
482 SetVisibility(int theMode);
486 SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl);
488 //! Gets memory size used by the instance (bytes).
494 //----------------------------------------------------------------------------
498 ~VISU_GaussPtsAct2();
500 //----------------------------------------------------------------------------
501 // To process VTK event method
504 OnInteractorEvent(unsigned long theEvent);