Contains information about one group of vertices.
This class is derived from GroupInfo. It adds group information that is specific to the ExcelTemplate project.
Inheritance: Smrf.NodeXL.Core.GroupInfo
コード例 #1
0
ファイル: Sheet5.cs プロジェクト: yesbb12/ParallelBFS
        TryGetRowIDAndLocation
        (
            KeyValuePair <String, IVertex> oLocationInfo,
            out Int32 iRowID,
            out PointF oLocationToSet
        )
        {
            AssertValid();

            iRowID         = Int32.MinValue;
            oLocationToSet = PointF.Empty;

            // The IVertex is the collapsed vertex that represents the group.
            // Information about the group is stored in the vertex's metadata.

            IVertex oVertex = oLocationInfo.Value;
            Object  oGroupInfoAsObject;

            if (oVertex.TryGetValue(ReservedMetadataKeys.CollapsedGroupInfo,
                                    typeof(ExcelTemplateGroupInfo), out oGroupInfoAsObject))
            {
                ExcelTemplateGroupInfo oGroupInfo =
                    (ExcelTemplateGroupInfo)oGroupInfoAsObject;

                if (oGroupInfo.RowID.HasValue)
                {
                    iRowID         = oGroupInfo.RowID.Value;
                    oLocationToSet = oVertex.Location;

                    return(true);
                }
            }

            return(false);
        }
コード例 #2
0
        TryCalculateGraphMetricsForOneGroup
        (
            ExcelTemplateGroupInfo oExcelTemplateGroupInfo,
            CalculateGraphMetricsContext oCalculateGraphMetricsContext,
            out OverallMetrics oOverallMetrics
        )
        {
            Debug.Assert(oExcelTemplateGroupInfo != null);
            Debug.Assert(oExcelTemplateGroupInfo.Vertices != null);
            Debug.Assert(oExcelTemplateGroupInfo.Vertices.Count > 0);
            Debug.Assert(oCalculateGraphMetricsContext != null);
            AssertValid();

            oOverallMetrics = null;

            ICollection <IVertex> oVertices = oExcelTemplateGroupInfo.Vertices;

            // Create a new graph from the vertices in the group and the edges that
            // connect them.

            IGraph oNewGraph = SubgraphCalculator.GetSubgraphAsNewGraph(oVertices);

            // Calculate the overall metrics for the new graph using the
            // OverallMetricCalculator class in the Algorithms namespace, which
            // knows nothing about Excel.

            return((new Algorithms.OverallMetricCalculator()).
                   TryCalculateGraphMetrics(oNewGraph,
                                            oCalculateGraphMetricsContext.BackgroundWorker,
                                            out oOverallMetrics));
        }
コード例 #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
                        );
                }
            }
        }
コード例 #4
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)
                        );
                }
            }
        }
コード例 #5
0
ファイル: GroupEdgeInfo.cs プロジェクト: yesbb12/ParallelBFS
        //*************************************************************************
        //  Constructor: GroupEdgeInfo()
        //
        /// <overloads>
        /// Initializes a new instance of the <see cref="GroupEdgeInfo" /> class.
        /// </overloads>
        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupEdgeInfo" /> class
        /// for a real group.
        /// </summary>
        ///
        /// <param name="edges">
        /// A collection of the group's zero or more edges.
        /// </param>
        ///
        /// <param name="groupInfo">
        /// Contains information about the real group.
        /// </param>
        //*************************************************************************

        public GroupEdgeInfo
        (
            IEnumerable <IEdge> edges,
            ExcelTemplateGroupInfo groupInfo
        )
            : this(edges, groupInfo, null)
        {
            // (Do nothing else.)

            AssertValid();
        }
コード例 #6
0
    //*************************************************************************
    //  Constructor: GroupEdgeInfo()
    //
    /// <overloads>
    /// Initializes a new instance of the <see cref="GroupEdgeInfo" /> class.
    /// </overloads>
    ///
    /// <summary>
    /// Initializes a new instance of the <see cref="GroupEdgeInfo" /> class
    /// for a real group.
    /// </summary>
    ///
    /// <param name="edges">
    /// A collection of the group's zero or more edges.
    /// </param>
    ///
    /// <param name="groupInfo">
    /// Contains information about the real group.
    /// </param>
    //*************************************************************************

    public GroupEdgeInfo
    (
        IEnumerable<IEdge> edges,
        ExcelTemplateGroupInfo groupInfo
    )
    : this(edges, groupInfo, null)
    {
        // (Do nothing else.)

        AssertValid();
    }
