Ejemplo n.º 1
0
        /// <summary>
        /// Initializes the scroll axis.
        /// </summary>
        /// <param name="scrollAxis">The scroll axis.</param>
        public void InitializeScrollAxis(ScrollAxisBase scrollAxis)
        {
            var pixelScrollAxis = scrollAxis as PixelScrollAxis;

            if (lineNested.Count > 0 && pixelScrollAxis == null)
            {
                throw new InvalidOperationException("When you have nested line collections you need to use PixelScrolling!");
            }

            //scrollAxis.distances.Clear();
            scrollAxis.DefaultLineSize = DefaultLineSize;
            scrollAxis.LineCount       = LineCount;

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

            foreach (KeyValuePair <int, LineSizeCollection> entry in lineNested)
            {
                pixelScrollAxis.SetNestedLines(entry.Key, entry.Value.Distances);
            }

            foreach (RangeValuePair <bool> entry in lineHidden)
            {
                scrollAxis.SetLineHiddenState(entry.Start, entry.End, entry.Value);
            }
        }