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