Book Image

Building Mapping Applications with QGIS

By : Erik Westra
Book Image

Building Mapping Applications with QGIS

By: Erik Westra

Overview of this book

Table of Contents (16 chapters)
Building Mapping Applications with QGIS
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with QGIS
Index

Implementing the track editing mode


Our final task for this chapter is to implement the track editing mode. We learned in the previous chapter how we can turn on the editing mode for a map layer and then use various map tools to let the user add, edit, and delete features. We'll start to implement the actual map tools in Chapter 9, Completing the ForestTrails Application, but for now, let's define our track editing mode itself.

The setEditMode() method is used to enter and leave the track editing mode. Replace the placeholder method you defined earlier with this new implementation:

    def setEditMode(self):
        if self.editing:
            if self.modified:
                reply = QMessageBox.question(self, "Confirm",
                                             "Save Changes?",
                                             QMessageBox.Yes |
                                             QMessageBox.No,
                                             QMessageBox.Yes)
                if reply...