コード例 #7
0
ファイル: GroupEdgeInfo.cs プロジェクト: yesbb12/ParallelBFS
        //*************************************************************************
        //  Constructor: GroupEdgeInfo()
        //
        /// <summary>
        /// Initializes a new instance of the <see cref="GroupEdgeInfo" /> class.
        /// </summary>
        ///
        /// <param name="oEdges">
        /// A collection of the group's zero or more edges.
        /// </param>
        ///
        /// <param name="oGroupInfo">
        /// Contains information about the group, or null if this is a "dummy"
        /// group.
        /// </param>
        ///
        /// <param name="sDummyGroupName">
        /// Name of the dummy group, or null if this is not a dummy group.
        /// </param>
        //*************************************************************************

        protected GroupEdgeInfo
        (
            IEnumerable <IEdge> oEdges,
            ExcelTemplateGroupInfo oGroupInfo,
            String sDummyGroupName
        )
        {
            m_oEdges          = oEdges;
            m_oGroupInfo      = oGroupInfo;
            m_sDummyGroupName = sDummyGroupName;

            AssertValid();
        }
コード例 #8
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)
                );
        }
コード例 #9
0
    ReadGroupTable
    (
        ListObject oGroupTable,
        ReadWorkbookContext oReadWorkbookContext,
        HashSet<String> oSkippedGroupNames,
        HashSet<String> oHiddenGroupNames
    )
    {
        Debug.Assert(oGroupTable != null);
        Debug.Assert(oReadWorkbookContext != null);
        Debug.Assert(oSkippedGroupNames != null);
        Debug.Assert(oHiddenGroupNames != null);
        AssertValid();

        if (oReadWorkbookContext.FillIDColumns)
        {
            FillIDColumn(oGroupTable);
        }

        Dictionary<String, ExcelTemplateGroupInfo> oGroupNameDictionary =
            new Dictionary<String, ExcelTemplateGroupInfo>();

        ColorConverter2 oColorConverter2 =
            oReadWorkbookContext.ColorConverter2;

        GroupVisibilityConverter oGroupVisibilityConverter =
            new GroupVisibilityConverter();

        BooleanConverter oBooleanConverter =
            oReadWorkbookContext.BooleanConverter;

        ExcelTableReader oExcelTableReader = new ExcelTableReader(oGroupTable);

        foreach ( ExcelTableReader.ExcelTableRow oRow in
            oExcelTableReader.GetRows() )
        {
            // Get the group information.

            String sGroupName;
            Color oVertexColor;
            VertexShape eVertexShape;

            if (
                !oRow.TryGetNonEmptyStringFromCell(GroupTableColumnNames.Name,
                    out sGroupName)
                ||
                !TryGetColor(oRow, GroupTableColumnNames.VertexColor,
                    oColorConverter2, out oVertexColor)
                ||
                !TryGetVertexShape(oRow, GroupTableColumnNames.VertexShape,
                    out eVertexShape)
                )
            {
                continue;
            }

            ReadVisibility(oRow, oGroupVisibilityConverter, sGroupName,
                oSkippedGroupNames, oHiddenGroupNames);

            Boolean bCollapsed = false;
            Boolean bCollapsedCellValue;

            if (
                TryGetBoolean(oRow, GroupTableColumnNames.Collapsed,
                    oBooleanConverter, out bCollapsedCellValue)
                &&
                bCollapsedCellValue
                )
            {
                bCollapsed = true;
            }

            String sCollapsedAttributes;

            if ( !oRow.TryGetNonEmptyStringFromCell(
                GroupTableColumnNames.CollapsedAttributes,
                out sCollapsedAttributes) )
            {
                sCollapsedAttributes = null;
            }

            Int32 iRowIDAsInt32;
            Nullable<Int32> iRowID = null;

            if ( oRow.TryGetInt32FromCell(CommonTableColumnNames.ID,
                out iRowIDAsInt32) )
            {
                iRowID = iRowIDAsInt32;
            }

            ExcelTemplateGroupInfo oExcelTemplateGroupInfo =
                new ExcelTemplateGroupInfo(sGroupName, iRowID, oVertexColor,
                    eVertexShape, bCollapsed, sCollapsedAttributes);

            if (oReadWorkbookContext.ReadGroupLabels)
            {
                String sLabel;

                if ( oRow.TryGetNonEmptyStringFromCell(
                    GroupTableColumnNames.Label, out sLabel) )
                {
                    oExcelTemplateGroupInfo.Label = sLabel;
                }
            }

            if (!oReadWorkbookContext.IgnoreVertexLocations)
            {
                System.Drawing.PointF oCollapsedLocation;

                if ( TryGetLocation(oRow, GroupTableColumnNames.CollapsedX,
                    GroupTableColumnNames.CollapsedY,
                    oReadWorkbookContext.VertexLocationConverter,
                    out oCollapsedLocation) )
                {
                    oExcelTemplateGroupInfo.CollapsedLocation =
                        oCollapsedLocation;
                }
            }

            try
            {
                oGroupNameDictionary.Add(sGroupName, oExcelTemplateGroupInfo);
            }
            catch (ArgumentException)
            {
                Range oInvalidCell = oRow.GetRangeForCell(
                    GroupTableColumnNames.Name);

                OnWorkbookFormatError( String.Format(

                    "The cell {0} contains a duplicate group name.  There"
                    + " can't be two rows with the same group name."
                    ,
                    ExcelUtil.GetRangeAddress(oInvalidCell)
                    ),

                    oInvalidCell
                );
            }
        }

        return (oGroupNameDictionary);
    }
