Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/ViewportConstraints/DateTimeVerticalAxisConstraint.cs @ 13847

Last change on this file since 13847 was 12503, checked in by aballeit, 10 years ago

#2283 added GUI and charts; fixed MCTS

File size: 869 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5
6namespace Microsoft.Research.DynamicDataDisplay.ViewportConstraints
7{
8  public sealed class DateTimeVerticalAxisConstraint : ViewportConstraint
9  {
10    private readonly double minSeconds = new TimeSpan(DateTime.MinValue.Ticks).TotalSeconds;
11    private readonly double maxSeconds = new TimeSpan(DateTime.MaxValue.Ticks).TotalSeconds;
12
13    public override DataRect Apply(DataRect previousDataRect, DataRect proposedDataRect, Viewport2D viewport)
14    {
15      DataRect borderRect = DataRect.Create(proposedDataRect.XMin, minSeconds, proposedDataRect.XMax, maxSeconds);
16      if (proposedDataRect.IntersectsWith(borderRect))
17      {
18        DataRect croppedRect = DataRect.Intersect(proposedDataRect, borderRect);
19        return croppedRect;
20      }
21
22      return previousDataRect;
23    }
24  }
25}
Note: See TracBrowser for help on using the repository browser.