summaryrefslogtreecommitdiff
path: root/Anoto/HotAreas
diff options
context:
space:
mode:
Diffstat (limited to 'Anoto/HotAreas')
-rw-r--r--Anoto/HotAreas/AnotoHotArea.cs95
-rw-r--r--Anoto/HotAreas/AnotoRadarScreen.cs16
-rw-r--r--Anoto/HotAreas/AnotoStrip.cs219
-rw-r--r--Anoto/HotAreas/AntotoStripBoard.cs16
4 files changed, 346 insertions, 0 deletions
diff --git a/Anoto/HotAreas/AnotoHotArea.cs b/Anoto/HotAreas/AnotoHotArea.cs
new file mode 100644
index 0000000..e84b672
--- /dev/null
+++ b/Anoto/HotAreas/AnotoHotArea.cs
@@ -0,0 +1,95 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.ComponentModel;
+
+namespace Anoto
+{
+ public enum Categories { Strip, StripBoard, Screen };
+ public enum SubCategories {NotDefined, Information, C0, C1, C2, C4, CallSign, Name, AircraftType, CruseSpeed, Departure, Arrival, SSR, InputFL, PrintTime, Sector, Frequency, FL1, FL2,
+ Beacon0, Beacon1, Beacon2, Beacon3, Beacon4, Beacon5, Beacon6, Beacon7, Beacon8, Beacon9,
+ Time0, Time1, Time2, Time3, Time4, Time5, Time6, Time7, Time8, Time9,
+ Unknown
+ };
+
+ [DefaultPropertyAttribute("PagesIP")]
+ public class AnotoHotArea
+ {
+ public static string[] PagesIP = {
+ "1728.0.0.0",
+ "1728.0.0.1",
+ "1728.0.0.2",
+ "1728.0.0.3",
+ "1728.0.0.4",
+ "1728.0.0.5",
+ "1728.0.0.6",
+ "1728.0.0.7",
+ "1728.0.0.8",
+ "1728.0.0.9",
+ "1728.0.0.10",
+ "1728.0.0.11",
+ "1728.0.0.12",
+ "1728.0.0.13",
+ "1728.0.0.14",
+ "1728.0.0.15",
+ "1728.0.0.16",
+ "1728.0.0.17",
+ "1728.0.0.18",
+ "1728.0.0.19",
+ "1728.0.0.20"
+ };
+
+ public override string ToString()
+ {
+ return this.Category.ToString();
+ }
+
+ private Rectangle _Rectangle;
+ [CategoryAttribute("HotBox"), DescriptionAttribute("the active hotbox")]
+ public Rectangle Rectangle
+ {
+ get { return _Rectangle; }
+ set { _Rectangle = value; }
+ }
+
+ private int _PageIndex;
+ [CategoryAttribute("HotBox"), DescriptionAttribute("the page Index")]
+ public int PageIndex
+ {
+ get { return _PageIndex; }
+ set { _PageIndex = value; }
+ }
+
+
+ [CategoryAttribute("HotBox"), DescriptionAttribute("the page name")]
+ public string Page
+ {
+ get {
+ if (_PageIndex != -1)
+ return PagesIP[_PageIndex];
+ else
+ return "Multi pages";
+ }
+ }
+
+ private Categories _Category;
+ [CategoryAttribute("Category"), DescriptionAttribute("the main category")]
+ public Categories Category
+ {
+ get { return _Category; }
+ set { _Category = value; }
+ }
+
+ private SubCategories _SubCategory;
+ [CategoryAttribute("Category"), DescriptionAttribute("the sub category")]
+ public SubCategories SubCategory
+ {
+ get { return _SubCategory; }
+ set { _SubCategory = value; }
+ }
+
+
+ }
+}
diff --git a/Anoto/HotAreas/AnotoRadarScreen.cs b/Anoto/HotAreas/AnotoRadarScreen.cs
new file mode 100644
index 0000000..6973b17
--- /dev/null
+++ b/Anoto/HotAreas/AnotoRadarScreen.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Anoto
+{
+ public class AnotoRadarScreen:AnotoHotArea
+ {
+ public AnotoRadarScreen()
+ {
+ this.Category = Categories.Screen;
+ this.PageIndex = -1; //Multi pages
+ }
+ }
+}
diff --git a/Anoto/HotAreas/AnotoStrip.cs b/Anoto/HotAreas/AnotoStrip.cs
new file mode 100644
index 0000000..c193e08
--- /dev/null
+++ b/Anoto/HotAreas/AnotoStrip.cs
@@ -0,0 +1,219 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Drawing;
+using System.IO;
+
+namespace Anoto
+{
+
+ public class AnotoStrip:AnotoHotArea
+ {
+ public string CallSign;
+ public string Name;
+ public string AircraftType;
+ public string CruseSpeed;
+ public string Departure;
+ public string Arrival;
+ public string SSR;
+ public string InputFL;
+ public string PrintTime;
+ public string Sector;
+ public string Frequency;
+ public string FL1;
+ public string FL2;
+
+ public string Beacon1;
+ public string Beacon1Time;
+ public string Beacon2;
+ public string Beacon2Time;
+ public string Beacon3;
+ public string Beacon3Time;
+ public string Beacon4;
+ public string Beacon4Time;
+ public string Beacon5;
+ public string Beacon5Time;
+ public string Beacon6;
+ public string Beacon6Time;
+
+ public string NextSector;
+
+ private float rationCmPixel = (5515-65) / 20.2f;
+
+ public SubCategories GetStripArea(int x, int y)
+ {
+ x -= 65; //X Margin
+
+ if (x < 4.9f * rationCmPixel)
+ return SubCategories.Information;
+
+ if (x < 7.2f * rationCmPixel)
+ return SubCategories.C0;
+ if (x < 9.0f * rationCmPixel)
+ return SubCategories.C1;
+ if (x < 11.0f * rationCmPixel)
+ return SubCategories.C2;
+ if (x < 12.4f * rationCmPixel)
+ return SubCategories.Beacon1;
+ if (x < 13.8f * rationCmPixel)
+ return SubCategories.Beacon2;
+ if (x < 15.2f * rationCmPixel)
+ return SubCategories.Beacon3;
+ if (x < 16.6f * rationCmPixel)
+ return SubCategories.Beacon4;
+ if (x < 18.0f * rationCmPixel)
+ return SubCategories.Beacon5;
+ if (x < 19.3f * rationCmPixel)
+ return SubCategories.Beacon6;
+
+ return SubCategories.Unknown;
+ }
+
+ public string GetTextForCell(SubCategories subC)
+ {
+ string resutl = "";
+
+ switch (subC)
+ {
+ case SubCategories.Information: resutl = this.SSR;
+ break;
+ case SubCategories.C0: resutl = this.Sector;
+ break;
+ case SubCategories.C1: resutl = this.FL1;
+ break;
+ case SubCategories.C2: resutl = this.FL2;
+ break;
+ case SubCategories.Beacon1: resutl = this.Beacon1;
+ break;
+ case SubCategories.Beacon2: resutl = this.Beacon2;
+ break;
+ case SubCategories.Beacon3: resutl = this.Beacon3;
+ break;
+ case SubCategories.Beacon4: resutl = this.Beacon4;
+ break;
+ case SubCategories.Beacon5: resutl = this.Beacon5;
+ break;
+ case SubCategories.Beacon6: resutl = this.Beacon6;
+ break;
+ case SubCategories.C4: resutl = this.NextSector;
+ break;
+ default:
+ break;
+ }
+ return resutl;
+ }
+
+
+
+ public AnotoStrip(string[] l)
+ {
+ // CALLSIGN; Nom; Type ACFT; Vit; Dép; Arr; SSR; Niv entrée; heure strip; Sect; fréq; FL; FL; Balise; estimée; Balise; estimée; Balise; estimée; Balise; estimée; Balise; estimée; Balise; estimée; Secteur
+ int i = 0;
+ CallSign = l[i++];
+ Name = l[i++];
+ AircraftType = l[i++];
+ CruseSpeed = l[i++];
+ Departure = l[i++];
+ Arrival = l[i++];
+ SSR = l[i++];
+ InputFL = l[i++];
+ PrintTime = l[i++];
+ Sector = l[i++];
+ Frequency = l[i++];
+ FL1 = l[i++];
+ FL2 = l[i++];
+
+ Beacon1 = l[i++];
+ Beacon1Time = l[i++];
+ Beacon2 = l[i++];
+ Beacon2Time = l[i++];
+ Beacon3 = l[i++];
+ Beacon3Time = l[i++];
+ Beacon4 = l[i++];
+ Beacon4Time = l[i++];
+ Beacon5 = l[i++];
+ Beacon5Time = l[i++];
+ Beacon6 = l[i++];
+ Beacon6Time = l[i++];
+
+ NextSector = l[i++];
+ }
+
+ public override string ToString()
+ {
+ return this.Category.ToString() + " ( " + CallSign + " )";// +Beacon1 + " " + Beacon2 + " " + Beacon3 + " " + Beacon4 + " " + Beacon5 + " " + Beacon6;
+ }
+
+ public bool IsSelected(Point pt)
+ {
+ return Rectangle.Contains(pt);
+ }
+
+ public static AnotoStrip GetStrip(int x, int y, string page, AnotoStrip[] strips)
+ {
+ AnotoStrip result = null;
+ foreach (var s in strips)
+ {
+ if ( AnotoHotArea.PagesIP[s.PageIndex] == page)
+ {
+ if (s.Rectangle.Contains(x, y))
+ return s;
+ }
+ }
+ return result;
+ }
+
+
+ public static AnotoStrip[] LoadFileStrip(string fileName)
+ {
+ List<AnotoStrip> strips = new List<AnotoStrip>();
+
+ // CALLSIGN; Nom; Type ACFT; Vit; Dép; Arr; SSR; Niv entrée; heure strip; Sect; fréq; FL; FL; Balise; estimée; Balise; estimée; Balise; estimée; Balise; estimée; Balise; estimée; Balise; estimée; Secteur
+ StreamReader sr = new StreamReader(fileName);
+ List<string> lines = new List<string>();
+ string input;
+
+ while ((input = sr.ReadLine()) != null)
+ {
+ lines.Add(input);
+ }
+ char[] sep = { ';' };
+
+ int left = 65;
+ int top = 89;
+ int right = 5515;
+ int bottom = 7850;
+
+ int nbrStripPerPage = 10;
+ int height = (bottom - top) / nbrStripPerPage;
+ int width = right - left;
+
+ int y = top;
+ int x = left;
+
+ for (int i = 0; i < lines.Count; i++)
+ {
+ string line = lines[i];
+
+ string[] l = line.Split(sep);
+ AnotoStrip s = new AnotoStrip(l);
+ s.Category = Categories.Strip;
+
+ s.Rectangle = new Rectangle(x, y, width, height);
+
+ s.PageIndex = (int)(i / nbrStripPerPage);
+
+ if ((i % nbrStripPerPage) == 0)
+ y = top;
+
+ y += height;
+
+ strips.Add(s);
+ }
+ return strips.ToArray();
+ }
+
+
+ }
+}
diff --git a/Anoto/HotAreas/AntotoStripBoard.cs b/Anoto/HotAreas/AntotoStripBoard.cs
new file mode 100644
index 0000000..d56d50f
--- /dev/null
+++ b/Anoto/HotAreas/AntotoStripBoard.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace Anoto
+{
+ public class AntotoStripBoard:AnotoHotArea
+ {
+ public AntotoStripBoard()
+ {
+ this.Category = Categories.StripBoard;
+ this.PageIndex = -1; //Multi pages
+ }
+ }
+}