コード例 #10
0
    //*************************************************************************
    //  Constructor: GroupEdgeInfo()
    //
    /// <summary>
    /// Initializes a new instance of the <see cref="GroupEdgeInfo" /> class.
    /// </summary>
    ///
    /// <param name="oEdges">
    /// A collection of the group's zero or more edges.
    /// </param>
    ///
    /// <param name="oGroupInfo">
    /// Contains information about the group, or null if this is a "dummy"
    /// group.
    /// </param>
    ///
    /// <param name="sDummyGroupName">
    /// Name of the dummy group, or null if this is not a dummy group.
    /// </param>
    //*************************************************************************

    protected GroupEdgeInfo
    (
        IEnumerable<IEdge> oEdges,
        ExcelTemplateGroupInfo oGroupInfo,
        String sDummyGroupName
    )
    {
        m_oEdges = oEdges;
        m_oGroupInfo = oGroupInfo;
        m_sDummyGroupName = sDummyGroupName;

        AssertValid();
    }
コード例 #11
0
        ReadGroupTable
        (
            ListObject oGroupTable,
            ReadWorkbookContext oReadWorkbookContext,
            HashSet <String> oSkippedGroupNames,
            HashSet <String> oHiddenGroupNames
        )
        {
            Debug.Assert(oGroupTable != null);
            Debug.Assert(oReadWorkbookContext != null);
            Debug.Assert(oSkippedGroupNames != null);
            Debug.Assert(oHiddenGroupNames != null);
            AssertValid();

            if (oReadWorkbookContext.FillIDColumns)
            {
                FillIDColumn(oGroupTable);
            }

            Dictionary <String, ExcelTemplateGroupInfo> oGroupNameDictionary =
                new Dictionary <String, ExcelTemplateGroupInfo>();

            ColorConverter2 oColorConverter2 =
                oReadWorkbookContext.ColorConverter2;

            GroupVisibilityConverter oGroupVisibilityConverter =
                new GroupVisibilityConverter();

            BooleanConverter oBooleanConverter =
                oReadWorkbookContext.BooleanConverter;

            ExcelTableReader oExcelTableReader = new ExcelTableReader(oGroupTable);

            foreach (ExcelTableReader.ExcelTableRow oRow in
                     oExcelTableReader.GetRows())
            {
                // Get the group information.

                String      sGroupName;
                Color       oVertexColor;
                VertexShape eVertexShape;

                if (
                    !oRow.TryGetNonEmptyStringFromCell(GroupTableColumnNames.Name,
                                                       out sGroupName)
                    ||
                    !TryGetColor(oRow, GroupTableColumnNames.VertexColor,
                                 oColorConverter2, out oVertexColor)
                    ||
                    !TryGetVertexShape(oRow, GroupTableColumnNames.VertexShape,
                                       out eVertexShape)
                    )
                {
                    continue;
                }

                ReadVisibility(oRow, oGroupVisibilityConverter, sGroupName,
                               oSkippedGroupNames, oHiddenGroupNames);

                Boolean bCollapsed = false;
                Boolean bCollapsedCellValue;

                if (
                    TryGetBoolean(oRow, GroupTableColumnNames.Collapsed,
                                  oBooleanConverter, out bCollapsedCellValue)
                    &&
                    bCollapsedCellValue
                    )
                {
                    bCollapsed = true;
                }

                String sCollapsedAttributes;

                if (!oRow.TryGetNonEmptyStringFromCell(
                        GroupTableColumnNames.CollapsedAttributes,
                        out sCollapsedAttributes))
                {
                    sCollapsedAttributes = null;
                }

                Int32            iRowIDAsInt32;
                Nullable <Int32> iRowID = null;

                if (oRow.TryGetInt32FromCell(CommonTableColumnNames.ID,
                                             out iRowIDAsInt32))
                {
                    iRowID = iRowIDAsInt32;
                }

                ExcelTemplateGroupInfo oExcelTemplateGroupInfo =
                    new ExcelTemplateGroupInfo(sGroupName, iRowID, oVertexColor,
                                               eVertexShape, bCollapsed, sCollapsedAttributes);

                if (oReadWorkbookContext.ReadGroupLabels)
                {
                    String sLabel;

                    if (oRow.TryGetNonEmptyStringFromCell(
                            GroupTableColumnNames.Label, out sLabel))
                    {
                        oExcelTemplateGroupInfo.Label = sLabel;
                    }
                }

                if (!oReadWorkbookContext.IgnoreVertexLocations)
                {
                    System.Drawing.PointF oCollapsedLocation;

                    if (TryGetLocation(oRow, GroupTableColumnNames.CollapsedX,
                                       GroupTableColumnNames.CollapsedY,
                                       oReadWorkbookContext.VertexLocationConverter,
                                       out oCollapsedLocation))
                    {
                        oExcelTemplateGroupInfo.CollapsedLocation =
                            oCollapsedLocation;
                    }
                }

                try
                {
                    oGroupNameDictionary.Add(sGroupName, oExcelTemplateGroupInfo);
                }
                catch (ArgumentException)
                {
                    Range oInvalidCell = oRow.GetRangeForCell(
                        GroupTableColumnNames.Name);

                    OnWorkbookFormatError(String.Format(

                                              "The cell {0} contains a duplicate group name.  There"
                                              + " can't be two rows with the same group name."
                                              ,
                                              ExcelUtil.GetRangeAddress(oInvalidCell)
                                              ),

                                          oInvalidCell
                                          );
                }
            }

            return(oGroupNameDictionary);
        }
