Stores one color column of the results of a call to .
Inheritance: AutoFillColumnResults
        DrawAutoFilledEdgeResults
        (
            DrawingObjects oDrawingObjects,
            Rectangle oColumnRectangle
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            Int32 iTop = oColumnRectangle.Top;

            if (m_oAutoFillWorkbookResults.AutoFilledEdgeColumnCount > 0)
            {
                DrawColumnHeader(oDrawingObjects, EdgePropertyHeader,
                                 oColumnRectangle.Left, oColumnRectangle.Right, ref iTop);

                Int32 iResultsLeft  = oColumnRectangle.Left;
                Int32 iResultsRight = oColumnRectangle.Right;

                AutoFillColorColumnResults oEdgeColorResults =
                    m_oAutoFillWorkbookResults.EdgeColorResults;

                if (oEdgeColorResults.ColumnAutoFilled)
                {
                    DrawColorColumnResults(oDrawingObjects, ColorCaption,
                                           oEdgeColorResults, VertexShape.SolidSquare,
                                           oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
                }

                AutoFillNumericRangeColumnResults oEdgeWidthResults =
                    m_oAutoFillWorkbookResults.EdgeWidthResults;

                if (oEdgeWidthResults.ColumnAutoFilled)
                {
                    DrawRampResults(oDrawingObjects,
                                    oEdgeWidthResults.SourceColumnName, EdgeWidthCaption,
                                    oEdgeWidthResults.SourceCalculationNumber1,
                                    oEdgeWidthResults.SourceCalculationNumber2,
                                    oEdgeWidthResults.DecimalPlaces, oColumnRectangle,
                                    iResultsLeft, iResultsRight, ref iTop);
                }

                AutoFillNumericRangeColumnResults oEdgeAlphaResults =
                    m_oAutoFillWorkbookResults.EdgeAlphaResults;

                if (oEdgeAlphaResults.ColumnAutoFilled)
                {
                    DrawAutoFilledAlphaResults(oDrawingObjects,
                                               oEdgeAlphaResults.SourceColumnName,
                                               oEdgeAlphaResults.SourceCalculationNumber1,
                                               oEdgeAlphaResults.SourceCalculationNumber2,
                                               oEdgeAlphaResults.DecimalPlaces,
                                               oEdgeAlphaResults.DestinationNumber1,
                                               oEdgeAlphaResults.DestinationNumber2,
                                               oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
                }
            }

            return(iTop);
        }
        DrawAutoFilledVertexResults
        (
            DrawingObjects oDrawingObjects,
            Rectangle oColumnRectangle
        )
        {
            Debug.Assert(oDrawingObjects != null);
            AssertValid();

            Int32 iTop = oColumnRectangle.Top;

            if (m_oAutoFillWorkbookResults.AutoFilledVertexNonXYColumnCount > 0)
            {
                DrawColumnHeader(oDrawingObjects, VertexPropertyHeader,
                                 oColumnRectangle.Left, oColumnRectangle.Right, ref iTop);

                Int32 iResultsLeft  = oColumnRectangle.Left;
                Int32 iResultsRight = oColumnRectangle.Right;

                AutoFillColorColumnResults oVertexColorResults =
                    m_oAutoFillWorkbookResults.VertexColorResults;

                if (oVertexColorResults.ColumnAutoFilled)
                {
                    DrawColorColumnResults(oDrawingObjects, ColorCaption,
                                           oVertexColorResults, VertexShape.Disk,
                                           oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
                }

                AutoFillNumericRangeColumnResults oVertexRadiusResults =
                    m_oAutoFillWorkbookResults.VertexRadiusResults;

                if (oVertexRadiusResults.ColumnAutoFilled)
                {
                    DrawRampResults(oDrawingObjects,
                                    oVertexRadiusResults.SourceColumnName, "Size",
                                    oVertexRadiusResults.SourceCalculationNumber1,
                                    oVertexRadiusResults.SourceCalculationNumber2,
                                    oVertexRadiusResults.DecimalPlaces, oColumnRectangle,
                                    iResultsLeft, iResultsRight, ref iTop);
                }

                AutoFillNumericRangeColumnResults oVertexAlphaResults =
                    m_oAutoFillWorkbookResults.VertexAlphaResults;

                if (oVertexAlphaResults.ColumnAutoFilled)
                {
                    DrawAutoFilledAlphaResults(oDrawingObjects,
                                               oVertexAlphaResults.SourceColumnName,
                                               oVertexAlphaResults.SourceCalculationNumber1,
                                               oVertexAlphaResults.SourceCalculationNumber2,
                                               oVertexAlphaResults.DecimalPlaces,
                                               oVertexAlphaResults.DestinationNumber1,
                                               oVertexAlphaResults.DestinationNumber2,
                                               oColumnRectangle, iResultsLeft, iResultsRight, ref iTop);
                }
            }

            return(iTop);
        }
示例#3
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)
                        );
                }
            }
        }
