vtk-ruby 5.0.4.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. data/lib/VTK/common.rb +7 -0
  2. data/lib/VTK/common.rb.rule +1 -0
  3. data/lib/VTK/filtering.rb +7 -0
  4. data/lib/VTK/filtering.rb.rule +1 -0
  5. data/lib/VTK/genericfiltering.rb +7 -0
  6. data/lib/VTK/genericfiltering.rb.rule +1 -0
  7. data/lib/VTK/graphics.rb +7 -0
  8. data/lib/VTK/graphics.rb.rule +1 -0
  9. data/lib/VTK/gtk.rb +5 -0
  10. data/lib/VTK/gtk.rb.rule +1 -0
  11. data/lib/VTK/gtk/GtkGLExtVTKRenderWindow.rb +635 -0
  12. data/lib/VTK/gtk/GtkGLExtVTKRenderWindow.rb.rule +1 -0
  13. data/lib/VTK/gtk/GtkGLExtVTKRenderWindowInteractor.rb +355 -0
  14. data/lib/VTK/gtk/GtkGLExtVTKRenderWindowInteractor.rb.rule +1 -0
  15. data/lib/VTK/gtk/GtkVTKRenderWindow.rb +615 -0
  16. data/lib/VTK/gtk/GtkVTKRenderWindow.rb.rule +1 -0
  17. data/lib/VTK/gtk/GtkVTKRenderWindowInteractor.rb +336 -0
  18. data/lib/VTK/gtk/GtkVTKRenderWindowInteractor.rb.rule +1 -0
  19. data/lib/VTK/hybrid.rb +7 -0
  20. data/lib/VTK/hybrid.rb.rule +1 -0
  21. data/lib/VTK/imaging.rb +7 -0
  22. data/lib/VTK/imaging.rb.rule +1 -0
  23. data/lib/VTK/io.rb +7 -0
  24. data/lib/VTK/io.rb.rule +1 -0
  25. data/lib/VTK/parallel.rb +7 -0
  26. data/lib/VTK/parallel.rb.rule +1 -0
  27. data/lib/VTK/rendering.rb +7 -0
  28. data/lib/VTK/rendering.rb.rule +1 -0
  29. data/lib/VTK/tk.rb +4 -0
  30. data/lib/VTK/tk.rb.rule +1 -0
  31. data/lib/VTK/tk/vtkLoadRubyTkWidgets.rb +54 -0
  32. data/lib/VTK/tk/vtkLoadRubyTkWidgets.rb.rule +1 -0
  33. data/lib/VTK/tk/vtkTkImageViewerWidget.rb +377 -0
  34. data/lib/VTK/tk/vtkTkImageViewerWidget.rb.rule +1 -0
  35. data/lib/VTK/tk/vtkTkPhotoImage.rb +28 -0
  36. data/lib/VTK/tk/vtkTkPhotoImage.rb.rule +1 -0
  37. data/lib/VTK/tk/vtkTkRenderWidget.rb +486 -0
  38. data/lib/VTK/tk/vtkTkRenderWidget.rb.rule +1 -0
  39. data/lib/VTK/tk/vtkTkRenderWindowInteractor.rb +394 -0
  40. data/lib/VTK/tk/vtkTkRenderWindowInteractor.rb.rule +1 -0
  41. data/lib/VTK/util.rb +6 -0
  42. data/lib/VTK/util.rb.rule +1 -0
  43. data/lib/VTK/util/colors.rb +223 -0
  44. data/lib/VTK/util/colors.rb.rule +1 -0
  45. data/lib/VTK/util/misc.rb +68 -0
  46. data/lib/VTK/util/misc.rb.rule +1 -0
  47. data/lib/VTK/util/vtkConstants.rb +123 -0
  48. data/lib/VTK/util/vtkConstants.rb.rule +1 -0
  49. data/lib/VTK/util/vtkImageExportToArray.rb +96 -0
  50. data/lib/VTK/util/vtkImageExportToArray.rb.rule +1 -0
  51. data/lib/VTK/util/vtkImageImportFromArray.rb +116 -0
  52. data/lib/VTK/util/vtkImageImportFromArray.rb.rule +1 -0
  53. data/lib/VTK/volumerendering.rb +7 -0
  54. data/lib/VTK/volumerendering.rb.rule +1 -0
  55. data/lib/VTK/vtkCommon.dll +0 -0
  56. data/lib/VTK/vtkCommon.exp +0 -0
  57. data/lib/VTK/vtkCommon.lib +0 -0
  58. data/lib/VTK/vtkCommonRuby.dll +0 -0
  59. data/lib/VTK/vtkCommonRuby.exp +0 -0
  60. data/lib/VTK/vtkCommonRuby.lib +0 -0
  61. data/lib/VTK/vtkCommonRubyD.dll +0 -0
  62. data/lib/VTK/vtkCommonRubyD.exp +0 -0
  63. data/lib/VTK/vtkCommonRubyD.lib +0 -0
  64. data/lib/VTK/vtkDICOMParser.dll +0 -0
  65. data/lib/VTK/vtkDICOMParser.exp +0 -0
  66. data/lib/VTK/vtkDICOMParser.lib +0 -0
  67. data/lib/VTK/vtkFiltering.dll +0 -0
  68. data/lib/VTK/vtkFiltering.exp +0 -0
  69. data/lib/VTK/vtkFiltering.lib +0 -0
  70. data/lib/VTK/vtkFilteringRuby.dll +0 -0
  71. data/lib/VTK/vtkFilteringRuby.exp +0 -0
  72. data/lib/VTK/vtkFilteringRuby.lib +0 -0
  73. data/lib/VTK/vtkFilteringRubyD.dll +0 -0
  74. data/lib/VTK/vtkFilteringRubyD.exp +0 -0
  75. data/lib/VTK/vtkFilteringRubyD.lib +0 -0
  76. data/lib/VTK/vtkGenericFiltering.dll +0 -0
  77. data/lib/VTK/vtkGenericFiltering.exp +0 -0
  78. data/lib/VTK/vtkGenericFiltering.lib +0 -0
  79. data/lib/VTK/vtkGenericFilteringRuby.dll +0 -0
  80. data/lib/VTK/vtkGenericFilteringRuby.exp +0 -0
  81. data/lib/VTK/vtkGenericFilteringRuby.lib +0 -0
  82. data/lib/VTK/vtkGenericFilteringRubyD.dll +0 -0
  83. data/lib/VTK/vtkGenericFilteringRubyD.exp +0 -0
  84. data/lib/VTK/vtkGenericFilteringRubyD.lib +0 -0
  85. data/lib/VTK/vtkGraphics.dll +0 -0
  86. data/lib/VTK/vtkGraphics.exp +0 -0
  87. data/lib/VTK/vtkGraphics.lib +0 -0
  88. data/lib/VTK/vtkGraphicsRuby.dll +0 -0
  89. data/lib/VTK/vtkGraphicsRuby.exp +0 -0
  90. data/lib/VTK/vtkGraphicsRuby.lib +0 -0
  91. data/lib/VTK/vtkGraphicsRubyD.dll +0 -0
  92. data/lib/VTK/vtkGraphicsRubyD.exp +0 -0
  93. data/lib/VTK/vtkGraphicsRubyD.lib +0 -0
  94. data/lib/VTK/vtkHybrid.dll +0 -0
  95. data/lib/VTK/vtkHybrid.exp +0 -0
  96. data/lib/VTK/vtkHybrid.lib +0 -0
  97. data/lib/VTK/vtkHybridRuby.dll +0 -0
  98. data/lib/VTK/vtkHybridRuby.exp +0 -0
  99. data/lib/VTK/vtkHybridRuby.lib +0 -0
  100. data/lib/VTK/vtkHybridRubyD.dll +0 -0
  101. data/lib/VTK/vtkHybridRubyD.exp +0 -0
  102. data/lib/VTK/vtkHybridRubyD.lib +0 -0
  103. data/lib/VTK/vtkIO.dll +0 -0
  104. data/lib/VTK/vtkIO.exp +0 -0
  105. data/lib/VTK/vtkIO.lib +0 -0
  106. data/lib/VTK/vtkIORuby.dll +0 -0
  107. data/lib/VTK/vtkIORuby.exp +0 -0
  108. data/lib/VTK/vtkIORuby.lib +0 -0
  109. data/lib/VTK/vtkIORubyD.dll +0 -0
  110. data/lib/VTK/vtkIORubyD.exp +0 -0
  111. data/lib/VTK/vtkIORubyD.lib +0 -0
  112. data/lib/VTK/vtkImaging.dll +0 -0
  113. data/lib/VTK/vtkImaging.exp +0 -0
  114. data/lib/VTK/vtkImaging.lib +0 -0
  115. data/lib/VTK/vtkImagingRuby.dll +0 -0
  116. data/lib/VTK/vtkImagingRuby.exp +0 -0
  117. data/lib/VTK/vtkImagingRuby.lib +0 -0
  118. data/lib/VTK/vtkImagingRubyD.dll +0 -0
  119. data/lib/VTK/vtkImagingRubyD.exp +0 -0
  120. data/lib/VTK/vtkImagingRubyD.lib +0 -0
  121. data/lib/VTK/vtkNetCDF.dll +0 -0
  122. data/lib/VTK/vtkNetCDF.exp +0 -0
  123. data/lib/VTK/vtkNetCDF.lib +0 -0
  124. data/lib/VTK/vtkParallel.dll +0 -0
  125. data/lib/VTK/vtkParallel.exp +0 -0
  126. data/lib/VTK/vtkParallel.lib +0 -0
  127. data/lib/VTK/vtkParallelRuby.dll +0 -0
  128. data/lib/VTK/vtkParallelRuby.exp +0 -0
  129. data/lib/VTK/vtkParallelRuby.lib +0 -0
  130. data/lib/VTK/vtkParallelRubyD.dll +0 -0
  131. data/lib/VTK/vtkParallelRubyD.exp +0 -0
  132. data/lib/VTK/vtkParallelRubyD.lib +0 -0
  133. data/lib/VTK/vtkParseOGLExt.exe +0 -0
  134. data/lib/VTK/vtkRendering.dll +0 -0
  135. data/lib/VTK/vtkRendering.exp +0 -0
  136. data/lib/VTK/vtkRendering.lib +0 -0
  137. data/lib/VTK/vtkRenderingRuby.dll +0 -0
  138. data/lib/VTK/vtkRenderingRuby.exp +0 -0
  139. data/lib/VTK/vtkRenderingRuby.lib +0 -0
  140. data/lib/VTK/vtkRenderingRubyD.dll +0 -0
  141. data/lib/VTK/vtkRenderingRubyD.exp +0 -0
  142. data/lib/VTK/vtkRenderingRubyD.lib +0 -0
  143. data/lib/VTK/vtkVREncodeString.exe +0 -0
  144. data/lib/VTK/vtkVolumeRendering.dll +0 -0
  145. data/lib/VTK/vtkVolumeRendering.exp +0 -0
  146. data/lib/VTK/vtkVolumeRendering.lib +0 -0
  147. data/lib/VTK/vtkVolumeRenderingRuby.dll +0 -0
  148. data/lib/VTK/vtkVolumeRenderingRuby.exp +0 -0
  149. data/lib/VTK/vtkVolumeRenderingRuby.lib +0 -0
  150. data/lib/VTK/vtkVolumeRenderingRubyD.dll +0 -0
  151. data/lib/VTK/vtkVolumeRenderingRubyD.exp +0 -0
  152. data/lib/VTK/vtkVolumeRenderingRubyD.lib +0 -0
  153. data/lib/VTK/vtkWidgets.dll +0 -0
  154. data/lib/VTK/vtkWidgets.exp +0 -0
  155. data/lib/VTK/vtkWidgets.lib +0 -0
  156. data/lib/VTK/vtkWidgetsRuby.dll +0 -0
  157. data/lib/VTK/vtkWidgetsRuby.exp +0 -0
  158. data/lib/VTK/vtkWidgetsRuby.lib +0 -0
  159. data/lib/VTK/vtkWidgetsRubyD.dll +0 -0
  160. data/lib/VTK/vtkWidgetsRubyD.exp +0 -0
  161. data/lib/VTK/vtkWidgetsRubyD.lib +0 -0
  162. data/lib/VTK/vtkWrapRuby.exe +0 -0
  163. data/lib/VTK/vtkWrapRubyInit.exe +0 -0
  164. data/lib/VTK/vtk_dummy.rb +3 -0
  165. data/lib/VTK/vtkexoIIc.dll +0 -0
  166. data/lib/VTK/vtkexoIIc.exp +0 -0
  167. data/lib/VTK/vtkexoIIc.lib +0 -0
  168. data/lib/VTK/vtkexpat.dll +0 -0
  169. data/lib/VTK/vtkexpat.exp +0 -0
  170. data/lib/VTK/vtkexpat.lib +0 -0
  171. data/lib/VTK/vtkfreetype.dll +0 -0
  172. data/lib/VTK/vtkfreetype.exp +0 -0
  173. data/lib/VTK/vtkfreetype.lib +0 -0
  174. data/lib/VTK/vtkftgl.dll +0 -0
  175. data/lib/VTK/vtkftgl.exp +0 -0
  176. data/lib/VTK/vtkftgl.lib +0 -0
  177. data/lib/VTK/vtkjpeg.dll +0 -0
  178. data/lib/VTK/vtkjpeg.exp +0 -0
  179. data/lib/VTK/vtkjpeg.lib +0 -0
  180. data/lib/VTK/vtkpng.dll +0 -0
  181. data/lib/VTK/vtkpng.exp +0 -0
  182. data/lib/VTK/vtkpng.lib +0 -0
  183. data/lib/VTK/vtkruby.exe +0 -0
  184. data/lib/VTK/vtksys.dll +0 -0
  185. data/lib/VTK/vtksys.exp +0 -0
  186. data/lib/VTK/vtksys.lib +0 -0
  187. data/lib/VTK/vtksysEncodeExecutable.exe +0 -0
  188. data/lib/VTK/vtksysProcessFwd9x.exe +0 -0
  189. data/lib/VTK/vtktiff.dll +0 -0
  190. data/lib/VTK/vtktiff.exp +0 -0
  191. data/lib/VTK/vtktiff.lib +0 -0
  192. data/lib/VTK/vtkzlib.dll +0 -0
  193. data/lib/VTK/vtkzlib.exp +0 -0
  194. data/lib/VTK/vtkzlib.lib +0 -0
  195. data/lib/VTK/widgets.rb +7 -0
  196. data/lib/VTK/widgets.rb.rule +1 -0
  197. data/lib/setup.rb +104 -0
  198. data/lib/vtk.rb +35 -0
  199. data/lib/vtk_dummy.rb +3 -0
  200. metadata +256 -0
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,394 @@
1
+ =begin
2
+ A fully functional VTK widget for Tkinter that uses
3
+ vtkGenericRenderWindowInteractor. The widget is called
4
+ vtkTkRenderWindowInteractor. The initialization part of this code is
5
+ similar to that of the vtkTkRenderWidget.
6
+
7
+ =end
8
+
9
+ require 'tk'
10
+ require 'vtk'
11
+ require 'vtk/tk/vtkLoadRubyTkWidgets'
12
+
13
+
14
+ class Vtk::TkRenderWindowInteractor < TkWindow
15
+ =begin
16
+ A vtkTkRenderWidndowInteractor for Python.
17
+
18
+ Use GetRenderWindow to get the vtkRenderWindow.
19
+
20
+ Create with the keyword stereo=1 in order to generate a
21
+ stereo-capable window.
22
+
23
+ Create with the keyword focus_on_enter=1 to enable
24
+ focus-follows-mouse. The default is for a click-to-focus mode.
25
+
26
+ __getattr__ is used to make the widget also behave like a
27
+ vtkGenericRenderWindowInteractor.
28
+ =end
29
+ TkCommandNames = ['vtkTkRenderWidget'.freeze].freeze
30
+
31
+ def initialize(master, kw={} )
32
+ =begin
33
+ Constructor.
34
+
35
+ Keyword arguments:
36
+
37
+ rw -- Use passed render window instead of creating a new one.
38
+
39
+ stereo -- If True, generate a stereo-capable window.
40
+ Defaults to False.
41
+
42
+ focus_on_enter -- If True, use a focus-follows-mouse mode.
43
+ Defaults to False where the widget will use a click-to-focus
44
+ mode.
45
+ =end
46
+ # load the necessary extensions into tk
47
+ Vtk.LoadRubyTkWidgets
48
+
49
+ _symbolkey2str(kw)
50
+
51
+ if kw['rw']
52
+ renderWindow = kw['rw']
53
+ else
54
+ renderWindow = Vtk::RenderWindow.new
55
+ end
56
+
57
+ if kw['stereo']
58
+ renderWindow.StereoCapableWindowOn
59
+ kw.delete('stereo')
60
+ end
61
+
62
+ # check if focus should follow mouse
63
+ if kw['focus_on_enter']
64
+ @FocusOnEnter = true
65
+ kw.delte('focus_on_enter')
66
+ else
67
+ @FocusOnEnter = false
68
+ end
69
+
70
+ kw['rw'] = renderWindow.GetAddressAsString("vtkRenderWindow")
71
+ kw['widgetname'] = 'vtkTkRenderWindowInteractor'
72
+ # kw['widgetname'] = 'vtkTkRenderWidget'
73
+ super( master, kw )
74
+ renderWindow.UnRegister(nil)
75
+
76
+ @Iren = Vtk::GenericRenderWindowInteractor.new
77
+ @Iren.SetRenderWindow(renderWindow)
78
+ @Iren.UnRegister(nil)
79
+
80
+ createTimer = Proc.new{|obj, evt|
81
+ self.after(10, Proc.new{ @Iren.TimerEvent })
82
+ }
83
+ destroyTimer = Proc.new{|obj, event|
84
+ =begin
85
+ The timer is a one shot timer so will expire automatically.
86
+ =end
87
+ return 1
88
+ }
89
+
90
+ @Iren.AddObserver('CreateTimerEvent', createTimer)
91
+ @Iren.AddObserver('DestroyTimerEvent', destroyTimer)
92
+
93
+
94
+
95
+ @OldFocus = nil
96
+
97
+ # private attributes
98
+ @InExpose = false
99
+
100
+ # create the Tk bindings
101
+ self.BindEvents
102
+ #self.tk_focusFollowsMouse
103
+
104
+ end
105
+
106
+ def BindEvents
107
+ =begin
108
+ Bind all the events.
109
+ =end
110
+ self.bind("Motion"){|e,s| s||s=self; s.MouseMoveEvent(e, 0, 0) }
111
+ self.bind("Control-Motion"){|e,s| s||s=self; s.MouseMoveEvent(e, 1, 0) }
112
+ self.bind("Shift-Motion"){|e,s| s||s=self; s.MouseMoveEvent(e, 1, 1) }
113
+ self.bind("Control-Shift-Motion"){|e,s| s||s=self; s.MouseMoveEvent(e, 0, 1) }
114
+
115
+ # Left Button
116
+ self.bind("ButtonPress-1"){|e,s| s||s=self; s.LeftButtonPressEvent(e, 0, 0) }
117
+ self.bind("Control-ButtonPress-1"){|e,s| s||s=self; s.LeftButtonPressEvent(e, 1, 0) }
118
+ self.bind("Shift-ButtonPress-1"){|e,s| s||s=self; s.LeftButtonPressEvent(e, 0, 1) }
119
+ self.bind("Control-Shift-ButtonPress-1"){|e,s| s||s=self; s.LeftButtonPressEvent(e, 1, 1) }
120
+ self.bind("ButtonRelease-1"){|e,s| s||s=self; s.LeftButtonReleaseEvent(e, 0, 0) }
121
+ self.bind("Control-ButtonRelease-1"){|e,s| s||s=self; s.LeftButtonReleaseEvent(e, 1, 0) }
122
+ self.bind("Shift-ButtonRelease-1"){|e,s| s||s=self; s.LeftButtonReleaseEvent(e, 0, 1) }
123
+ self.bind("Control-Shift-ButtonRelease-1"){|e,s| s||s=self; s.LeftButtonReleaseEvent(e, 1, 1) }
124
+
125
+ # Middle Button
126
+ self.bind("ButtonPress-2"){|e,s| s||s=self; s.MiddleButtonPressEvent(e, 0, 0) }
127
+ self.bind("Control-ButtonPress-2"){|e,s| s||s=self; s.MiddleButtonPressEvent(e, 1, 0) }
128
+ self.bind("Shift-ButtonPress-2"){|e,s| s||s=self; s.MiddleButtonPressEvent(e, 0, 1) }
129
+ self.bind("Control-Shift-ButtonPress-2"){|e,s| s||s=self; s.MiddleButtonPressEvent(e, 1, 1) }
130
+ self.bind("ButtonRelease-2"){|e,s| s||s=self; s.MiddleButtonReleaseEvent(e, 0, 0) }
131
+ self.bind("Control-ButtonRelease-2"){|e,s| s||s=self; s.MiddleButtonReleaseEvent(e, 1, 0) }
132
+ self.bind("Shift-ButtonRelease-2"){|e,s| s||s=self; s.MiddleButtonReleaseEvent(e, 0, 1) }
133
+ self.bind("Control-Shift-ButtonRelease-2"){|e,s| s||s=self; s.MiddleButtonReleaseEvent(e, 1, 1) }
134
+
135
+ # Right Button
136
+ self.bind("ButtonPress-3"){|e,s| s||s=self; s.RightButtonPressEvent(e, 0, 0) }
137
+ self.bind("Control-ButtonPress-3"){|e,s| s||s=self; s.RightButtonPressEvent(e, 1, 0) }
138
+ self.bind("Shift-ButtonPress-3"){|e,s| s||s=self; s.RightButtonPressEvent(e, 0, 1) }
139
+ self.bind("Control-Shift-ButtonPress-3"){|e,s| s||s=self; s.RightButtonPressEvent(e, 1, 1) }
140
+ self.bind("ButtonRelease-3"){|e,s| s||s=self; s.RightButtonReleaseEvent(e, 0, 0) }
141
+ self.bind("Control-ButtonRelease-3"){|e,s| s||s=self; s.RightButtonReleaseEvent(e, 1, 0) }
142
+ self.bind("Shift-ButtonRelease-3"){|e,s| s||s=self; s.RightButtonReleaseEvent(e, 0, 1) }
143
+ self.bind("Control-Shift-ButtonRelease-3"){|e,s| s||s=self; s.RightButtonReleaseEvent(e, 1, 1) }
144
+
145
+ if Config::CONFIG['arch'] =~ /win32/
146
+ self.bind("MouseWheel"){|e,s| s||s=self; s.MouseWheelEvent(e, 0, 0) }
147
+ self.bind("Control-MouseWheel"){|e,s| s||s=self; s.MouseWheelEvent(e, 1, 0) }
148
+ self.bind("Shift-MouseWheel"){|e,s| s||s=self; s.MouseWheelEvent(e, 0, 1) }
149
+ self.bind("Control-Shift-MouseWheel"){|e,s| s||s=self; s.MouseWheelEvent(e, 1, 1) }
150
+ else
151
+ # Mouse wheel forward event
152
+ self.bind("ButtonPress-4"){|e,s| s||s=self; s.MouseWheelForwardEvent(e, 0, 0) }
153
+ self.bind("Control-ButtonPress-4"){|e,s| s||s=self; s.MouseWheelForwardEvent(e, 1, 0) }
154
+ self.bind("Shift-ButtonPress-4"){|e,s| s||s=self; s.MouseWheelForwardEvent(e, 0, 1) }
155
+ self.bind("Control-Shift-ButtonPress-4"){|e,s| s||s=self; s.MouseWheelForwardEvent(e, 1, 1) }
156
+
157
+ # Mouse wheel backward event
158
+ self.bind("ButtonPress-5"){|e,s| s||s=self; s.MouseWheelBackwardEvent(e, 0, 0) }
159
+ self.bind("Control-ButtonPress-5"){|e,s| s||s=self; s.MouseWheelBackwardEvent(e, 1, 0) }
160
+ self.bind("Shift-ButtonPress-5"){|e,s| s||s=self; s.MouseWheelBackwardEvent(e, 0, 1) }
161
+ self.bind("Control-Shift-ButtonPress-5"){|e,s| s||s=self; s.MouseWheelBackwardEvent(e, 1, 1) }
162
+ end
163
+
164
+ # Key related events
165
+ self.bind("KeyPress"){|e,s| s||s=self; s.KeyPressEvent(e, 0, 0) }
166
+ self.bind("Control-KeyPress"){|e,s| s||s=self; s.KeyPressEvent(e, 1, 0) }
167
+ self.bind("Shift-KeyPress"){|e,s| s||s=self; s.KeyPressEvent(e, 0, 1) }
168
+ self.bind("Control-Shift-KeyPress"){|e,s| s||s=self; s.KeyPressEvent(e, 1, 1) }
169
+
170
+ self.bind("KeyRelease"){|e,s| s||s=self; s.KeyReleaseEvent(e, 0, 0) }
171
+ self.bind("Control-KeyRelease"){|e,s| s||s=self; s.KeyReleaseEvent(e, 1, 0) }
172
+ self.bind("Shift-KeyRelease"){|e,s| s||s=self; s.KeyReleaseEvent(e, 0, 1) }
173
+ self.bind("Control-Shift-KeyRelease"){|e,s| s||s=self; s.KeyReleaseEvent(e, 1, 1) }
174
+
175
+ self.bind("Enter"){|e,s| s||s=self; s.EnterEvent(e, 0, 0) }
176
+ self.bind("Control-Enter"){|e,s| s||s=self; s.EnterEvent(e, 1, 0) }
177
+ self.bind("Shift-Enter"){|e,s| s||s=self; s.EnterEvent(e, 0, 1) }
178
+ self.bind("Control-Shift-Enter"){|e,s| s||s=self; s.EnterEvent(e, 1, 1) }
179
+ self.bind("Leave"){|e,s| s||s=self; s.LeaveEvent(e, 0, 0) }
180
+ self.bind("Control-Leave"){|e,s| s||s=self; s.LeaveEvent(e, 1, 0) }
181
+ self.bind("Shift-Leave"){|e,s| s||s=self; s.LeaveEvent(e, 0, 1) }
182
+ self.bind("Control-Shift-Leave"){|e,s| s||s=self; s.LeaveEvent(e, 1, 1) }
183
+
184
+ self.bind("Configure"){|e,s| s||s=self; s.ConfigureEvent(e) }
185
+ self.bind("Expose"){|e,s| s||s=self; s.ExposeEvent }
186
+ end
187
+
188
+ def _GrabFocus(enter=0)
189
+ @OldFocus=self.focus
190
+ self.focus
191
+ end
192
+
193
+ def MouseMoveEvent(event, ctrl, shift)
194
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
195
+ shift, 0.chr, 0, nil)
196
+ @Iren.MouseMoveEvent
197
+ end
198
+
199
+ def LeftButtonPressEvent(event, ctrl, shift)
200
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
201
+ shift, 0.chr, 0, nil)
202
+ @Iren.LeftButtonPressEvent
203
+ if !@FocusOnEnter
204
+ _GrabFocus
205
+ end
206
+ end
207
+
208
+ def LeftButtonReleaseEvent(event, ctrl, shift)
209
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
210
+ shift, 0.chr, 0, nil)
211
+ @Iren.LeftButtonReleaseEvent
212
+ end
213
+
214
+ def MiddleButtonPressEvent(event, ctrl, shift)
215
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
216
+ shift, 0.chr, 0, nil)
217
+ @Iren.MiddleButtonPressEvent
218
+ if !@FocusOnEnter
219
+ _GrabFocus
220
+ end
221
+ end
222
+
223
+ def MiddleButtonReleaseEvent( event, ctrl, shift)
224
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
225
+ shift, 0.chr, 0, nil)
226
+ @Iren.MiddleButtonReleaseEvent
227
+ end
228
+
229
+ def RightButtonPressEvent(event, ctrl, shift)
230
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
231
+ shift, 0.chr, 0, nil)
232
+ @Iren.RightButtonPressEvent
233
+ if !@FocusOnEnter
234
+ _GrabFocus
235
+ end
236
+ end
237
+
238
+ def RightButtonReleaseEvent(event, ctrl, shift)
239
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
240
+ shift, 0.chr, 0, nil)
241
+ @Iren.RightButtonReleaseEvent
242
+ end
243
+
244
+ def MouseWheelEvent(event, ctrl, shift)
245
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
246
+ shift, 0.chr, 0, nil)
247
+ if event.delta > 0
248
+ @Iren.MouseWheelForwardEvent
249
+ else
250
+ @Iren.MouseWheelBackwardEvent
251
+ end
252
+ end
253
+
254
+ def MouseWheelForwardEvent(event, ctrl, shift)
255
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
256
+ shift, 0.chr, 0, nil)
257
+ @Iren.MouseWheelForwardEvent
258
+ end
259
+
260
+ def MouseWheelBackwardEvent(event, ctrl, shift)
261
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
262
+ shift, 0.chr, 0, nil)
263
+ @Iren.MouseWheelBackwardEvent
264
+ end
265
+
266
+ def KeyPressEvent(event, ctrl, shift)
267
+ key = 0.chr
268
+ if event.keysym_num < 256
269
+ key = event.keysym_num.chr
270
+ end
271
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
272
+ shift, key, 0, event.keysym)
273
+ @Iren.KeyPressEvent
274
+ @Iren.CharEvent
275
+ end
276
+
277
+ def KeyReleaseEvent(event, ctrl, shift)
278
+ key = 0.chr
279
+ if event.keysym_num < 256
280
+ key = event.keysym_num.chr
281
+ end
282
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl,
283
+ shift, key, 0, event.keysym)
284
+ @Iren.KeyReleaseEvent
285
+ end
286
+
287
+ def ConfigureEvent(event)
288
+ @Iren.SetSize(event.width, event.height)
289
+ @Iren.ConfigureEvent
290
+ end
291
+
292
+ def EnterEvent(event, ctrl, shift)
293
+ if @FocusOnEnter
294
+ _GrabFocus
295
+ end
296
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl, shift,
297
+ 0.chr, 0, nil)
298
+ @Iren.EnterEvent
299
+ end
300
+
301
+ def LeaveEvent(event, ctrl, shift)
302
+ if @FocusOnEnter && (@OldFocus != nil)
303
+ @OldFocus.focus
304
+ end
305
+ @Iren.SetEventInformationFlipY(event.x, event.y, ctrl, shift,
306
+ 0.chr, 0, nil)
307
+ @Iren.LeaveEvent
308
+ end
309
+
310
+ def ExposeEvent
311
+ if !@InExpose
312
+ @InExpose = true
313
+ self.update
314
+ self.GetRenderWindow.Render
315
+ @InExpose = false
316
+ end
317
+ end
318
+
319
+ def GetRenderWindow
320
+ addr = Tk.tk_call(self, 'GetRenderWindow')[5..-1]
321
+ renderWindow = Vtk::RenderWindow.new('_%s_vtkRenderWindow_p' % addr)
322
+ renderWindow.UnRegister(nil)
323
+ return renderWindow
324
+ end
325
+
326
+ def Render
327
+ self.GetRenderWindow.Render
328
+ end
329
+
330
+ # wrapping methods of Vtk::RenderWindowInteractor
331
+ names = self.instance_methods
332
+ Vtk::RenderWindowInteractor.instance_methods.each{|name|
333
+ unless names.include?(name)
334
+ argc = Vtk::RenderWindowInteractor.instance_method(name).arity
335
+ argv = []
336
+ if argc >= 0
337
+ for i in 0...argc
338
+ argv.push "arg#{i}"
339
+ end
340
+ else
341
+ for i in 0...-argc-1
342
+ argv.push "arg#{i}"
343
+ end
344
+ argv.push "*optional"
345
+ end
346
+ eval <<-"EOF"
347
+ def #{name}( #{argv.join(",")} )
348
+ @Iren.#{name}( #{argv.join(",")} )
349
+ end
350
+ EOF
351
+ end
352
+ }
353
+ end
354
+
355
+
356
+ #----------------------------------------------------------------------------
357
+ def vtkRenderWindowInteractorConeExample
358
+ =begin
359
+ Like it says, just a simple example
360
+ =end
361
+ # create root window
362
+ root = TkRoot.new
363
+
364
+ # create vtkTkRenderWidget
365
+ pane = Vtk::TkRenderWindowInteractor.new(root, 'width'=>300, 'height'=>300)
366
+ pane.Initialize
367
+
368
+ pane.AddObserver("ExitEvent", Proc.new{|o,e,q| exit })
369
+
370
+ ren = Vtk::Renderer.new
371
+ pane.GetRenderWindow.AddRenderer(ren)
372
+
373
+ cone = Vtk::ConeSource.new
374
+ cone.SetResolution(8)
375
+
376
+ coneMapper = Vtk::PolyDataMapper.new
377
+ coneMapper.SetInput(cone.GetOutput)
378
+
379
+ coneActor = Vtk::Actor.new
380
+ coneActor.SetMapper(coneMapper)
381
+
382
+ ren.AddActor(coneActor)
383
+
384
+ # pack the pane into the tk root
385
+ pane.pack('fill'=>'both', 'expand'=>1)
386
+ pane.Start
387
+
388
+ # start the tk mainloop
389
+ root.mainloop
390
+ end
391
+
392
+ if $0 == __FILE__
393
+ vtkRenderWindowInteractorConeExample
394
+ end
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,6 @@
1
+ require 'vtk'
2
+ require 'vtk/util/colors'
3
+ require 'vtk/util/misc'
4
+ require 'vtk/util/vtkConstants'
5
+ require 'vtk/util/vtkImageExportToArray'
6
+ require 'vtk/util/vtkImageImportFromArray'
@@ -0,0 +1 @@
1
+ # generated from CMake
@@ -0,0 +1,223 @@
1
+ # This module defines many standard colors that should be useful.
2
+ # These colors should be exactly the same as the ones defined in
3
+ # colors.tcl.
4
+
5
+ module Vtk
6
+
7
+ module Colors
8
+ # Whites
9
+ Antique_white = [0.9804, 0.9216, 0.8431]
10
+ Azure = [0.9412, 1.0000, 1.0000]
11
+ Bisque = [1.0000, 0.8941, 0.7686]
12
+ Blanched_almond = [1.0000, 0.9216, 0.8039]
13
+ Cornsilk = [1.0000, 0.9725, 0.8627]
14
+ Eggshell = [0.9900, 0.9000, 0.7900]
15
+ Floral_white = [1.0000, 0.9804, 0.9412]
16
+ Gainsboro = [0.8627, 0.8627, 0.8627]
17
+ Ghost_white = [0.9725, 0.9725, 1.0000]
18
+ Honeydew = [0.9412, 1.0000, 0.9412]
19
+ Ivory = [1.0000, 1.0000, 0.9412]
20
+ Lavender = [0.9020, 0.9020, 0.9804]
21
+ Lavender_blush = [1.0000, 0.9412, 0.9608]
22
+ Lemon_chiffon = [1.0000, 0.9804, 0.8039]
23
+ Linen = [0.9804, 0.9412, 0.9020]
24
+ Mint_cream = [0.9608, 1.0000, 0.9804]
25
+ Misty_rose = [1.0000, 0.8941, 0.8824]
26
+ Moccasin = [1.0000, 0.8941, 0.7098]
27
+ Navajo_white = [1.0000, 0.8706, 0.6784]
28
+ Old_lace = [0.9922, 0.9608, 0.9020]
29
+ Papaya_whip = [1.0000, 0.9373, 0.8353]
30
+ Peach_puff = [1.0000, 0.8549, 0.7255]
31
+ Seashell = [1.0000, 0.9608, 0.9333]
32
+ Snow = [1.0000, 0.9804, 0.9804]
33
+ Thistle = [0.8471, 0.7490, 0.8471]
34
+ Titanium_white = [0.9900, 1.0000, 0.9400]
35
+ Wheat = [0.9608, 0.8706, 0.7020]
36
+ White = [1.0000, 1.0000, 1.0000]
37
+ White_smoke = [0.9608, 0.9608, 0.9608]
38
+ Zinc_white = [0.9900, 0.9700, 1.0000]
39
+
40
+ # Greys
41
+ Cold_grey = [0.5000, 0.5400, 0.5300]
42
+ Dim_grey = [0.4118, 0.4118, 0.4118]
43
+ Grey = [0.7529, 0.7529, 0.7529]
44
+ Light_grey = [0.8275, 0.8275, 0.8275]
45
+ Slate_grey = [0.4392, 0.5020, 0.5647]
46
+ Slate_grey_dark = [0.1843, 0.3098, 0.3098]
47
+ Slate_grey_light = [0.4667, 0.5333, 0.6000]
48
+ Warm_grey = [0.5000, 0.5000, 0.4100]
49
+
50
+ # Blacks
51
+ Black = [0.0000, 0.0000, 0.0000]
52
+ Ivory_black = [0.1600, 0.1400, 0.1300]
53
+ Lamp_black = [0.1800, 0.2800, 0.2300]
54
+
55
+ # Reds
56
+ Alizarin_crimson = [0.8900, 0.1500, 0.2100]
57
+ Brick = [0.6100, 0.4000, 0.1200]
58
+ Cadmium_red_deep = [0.8900, 0.0900, 0.0500]
59
+ Coral = [1.0000, 0.4980, 0.3137]
60
+ Coral_light = [0.9412, 0.5020, 0.5020]
61
+ Deep_pink = [1.0000, 0.0784, 0.5765]
62
+ English_red = [0.8300, 0.2400, 0.1000]
63
+ Firebrick = [0.6980, 0.1333, 0.1333]
64
+ Geranium_lake = [0.8900, 0.0700, 0.1900]
65
+ Hot_pink = [1.0000, 0.4118, 0.7059]
66
+ Indian_red = [0.6900, 0.0900, 0.1200]
67
+ Light_salmon = [1.0000, 0.6275, 0.4784]
68
+ Madder_lake_deep = [0.8900, 0.1800, 0.1900]
69
+ Maroon = [0.6902, 0.1882, 0.3765]
70
+ Pink = [1.0000, 0.7529, 0.7961]
71
+ Pink_light = [1.0000, 0.7137, 0.7569]
72
+ Raspberry = [0.5300, 0.1500, 0.3400]
73
+ Red = [1.0000, 0.0000, 0.0000]
74
+ Rose_madder = [0.8900, 0.2100, 0.2200]
75
+ Salmon = [0.9804, 0.5020, 0.4471]
76
+ Tomato = [1.0000, 0.3882, 0.2784]
77
+ Venetian_red = [0.8300, 0.1000, 0.1200]
78
+
79
+ # Browns
80
+ Beige = [0.6400, 0.5800, 0.5000]
81
+ Brown = [0.5000, 0.1647, 0.1647]
82
+ Brown_madder = [0.8600, 0.1600, 0.1600]
83
+ Brown_ochre = [0.5300, 0.2600, 0.1200]
84
+ Burlywood = [0.8706, 0.7216, 0.5294]
85
+ Burnt_sienna = [0.5400, 0.2100, 0.0600]
86
+ Burnt_umber = [0.5400, 0.2000, 0.1400]
87
+ Chocolate = [0.8235, 0.4118, 0.1176]
88
+ Deep_ochre = [0.4500, 0.2400, 0.1000]
89
+ Flesh = [1.0000, 0.4900, 0.2500]
90
+ Flesh_ochre = [1.0000, 0.3400, 0.1300]
91
+ Gold_ochre = [0.7800, 0.4700, 0.1500]
92
+ Greenish_umber = [1.0000, 0.2400, 0.0500]
93
+ Khaki = [0.9412, 0.9020, 0.5490]
94
+ Khaki_dark = [0.7412, 0.7176, 0.4196]
95
+ Light_beige = [0.9608, 0.9608, 0.8627]
96
+ Peru = [0.8039, 0.5216, 0.2471]
97
+ Rosy_brown = [0.7373, 0.5608, 0.5608]
98
+ Raw_sienna = [0.7800, 0.3800, 0.0800]
99
+ Raw_umber = [0.4500, 0.2900, 0.0700]
100
+ Sepia = [0.3700, 0.1500, 0.0700]
101
+ Sienna = [0.6275, 0.3216, 0.1765]
102
+ Saddle_brown = [0.5451, 0.2706, 0.0745]
103
+ Sandy_brown = [0.9569, 0.6431, 0.3765]
104
+ Tan = [0.8235, 0.7059, 0.5490]
105
+ Van_dyke_brown = [0.3700, 0.1500, 0.0200]
106
+
107
+ # Oranges
108
+ Cadmium_orange = [1.0000, 0.3800, 0.0100]
109
+ Cadmium_red_light = [1.0000, 0.0100, 0.0500]
110
+ Carrot = [0.9300, 0.5700, 0.1300]
111
+ Dark_orange = [1.0000, 0.5490, 0.0000]
112
+ Mars_orange = [0.5900, 0.2700, 0.0800]
113
+ Mars_yellow = [0.8900, 0.4400, 0.1000]
114
+ Orange = [1.0000, 0.5000, 0.0000]
115
+ Orange_red = [1.0000, 0.2706, 0.0000]
116
+ Yellow_ochre = [0.8900, 0.5100, 0.0900]
117
+
118
+ # Yellows
119
+ Aureoline_yellow = [1.0000, 0.6600, 0.1400]
120
+ Banana = [0.8900, 0.8100, 0.3400]
121
+ Cadmium_lemon = [1.0000, 0.8900, 0.0100]
122
+ Cadmium_yellow = [1.0000, 0.6000, 0.0700]
123
+ Cadmium_yellow_light = [1.0000, 0.6900, 0.0600]
124
+ Gold = [1.0000, 0.8431, 0.0000]
125
+ Goldenrod = [0.8549, 0.6471, 0.1255]
126
+ Goldenrod_dark = [0.7216, 0.5255, 0.0431]
127
+ Goldenrod_light = [0.9804, 0.9804, 0.8235]
128
+ Goldenrod_pale = [0.9333, 0.9098, 0.6667]
129
+ Light_goldenrod = [0.9333, 0.8667, 0.5098]
130
+ Melon = [0.8900, 0.6600, 0.4100]
131
+ Naples_yellow_deep = [1.0000, 0.6600, 0.0700]
132
+ Yellow = [1.0000, 1.0000, 0.0000]
133
+ Yellow_light = [1.0000, 1.0000, 0.8784]
134
+
135
+ # Greens
136
+ Chartreuse = [0.4980, 1.0000, 0.0000]
137
+ Chrome_oxide_green = [0.4000, 0.5000, 0.0800]
138
+ Cinnabar_green = [0.3800, 0.7000, 0.1600]
139
+ Cobalt_green = [0.2400, 0.5700, 0.2500]
140
+ Emerald_green = [0.0000, 0.7900, 0.3400]
141
+ Dorest_green = [0.1333, 0.5451, 0.1333]
142
+ Green = [0.0000, 1.0000, 0.0000]
143
+ Green_dark = [0.0000, 0.3922, 0.0000]
144
+ Green_pale = [0.5961, 0.9843, 0.5961]
145
+ Green_yellow = [0.6784, 1.0000, 0.1843]
146
+ Lawn_green = [0.4863, 0.9882, 0.0000]
147
+ Lime_green = [0.1961, 0.8039, 0.1961]
148
+ Mint = [0.7400, 0.9900, 0.7900]
149
+ Olive = [0.2300, 0.3700, 0.1700]
150
+ Olive_drab = [0.4196, 0.5569, 0.1373]
151
+ Olive_green_dark = [0.3333, 0.4196, 0.1843]
152
+ Permanent_green = [0.0400, 0.7900, 0.1700]
153
+ Sap_green = [0.1900, 0.5000, 0.0800]
154
+ Sea_green = [0.1804, 0.5451, 0.3412]
155
+ Sea_green_dark = [0.5608, 0.7373, 0.5608]
156
+ Sea_green_medium = [0.2353, 0.7020, 0.4431]
157
+ Sea_green_light = [0.1255, 0.6980, 0.6667]
158
+ Spring_green = [0.0000, 1.0000, 0.4980]
159
+ Spring_green_medium = [0.0000, 0.9804, 0.6039]
160
+ Terre_verte = [0.2200, 0.3700, 0.0600]
161
+ Viridian_light = [0.4300, 1.0000, 0.4400]
162
+ Yellow_green = [0.6039, 0.8039, 0.1961]
163
+
164
+ # Cyans
165
+ Aquamarine = [0.4980, 1.0000, 0.8314]
166
+ Aquamarine_medium = [0.4000, 0.8039, 0.6667]
167
+ Cyan = [0.0000, 1.0000, 1.0000]
168
+ Cyan_white = [0.8784, 1.0000, 1.0000]
169
+ Turquoise = [0.2510, 0.8784, 0.8157]
170
+ Turquoise_dark = [0.0000, 0.8078, 0.8196]
171
+ Turquoise_medium = [0.2824, 0.8196, 0.8000]
172
+ Turquoise_pale = [0.6863, 0.9333, 0.9333]
173
+
174
+ # Blues
175
+ Alice_blue = [0.9412, 0.9725, 1.0000]
176
+ Blue = [0.0000, 0.0000, 1.0000]
177
+ Blue_light = [0.6784, 0.8471, 0.9020]
178
+ Blue_medium = [0.0000, 0.0000, 0.8039]
179
+ Cadet = [0.3725, 0.6196, 0.6275]
180
+ Cobalt = [0.2400, 0.3500, 0.6700]
181
+ Cornflower = [0.3922, 0.5843, 0.9294]
182
+ Cerulean = [0.0200, 0.7200, 0.8000]
183
+ Dodger_blue = [0.1176, 0.5647, 1.0000]
184
+ Indigo = [0.0300, 0.1800, 0.3300]
185
+ Manganese_blue = [0.0100, 0.6600, 0.6200]
186
+ Midnight_blue = [0.0980, 0.0980, 0.4392]
187
+ Navy = [0.0000, 0.0000, 0.5020]
188
+ Peacock = [0.2000, 0.6300, 0.7900]
189
+ Powder_blue = [0.6902, 0.8784, 0.9020]
190
+ Royal_blue = [0.2549, 0.4118, 0.8824]
191
+ Slate_blue = [0.4157, 0.3529, 0.8039]
192
+ Slate_blue_dark = [0.2824, 0.2392, 0.5451]
193
+ Slate_blue_light = [0.5176, 0.4392, 1.0000]
194
+ Slate_blue_medium = [0.4824, 0.4078, 0.9333]
195
+ Sky_blue = [0.5294, 0.8078, 0.9216]
196
+ Sky_blue_deep = [0.0000, 0.7490, 1.0000]
197
+ Sky_blue_light = [0.5294, 0.8078, 0.9804]
198
+ Steel_blue = [0.2745, 0.5098, 0.7059]
199
+ Steel_blue_light = [0.6902, 0.7686, 0.8706]
200
+ Turquoise_blue = [0.0000, 0.7800, 0.5500]
201
+ Ultramarine = [0.0700, 0.0400, 0.5600]
202
+
203
+ # Magentas
204
+ Blue_violet = [0.5412, 0.1686, 0.8863]
205
+ Cobalt_violet_deep = [0.5700, 0.1300, 0.6200]
206
+ Magenta = [1.0000, 0.0000, 1.0000]
207
+ Orchid = [0.8549, 0.4392, 0.8392]
208
+ Orchid_dark = [0.6000, 0.1961, 0.8000]
209
+ Orchid_medium = [0.7294, 0.3333, 0.8275]
210
+ Permanent_red_violet = [0.8600, 0.1500, 0.2700]
211
+ Plum = [0.8667, 0.6275, 0.8667]
212
+ Purple = [0.6275, 0.1255, 0.9412]
213
+ Purple_medium = [0.5765, 0.4392, 0.8588]
214
+ Ultramarine_violet = [0.3600, 0.1400, 0.4300]
215
+ Violet = [0.5600, 0.3700, 0.6000]
216
+ Violet_dark = [0.5804, 0.0000, 0.8275]
217
+ Violet_red = [0.8157, 0.1255, 0.5647]
218
+ Violet_red_medium = [0.7804, 0.0824, 0.5216]
219
+ Violet_red_pale = [0.8588, 0.4392, 0.5765]
220
+
221
+ end
222
+ end
223
+