safe.gui.tools.rectangle_map_tool module

Map tool implementation for selecting rectangles.

Based on work by Guisepe Sucameli, 2010. Updated for coding compliance etc. by Tim Sutton, Oct 2014.

New in version 2.2.0.

class safe.gui.tools.rectangle_map_tool.RectangleMapTool(canvas)[source]

Bases: qgis._gui.QgsMapToolEmitPoint

Map tool that lets the user define the analysis extents.

canvasMoveEvent(e)[source]
Parameters:e
Returns:
canvasPressEvent(e)[source]

Handle canvas press events so we know when user is capturing the rect.

Parameters:e – A Qt event object.
Type:QEvent
canvasReleaseEvent(e)[source]

Handle canvas release events has finished capturing e

Parameters:e – A Qt event object.
Type:QEvent
deactivate()[source]

Disable the tool.

deactivated
rectangle()[source]

Accessor for the rectangle.

Returns:A rectangle showing the designed extent.
Return type:QgsRectangle
rectangle_created
reset()[source]

Clear the rubber band for the analysis extents.

set_rectangle(rectangle)[source]

Set the rectangle for the selection. :param rectangle: :return:

show_rectangle(start_point, end_point)[source]

Show the rectangle on the canvas.

Parameters:
  • start_point (QgsPoint) – QGIS Point object representing the origin ( top left).
  • end_point (QgsPoint) – QGIS Point object representing the contra-origin ( bottom right).
Returns: