Commit c9ebe7546c62cc4db6407e04dbd035477f999459
1 parent
ecae62b9
Exists in
master
and in
54 other branches
Fixed the problems with the ball reference
Showing
1 changed file
with
18 additions
and
12 deletions
Show diff stats
invesalius/data/viewer_volume.py
| @@ -189,6 +189,9 @@ class Viewer(wx.Panel): | @@ -189,6 +189,9 @@ class Viewer(wx.Panel): | ||
| 189 | 189 | ||
| 190 | Publisher.subscribe(self.RemoveVolume, 'Remove Volume') | 190 | Publisher.subscribe(self.RemoveVolume, 'Remove Volume') |
| 191 | 191 | ||
| 192 | + Publisher.subscribe(self._check_ball_reference, 'Enable style') | ||
| 193 | + Publisher.subscribe(self._uncheck_ball_reference, 'Disable style') | ||
| 194 | + | ||
| 192 | def SetStereoMode(self, pubsub_evt): | 195 | def SetStereoMode(self, pubsub_evt): |
| 193 | mode = pubsub_evt.data | 196 | mode = pubsub_evt.data |
| 194 | ren_win = self.interactor.GetRenderWindow() | 197 | ren_win = self.interactor.GetRenderWindow() |
| @@ -255,6 +258,20 @@ class Viewer(wx.Panel): | @@ -255,6 +258,20 @@ class Viewer(wx.Panel): | ||
| 255 | self._mode_cross = False | 258 | self._mode_cross = False |
| 256 | self.RemoveBallReference() | 259 | self.RemoveBallReference() |
| 257 | 260 | ||
| 261 | + def _check_ball_reference(self, pubsub_evt): | ||
| 262 | + st = pubsub_evt.data | ||
| 263 | + if st == const.SLICE_STATE_CROSS: | ||
| 264 | + self._mode_cross = True | ||
| 265 | + self._check_and_set_ball_visibility() | ||
| 266 | + self.interactor.Render() | ||
| 267 | + | ||
| 268 | + def _uncheck_ball_reference(self, pubsub_evt): | ||
| 269 | + st = pubsub_evt.data | ||
| 270 | + if st == const.SLICE_STATE_CROSS: | ||
| 271 | + self._mode_cross = False | ||
| 272 | + self.RemoveBallReference() | ||
| 273 | + self.interactor.Render() | ||
| 274 | + | ||
| 258 | def OnShowSurface(self, pubsub_evt): | 275 | def OnShowSurface(self, pubsub_evt): |
| 259 | index, value = pubsub_evt.data | 276 | index, value = pubsub_evt.data |
| 260 | if value: | 277 | if value: |
| @@ -262,7 +279,6 @@ class Viewer(wx.Panel): | @@ -262,7 +279,6 @@ class Viewer(wx.Panel): | ||
| 262 | else: | 279 | else: |
| 263 | self._to_show_ball -= 1 | 280 | self._to_show_ball -= 1 |
| 264 | self._check_and_set_ball_visibility() | 281 | self._check_and_set_ball_visibility() |
| 265 | - print "OnShowSurface: to show ball", self._to_show_ball | ||
| 266 | 282 | ||
| 267 | def SetBallReferencePosition(self, pubsub_evt): | 283 | def SetBallReferencePosition(self, pubsub_evt): |
| 268 | x, y, z = pubsub_evt.data | 284 | x, y, z = pubsub_evt.data |
| @@ -358,7 +374,6 @@ class Viewer(wx.Panel): | @@ -358,7 +374,6 @@ class Viewer(wx.Panel): | ||
| 358 | self.interactor.Render() | 374 | self.interactor.Render() |
| 359 | self._to_show_ball -= 1 | 375 | self._to_show_ball -= 1 |
| 360 | self._check_and_set_ball_visibility() | 376 | self._check_and_set_ball_visibility() |
| 361 | - print "RemoveVolume: to show ball", self._to_show_ball | ||
| 362 | 377 | ||
| 363 | def RemoveActors(self, pubsub_evt): | 378 | def RemoveActors(self, pubsub_evt): |
| 364 | "Remove a list of actors" | 379 | "Remove a list of actors" |
| @@ -408,8 +423,6 @@ class Viewer(wx.Panel): | @@ -408,8 +423,6 @@ class Viewer(wx.Panel): | ||
| 408 | pass | 423 | pass |
| 409 | 424 | ||
| 410 | def SetInteractorStyle(self, state): | 425 | def SetInteractorStyle(self, state): |
| 411 | - print "SetInteractorStyle" | ||
| 412 | - print "state: ", state | ||
| 413 | action = { | 426 | action = { |
| 414 | const.STATE_PAN: | 427 | const.STATE_PAN: |
| 415 | { | 428 | { |
| @@ -646,7 +659,6 @@ class Viewer(wx.Panel): | @@ -646,7 +659,6 @@ class Viewer(wx.Panel): | ||
| 646 | self.raycasting_volume = True | 659 | self.raycasting_volume = True |
| 647 | self._to_show_ball += 1 | 660 | self._to_show_ball += 1 |
| 648 | self._check_and_set_ball_visibility() | 661 | self._check_and_set_ball_visibility() |
| 649 | - print "OnShowRaycasting: to show ball", self._to_show_ball | ||
| 650 | if self.on_wl: | 662 | if self.on_wl: |
| 651 | self.text.Show() | 663 | self.text.Show() |
| 652 | 664 | ||
| @@ -655,7 +667,6 @@ class Viewer(wx.Panel): | @@ -655,7 +667,6 @@ class Viewer(wx.Panel): | ||
| 655 | self.text.Hide() | 667 | self.text.Hide() |
| 656 | self._to_show_ball -= 1 | 668 | self._to_show_ball -= 1 |
| 657 | self._check_and_set_ball_visibility() | 669 | self._check_and_set_ball_visibility() |
| 658 | - print "OnHideRaycasting: to show ball", self._to_show_ball | ||
| 659 | 670 | ||
| 660 | def OnSize(self, evt): | 671 | def OnSize(self, evt): |
| 661 | self.UpdateRender() | 672 | self.UpdateRender() |
| @@ -686,7 +697,6 @@ class Viewer(wx.Panel): | @@ -686,7 +697,6 @@ class Viewer(wx.Panel): | ||
| 686 | self.interactor.Render() | 697 | self.interactor.Render() |
| 687 | self._to_show_ball += 1 | 698 | self._to_show_ball += 1 |
| 688 | self._check_and_set_ball_visibility() | 699 | self._check_and_set_ball_visibility() |
| 689 | - print "LoadActor: to show ball", self._to_show_ball | ||
| 690 | 700 | ||
| 691 | def RemoveActor(self, pubsub_evt): | 701 | def RemoveActor(self, pubsub_evt): |
| 692 | utils.debug("RemoveActor") | 702 | utils.debug("RemoveActor") |
| @@ -696,7 +706,6 @@ class Viewer(wx.Panel): | @@ -696,7 +706,6 @@ class Viewer(wx.Panel): | ||
| 696 | self.interactor.Render() | 706 | self.interactor.Render() |
| 697 | self._to_show_ball -= 1 | 707 | self._to_show_ball -= 1 |
| 698 | self._check_and_set_ball_visibility() | 708 | self._check_and_set_ball_visibility() |
| 699 | - print "to show ball", self._to_show_ball | ||
| 700 | 709 | ||
| 701 | def RemoveAllActor(self, pubsub_evt): | 710 | def RemoveAllActor(self, pubsub_evt): |
| 702 | utils.debug("RemoveAllActor") | 711 | utils.debug("RemoveAllActor") |
| @@ -710,7 +719,6 @@ class Viewer(wx.Panel): | @@ -710,7 +719,6 @@ class Viewer(wx.Panel): | ||
| 710 | def LoadVolume(self, pubsub_evt): | 719 | def LoadVolume(self, pubsub_evt): |
| 711 | self.raycasting_volume = True | 720 | self.raycasting_volume = True |
| 712 | #self._to_show_ball += 1 | 721 | #self._to_show_ball += 1 |
| 713 | - #print "to show ball", self._to_show_ball | ||
| 714 | 722 | ||
| 715 | volume = pubsub_evt.data[0] | 723 | volume = pubsub_evt.data[0] |
| 716 | colour = pubsub_evt.data[1] | 724 | colour = pubsub_evt.data[1] |
| @@ -734,6 +742,7 @@ class Viewer(wx.Panel): | @@ -734,6 +742,7 @@ class Viewer(wx.Panel): | ||
| 734 | self.ren.ResetCamera() | 742 | self.ren.ResetCamera() |
| 735 | self.ren.ResetCameraClippingRange() | 743 | self.ren.ResetCameraClippingRange() |
| 736 | 744 | ||
| 745 | + self._check_and_set_ball_visibility() | ||
| 737 | self.UpdateRender() | 746 | self.UpdateRender() |
| 738 | 747 | ||
| 739 | def UnloadVolume(self, pubsub_evt): | 748 | def UnloadVolume(self, pubsub_evt): |
| @@ -743,7 +752,6 @@ class Viewer(wx.Panel): | @@ -743,7 +752,6 @@ class Viewer(wx.Panel): | ||
| 743 | self.raycasting_volume = False | 752 | self.raycasting_volume = False |
| 744 | self._to_show_ball -= 1 | 753 | self._to_show_ball -= 1 |
| 745 | self._check_and_set_ball_visibility() | 754 | self._check_and_set_ball_visibility() |
| 746 | - print "UnloadVolume: to show ball", self._to_show_ball | ||
| 747 | 755 | ||
| 748 | def OnSetViewAngle(self, evt_pubsub): | 756 | def OnSetViewAngle(self, evt_pubsub): |
| 749 | view = evt_pubsub.data | 757 | view = evt_pubsub.data |
| @@ -819,7 +827,6 @@ class Viewer(wx.Panel): | @@ -819,7 +827,6 @@ class Viewer(wx.Panel): | ||
| 819 | self.interactor.Render() | 827 | self.interactor.Render() |
| 820 | 828 | ||
| 821 | def OnInsertLinearMeasurePoint(self, obj, evt): | 829 | def OnInsertLinearMeasurePoint(self, obj, evt): |
| 822 | - print "Hey, you inserted measure point" | ||
| 823 | x,y = self.interactor.GetEventPosition() | 830 | x,y = self.interactor.GetEventPosition() |
| 824 | self.measure_picker.Pick(x, y, 0, self.ren) | 831 | self.measure_picker.Pick(x, y, 0, self.ren) |
| 825 | x, y, z = self.measure_picker.GetPickPosition() | 832 | x, y, z = self.measure_picker.GetPickPosition() |
| @@ -842,7 +849,6 @@ class Viewer(wx.Panel): | @@ -842,7 +849,6 @@ class Viewer(wx.Panel): | ||
| 842 | self.interactor.Render() | 849 | self.interactor.Render() |
| 843 | 850 | ||
| 844 | def OnInsertAngularMeasurePoint(self, obj, evt): | 851 | def OnInsertAngularMeasurePoint(self, obj, evt): |
| 845 | - print "Hey, you inserted a angular point" | ||
| 846 | x,y = self.interactor.GetEventPosition() | 852 | x,y = self.interactor.GetEventPosition() |
| 847 | self.measure_picker.Pick(x, y, 0, self.ren) | 853 | self.measure_picker.Pick(x, y, 0, self.ren) |
| 848 | x, y, z = self.measure_picker.GetPickPosition() | 854 | x, y, z = self.measure_picker.GetPickPosition() |