示例#4
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)
                );
        }
        //*************************************************************************
        //  Constructor: AutoFillWorkbookResults()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="AutoFillWorkbookResults" /> class.
        /// </summary>
        //*************************************************************************

        public AutoFillWorkbookResults()
        {
            m_oEdgeColorResults = new AutoFillColorColumnResults();
            m_oEdgeWidthResults = new AutoFillNumericRangeColumnResults();
            m_oEdgeAlphaResults = new AutoFillNumericRangeColumnResults();

            m_oVertexColorResults  = new AutoFillColorColumnResults();
            m_oVertexRadiusResults = new AutoFillNumericRangeColumnResults();
            m_oVertexAlphaResults  = new AutoFillNumericRangeColumnResults();
            m_oVertexXResults      = new AutoFillNumericRangeColumnResults();
            m_oVertexYResults      = new AutoFillNumericRangeColumnResults();

            AssertValid();
        }
    //*************************************************************************
    //  Constructor: AutoFillWorkbookResults()
    //
    /// <summary>
    /// Initializes a new instance of the <see
    /// cref="AutoFillWorkbookResults" /> class.
    /// </summary>
    //*************************************************************************

    public AutoFillWorkbookResults()
    {
        m_oEdgeColorResults = new AutoFillColorColumnResults();
        m_oEdgeWidthResults = new AutoFillNumericRangeColumnResults();
        m_oEdgeAlphaResults = new AutoFillNumericRangeColumnResults();

        m_oVertexColorResults = new AutoFillColorColumnResults();
        m_oVertexRadiusResults = new AutoFillNumericRangeColumnResults();
        m_oVertexAlphaResults = new AutoFillNumericRangeColumnResults();
        m_oVertexXResults = new AutoFillNumericRangeColumnResults();
        m_oVertexYResults = new AutoFillNumericRangeColumnResults();

        AssertValid();
    }
        DrawColorColumnResults
        (
            DrawingObjects oDrawingObjects,
            String sCaption,
            AutoFillColorColumnResults oColorResults,
            VertexShape eCategoryShape,
            Rectangle oColumnRectangle,
            Int32 iResultsLeft,
            Int32 iResultsRight,
            ref Int32 iTop
        )
        {
            Debug.Assert(oDrawingObjects != null);
            Debug.Assert(!String.IsNullOrEmpty(sCaption));
            Debug.Assert(oColorResults != null);

            if (oColorResults.SourceColumnContainsNumbers)
            {
                DrawColorBarResults(oDrawingObjects,
                                    oColorResults.SourceColumnName, ColorCaption,
                                    oColorResults.SourceCalculationNumber1,
                                    oColorResults.SourceCalculationNumber2,
                                    oColorResults.DecimalPlaces,
                                    oColorResults.DestinationColor1,
                                    oColorResults.DestinationColor2,
                                    oColumnRectangle, iResultsLeft, iResultsRight,
                                    ref iTop);
            }
            else
            {
                DrawColorCategoryResults(oDrawingObjects,
                                         oColorResults.CategoryNames,

                                         (Int32 categoryIndex, out VertexShape categoryShape,
                                          out Color categoryColor) =>
                {
                    categoryShape = eCategoryShape;

                    categoryColor = ColorUtil.GetUniqueColor(categoryIndex,
                                                             oColorResults.CategoryNames.Count);
                },

                                         oColumnRectangle, ref iTop
                                         );
            }
        }
