当前位置: 首页>>代码示例>>C#>>正文


C# Graph.LaneInfoCount方法代码示例

本文整理汇总了C#中Graph.LaneInfoCount方法的典型用法代码示例。如果您正苦于以下问题:C# Graph.LaneInfoCount方法的具体用法?C# Graph.LaneInfoCount怎么用?C# Graph.LaneInfoCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Graph的用法示例。


在下文中一共展示了Graph.LaneInfoCount方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawItem

        // end DrawGraph
        private bool DrawItem(Graphics wa, Graph.LaneRow row)
        {
            if (row == null || row.NodeLane == -1)
            {
                return false;
            }

            // Clip to the area we're drawing in, but draw 1 pixel past so
            // that the top/bottom of the line segment's anti-aliasing isn't
            // visible in the final rendering.
            int top = wa.RenderingOrigin.Y + _rowHeight / 2;
            var laneRect = new Rectangle(0, top, Width, _rowHeight);
            Region oldClip = wa.Clip;
            var newClip = new Region(laneRect);
            newClip.Intersect(oldClip);
            wa.Clip = newClip;
            wa.Clear(Color.Transparent);

            for (int r = 0; r < 2; r++)
                for (int lane = 0; lane < row.Count; lane++)
                {
                    int mid = wa.RenderingOrigin.X + (int)((lane + 0.5) * LaneWidth);

                    for (int item = 0; item < row.LaneInfoCount(lane); item++)
                    {
                        Graph.LaneInfo laneInfo = row[lane, item];

                        //Draw all non-relative items first, them draw
                        //all relative items on top
                        if (laneInfo.Junctions.FirstOrDefault() != null)
                            if (laneInfo.Junctions.First().IsRelative == (r == 0))
                                continue;

                        List<Color> curColors = GetJunctionColors(laneInfo.Junctions);

                        // Create the brush for drawing the line
                        Brush brushLineColor;
                        bool drawBorder = BranchBorders; //hide border for "non-relatives"
                        if (curColors.Count == 1 || !StripedBranchChange)
                        {
                            if (curColors[0] != _nonRelativeColor)
                            {
                                brushLineColor = new SolidBrush(curColors[0]);
                            }
                            else if (curColors.Count > 1 && curColors[1] != _nonRelativeColor)
                            {
                                brushLineColor = new SolidBrush(curColors[1]);
                            }
                            else
                            {
                                drawBorder = false;
                                brushLineColor = new SolidBrush(_nonRelativeColor);
                            }
                        }
                        else
                        {
                            brushLineColor = new HatchBrush(HatchStyle.DarkDownwardDiagonal, curColors[0], curColors[1]);
                            if (curColors[0] == _nonRelativeColor && curColors[1] == _nonRelativeColor) drawBorder = false;
                        }

                        for (int i = drawBorder ? 0 : 2; i < 3; i++)
                        {
                            Pen penLine;
                            if (i == 0)
                            {
                                penLine = new Pen(new SolidBrush(Color.White), LaneLineWidth + 2);
                            }
                            else if (i == 1)
                            {
                                penLine = new Pen(new SolidBrush(Color.Black), LaneLineWidth + 1);
                            }
                            else
                            {
                                penLine = new Pen(brushLineColor, LaneLineWidth);
                            }

                            if (laneInfo.ConnectLane == lane)
                            {
                                wa.DrawLine
                                    (
                                        penLine,
                                        new Point(mid, top - 1),
                                        new Point(mid, top + _rowHeight + 2)
                                    );
                            }
                            else
                            {
                                wa.DrawBezier
                                    (
                                        penLine,
                                        new Point(mid, top - 1),
                                        new Point(mid, top + _rowHeight + 2),
                                        new Point(mid + (laneInfo.ConnectLane - lane) * LaneWidth, top - 1),
                                        new Point(mid + (laneInfo.ConnectLane - lane) * LaneWidth, top + _rowHeight + 2)
                                    );
                            }
                        }
                    }
                }
//.........这里部分代码省略.........
开发者ID:pvginkel,项目名称:VisualGit,代码行数:101,代码来源:DvcsGraph.cs

示例2: DrawItemLoop

        private void DrawItemLoop(Graphics wa, Graph.ILaneRow row, int top)
        {
            for (int r = 0; r < 2; r++)
                for (int lane = 0; lane < row.Count; lane++)
                {
                    int mid = wa.RenderingOrigin.X + (int)((lane + 0.5) * LANE_WIDTH);

                    for (int item = 0; item < row.LaneInfoCount(lane); item++)
                    {
                        Graph.LaneInfo laneInfo = row[lane, item];

                        //Draw all non-relative items first, them draw
                        //all relative items on top
                        if (laneInfo.Junctions.FirstOrDefault() != null)
                            if (laneInfo.Junctions.First().IsRelative == (r == 0))
                                continue;

                        List<Color> curColors = GetJunctionColors(laneInfo.Junctions);

                        // Create the brush for drawing the line
                        Brush brushLineColor;
                        bool drawBorder = Settings.BranchBorders; //hide border for "non-relatives"
                        if (curColors.Count == 1 || !Settings.StripedBranchChange)
                        {
                            if (curColors[0] != nonRelativeColor)
                            {
                                brushLineColor = new SolidBrush(curColors[0]);
                            }
                            else if (curColors.Count > 1 && curColors[1] != nonRelativeColor)
                            {
                                brushLineColor = new SolidBrush(curColors[1]);
                            }
                            else
                            {
                                drawBorder = false;
                                brushLineColor = new SolidBrush(nonRelativeColor);
                            }
                        }
                        else
                        {
                            brushLineColor = new HatchBrush(HatchStyle.DarkDownwardDiagonal, curColors[0], curColors[1]);
                            if (curColors[0] == nonRelativeColor && curColors[1] == nonRelativeColor) drawBorder = false;
                        }

                        laneInfo = DrawPenLoop(wa, top, lane, mid, laneInfo, brushLineColor, drawBorder);
                    }
                }
        }
开发者ID:ImaginaryDevelopment,项目名称:gitextensions,代码行数:48,代码来源:DvcsGraph.cs

示例3: DrawItem

        // end drawGraph
        private bool DrawItem(Graphics wa, Graph.ILaneRow row)
        {
            if (row == null || row.NodeLane == -1)
            {
                return false;
            }

            // Clip to the area we're drawing in, but draw 1 pixel past so
            // that the top/bottom of the line segment's anti-aliasing isn't
            // visible in the final rendering.
            int top = wa.RenderingOrigin.Y + rowHeight / 2;
            var laneRect = new Rectangle(0, top, Width, rowHeight);
            Region oldClip = wa.Clip;
            var newClip = new Region(laneRect);
            newClip.Intersect(oldClip);
            wa.Clip = newClip;
            wa.Clear(Color.Transparent);

            //for (int r = 0; r < 2; r++)
                for (int lane = 0; lane < row.Count; lane++)
                {
                    int mid = wa.RenderingOrigin.X + (int)((lane + 0.5) * LANE_WIDTH);

                    for (int item = 0; item < row.LaneInfoCount(lane); item++)
                    {
                        Graph.LaneInfo laneInfo = row[lane, item];

                        bool highLight = (RevisionGraphDrawStyle == RevisionGraphDrawStyleEnum.DrawNonRelativesGray && laneInfo.Junctions.Any(j => j.IsRelative)) ||
                                         (RevisionGraphDrawStyle == RevisionGraphDrawStyleEnum.HighlightSelected && laneInfo.Junctions.Any(j => j.HighLight)) ||
                                         (RevisionGraphDrawStyle == RevisionGraphDrawStyleEnum.Normal);

                        List<Color> curColors = GetJunctionColors(laneInfo.Junctions);

                        // Create the brush for drawing the line
                        Brush brushLineColor = null;
                        Pen brushLineColorPen = null;
                        try
                        {
                            bool drawBorder = Settings.BranchBorders && highLight; //hide border for "non-relatives"

                            if (curColors.Count == 1 || !Settings.StripedBranchChange)
                            {
                                if (curColors[0] != nonRelativeColor)
                                {
                                    brushLineColor = new SolidBrush(curColors[0]);
                                }
                                else if (curColors.Count > 1 && curColors[1] != nonRelativeColor)
                                {
                                    brushLineColor = new SolidBrush(curColors[1]);
                                }
                                else
                                {
                                    drawBorder = false;
                                    brushLineColor = new SolidBrush(nonRelativeColor);
                                }
                            }
                            else
                            {
                                Color lastRealColor = curColors.LastOrDefault(c => c != nonRelativeColor);

                                if (lastRealColor.IsEmpty)
                                {
                                    brushLineColor = new SolidBrush(nonRelativeColor);
                                    drawBorder = false;
                                }
                                else
                                {
                                    brushLineColor = new HatchBrush(HatchStyle.DarkDownwardDiagonal, curColors[0], lastRealColor);
                                }
                            }

                            for (int i = drawBorder ? 0 : 2; i < 3; i++)
                            {
                                Pen penLine = null;
                                if (i == 0)
                                {
                                    penLine = whiteBorderPen;
                                }
                                else if (i == 1)
                                {
                                    penLine = blackBorderPen;
                                }
                                else
                                {
                                    if (brushLineColorPen == null)
                                        brushLineColorPen = new Pen(brushLineColor, LANE_LINE_WIDTH);
                                    penLine = brushLineColorPen;
                                }

                                if (laneInfo.ConnectLane == lane)
                                {
                                    wa.DrawLine
                                        (
                                            penLine,
                                            new Point(mid, top - 1),
                                            new Point(mid, top + rowHeight + 2)
                                        );
                                }
                                else
//.........这里部分代码省略.........
开发者ID:vshih,项目名称:gitextensions,代码行数:101,代码来源:DvcsGraph.cs

示例4: DrawItem

        private bool DrawItem(Graphics wa, Graph.ILaneRow row)
        {
            if (row == null || row.NodeLane == -1)
            {
                return false;
            }

            // Clip to the area we're drawing in, but draw 1 pixel past so
            // that the top/bottom of the line segment's anti-aliasing isn't
            // visible in the final rendering.
            int top = wa.RenderingOrigin.Y + _rowHeight / 2;
            var laneRect = new Rectangle(0, top, (int)wa.ClipBounds.Width, _rowHeight);
            Region oldClip = wa.Clip;
            var newClip = new Region(laneRect);
            newClip.Intersect(oldClip);
            wa.Clip = newClip;
            // wa.Clear(Color.Transparent);

            //Getting RevisionGraphDrawStyle results in call to AppSettings. This is not very cheap, cache.
            revisionGraphDrawStyleCache = RevisionGraphDrawStyle;

            //for (int r = 0; r < 2; r++)
            for (int lane = 0; lane < row.Count; lane++)
            {
                int mid = wa.RenderingOrigin.X + (int)((lane + 0.5) * _laneWidth);

                for (int item = 0; item < row.LaneInfoCount(lane); item++)
                {
                    if (item > 2)
                    {
                    }
                    Graph.LaneInfo laneInfo = row[lane, item];

                    bool highLight = (revisionGraphDrawStyleCache == RevisionGraphDrawStyleEnum.DrawNonRelativesGray && laneInfo.Junctions.Any(j => j.IsRelative)) ||
                                     (revisionGraphDrawStyleCache == RevisionGraphDrawStyleEnum.HighlightSelected && laneInfo.Junctions.Any(j => j.HighLight)) ||
                                     (revisionGraphDrawStyleCache == RevisionGraphDrawStyleEnum.Normal);

                    List<Color> curColors = GetJunctionColors(laneInfo.Junctions);

                    // Create the brush for drawing the line
                    Brush brushLineColor = null;
                    Pen brushLineColorPen = null;
                    try
                    {
                        bool drawBorder = highLight && AppSettings.BranchBorders; //hide border for "non-relatives"

                        if (curColors.Count == 1 || !AppSettings.StripedBranchChange)
                        {
                            if (curColors[0] != _nonRelativeColor)
                            {
                                brushLineColor = new SolidBrush(curColors[0]);
                            }
                            else if (curColors.Count > 1 && curColors[1] != _nonRelativeColor)
                            {
                                brushLineColor = new SolidBrush(curColors[1]);
                            }
                            else
                            {
                                drawBorder = false;
                                brushLineColor = new SolidBrush(_nonRelativeColor);
                            }
                        }
                        else
                        {
                            Color lastRealColor = curColors.LastOrDefault(c => c != _nonRelativeColor);

                            if (lastRealColor.IsEmpty)
                            {
                                brushLineColor = new SolidBrush(_nonRelativeColor);
                                drawBorder = false;
                            }
                            else
                            {
                                brushLineColor = new HatchBrush(HatchStyle.DarkDownwardDiagonal, curColors[0], lastRealColor);
                            }
                        }

                        // Precalculate line endpoints
                        bool singleLane = laneInfo.ConnectLane == lane;
                        int x0 = mid;
                        int y0 = top - 1;
                        int x1 = singleLane ? x0 : mid + (laneInfo.ConnectLane - lane) * _laneWidth;
                        int y1 = top + _rowHeight;

                        Point p0 = new Point(x0, y0);
                        Point p1 = new Point(x1, y1);

                        // Precalculate curve control points when needed
                        Point c0, c1;
                        if (singleLane)
                        {
                            c0 = c1 = Point.Empty;
                        }
                        else
                        {
                            // Controls the curvature of cross-lane lines (0 = straight line, 1 = 90 degree turns)
                            const float severity = 0.5f;
                            c0 = new Point(x0, (int)(y0 * (1.0f - severity) + y1 * severity));
                            c1 = new Point(x1, (int)(y1 * (1.0f - severity) + y0 * severity));
                        }
//.........这里部分代码省略.........
开发者ID:akrisiun,项目名称:gitextensions,代码行数:101,代码来源:DvcsGraph.cs


注:本文中的Graph.LaneInfoCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。