Our next task is to implement the Edit Track action. To do this, we'll take
EditTool we defined in Chapter 7, Selecting and Editing Features in a PyQGIS Application, and modify it to work specifically with tracks. Fortunately, we only need to support LineString geometries and can make use of our mixin class, which will simplify the implementation of this new map tool.
Let's start by adding our new class definition to the
mapTools.py module, along with the
class EditTrackTool(QgsMapTool, MapToolMixin): def __init__(self, canvas, layer, onTrackEdited): QgsMapTool.__init__(self, canvas) self.onTrackEdited = onTrackEdited self.dragging = False self.feature = None self.vertex = None self.setLayer(layer) self.setCursor(Qt.CrossCursor) ...