Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Charts/Shapes/HorizontalLine.cs @ 13398

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

#2283 added GUI and charts; fixed MCTS

File size: 1.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows.Shapes;
6using System.Windows;
7using System.Windows.Media;
8using Microsoft.Research.DynamicDataDisplay;
9
10namespace Microsoft.Research.DynamicDataDisplay.Charts
11{
12  /// <summary>
13  /// Represents an infinite horizontal line with y-coordinate.
14  /// </summary>
15  public sealed class HorizontalLine : SimpleLine
16  {
17    /// <summary>
18    /// Initializes a new instance of the <see cref="HorizontalLine"/> class.
19    /// </summary>
20    public HorizontalLine() { }
21
22    /// <summary>
23    /// Initializes a new instance of the <see cref="HorizontalLine"/> class with specified y coordinate.
24    /// </summary>
25    /// <param name="yCoordinate">The y coordinate of line.</param>
26    public HorizontalLine(double yCoordinate)
27    {
28      Value = yCoordinate;
29    }
30
31    protected override void UpdateUIRepresentationCore()
32    {
33      var transform = Plotter.Viewport.Transform;
34
35      Point p1 = new Point(Plotter.Viewport.Visible.XMin, Value).DataToScreen(transform);
36      Point p2 = new Point(Plotter.Viewport.Visible.XMax, Value).DataToScreen(transform);
37
38      LineGeometry.StartPoint = p1;
39      LineGeometry.EndPoint = p2;
40    }
41  }
42}
Note: See TracBrowser for help on using the repository browser.