32 return mGraphVertexes.size() - 1;
35 int QgsGraph::addArc(
int outVertexIdx,
int inVertexIdx,
const QVector< QVariant >& properties )
39 e.mProperties = properties;
40 e.mOut = outVertexIdx;
42 mGraphArc.push_back( e );
43 int edgeIdx = mGraphArc.size() - 1;
45 mGraphVertexes[ outVertexIdx ].mOutArc.push_back( edgeIdx );
46 mGraphVertexes[ inVertexIdx ].mInArc.push_back( edgeIdx );
48 return mGraphArc.size() - 1;
53 return mGraphVertexes[ idx ];
58 return mGraphArc[ idx ];
64 return mGraphVertexes.size();
69 return mGraphArc.size();
75 for ( i = 0; i < mGraphVertexes.size(); ++i )
77 if ( mGraphVertexes[ i ].point() == pt )
94 return mProperties[ i ];
113 : mCoordinate( point )
QgsGraphArcIdList inArc() const
return incoming edges
const QgsGraphArc & arc(int idx) const
return edge at index
int inVertex() const
return index of incoming vertex
QVariant property(int propertyIndex) const
return property value
QgsGraphArcIdList outArc() const
return outgoing edges
QgsPoint point() const
return vertex point
int outVertex() const
return index of outgoing vertex
QVector< QVariant > properties() const
get array of proertyes
This class implement a graph edge.
int findVertex(const QgsPoint &pt) const
find vertex by point
int arcCount() const
return edge count
int addArc(int outVertexIdx, int inVertexIdx, const QVector< QVariant > &properties)
add edge to a graph
int addVertex(const QgsPoint &pt)
add vertex to a grap
A class to represent a point.
This class implement a graph vertex.
QgsGraphVertex()
default constructor.
const QgsGraphVertex & vertex(int idx) const
return vertex at index
int vertexCount() const
return vertex count
QList< int > QgsGraphArcIdList