[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
QGIS unit tests
Build tests
Make sure that you have enabled building of tests in CMake.
cmake -DENABLE_TESTS=ON ..
Run tests
You can run all tests using make check
.
Individual tests can be run using ctest
.
For example if the output of make check
ends like this:
The following tests FAILED:
77 - PyQgsLocalServer (Failed)
You could re-run the failing test with:
ctest -V -R PyQgsLocalServer
The parameter -V
enables verbose mode and -R
takes a regular expression as
parameter and will only run matching tests.
Advanced configuration
Postgres
Make sure that you have enabled building of postgres test in CMake.
cmake -DENABLE_PGTEST=ON ..
To test the postgres provider you will need to have a database available to which the postgres provider can connect. The server will need to have postgis support enabled. By default the test uses the following connection options: dbname='qgis_test' host=localhost port=5432 user='postgres' password='postgres'
If this does not match your setup you can set the environment variable QGIS_PGTEST_DB to the desired connection string.
Please note that the database needs to be initialized using the sql-script tests/testdata/provider/testdata.sql It takes care of activating postgis for the test database and creates some tables containing test data.