Skip to content
Permalink
Browse files

Added QgsTracer to support tracing in map tools

The tracer builds a graph from input layers and uses Dijkstra's
algorithm for the shortest path in the graph.

There is already QgsGraph class and friends in QGIS code including
Dijkstra's algorithm, however that implementation does not fit our
needs well for a number of reasons (some of them would be easy
to fix, but others would require a significant rewrite):
- limited to single input layer
- no monitoring of changes in the input layers
- no support for polygons
- not in core library
- shortest path alg does only stops when all distances are calculated
- every point of input layer represented as a vertex in graph
  (resulting graph is much denser than necessary and path finding slower)
- edges have always one direction, requiring two edges between each
  pair of vertices (resulting graph has twice as many edges)
- graph is always built with start/finish points
  (does not allow temporary addition of start/finish points and their
   removal without complete rebuild of the graph)
  • Loading branch information
wonder-sk committed Jan 8, 2016
1 parent e0a557a commit 9a6ffc4b2e883bf412f692f46df1f780aa8b0675
Showing with 782 additions and 0 deletions.
  1. +3 −0 src/core/CMakeLists.txt
  2. +534 −0 src/core/qgstracer.cpp
  3. +55 −0 src/core/qgstracer.h
  4. +1 −0 tests/src/core/CMakeLists.txt
  5. +189 −0 tests/src/core/testqgstracer.cpp
@@ -184,6 +184,7 @@ SET(QGIS_CORE_SRCS
qgssqlexpressioncompiler.cpp
qgsstatisticalsummary.cpp
qgsstringutils.cpp
qgstracer.cpp
qgstransaction.cpp
qgstextlabelfeature.cpp
qgstolerance.cpp
@@ -454,6 +455,7 @@ SET(QGIS_CORE_MOC_HDRS
qgsrelationmanager.h
qgsrunprocess.h
qgssnappingutils.h
qgstracer.h
qgstransaction.h
qgsvectordataprovider.h
qgsvectorlayercache.h
@@ -659,6 +661,7 @@ SET(QGIS_CORE_HDRS
qgsstringutils.h
qgstextlabelfeature.h
qgstolerance.h
qgstracer.h

qgsvectordataprovider.h
qgsvectorlayercache.h

0 comments on commit 9a6ffc4

Please sign in to comment.
You can’t perform that action at this time.