FromString ( String attributes ) { Debug.Assert(attributes != null); CollapsedGroupAttributes oCollapsedGroupAttributes = new CollapsedGroupAttributes(); PopulateDictionary(oCollapsedGroupAttributes, attributes); return(oCollapsedGroupAttributes); }
PreDrawVertex ( IVertex vertex ) { Debug.Assert(vertex != null); AssertValid(); // Check whether the vertex represents a collapsed group. Object oCollapsedGroupAsObject; if ( vertex.TryGetValue(ReservedMetadataKeys.CollapsedGroupInfo, typeof(GroupInfo), out oCollapsedGroupAsObject) ) { // Yes. Get the group information. m_oCollapsedGroupVertex = vertex; m_oCollapsedGroup = (GroupInfo)oCollapsedGroupAsObject; if ( String.IsNullOrEmpty(m_oCollapsedGroup.CollapsedAttributes) ) { // No attributes were specified for the collapsed group. Set // attributes on the collapsed group vertex that will cause it // to be drawn in a default manner. m_oCollapsedGroupAttributes = new CollapsedGroupAttributes(); SetDefaultAttributesOnCollapsedGroup(); } else { m_oCollapsedGroupAttributes = CollapsedGroupAttributes.FromString( m_oCollapsedGroup.CollapsedAttributes); SetSpecifiedAttributesOnCollapsedGroup(); } } else { m_oCollapsedGroupVertex = null; m_oCollapsedGroup = null; m_oCollapsedGroupAttributes = null; } }
FromString ( String attributes ) { Debug.Assert(attributes != null); CollapsedGroupAttributes oCollapsedGroupAttributes = new CollapsedGroupAttributes(); PopulateDictionary(oCollapsedGroupAttributes, attributes); return (oCollapsedGroupAttributes); }
SetUp() { m_oCollapsedGroupAttributes = new CollapsedGroupAttributes(); }
GetRowIDsToAverageForEdges ( GroupInfo oGroup, CollapsedGroupAttributes oCollapsedGroupAttributes, Int32 iAnchorVertexIndex ) { Debug.Assert(oGroup != null); Debug.Assert(oCollapsedGroupAttributes != null); Debug.Assert(iAnchorVertexIndex >= 0); List<Int32> oRowIDsOfRowsToAverage = new List<Int32>(); String sAnchorVertexName; if ( oCollapsedGroupAttributes.TryGetValue( CollapsedGroupAttributeKeys.GetAnchorVertexNameKey( iAnchorVertexIndex), out sAnchorVertexName) ) { // The group's vertices are the span vertices. Loop through them. foreach (IVertex oVertex in oGroup.Vertices) { // We need to find the edge that is incident to the specified // anchor vertex. foreach (IEdge oIncidentEdge in oVertex.IncidentEdges) { IVertex oAdjacentVertex = oIncidentEdge.GetAdjacentVertex(oVertex); if (oAdjacentVertex.Name == sAnchorVertexName) { // The row ID is stored in the edge's Tag, as long as // the edge row isn't hidden. if (oIncidentEdge.Tag is Int32) { oRowIDsOfRowsToAverage.Add( (Int32)oIncidentEdge.Tag); } break; } } } } return (oRowIDsOfRowsToAverage); }
GetRowIDsToAverageForVertexColor ( GroupInfo oGroup, CollapsedGroupAttributes oCollapsedGroupAttributes, String sType ) { Debug.Assert(oGroup != null); Debug.Assert(oCollapsedGroupAttributes != null); Debug.Assert( !String.IsNullOrEmpty(sType) ); List<Int32> oRowIDsOfRowsToAverage = new List<Int32>(); IEnumerable<IVertex> oVerticesToAverage = null; switch (sType) { // Fan, Connector, and Clique fall through as each includes the proper vertices case CollapsedGroupAttributeValues.FanMotifType: case CollapsedGroupAttributeValues.DConnectorMotifType: case CollapsedGroupAttributeValues.CliqueMotifType: // All of the motif's vertices should be included. oVerticesToAverage = oGroup.Vertices; break; default: break; } if (oVerticesToAverage != null) { foreach (IVertex oVertex in oVerticesToAverage) { // The row ID is stored in the vertex's Tag, as long as the // vertex row isn't hidden. if (oVertex.Tag is Int32) { oRowIDsOfRowsToAverage.Add( (Int32)oVertex.Tag ); } } } return (oRowIDsOfRowsToAverage); }
AddEdgeWidthAttributesToDConnectorMotif ( ExcelTemplateGroupInfo oGroup, Boolean bEdgeWidthColumnAutoFilled, AutoFillNumericRangeColumnResults oEdgeWidthResults, NumericRangeColumnAutoFillUserSettings oEdgeWidthDetails, Dictionary<Int32, Object> oEdgeWidthSourceDictionary, ReadWorkbookContext oReadWorkbookContext, CollapsedGroupAttributes oCollapsedGroupAttributes, Int32 iAnchorVertices ) { Debug.Assert(oGroup != null); Debug.Assert(oEdgeWidthResults != null); Debug.Assert(oReadWorkbookContext != null); Debug.Assert(oCollapsedGroupAttributes != null); Debug.Assert(iAnchorVertices >= 0); // If the edge width column was autofilled, get the average width for // the edges incident to the two-connector motif's first anchor, then // its second anchor. Otherwise, don't do anything. if (!bEdgeWidthColumnAutoFilled) { return; } for (Int32 iAnchorVertexIndex = 0; iAnchorVertexIndex < iAnchorVertices; iAnchorVertexIndex++) { Double dAverageEdgeWidth; if ( TableColumnMapper.TryMapAverageNumber( GetRowIDsToAverageForEdges(oGroup, oCollapsedGroupAttributes, iAnchorVertexIndex), oEdgeWidthSourceDictionary, oEdgeWidthResults.SourceCalculationNumber1, oEdgeWidthResults.SourceCalculationNumber2, oEdgeWidthResults.DestinationNumber1, oEdgeWidthResults.DestinationNumber2, oEdgeWidthDetails.UseLogs, out dAverageEdgeWidth ) ) { oCollapsedGroupAttributes.Add( CollapsedGroupAttributeKeys.GetAnchorVertexEdgeWidthKey( iAnchorVertexIndex), dAverageEdgeWidth ); } } }
AddEdgeColorAttributesToDConnectorMotif ( ExcelTemplateGroupInfo oGroup, Boolean bEdgeColorColumnAutoFilled, AutoFillColorColumnResults oEdgeColorResults, ColorColumnAutoFillUserSettings oEdgeColorDetails, Dictionary<Int32, Object> oEdgeColorSourceDictionary, ReadWorkbookContext oReadWorkbookContext, CollapsedGroupAttributes oCollapsedGroupAttributes, Int32 iAnchorVertices ) { Debug.Assert(oGroup != null); Debug.Assert(oEdgeColorResults != null); Debug.Assert(oReadWorkbookContext != null); Debug.Assert(oCollapsedGroupAttributes != null); Debug.Assert(iAnchorVertices >= 0); // If the edge color column was autofilled, get the average color for // the edges incident to the D-connector motif's first anchor, then its // second anchor, and so on. Otherwise, don't do anything. if (!bEdgeColorColumnAutoFilled) { return; } for (Int32 iAnchorVertexIndex = 0; iAnchorVertexIndex < iAnchorVertices; iAnchorVertexIndex++) { Color oAverageColor; if ( TableColumnMapper.TryMapAverageColor( GetRowIDsToAverageForEdges(oGroup, oCollapsedGroupAttributes, iAnchorVertexIndex), oEdgeColorSourceDictionary, oEdgeColorResults.SourceCalculationNumber1, oEdgeColorResults.SourceCalculationNumber2, oEdgeColorResults.DestinationColor1, oEdgeColorResults.DestinationColor2, oEdgeColorDetails.UseLogs, out oAverageColor) ) { oCollapsedGroupAttributes.Add( CollapsedGroupAttributeKeys.GetAnchorVertexEdgeColorKey( iAnchorVertexIndex), oReadWorkbookContext.ColorConverter2.GraphToWorkbook( oAverageColor) ); } } }
AddVertexColorAttributeToMotif ( ExcelTemplateGroupInfo oGroup, String sType, Boolean bVertexColorColumnAutoFilled, AutoFillColorColumnResults oVertexColorResults, ColorColumnAutoFillUserSettings oVertexColorDetails, Dictionary<Int32, Object> oVertexColorSourceDictionary, ReadWorkbookContext oReadWorkbookContext, CollapsedGroupAttributes oCollapsedGroupAttributes ) { Debug.Assert(oGroup != null); Debug.Assert( !String.IsNullOrEmpty(sType) ); Debug.Assert(oVertexColorResults != null); Debug.Assert(oReadWorkbookContext != null); Debug.Assert(oCollapsedGroupAttributes != null); Color oColor; // If the vertex color column was autofilled, get the average color // for the vertices in the motif. if ( !bVertexColorColumnAutoFilled || !TableColumnMapper.TryMapAverageColor( GetRowIDsToAverageForVertexColor(oGroup, oCollapsedGroupAttributes, sType), oVertexColorSourceDictionary, oVertexColorResults.SourceCalculationNumber1, oVertexColorResults.SourceCalculationNumber2, oVertexColorResults.DestinationColor1, oVertexColorResults.DestinationColor2, oVertexColorDetails.UseLogs, out oColor) ) { // Default to the color that was assigned to the group. oColor = oGroup.VertexColor; } oCollapsedGroupAttributes.Add( CollapsedGroupAttributeKeys.VertexColor, oReadWorkbookContext.ColorConverter2.GraphToWorkbook(oColor) ); }