本文整理汇总了C#中Range.IntersectsWith方法的典型用法代码示例。如果您正苦于以下问题:C# Range.IntersectsWith方法的具体用法?C# Range.IntersectsWith怎么用?C# Range.IntersectsWith使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Range
的用法示例。
在下文中一共展示了Range.IntersectsWith方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEventInfos
protected override IEnumerable<IEventInfo> GetEventInfos(TimeLineVisualizationState state, Telerik.Windows.Core.HierarchicalItem hierarchicalItem)
{
foreach (var eventInfo in base.GetEventInfos(state, hierarchicalItem))
{
yield return eventInfo;
}
var task = hierarchicalItem.SourceItem as GanttTask;
if (task != null && !task.IsMilestone)
{
var roundedStart = state.Rounder.Round(new DateRange(task.Start, task.Start));
var roundedEnd = state.Rounder.Round(new DateRange(task.End, task.End));
var offSetTime = 0.3;
var startLabelRange = new Range<long>(roundedStart.Start.AddDays(-1 - offSetTime).Ticks, roundedStart.Start.AddDays(-offSetTime).Ticks);
var endLabelRange = new Range<long>(roundedEnd.Start.AddDays(offSetTime).Ticks, roundedEnd.Start.AddDays(1 + offSetTime).Ticks);
if (startLabelRange.IntersectsWith(state.VisibleTimeRange))
{
yield return new StartLabelEventInfo(startLabelRange, hierarchicalItem.Index)
{
OriginalEvent = hierarchicalItem.SourceItem
};
}
if (endLabelRange.IntersectsWith(state.VisibleTimeRange))
{
yield return new EndLabelEventInfo(endLabelRange, hierarchicalItem.Index)
{
OriginalEvent = hierarchicalItem.SourceItem
};
}
}
}
示例2: GetEventInfos
protected override IEnumerable<IEventInfo> GetEventInfos(TimeLineVisualizationState state, HierarchicalItem hierarchicalItem)
{
foreach (var eventInfo in base.GetEventInfos(state, hierarchicalItem))
{
yield return eventInfo;
}
var task = hierarchicalItem.SourceItem as GanttDeadlineTask;
var deadline = task != null ? task.GanttDeadLine : default(DateTime?);
if (deadline.HasValue)
{
if (task.GanttDeadLine.HasValue && projectDeadLine < task.GanttDeadLine.Value)
{
deadline = task.GanttDeadLine = projectDeadLine;
task.Refresh();
}
var roundedDeadline = state.Rounder.Round(new DateRange(deadline.Value, deadline.Value));
var deadlineRange = new Range<long>(roundedDeadline.Start.Ticks, roundedDeadline.End.Ticks);
if (deadlineRange.IntersectsWith(state.VisibleTimeRange))
{
yield return new TimeLineDeadlineEventInfo(deadlineRange, hierarchicalItem.Index, hierarchicalItem.SourceItem as GanttDeadlineTask);
}
}
yield return new ProjectDeadlineEventInfo(new Range<long>(this.projectDeadLine.Ticks), 0, state.VisibleItems.Count - 1);
}
示例3: TestIntersection
public void TestIntersection()
{
Range<int> one = new Range<int>(0, 10);
Range<int> two = new Range<int>(2, 5);
Assert.IsTrue(one.IntersectsWith(two));
Assert.IsTrue(one.IsBetween(2));
Assert.IsFalse(one.IsBetween(12));
}
示例4: GetEventInfosBase
private IEnumerable<IEventInfo> GetEventInfosBase(TimeLineVisualizationState state, int index, HierarchicalItem hierarchicalItem)
{
var dateRange = hierarchicalItem.SourceItem as IDateRange;
var roundedRange = state.Rounder.Round(dateRange);
var taskRange = new Range<long>(roundedRange.Start.Ticks, roundedRange.End.Ticks);
if (taskRange.IntersectsWith(state.VisibleTimeRange))
{
var eventInfo = new EventInfo(taskRange, index, 1, new Range<int>(0), IsSummary(hierarchicalItem.SourceItem), IsMilestone(hierarchicalItem.SourceItem))
{
OriginalEvent = hierarchicalItem.SourceItem
};
yield return eventInfo;
}
}
示例5: GetEventInfos
protected override IEnumerable<IEventInfo> GetEventInfos(TimeLineVisualizationState state, Telerik.Windows.Core.HierarchicalItem hierarchicalItem)
{
foreach (var eventInfo in base.GetEventInfos(state, hierarchicalItem))
{
yield return eventInfo;
}
var task = hierarchicalItem.SourceItem as GanttDeadlineTask;
var deadline = task != null ? task.GanttDeadLine : default(DateTime?);
if (deadline.HasValue)
{
var roundedDeadline = state.Rounder.Round(new DateRange(deadline.Value, deadline.Value));
var deadlineRange = new Range<long>(roundedDeadline.Start.Ticks, roundedDeadline.End.Ticks);
if (deadlineRange.IntersectsWith(state.VisibleTimeRange))
{
yield return new TimeLineDeadlineEventInfo(deadlineRange, hierarchicalItem.Index);
}
}
}
示例6: GetEventInfos
protected override IEnumerable<IEventInfo> GetEventInfos(TimeLineVisualizationState state, HierarchicalItem hierarchicalItem)
{
foreach (var eventInfo in base.GetEventInfos(state, hierarchicalItem))
{
yield return eventInfo;
}
var task = hierarchicalItem.SourceItem as GanttBaselineTask;
var baselineStartDate = task != null ? task.StartPlannedDate : DateTime.MinValue;
if (baselineStartDate != null && baselineStartDate != DateTime.MinValue)
{
var roundedDeadline = state.Rounder.Round(new DateRange(baselineStartDate, task.EndPlannedDate));
var baselineRange = new Range<long>(roundedDeadline.Start.Ticks, roundedDeadline.End.Ticks);
if (baselineRange.IntersectsWith(state.VisibleTimeRange))
{
yield return new BaselineEventInfo(baselineRange, hierarchicalItem.Index, hierarchicalItem.SourceItem as GanttBaselineTask);
}
}
}
示例7: GetEventInfos
protected override IEnumerable<IEventInfo> GetEventInfos(TimeLineVisualizationState state, Telerik.Windows.Core.HierarchicalItem hierarchicalItem)
{
foreach (var eventInfo in base.GetEventInfos(state, hierarchicalItem))
{
yield return eventInfo;
}
var task = hierarchicalItem.SourceItem as CustomGanttTask;
foreach (var deadLine in task.CustomDeadLines)
{
if (deadLine != null)
{
var roundedDeadline = state.Rounder.Round(deadLine);
var deadlineRange = new Range<long>(roundedDeadline.Start.Ticks, roundedDeadline.End.Ticks);
if (deadlineRange.IntersectsWith(state.VisibleTimeRange))
{
yield return new NationalEventSlotInfo(deadlineRange, hierarchicalItem.Index);
}
}
}
}