public static void OnInserted(IDistanceCounterCollection distances, ILineSizeHost linesHost, int insertAt, int count)
        {
            distances.Insert(insertAt, count);
            int to = insertAt + count - 1;
            int repeatSizeCount;

            // Set line sizes
            for (int index = insertAt; index <= to; index++)
            {
                double size = linesHost.GetSize(index, out repeatSizeCount);
                if (size != distances.DefaultDistance)
                {
                    int rangeTo = GetRangeToHelper(index, to, repeatSizeCount);
                    distances.SetRange(index, rangeTo, size);
                    index = rangeTo;
                }
            }

            // Also check for hidden rows and reset line sizes for them.
            for (int index = insertAt; index <= to; index++)
            {
                bool hide = linesHost.GetHidden(index, out repeatSizeCount);
                if (hide)
                {
                    int rangeTo = GetRangeToHelper(index, to, repeatSizeCount);
                    distances.SetRange(index, rangeTo, 0.0);
                    index = rangeTo;
                }
            }
        }
        public static void DistancesLineHiddenChanged(IDistanceCounterCollection distances, ILineSizeHost linesHost, int from, int to)
        {
            var ndh = linesHost as INestedDistancesHost;

            for (int n = from; n <= to; n++)
            {
                int  repeatSizeCount;
                bool hide = linesHost.GetHidden(n, out repeatSizeCount);

                if (ndh == null || ndh.GetDistances(n) == null)
                {
                    int rangeTo = GetRangeToHelper(n, to, repeatSizeCount);
                    if (hide)
                    {
                        distances.SetRange(n, rangeTo, 0.0);
                    }
                    else
                    {
                        DistancesLineSizeChanged(distances, linesHost, n, rangeTo);
                    }
                    n = rangeTo;
                }
                else
                {
                    distances.SetNestedDistances(n, hide ? null : ndh.GetDistances(n));
                }
            }
        }
        private void InitializeDistances()
        {
            distances.Clear();
            distances.Count           = GetLineCount();
            distances.DefaultDistance = DefaultLineSize;

            foreach (KeyValuePair <int, LineSizeCollection> entry in lineNested)
            {
                int  repeatSizeCount;
                bool hide = GetHidden(entry.Key, out repeatSizeCount);
                if (hide)
                {
                    distances.SetNestedDistances(entry.Key, null);
                }
                else
                {
                    distances.SetNestedDistances(entry.Key, entry.Value.Distances);
                }
            }

            foreach (RangeValuePair <double> entry in lineSizes)
            {
                if (entry.Value != -2)
                {
                    distances.SetRange(entry.Start, entry.End, entry.Value < 0 ? DefaultLineSize : entry.Value);
                }
            }

            foreach (RangeValuePair <bool> entry in lineHidden)
            {
                if (entry.Value)
                {
                    distances.SetRange(entry.Start, entry.End, 0);
                }
            }
        }
        public static void DistancesLineSizeChanged(IDistanceCounterCollection distances, ILineSizeHost linesHost, int from, int to)
        {
            var ndh = linesHost as INestedDistancesHost;

            for (int n = from; n <= to; n++)
            {
                if (ndh == null || ndh.GetDistances(n) == null)
                {
                    int    repeatSizeCount;
                    double size    = linesHost.GetSize(n, out repeatSizeCount);
                    int    rangeTo = GetRangeToHelper(n, to, repeatSizeCount);
                    distances.SetRange(n, rangeTo, size);
                    n = rangeTo;
                }
                else
                {
                    distances.SetNestedDistances(n, ndh.GetDistances(n));
                }
            }
        }
Exemple #5
0
 /// <summary>
 /// Hides a specified range of entities (lines, rows or colums)
 /// </summary>
 /// <param name="from">The index for the first entity&gt;</param>
 /// <param name="to">The raw index for the last entity</param>
 /// <param name="distance"></param>
 public void SetRange(int from, int to, double distance)
 {
     trackDCC.SetRange(from + start, to + start, distance);
 }