Beispiel #1
0
        /// <summary>
        /// Gets the aligned scroll value which is the starting point of the entity
        /// found at the given distance position.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <returns>The starting point of the entity.</returns>
        public double GetAlignedScrollValue(double point)
        {
            double offset = trackDCC.GetPreviousScrollValue(start);
            double d      = trackDCC.GetAlignedScrollValue(point + offset);

            if (double.IsNaN(d) || d < offset || d - offset > TotalDistance)
            {
                return(double.NaN);
            }
            return(d - offset);
        }
        /// <summary>
        /// Gets the aligned scroll value which is the starting point of the entity
        /// found at the given distance position.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <returns>The starting point of the entity.</returns>
        public double GetAlignedScrollValue(double point)
        {
            int    index       = IndexOfCumulatedDistance(point);
            double nestedStart = GetCumulatedDistanceAt(index);
            double delta       = point - nestedStart;

            if (delta > 0)
            {
                IDistanceCounterCollection nestedDcc = GetNestedDistances(index);
                if (nestedDcc != null)
                {
                    double r = nestedDcc.GetAlignedScrollValue(delta);
                    if (!double.IsNaN(r) && r >= 0 && r < nestedDcc.TotalDistance)
                    {
                        return(nestedStart + r);
                    }
                }
            }

            return(GetCumulatedDistanceAt(index));
        }