示例#8
0
        AddCollapsedGroupAttributesInternal
        (
            Microsoft.Office.Interop.Excel.Workbook oWorkbook,
            ReadWorkbookContext oReadWorkbookContext,
            ListObject oEdgeTable,
            ListObject oVertexTable,
            GroupInfo[] aoGroups
        )
        {
            Debug.Assert(oWorkbook != null);
            Debug.Assert(oReadWorkbookContext != null);
            Debug.Assert(oEdgeTable != null);
            Debug.Assert(oVertexTable != null);
            Debug.Assert(aoGroups != null);
            Debug.Assert(aoGroups.Length > 0);

            // Check whether relevant columns have been autofilled using numerical
            // source columns.

            PerWorkbookSettings oPerWorkbookSettings =
                new PerWorkbookSettings(oWorkbook);

            AutoFillColorColumnResults oVertexColorResults =
                oPerWorkbookSettings.AutoFillWorkbookResults.VertexColorResults;

            Boolean bVertexColorColumnAutoFilled =
                oVertexColorResults.ColumnAutoFilled &&
                !oVertexColorResults.ColumnAutoFilledWithCategories;

            AutoFillColorColumnResults oEdgeColorResults =
                oPerWorkbookSettings.AutoFillWorkbookResults.EdgeColorResults;

            Boolean bEdgeColorColumnAutoFilled =
                oEdgeColorResults.ColumnAutoFilled &&
                !oEdgeColorResults.ColumnAutoFilledWithCategories;

            AutoFillNumericRangeColumnResults oEdgeWidthResults =
                oPerWorkbookSettings.AutoFillWorkbookResults.EdgeWidthResults;

            Boolean bEdgeWidthColumnAutoFilled =
                oEdgeWidthResults.ColumnAutoFilled;

            // Some user settings for autofill may be needed.
            //
            // Note: This is a design bug.  The user's current settings should not
            // be required; everything needed here should come from the autofill
            // results.  The long-term fix is to add a UseLogs property to the
            // AutoFillColorColumnResults class.

            AutoFillUserSettings oAutoFillUserSettings =
                new AutoFillUserSettings();

            ColorColumnAutoFillUserSettings oVertexColorDetails =
                oAutoFillUserSettings.VertexColorDetails;

            ColorColumnAutoFillUserSettings oEdgeColorDetails =
                oAutoFillUserSettings.EdgeColorDetails;

            NumericRangeColumnAutoFillUserSettings oEdgeWidthDetails =
                oAutoFillUserSettings.EdgeWidthDetails;

            // The key is the row ID for each visible row in the vertex table and
            // the value is value of the source column cell in that row that was
            // used to autofill the vertex color column, if it was autofilled.

            Dictionary <Int32, Object> oVertexColorSourceDictionary =
                bVertexColorColumnAutoFilled ?

                GetRowIDDictionary(oVertexTable,
                                   oVertexColorResults.SourceColumnName)
            :
                null;

            // Ditto for edge colors and edge widths.

            Dictionary <Int32, Object> oEdgeColorSourceDictionary =
                bEdgeColorColumnAutoFilled ?

                GetRowIDDictionary(oEdgeTable, oEdgeColorResults.SourceColumnName)
            :
                null;

            Dictionary <Int32, Object> oEdgeWidthSourceDictionary =
                bEdgeWidthColumnAutoFilled ?

                GetRowIDDictionary(oEdgeTable, oEdgeWidthResults.SourceColumnName)
            :
                null;

            // Only motifs need to have attributes added to them.

            foreach (ExcelTemplateGroupInfo oGroup in aoGroups.Where(
                         oGroup => oGroup.CollapsedAttributes != null))
            {
                CollapsedGroupAttributes oCollapsedGroupAttributes =
                    CollapsedGroupAttributes.FromString(
                        oGroup.CollapsedAttributes);

                String sType = oCollapsedGroupAttributes.GetGroupType();

                if (
                    sType == CollapsedGroupAttributeValues.FanMotifType
                    ||
                    sType == CollapsedGroupAttributeValues.DConnectorMotifType
                    ||
                    sType == CollapsedGroupAttributeValues.CliqueMotifType
                    )
                {
                    AddVertexColorAttributeToMotif(oGroup, sType,
                                                   bVertexColorColumnAutoFilled, oVertexColorResults,
                                                   oVertexColorDetails, oVertexColorSourceDictionary,
                                                   oReadWorkbookContext, oCollapsedGroupAttributes);
                }

                if (sType == CollapsedGroupAttributeValues.DConnectorMotifType)
                {
                    Int32 iAnchorVertices;

                    if (oCollapsedGroupAttributes.TryGetValue(
                            CollapsedGroupAttributeKeys.AnchorVertices,
                            out iAnchorVertices))
                    {
                        AddEdgeColorAttributesToDConnectorMotif(oGroup,
                                                                bEdgeColorColumnAutoFilled, oEdgeColorResults,
                                                                oEdgeColorDetails, oEdgeColorSourceDictionary,
                                                                oReadWorkbookContext, oCollapsedGroupAttributes,
                                                                iAnchorVertices);

                        AddEdgeWidthAttributesToDConnectorMotif(oGroup,
                                                                bEdgeWidthColumnAutoFilled, oEdgeWidthResults,
                                                                oEdgeWidthDetails, oEdgeWidthSourceDictionary,
                                                                oReadWorkbookContext, oCollapsedGroupAttributes,
                                                                iAnchorVertices);
                    }
                }

                oGroup.CollapsedAttributes = oCollapsedGroupAttributes.ToString();
            }
        }
    DrawColorColumnResults
    (
        DrawingObjects oDrawingObjects,
        String sCaption,
        AutoFillColorColumnResults oColorResults,
        VertexShape eCategoryShape,
        Rectangle oColumnRectangle,
        Int32 iResultsLeft,
        Int32 iResultsRight,
        ref Int32 iTop
    )
    {
        Debug.Assert(oDrawingObjects != null);
        Debug.Assert( !String.IsNullOrEmpty(sCaption) );
        Debug.Assert(oColorResults != null);

        if (oColorResults.SourceColumnContainsNumbers)
        {
            DrawColorBarResults(oDrawingObjects,
                oColorResults.SourceColumnName, ColorCaption,
                oColorResults.SourceCalculationNumber1,
                oColorResults.SourceCalculationNumber2,
                oColorResults.DecimalPlaces,
                oColorResults.DestinationColor1,
                oColorResults.DestinationColor2,
                oColumnRectangle, iResultsLeft, iResultsRight,
                ref iTop);
        }
        else
        {
            DrawColorCategoryResults(oDrawingObjects,
                oColorResults.CategoryNames,

                (Int32 categoryIndex, out VertexShape categoryShape,
                    out Color categoryColor) =>
                {
                    categoryShape = eCategoryShape;

                    categoryColor = ColorUtil.GetUniqueColor(categoryIndex,
                        oColorResults.CategoryNames.Count);
                },

                oColumnRectangle, ref iTop
                );
        }
    }
    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)
            );
    }