Stores one numeric range column of the results of a call to .
Наследование: AutoFillColumnResults
        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);
        }
        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);
        }
Пример #3
0
        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
                        );
                }
            }
        }
        //*************************************************************************
        //  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();
    }
Пример #6
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();
            }
        }
    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
                    );
            }
        }
    }