SetDefaultAttributesOnCollapsedGroup()
{
Debug.Assert(m_oCollapsedGroup != null);
Debug.Assert(m_oCollapsedGroupVertex != null);
AssertValid();
// Get the vertices that were collapsed into the collapsed group
// vertex.
ICollection<IVertex> oCollapsedVertices = m_oCollapsedGroup.Vertices;
Debug.Assert(oCollapsedVertices != null);
Debug.Assert(oCollapsedVertices.Count > 0);
// Use the color and shape of the first vertex in the group.
IVertex oFirstVertexToCollapse = oCollapsedVertices.First();
Object oColor;
// Note: Don't check the type of the color here, because it can be
// either of two types.
if ( oFirstVertexToCollapse.TryGetValue(
ReservedMetadataKeys.PerColor, out oColor) )
{
m_oCollapsedGroupVertex.SetValue(ReservedMetadataKeys.PerColor,
oColor);
}
Object oShape;
if ( oFirstVertexToCollapse.TryGetValue(
ReservedMetadataKeys.PerVertexShape, typeof(VertexShape),
out oShape) )
{
m_oCollapsedGroupVertex.SetValue(
ReservedMetadataKeys.PerVertexShape, (VertexShape)oShape);
}
// Use a size determined by the number of collapsed vertices.
Single fRadius = (Single)Math.Min(
8F + oCollapsedVertices.Count * 1F,
VertexDrawer.MaximumRadius / 12.0F);
m_oCollapsedGroupVertex.SetValue(ReservedMetadataKeys.PerVertexRadius,
fRadius);
// Add the group name as a label.
String sLabel = m_oCollapsedGroup.Label;
if ( !String.IsNullOrEmpty(sLabel) )
{
m_oCollapsedGroupVertex.SetValue(
ReservedMetadataKeys.PerVertexLabel, sLabel);
}
}