AddVertexDuringGroupExpand
(
IVertex oVertex,
Boolean bDrawVertex,
Random oRandom
)
{
Debug.Assert(oVertex != null);
Debug.Assert(oRandom != null);
AssertValid();
m_oGraph.Vertices.Add(oVertex);
if ( VertexOrEdgeIsSelected(oVertex) )
{
m_oSelectedVertices.Add(oVertex);
}
if (bDrawVertex && m_oLastGraphDrawingContext != null)
{
if (oVertex.Location == System.Drawing.PointF.Empty)
{
// The vertex has never been laid out. This occurs when the
// vertex is in a group that was collapsed before the graph was
// drawn. Give the vertex a random location.
Rect oGraphRectangleMinusMargin =
m_oLastGraphDrawingContext.GraphRectangleMinusMargin;
oVertex.Location = new System.Drawing.PointF(
oRandom.Next(
(Int32)Math.Ceiling(oGraphRectangleMinusMargin.Left),
(Int32)oGraphRectangleMinusMargin.Right
),
oRandom.Next(
(Int32)Math.Ceiling(oGraphRectangleMinusMargin.Top),
(Int32)oGraphRectangleMinusMargin.Bottom
)
);
}
m_oGraphDrawer.DrawNewVertex(oVertex, m_oLastGraphDrawingContext);
}
}