[Qgis-developer] Object owner design in QgsGraphBuilder

Kuhn Matthias, Vermessung Matthias.Kuhn at Stadt-Uster.ch
Sun Sep 2 23:37:48 PDT 2012


Thank you for your response, Sergey,

I think I forgot to say thank you in my last mail, as I'm actually very happy to have found your implementation of Graphs and Dijkstra already in core. It saved me quite a bit of work.

I adjusted my code now, so I'm constructing the QgsGraph without the help of the QgsGraphBuilder. This way, I can use the id that already gets returned from QgsGraph when inserting new edges/vertices there. Is your idea to keep this return value, or to also replace it with an id specified by QgsGraphDirector (or similar)?

Meanwhile, my main concern is an additional QVariant for edges and vertices. What is your opinion on such a parameter?
https://github.com/matthias-kuhn/Quantum-GIS/commit/4ed7759ecb4e3b495ca2c37a7ffcf291df537148 and
https://github.com/matthias-kuhn/Quantum-GIS/commit/ca472fa3321fc8ccb02a876a7e9eb669b04d0f89

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?

Regards,
Matthias Kuhn
 

> -----Original Message-----
> From: qgis-developer-bounces at lists.osgeo.org 
> [mailto:qgis-developer-bounces at lists.osgeo.org] On Behalf Of 
> Sergey Yakushev
> Sent: Saturday, September 01, 2012 10:15 PM
> To: qgis-developer at lists.osgeo.org
> Subject: Re: [Qgis-developer] Object owner design in QgsGraphBuilder
> 
> > Documentation blocks added:
> > 
> https://github.com/matthias-kuhn/Quantum-GIS/commit/6cae97155901525e93
> > cbdf31af7ac7ad7c103805
> >
> > Add asserts to protect from accessing null-pointers:
> > 
> https://github.com/matthias-kuhn/Quantum-GIS/commit/0b34bd76658688509a
> > ef988f37dd8aa755722dbc
> >
> > Return ids of created vertexes and arcs
> > 
> https://github.com/matthias-kuhn/Quantum-GIS/commit/3d4f2251c759bcc1bc
> > e91aa1424b79a01c0c22b8
> 
> Hello
> 
> I do not agree with the addition QgsGraphBuilder return id 
> adding vertices and edges.
> 
> The idea is that QgsGraphDirector clearly specifies 
> identitfier of the verteces and its coordinates. But, in the 
> current implementation of QgsGraphBuilder requirement 
> coincides with desire.
> 
> Theoretically, you can implement child 
> QgsGraphBuilderInterface that constructs the object graph 
> without a unique integer identifier. Or, conversely, it 
> throws coordinate information. But for the analysis of these 
> objects, you can not use QgsGraphAnalyzer.
> 
> In the version of QGIS 1.7 I used AdjacencyMatrix as a graph object:
> 
> typedef std :: map <QgsPoint, ArcAttributes, QgsPointCompare> 
> AdjacencyMatrixString; typedef std :: map <QgsPoint, 
> AdjacencyMatrixString, QgsPointCompare> AdjacencyMatrix;
> 
> The integer identifier is not applicable to the type 
> AdjacencyMatrix and maybe in the future someone wants to 
> create a similar object. It would be unfortunate if 
> QgsGraphDirector childs will depend on the integer identifier.
> For this reason, there is a double Identification of vertices 
> and edges in QgsGraphDirector and QgsGraphBuilder classes. By 
> integer identifier and the coordinates of points.
> 
> ---
> 
> Still need to explain the following. If you implement child 
> QgsGraphDirector, then the correct implementation of the 
> method makeGraph () should be:
> 
> 1. Add all the vertices from id = 0 to last.
> 2. Add all the arc with correct points identifier.
> 
> In reverse order reap QgsGraph get bad output.
> 
> 
> --
> Sergey Yakushev
> 
> Sorry for a bad english.
> _______________________________________________
> 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