/// <summary> /// Gets the distance position of the next entity after a given point. /// </summary> /// <param name="point">The point.</param> /// <returns>The distance position.</returns> public double GetNextScrollValue(double point) { int index = IndexOfCumulatedDistance(point); if (index >= Count) { return(double.NaN); } double nestedStart = GetCumulatedDistanceAt(index); double delta = point - nestedStart; IDistanceCounterCollection nestedDcc = GetNestedDistances(index); if (nestedDcc != null) { double r = nestedDcc.GetNextScrollValue(delta); if (!double.IsNaN(r) && r >= 0 && r < nestedDcc.TotalDistance) { return(nestedStart + r); } } index = GetNextVisibleIndex(index); if (index >= 0 && index < Count) { return(GetCumulatedDistanceAt(index)); } return(double.NaN); }
/// <summary> /// Associates a collection of nested lines with a line in this axis. /// </summary> /// <param name="index">The index.</param> /// <param name="nestedLines">The nested lines.</param> public void SetNestedLines(int index, IDistanceCounterCollection nestedLines) { if (distances != null) { distances.SetNestedDistances(index, nestedLines); } }
/// <summary> /// Assigns a collection with nested entities to an item. /// </summary> /// <param name="index">The index.</param> /// <param name="nestedCollection">The nested collection.</param> public void SetNestedDistances(int index, IDistanceCounterCollection nestedCollection) { CheckRange("index", 0, Count - 1, index); if (GetNestedDistances(index) != nestedCollection) { if (index >= InternalCount) { EnsureTreeCount(index + 1); } DistanceLineCounterEntry entry = Split(index); Split(index + 1); if (nestedCollection != null) { var vcs = new NestedDistanceCounterCollectionSource(this, nestedCollection, entry); entry.Value = vcs; } else { entry.Value = new DistanceLineCounterSource(0, 1); } entry.InvalidateCounterBottomUp(true); } }
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)); } } }
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; } } }
/// <summary> /// Initializes a new instance of the <see cref="NestedTreeTableVisibleCounterSource"/> class. /// </summary> /// <param name="parentDistances">The parent distances.</param> /// <param name="nestedDistances">The nested distances.</param> public NestedTreeTableVisibleCounterSource(IDistanceCounterCollection parentDistances, IDistanceCounterCollection nestedDistances) : base(0) { this.parentDistances = parentDistances; this.nestedDistances = nestedDistances; nestedDistances.ConnectWithParent(this); }
/// <summary> /// Initializes a new instance of the <see cref="NestedDistanceCounterCollectionSource"/> class. /// </summary> /// <param name="parentDistances">The parent distances.</param> /// <param name="nestedDistances">The nested distances.</param> /// <param name="entry">The entry.</param> public NestedDistanceCounterCollectionSource(IDistanceCounterCollection parentDistances, IDistanceCounterCollection nestedDistances, DistanceLineCounterEntry entry) : base(0, 1) { this.parentDistances = parentDistances; this.nestedDistances = nestedDistances; this.entry = entry; if (nestedDistances != null) { nestedDistances.ConnectWithParent(this); } }
/// <summary> /// Assigns a collection with nested entities to an item. /// </summary> /// <param name="index">The index.</param> /// <param name="nestedCollection">The nested collection.</param> public void SetNestedDistances(int index, IDistanceCounterCollection nestedCollection) { CheckRange("index", 0, Count - 1, index); EnsureTreeCount(index + 1); TreeTableWithCounterEntry rbEntry = rbTree[index]; var vcs = new NestedTreeTableVisibleCounterSource(this, nestedCollection); rbEntry.Value = vcs; rbEntry.InvalidateCounterBottomUp(false); vcs.Entry = rbEntry; }
/// <summary> /// Gets the distance position of the entity preceeding a given point. If the point /// is in between entities the starting point of the matching entity /// is returned. /// </summary> /// <param name="point">The point.</param> /// <returns>The distance position.</returns> public double GetPreviousScrollValue(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.GetPreviousScrollValue(delta); if (!double.IsNaN(r) && r >= 0 && r < nestedDcc.TotalDistance) { return(nestedStart + r); } } return(GetCumulatedDistanceAt(index)); } index = GetPreviousVisibleIndex(index); if (index >= 0 && index < Count) { nestedStart = GetCumulatedDistanceAt(index); IDistanceCounterCollection nestedDcc = GetNestedDistances(index); if (nestedDcc != null) { //WPF-29115 - We have set the DetailsViewPadding, the TotalDistance is calculated based in padding, //but we have calculated the index divided the TotalDistance by DefalultLine size so index should be wrong. //So before processing the calculation minus the paddingDistance. delta = nestedDcc.TotalDistance - (nestedDcc as DistanceRangeCounterCollection).paddingDistance; double r = nestedDcc.GetPreviousScrollValue(delta); if (!double.IsNaN(r) && r >= 0 && r < nestedDcc.TotalDistance) { return(nestedStart + r); } } return(nestedStart); } return(double.NaN); }
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)); } } }
/// <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)); }
/// <summary> /// Initializes a new instance of the <see cref="DistanceCounterSubset"/> class. /// </summary> /// <param name="trackedParentCollection">The parent collection for which a subset is "tracked".</param> public DistanceCounterSubset(IDistanceCounterCollection trackedParentCollection) { this.trackDCC = trackedParentCollection; }
/// <summary> /// Assigns a collection with nested entities to an item. /// </summary> /// <param name="index">The index.</param> /// <param name="nestedCollection">The nested collection.</param> public void SetNestedDistances(int index, IDistanceCounterCollection nestedCollection) { trackDCC.SetNestedDistances(index + start, nestedCollection); }