コード例 #12
0
    TryCalculateGraphMetricsForOneGroup
    (
        ExcelTemplateGroupInfo oExcelTemplateGroupInfo,
        CalculateGraphMetricsContext oCalculateGraphMetricsContext,
        out OverallMetrics oOverallMetrics
    )
    {
        Debug.Assert(oExcelTemplateGroupInfo != null);
        Debug.Assert(oExcelTemplateGroupInfo.Vertices != null);
        Debug.Assert(oExcelTemplateGroupInfo.Vertices.Count > 0);
        Debug.Assert(oCalculateGraphMetricsContext != null);
        AssertValid();

        oOverallMetrics = null;

        ICollection<IVertex> oVertices = oExcelTemplateGroupInfo.Vertices;

        // Create a new graph from the vertices in the group and the edges that
        // connect them.

        IGraph oNewGraph = SubgraphCalculator.GetSubgraphAsNewGraph(oVertices);

        // Calculate the overall metrics for the new graph using the
        // OverallMetricCalculator class in the Algorithms namespace, which
        // knows nothing about Excel.

        return ( (new Algorithms.OverallMetricCalculator() ).
            TryCalculateGraphMetrics(oNewGraph,
                oCalculateGraphMetricsContext.BackgroundWorker,
                out oOverallMetrics) );
    }
コード例 #13
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
                    );
            }
        }
    }
コード例 #14
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)
                    );
            }
        }
    }
コード例 #15
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)
            );
    }