fw4spl
Instantiator.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2016.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #include "fwRenderVTK/vtk/fwVtkBoxRepresentation.hpp"
8 #include "fwRenderVTK/vtk/fwVtkPicker.hpp"
9 #include "fwRenderVTK/vtk/fwVtkCellPicker.hpp"
10 #include "fwRenderVTK/vtk/InteractorStyle2DForNegato.hpp"
11 #include "fwRenderVTK/vtk/InteractorStyle3DForNegato.hpp"
12 #include "fwRenderVTK/vtk/Instantiator.hpp"
13 
14 #include <fwCore/base.hpp>
15 
16 #include <vtkInstantiator.h>
17 #include <vtkVersion.h>
18 
19 #if (VTK_MAJOR_VERSION < 6 || (VTK_MAJOR_VERSION == 6 && VTK_MINOR_VERSION < 1))
20 extern vtkObject* vtkInstantiatorfwVtkBoxRepresentationNew();
21 extern vtkObject* vtkInstantiatorfwVtkPickerNew();
22 extern vtkObject* vtkInstantiatorfwVtkCellPickerNew();
23 extern vtkObject* vtkInstantiatorInteractorStyle2DForNegatoNew();
24 extern vtkObject* vtkInstantiatorInteractorStyle3DForNegatoNew();
25 #else
26 vtkInstantiatorNewMacro(fwVtkBoxRepresentation);
27 vtkInstantiatorNewMacro(fwVtkPicker);
28 vtkInstantiatorNewMacro(fwVtkCellPicker);
29 vtkInstantiatorNewMacro(InteractorStyle2DForNegato);
30 vtkInstantiatorNewMacro(InteractorStyle3DForNegato);
31 #endif
32 
33 namespace fwRenderVTK
34 {
35 
36 namespace vtk
37 {
38 
39 void Instantiator::ClassInitialize()
40 {
41  vtkInstantiator::RegisterInstantiator("fwVtkBoxRepresentation", vtkInstantiatorfwVtkBoxRepresentationNew);
42  vtkInstantiator::RegisterInstantiator("fwVtkPicker", vtkInstantiatorfwVtkPickerNew);
43  vtkInstantiator::RegisterInstantiator("fwVtkCellPicker", vtkInstantiatorfwVtkCellPickerNew);
44  vtkInstantiator::RegisterInstantiator("InteractorStyle2DForNegato", vtkInstantiatorInteractorStyle2DForNegatoNew);
45  vtkInstantiator::RegisterInstantiator("InteractorStyle3DForNegato", vtkInstantiatorInteractorStyle3DForNegatoNew);
46 
47 #ifdef DEBUG
48  vtkObject* o;
49 #ifndef ANDROID
50  o = vtkInstantiator::CreateInstance("fwVtkBoxRepresentation");
51  SLM_ASSERT("Unable to instantiate a fwVtkBoxRepresentation",o);
52  o->Delete();
53 #endif
54 
55  o = vtkInstantiator::CreateInstance("fwVtkPicker");
56  SLM_ASSERT("Unable to instantiate a fwVtkPicker",o);
57  o->Delete();
58 
59  o = vtkInstantiator::CreateInstance("fwVtkCellPicker");
60  SLM_ASSERT("Unable to instantiate a fwVtkCellPicker",o);
61  o->Delete();
62 
63  o = vtkInstantiator::CreateInstance("InteractorStyle2DForNegato");
64  SLM_ASSERT("Unable to instantiate a InteractorStyle2DForNegato",o);
65  o->Delete();
66 
67  o = vtkInstantiator::CreateInstance("InteractorStyle3DForNegato");
68  SLM_ASSERT("Unable to instantiate a InteractorStyle3DForNegato",o);
69  o->Delete();
70 #endif
71 }
72 
73 void Instantiator::ClassFinalize()
74 {
75  vtkInstantiator::UnRegisterInstantiator("fwVtkBoxRepresentation", vtkInstantiatorfwVtkBoxRepresentationNew);
76  vtkInstantiator::UnRegisterInstantiator("fwVtkPicker", vtkInstantiatorfwVtkPickerNew);
77  vtkInstantiator::UnRegisterInstantiator("fwVtkCellPicker", vtkInstantiatorfwVtkCellPickerNew);
78  vtkInstantiator::UnRegisterInstantiator("InteractorStyle2DForNegato", vtkInstantiatorInteractorStyle2DForNegatoNew);
79  vtkInstantiator::UnRegisterInstantiator("InteractorStyle3DForNegato", vtkInstantiatorInteractorStyle3DForNegatoNew);
80 }
81 } //vtk
82 
83 } //fwRenderVTK
84 
#define SLM_ASSERT(message, cond)
work like &#39;assert&#39; from &#39;cassert&#39;, with in addition a message logged by spylog (with FATAL loglevel) ...
Definition: spyLog.hpp:308
The namespace fwRenderVTK contains classes for rendering with VTK.