From 42dc1d36235292786322d28340a81c6cb3fd46c0 Mon Sep 17 00:00:00 2001 From: hurter Date: Wed, 31 Aug 2011 16:25:05 +0000 Subject: --- AnotoData/AnotoRadarScreen.cs | 62 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 AnotoData/AnotoRadarScreen.cs (limited to 'AnotoData/AnotoRadarScreen.cs') diff --git a/AnotoData/AnotoRadarScreen.cs b/AnotoData/AnotoRadarScreen.cs new file mode 100644 index 0000000..d99c743 --- /dev/null +++ b/AnotoData/AnotoRadarScreen.cs @@ -0,0 +1,62 @@ +using System; +using System.Collections.Generic; + +using System.Text; +using System.Drawing; +using System.Globalization; + + +namespace AnotoData +{ + public class AnotoRadarScreen : AnotoHotArea + { + CultureInfo ci = new CultureInfo("en-US"); + + public AnotoRadarScreen() + { + this.Category = Categories.Screen; + this.PageIndex = -1; //Multi pages + + LastX = -1; + LastY = -1; + LastPage = ""; + + } + + public override bool IsInside(int x, int y, string page) + { + if ((page == "1728.0.0.8") || (page == "1728.0.0.9")) + return true; + return false; + } + + private int LastX = -1; + private int LastY = -1; + private string LastPage = ""; + + + public void SendIvyMsg(string penSerial, int x, int y, string page, IvyBus.IvyControl TheIvyBus) + { + if ((LastX != x) || (LastY != y) || (LastPage != page)) + { + //Normalize the data + PointF ptN = GetNormilizedCoordinate(x, y, page); + TheIvyBus.SendMsg("RadarScreenPenDown PenId=" + penSerial + " X=" + ptN.X.ToString(ci) + " Y=" + ptN.Y.ToString(ci)); + + LastX = x; + LastY = y; + LastPage = page; + } + + } + + public PointF GetNormilizedCoordinate(int x, int y, string page) + { + float yn = (float)y / (float)AnotoHotArea.MaxY; + float xn = (float)x / (float)AnotoHotArea.MaxX / 2.0f; + if (page == "1728.0.0.9") xn += 0.5f; + + return new PointF(xn, yn); + } + } +} -- cgit v1.1