SetCollapsedFanMotifAttributes()
{
Debug.Assert(m_oCollapsedGroup != null);
Debug.Assert(m_oCollapsedGroupVertex != null);
Debug.Assert(m_oCollapsedGroupAttributes != null);
AssertValid();
// The vertex that represents the collapsed group should look like the
// fan motif's head vertex. Find the head vertex in the collection of
// the group's vertices.
String sHeadVertexName;
Int32 iLeafVertices;
if (
!m_oCollapsedGroupAttributes.TryGetValue(
CollapsedGroupAttributeKeys.HeadVertexName,
out sHeadVertexName)
||
!m_oCollapsedGroupAttributes.TryGetValue(
CollapsedGroupAttributeKeys.LeafVertices, out iLeafVertices)
)
{
// Behave gracefully.
return;
}
Single radius = 0.1f;
m_oCollapsedGroupVertex.SetValue(ReservedMetadataKeys.PerVertexRadius, radius);
// The head part of the collapsed group vertex should have the same
// color as the head vertex. That color was just copied to the
// collapsed group vertex.
//
// The fan part of the collapsed group vertex should be colored using
// the color specified in the collapsed attributes for the fan motif.
// Store this color in a special FanMotifFanColor key on the collapsed
// group vertex.
SetVertexColorFromCollapsedGroupAttributes(
ReservedMetadataKeys.FanMotifFanColor);
// Sample tooltip:
//
// Fan motif: 5 vertices with head vertex "HeadVertexName"
m_oCollapsedGroupVertex.SetValue(
ReservedMetadataKeys.PerVertexToolTip,
String.Format(
"Fan motif: {0} leaf vertices with head vertex \"{1}\""
,
iLeafVertices,
sHeadVertexName
)
);
}