Example #1
0
        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)
                        );
                }
            }
        }
Example #2
0
        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)
                );
        }