public RevisionGraphSegment AddParent(RevisionGraphRevision parent, out int maxScore)
        {
            // Generate a LaneColor used for rendering
            if (Parents.Any())
            {
                parent.LaneColor = parent.Score;
            }
            else
            {
                if (parent.LaneColor == -1)
                {
                    parent.LaneColor = LaneColor;
                }
            }

            if (IsRelative)
            {
                parent.MakeRelative();
            }

            Parents.Add(parent);
            parent.AddChild(this);

            maxScore = parent.EnsureScoreIsAbove(Score);

            RevisionGraphSegment revisionGraphSegment = new RevisionGraphSegment(parent, this);

            parent.EndSegments.Add(revisionGraphSegment);
            StartSegments.Add(revisionGraphSegment);

            return(revisionGraphSegment);
        }
        public int GetLaneIndexForSegment(RevisionGraphSegment revisionGraphRevision)
        {
            BuildSegmentLanes();
            if (_segmentLanes !.TryGetValue(revisionGraphRevision, out int index))
            {
                return(index);
            }

            return(-1);
        }
示例#3
0
        public LaneInfo(RevisionGraphSegment startSegment, LaneInfo?derivedFrom)
        {
            StartRevision = derivedFrom is null ? startSegment.Child : startSegment.Parent;

            int colorSeed = StartRevision.Objectid.GetHashCode();

            if (derivedFrom is null)
            {
                colorSeed ^= startSegment.Parent.Objectid.GetHashCode();
            }

            do
            {
                Color = RevisionGraphLaneColor.GetColorForLane(colorSeed);
                ++colorSeed;
            }while (Color == derivedFrom?.Color);
        }
示例#4
0
 public void MoveLaneRightToStraigten(RevisionGraphSegment revisionGraphRevision)
 {
     _segmentLanes[revisionGraphRevision] = _segmentLanes[revisionGraphRevision] + 1;
 }