PageRenderTime 48ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/Main/src/DynamicDataDisplay/Charts/Shapes/VerticalRange.cs

#
C# | 34 lines | 26 code | 5 blank | 3 comment | 0 complexity | e0ae6d74570f08f4c712009894e974ad MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows.Media;
  6. using System.Windows;
  7. namespace Microsoft.Research.DynamicDataDisplay.Charts
  8. {
  9. /// <summary>
  10. /// Paints vertical filled and outlined range in viewport coordinates.
  11. /// </summary>
  12. public sealed class VerticalRange : RangeHighlight
  13. {
  14. protected override void UpdateUIRepresentationCore()
  15. {
  16. var transform = Plotter.Viewport.Transform;
  17. DataRect visible = Plotter.Viewport.Visible;
  18. Point p1_top = new Point(Value1, visible.YMin).DataToScreen(transform);
  19. Point p1_bottom = new Point(Value1, visible.YMax).DataToScreen(transform);
  20. Point p2_top = new Point(Value2, visible.YMin).DataToScreen(transform);
  21. Point p2_bottom = new Point(Value2, visible.YMax).DataToScreen(transform);
  22. LineGeometry1.StartPoint = p1_top;
  23. LineGeometry1.EndPoint = p1_bottom;
  24. LineGeometry2.StartPoint = p2_top;
  25. LineGeometry2.EndPoint = p2_bottom;
  26. RectGeometry.Rect = new Rect(p1_top, p2_bottom);
  27. }
  28. }
  29. }