[FEATURE] Tracing of features (digitizing)
Tracing can be now used in various capturing map tools (add feature, add part, ...) including reshape and split tools.
Tracing is simply a new mode for these tools - when tracing is not enabled, the tools work as usual. When tracing is enabled (by clicking the new magnet icon or pressing T key), tools switch to tracing behavior:
- first click on a vertex/edge (must be snapped!) will start tracing - moving mouse on top of the map continuously updates the trace
- next click will confirm the trace and mark start of a new trace Tracing can be enabled/disabled anytime even while digitizing one feature, so it is possible to digitize some parts of the feature with tracing enabled and other parts with tracing disabled.
Tracing respects snapping configuration for the list of traceable layers.
If there are too many features in map display, tracing is disabled to avoid potentially long tracing structure preparation and large memory overhead. After zooming in or disabling some layers the tracing is enabled again.
Internally, things work like this:
- when tracing is requested, linestrings are extracted from vector layers, then noded (using GEOSNode to resolve all intersections) and finally a simple planar graph is built (vertices + edges)
- when tracing, endpoints are temporarily added to the graph (if not equal to one of existing vertices already) and Dijkstra's algorithm is run to get shortest path
Original specs for the curious ones (the interaction with QGIS is slightly improved from what has been specified): http://www.lutraconsulting.co.uk/crowdfunding/autotrace-phase-2/specification.pdf
* QgsFilePicker is intended to be used across whole QGIS application for file picking
* right now it supports only single file/folder selection
* it has advanced support of relative path
* QgsExternalRessourceWidget is the pending editor widget which integrates a photo/web viewer
* it can be properly accessible from the API and custom widgets
* new class to avoid duplicating code for legacy support
* old widgets will be removed from QGIS 3 (users will be invited to use the new widget in the config dialog)
* Use an hyperlink for file name: when checked the widget displays an hyperlink (in a QLabel) instead of a QLineEdit. The link is always clickable, even in non edit mode. In this mode, user can only change the content of the field by selecting a file with the file selector (which is opened with the "..." button). If you want to revert to editable QLineEdit file name widget, just unchek the option.
* Display the full path: when checked, the hyperlink will display the absolute path of the file. When unchecked, the hyperlink will display only the name of the file (useful if the file path is always long).
Default Path: this is the path that will be used by the file selector when opening. The file selector will start at this path (if the option is not empty).
* Store Relative paths to the default path: when checked, file names are stored relatively to the default path described above. It is useful to store long paths into text shapefiles attributes limited to 254 characters.
* Store relative paths to the project path: when checked, file names are stored relatively to the project (.qgs file) path. This option will override the "save paths" setting of the project because it is sometimes useful to store code/svg/layer path relatively but not for the file name attributes.
* File storage options are exclusive options to make the file selector select files (default mode) or only directories.
File Name editor widget:
* add a isFieldSupported method to the factory to allow File Name widget only on fields that are QStrings.
* add a new QSetting to save the last path used in the widget. Before the PR, users were always defaulted to QGIS home directory when using the file selector button. This QSetting could also be used for the photo widget.
* when you want to change the value of an already set attribute, file selector will point to this path.
* when the value of the attribute is null or non valid (not a file), the file selector will use the default path (if set), or the last used path or the home directory.
During rendering, two new variables will be available:
* `geometry_part_count`
* `geometry_part_num` (1-based index)
Useful to apply different styles to different parts of multipart
features
Applies to north arrow, copyright and scalebar.
- Changed dialogs to use QgsUnitSelectionWidget.
- Added QgsSymbolV2::OutputUnit enum to decorationitem.
- Updated to use mm, pixel, or percentage units.
- Added percentage to OutputUnit enum.
- Updated qgssymbolv2utils to include percentage.
- Updated qgsunitselectionwidget to include percentage.
Changed selection widget in its own commit
Added Percentage to OutputUnit enum.
Added percentage to switches in utils