using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; using System.IO; namespace Anoto { public class AnotoStrip { 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; public string Page; // public string[] Beacons; // public int IDCautra; public Rectangle Region; public enum StripAreas { CallSign, Name, AircraftType, CruseSpeed, Departure, Arrival, SSR, InputFL, PrintTime, Sector, Frequency, FL1, FL2, Beacon1, Beacon1Time, Beacon2, Beacon2Time, Beacon3, Beacon3Time, Beacon4, Beacon4Time, Beacon5, Beacon5Time, Beacon6, Beacon6Time, NextSector, unknown } public enum Cells { Info, C0, C1, C2, Beacon1, Beacon2, Beacon3, Beacon4, Beacon5, Beacon6,C4 } private float rationCmPixel = (5515-65) / 20.2f; public Cells GetStripArea(int x, int y) { x -= 65; //X Margin if (x < 4.9f * rationCmPixel) return Cells.Info; if (x < 7.2f * rationCmPixel) return Cells.C0; if (x < 9.0f * rationCmPixel) return Cells.C1; if (x < 11.0f * rationCmPixel) return Cells.C2; if (x < 12.4f * rationCmPixel) return Cells.Beacon1; if (x < 13.8f * rationCmPixel) return Cells.Beacon2; if (x < 15.2f * rationCmPixel) return Cells.Beacon3; if (x < 16.6f * rationCmPixel) return Cells.Beacon4; if (x < 18.0f * rationCmPixel) return Cells.Beacon5; if (x < 19.3f * rationCmPixel) return Cells.Beacon6; return Cells.C4; } public string GetTextForCell(Cells cell) { string resutl = ""; switch (cell) { case Cells.Info: resutl = this.SSR; break; case Cells.C0: resutl = this.Sector; break; case Cells.C1: resutl = this.FL1; break; case Cells.C2: resutl = this.FL2; break; case Cells.Beacon1: resutl = this.Beacon1; break; case Cells.Beacon2: resutl = this.Beacon2; break; case Cells.Beacon3: resutl = this.Beacon3; break; case Cells.Beacon4: resutl = this.Beacon4; break; case Cells.Beacon5: resutl = this.Beacon5; break; case Cells.Beacon6: resutl = this.Beacon6; break; case Cells.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 CallSign + " " + Beacon1 + " " + Beacon2 + " " + Beacon3 + " " + Beacon4 + " " + Beacon5 + " " + Beacon6; } public bool IsSelected(Point pt) { return Region.Contains(pt); } public static AnotoStrip GetStrip(int x, int y, string page, AnotoStrip[] strips) { AnotoStrip result = null; foreach (var s in strips) { if (s.Page == page) { if (s.Region.Contains(x, y)) return s; } } return result; } public static AnotoStrip[] LoadFileStrip(string fileName) { string[] papers = { "1728.0.0.0", "1728.0.0.1", "1728.0.0.2", "1728.0.0.3"}; List strips = new List(); // 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 lines = new List(); 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.Region = new Rectangle(x, y, width, height); s.Page = papers[i / nbrStripPerPage]; if ((i % nbrStripPerPage) == 0) y = top; y += height; strips.Add(s); } return strips.ToArray(); } /* public static AnotoStrip[] CreateStrips() { #region StripDef int[] IDCautra = {1002,1254,1277,1267,1280,1329,1586,1222,1234, 1002,1254,1277,1267,1280,1329,1586,1222,1234, 1002,1254,1277,1267,1280,1329,1586,1222,1234, 1002,1254,1277,1267,1280,1329,1586,1222,1234 }; string[] papers = { "1728.0.0.0", "1728.0.0.0", "1728.0.0.0", "1728.0.0.0", "1728.0.0.0", "1728.0.0.0", "1728.0.0.0", "1728.0.0.0", "1728.0.0.0", "1728.0.0.2", "1728.0.0.2", "1728.0.0.2", "1728.0.0.2", "1728.0.0.2", "1728.0.0.2", "1728.0.0.2", "1728.0.0.2", "1728.0.0.2", "1728.0.0.1", "1728.0.0.1", "1728.0.0.1", "1728.0.0.1", "1728.0.0.1", "1728.0.0.1", "1728.0.0.1", "1728.0.0.1", "1728.0.0.1", "1728.0.0.3", "1728.0.0.3", "1728.0.0.3", "1728.0.0.3", "1728.0.0.3", "1728.0.0.3", "1728.0.0.3", "1728.0.0.3", "1728.0.0.3"}; string[] names = { "DAL74", "N525AJ", "IBE3809", "RA422LD", "BZ760DI", "BAW2542", "AF870XZ", "AAF235", "RYR6773", "AF204TC", "SVK516P", "TSC392", "TAR725", "IBE3537", "IBE3549", "NWA50", "AFR5891", "RA441VM", "EZY12BV", "GWI2604", "EZY253Y", "RYR98AD", "ETH501", "IBE3513", "AFL289", "AFR5891", "TSC392", "EZY72JD", "AF802UH", "BZ910HD", "KLM83K", "BZ911JB", "ACA890", "ANE8819", "BEL2F", "RA442TW" }; string[] c0 = { "BEDIX", "OTROT", "MEBAK", "VNE", "OTROT", "KUKOR", "BEDIX", "ETAMO", "ABUSO", "LAKOB", "ETAMO", "VALKU", "ETAMO", "MEBAK", "MEBAK", "ABUSO", "LERGA", "BEDIX", "LAKOB", "MEBAK", "KUKOR", "OTROT", "ABUSO", "MEBAK", "REPSI", "VNE", "BEDIX", "LAKOB", "BELEP", "ABUSO", "ETAMO", "OTROT", "ABUSO", "RUSIT", "KUKOR", "BELEP"}; string[] c1 = { "", "", "REPSI", "REPSI", "", "", "", "", "", "", "", "", "", "REPSI", "REPSI", "", "", "", "", "REPSI", "", "", "", "REPSI", "", "", "", "", "", "", "", "", "", "", "", ""}; string[] c2 = { "VALKU", "LERGA", "LERGA", "PIMKA", "LERGA", "OBEPA", "VALKU", "VALKU", "ADATU", "OBEPA", "VALKU", "LABAL", "VALKU", "LERGA", "LERGA", "ADATU", "MOKDI", "VALKU", "OBEPA", "LERGA", "OBEPA", "LERGA", "ADATU", "LERGA", "LERGA", "REPSI", "VALKU", "OBEPA", "TIS", "ADATU", "VALKU", "LERGA", "ADATU", "LERGA", "OBEPA", "TIS"}; string[] c3 = { "", "MALEB", "MOKDI", "LERGA", "MALEB", "", "LABAL", "ADATU", "LERGA", "LERGA", "ADATU", "", "ADATU", "MOKDI", "MOKDI", "LERGA", "OLRAK", "", "LERGA", "MOKDI", "", "MALEB", "LERGA", "MOKDI", "MOKDI", "PIMAK", "", "", "ADEKA", "LERGA", "ADATU", "MALEB", "LERGA", "MOKDI", "LERGA", "ADEKA"}; string[] c4 = { "TIS", "", "OLRAK", "MOKDI", "", "OTROT", "", "OLRAK", "", "", "", "ROA", "OLRAK", "OLRAK", "OLRAK", "", "", "LABAL", "LATAM", "OLRAK", "OTROT", "", "", "OLRAK", "OLRAK", "LERGA", "LABAL", "OTROT", "VALKU", "", "OLRAK", "", "", "OLRAK", "", ""}; string[] c5 = { "", "OBUBA", "ROMAK", "OLRAK", "OBUBA", "", "ROA", "BADAM", "LATAM", "LATAM", "OLRAK", "", "BADAM", "ROMAK", "ROMAK", "OTROT", "ROMAK", "", "MTL", "ROMAK", "", "OBUBA", "OTROT", "ROMAK", "ROMAK", "MODKI", "", "", "BEBIX", "LATAM", "GONIM", "OBUBA", "OTROT", "ROMAK", "LATAM", "VALKU"}; #endregion List strips = new List(); int index = 0; int width = 5400; int height = ( 7000-160) / 9; int x = 0; int startY = 160; int y = startY; string page = "00"; foreach (var name in names) { if ((index % 9) == 0) y = startY; AnotoStrip s = new AnotoStrip(); s.CallSign = name; s.Region = new Rectangle(x, y, width, height); s.Page = papers[index]; s.IDCautra = IDCautra[index]; y += height; //Beacons string[] list = new string[6]; int i = 0; list[i++] = c0[index]; list[i++] = c1[index]; list[i++] = c2[index]; list[i++] = c3[index]; list[i++] = c4[index]; list[i++] = c5[index]; s.Beacons = list; strips.Add(s); index++; } return strips.ToArray(); }*/ } }