PageRenderTime 43ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/Main/src/DynamicDataDisplay/Transforms/SwapTransform.cs

#
C# | 41 lines | 20 code | 3 blank | 18 comment | 0 complexity | a030fcf092fb5b94dc38852120abb04a 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;
  6. namespace Microsoft.Research.DynamicDataDisplay
  7. {
  8. /// <summary>
  9. /// Represents a DataTransform that simply swaps points' coefficitiens from x to y and vice verca.
  10. /// </summary>
  11. public sealed class SwapTransform : DataTransform
  12. {
  13. /// <summary>
  14. /// Initializes a new instance of the <see cref="SwapTransform"/> class.
  15. /// </summary>
  16. public SwapTransform() { }
  17. /// <summary>
  18. /// Transforms the point in data coordinates to viewport coordinates.
  19. /// </summary>
  20. /// <param name="pt">The point in data coordinates.</param>
  21. /// <returns>
  22. /// Transformed point in viewport coordinates.
  23. /// </returns>
  24. public override Point DataToViewport(Point pt)
  25. {
  26. return new Point(pt.Y, pt.X);
  27. }
  28. /// <summary>
  29. /// Transforms the point in viewport coordinates to data coordinates.
  30. /// </summary>
  31. /// <param name="pt">The point in viewport coordinates.</param>
  32. /// <returns>Transformed point in data coordinates.</returns>
  33. public override Point ViewportToData(Point pt)
  34. {
  35. return new Point(pt.Y, pt.X);
  36. }
  37. }
  38. }