Graphics Reference
In-Depth Information
def onTrackEdited(self):
self.modified = True
self.mapCanvas.refresh()
We simply need to remember that the track layer has been modified and redraw the map
canvas to show the change. Note that we don't switch back to the panning mode, as the
user will continue to make changes to the track vertices until he or she explicitly switches
off the edit tool by clicking on the toolbar icon a second time, or by choosing a different
action from the toolbar.
With this implemented, you can rerun your program, switch to track editing mode, and
click on the Edit Track action to add, move, or delete vertices. If you look carefully,
you'll see that the vertex you're dragging will snap to the vertex of another feature when
you move the mouse close to it. As with the EditTool , you can double-click on a seg-
ment to add a new vertex, or press the Ctrl key and click on a vertex to delete it.
Search WWH ::




Custom Search