PageRenderTime 47ms CodeModel.GetById 12ms app.highlight 29ms RepoModel.GetById 1ms app.codeStats 1ms

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