Commit 2ce381795a77483bca45d360475ac0fb8ddf2e88
1 parent
133f8acf
Exists in
master
and in
67 other branches
Measures is working again
Showing
1 changed file
with
13 additions
and
4 deletions
Show diff stats
invesalius/data/viewer_slice.py
| ... | ... | @@ -98,12 +98,12 @@ class Viewer(wx.Panel): |
| 98 | 98 | self._warped = False |
| 99 | 99 | |
| 100 | 100 | def __init_gui(self): |
| 101 | - interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize()) | |
| 101 | + self.interactor = wxVTKRenderWindowInteractor(self, -1, size=self.GetSize()) | |
| 102 | 102 | |
| 103 | 103 | scroll = wx.ScrollBar(self, -1, style=wx.SB_VERTICAL) |
| 104 | 104 | self.scroll = scroll |
| 105 | 105 | sizer = wx.BoxSizer(wx.HORIZONTAL) |
| 106 | - sizer.Add(interactor, 1, wx.EXPAND|wx.GROW) | |
| 106 | + sizer.Add(self.interactor, 1, wx.EXPAND|wx.GROW) | |
| 107 | 107 | |
| 108 | 108 | background_sizer = wx.BoxSizer(wx.HORIZONTAL) |
| 109 | 109 | background_sizer.AddSizer(sizer, 1, wx.EXPAND|wx.GROW|wx.ALL, 2) |
| ... | ... | @@ -115,9 +115,7 @@ class Viewer(wx.Panel): |
| 115 | 115 | self.Update() |
| 116 | 116 | self.SetAutoLayout(1) |
| 117 | 117 | |
| 118 | - self.interactor = interactor | |
| 119 | 118 | self.pick = vtk.vtkWorldPointPicker() |
| 120 | - | |
| 121 | 119 | self.interactor.SetPicker(self.pick) |
| 122 | 120 | |
| 123 | 121 | def OnContextMenu(self, evt): |
| ... | ... | @@ -223,6 +221,8 @@ class Viewer(wx.Panel): |
| 223 | 221 | "LeftButtonPressEvent": self.OnInsertAngularMeasurePoint |
| 224 | 222 | }, |
| 225 | 223 | } |
| 224 | + | |
| 225 | + | |
| 226 | 226 | if state == const.SLICE_STATE_CROSS: |
| 227 | 227 | self.__set_cross_visibility(1) |
| 228 | 228 | ps.Publisher().sendMessage('Activate ball reference') |
| ... | ... | @@ -276,6 +276,15 @@ class Viewer(wx.Panel): |
| 276 | 276 | else: |
| 277 | 277 | self.interactor.Bind(wx.EVT_LEFT_DCLICK, None) |
| 278 | 278 | |
| 279 | + # Measures are using vtkPropPicker because they need to get which actor | |
| 280 | + # was picked. | |
| 281 | + if state in (const.STATE_MEASURE_DISTANCE, const.STATE_MEASURE_ANGLE): | |
| 282 | + self.pick = vtk.vtkPropPicker() | |
| 283 | + self.interactor.SetPicker(self.pick) | |
| 284 | + else: | |
| 285 | + self.pick = vtk.vtkWorldPointPicker() | |
| 286 | + self.interactor.SetPicker(self.pick) | |
| 287 | + | |
| 279 | 288 | self.style = style |
| 280 | 289 | self.interactor.SetInteractorStyle(style) |
| 281 | 290 | self.interactor.Render() | ... | ... |