(self, ax, onselect=None, *, useblit=False,
props=None, handle_props=None, grab_range=10,
draw_bounding_box=False, box_handle_props=None,
box_props=None)
| 4077 | """ |
| 4078 | |
| 4079 | def __init__(self, ax, onselect=None, *, useblit=False, |
| 4080 | props=None, handle_props=None, grab_range=10, |
| 4081 | draw_bounding_box=False, box_handle_props=None, |
| 4082 | box_props=None): |
| 4083 | # The state modifiers 'move', 'square', and 'center' are expected by |
| 4084 | # _SelectorWidget but are not supported by PolygonSelector |
| 4085 | # Note: could not use the existing 'move' state modifier in-place of |
| 4086 | # 'move_all' because _SelectorWidget automatically discards 'move' |
| 4087 | # from the state on button release. |
| 4088 | state_modifier_keys = dict(clear='escape', move_vertex='control', |
| 4089 | move_all='shift', move='not-applicable', |
| 4090 | square='not-applicable', |
| 4091 | center='not-applicable', |
| 4092 | rotate='not-applicable') |
| 4093 | super().__init__(ax, onselect, useblit=useblit, |
| 4094 | state_modifier_keys=state_modifier_keys) |
| 4095 | |
| 4096 | self._xys = [(0, 0)] |
| 4097 | |
| 4098 | if props is None: |
| 4099 | props = dict(color='k', linestyle='-', linewidth=2, alpha=0.5) |
| 4100 | props = {**props, 'animated': self._useblit} |
| 4101 | self._selection_artist = line = Line2D([], [], **props) |
| 4102 | self.ax.add_line(line) |
| 4103 | |
| 4104 | if handle_props is None: |
| 4105 | handle_props = dict(markeredgecolor='k', |
| 4106 | markerfacecolor=props.get('color', 'k')) |
| 4107 | self._handle_props = handle_props |
| 4108 | self._polygon_handles = ToolHandles(self.ax, [], [], |
| 4109 | useblit=self._useblit, |
| 4110 | marker_props=self._handle_props) |
| 4111 | |
| 4112 | self._active_handle_idx = -1 |
| 4113 | self.grab_range = grab_range |
| 4114 | |
| 4115 | self.set_visible(True) |
| 4116 | self._draw_box = draw_bounding_box |
| 4117 | self._box = None |
| 4118 | |
| 4119 | if box_handle_props is None: |
| 4120 | box_handle_props = {} |
| 4121 | self._box_handle_props = {**self._handle_props, **box_handle_props} |
| 4122 | self._box_props = box_props |
| 4123 | |
| 4124 | def _get_bbox(self): |
| 4125 | return self._selection_artist.get_bbox() |
nothing calls this directly
no test coverage detected