[Qgis-developer] Object owner design in QgsGraphBuilder

Kuhn Matthias, Vermessung Matthias.Kuhn at Stadt-Uster.ch
Thu Sep 6 00:14:25 PDT 2012


> > Was your idea to put such information into the properties 
> > QVector that can be passed with addArc()? Would it be 
> > feasible to integrate this also for vertices in one way or another?
> 
> The idea is that you should not edit QgsGraph object :-) . 
> Probably I will not add the properties top. New functional is 
> not a big problem for me, but I do not know why it.

My problem is the following: I have a layer containing the nodes and another layer (actually even a combination of two layers) containing the edges. They are connected by data definition and not only/necessarily geometry. Each node has some properties which are saved as attributes in the node layer.
If I can store a reference (feature id) to the node in the vertex on the graph I can access all these properties when iterating over a found shortest path. This can be useful e.g. if you want to draw a height profile of this path.

> If you create an object without using QgsGraph 
> QgsGraphBuilder QgsGraphDirector then a good idea to use 
> other libraries to analyze graphs. For example, bgl [1] or 
> NetworkX [2]. And I use the builder pattern [3], so you can 
> use the algorithm analyzes the vector layer 
> (QgsLineVectorGraphDirector object). I spent a lot of time debugging.

I like to minimize dependencies and your library already fits my purpose pretty well :)

I can stick to the builder pattern and write my own Director / Builder for this.
But I can only do this, if I am able to store at least one additional reference in QgsGraphVertex.

Cheers

> 
> Currently I work of full-feature network and surface cost 
> analysis plugin, but I will not use more than the shortest 
> path and minimum spanning tree.
> 
> Thanks.
> 
> [1] http://www.boost.org/doc/libs/1_51_0/libs/graph/doc/index.html
> [2] http://networkx.lanl.gov/
> [3] http://en.wikipedia.org/wiki/Builder_pattern
> -- 
> 
> Sergey Yakushev
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> 


More information about the Qgis-developer mailing list