/** * Route Data for Rob's Moving Map package * @author Robert John Morton * @version 02 March 2019 This class file is [re]generated automatically by the routes data entry program. */ class loader { private static final String MSG[][] = { // Progress messages {"Loading route names...", "Loading waypoints...", "Flight ready to depart."}, {"Carregando nomes de rota...", "Carregando viapontos...", "Vôo pronto para partir."} }, RN[] = { // Route Names "Stansted -> Belo Horizonte", "Stansted -> Edinburgh", "Stansted -> Marseilles", "Stansted -> Seattle", "Carlos Prates -> Rio Quente", "Carlos Prates -> São Francisco" }, /* An asterisk indicates that the item is an actual way-point as opposed to an off-route feature. This is followed by the way-point's latitude, longitude, height and name. Lattutudes and longitudes are given as int- egral seconds-of-arc in a bipolar 7-digit field including sign. Height is a 5-digit field, including sign if necessary. 1 7 1 7 5 1 ? "*+999999 +999999 9999 AAAAAAAA..." */ RF[][] = { // Route Features {"* 186780 780 106 Stansted", // Stansted to Belo Horizonte "* 186000 -780 130 Barnet", "* 184440 -2100 154 Guildford", "* 182880 -3900 7 Portsmouth", "* 178020 -9120 0 St.Peter Port", "* 172800 -14760 6 Quimper", "* 154800 -27240 465 Lugo", "* 152400 -28260 132 Ourense", "* 150060 -31800 104 Porto", "* 117601 -60927 400 Funchal", "* 60273 -82613 54 Sal-Cape Verde", "* -13260 -138300 21 Fortaleza", "* -15120 -138720 865 Baturité", "* -17880 -140460 193 Quixadá", "* -18720 -141480 191 Quixeramobim", "* -20100 -141720 183 Senador Pompeu", "* -21960 -142020 317 Acopiara", "* -22860 -141480 222 Iguatu", "* -25020 -140280 259 Aurora", "* -25980 -141360 429 Juàzeiro do Norte", "* -27300 -141480 648 Jardim", "* -29100 -142500 392 Parnamirim", "* -32400 -143640 364 Curaçá", "* -33180 -145080 383 Petrolina", "* -37680 -144660 538 Senhor do Bonfim", "* -40260 -145860 463 Jacobina", "* -41520 -148200 1100 Morro de Chapéu", "* -44400 -148440 394 Lençóis", "* -46800 -148920 1077 Mucugê", "* -49740 -148680 520 Ituacu", "* -51120 -150000 454 Brumado", "* -54300 -153900 582 Monte Azul", "* -60240 -157920 661 Montes Claros", "* -61560 -157740 698 Bocaiúva", "* -65640 -156840 1288 Diamantina", "* -67200 -155100 722 Sabinópolis", "* -69240 -154860 458 Ferros", "* -70620 -155640 766 Itabira", "* -70680 -158280 739 Tancredo Neves", " 185400 -300 London", " 183000 -540 Brighton", " 183240 -5040 Southamption", " 189240 4620 Norwich", " 190560 4680 Cromer", " 186840 3300 Colchester", " 186300 -4500 Oxford", " 186900 -7500 Cheltenham", " 175500 -16920 Brest", " 182280 10980 Lille", " 139400 -32901 Lisboa", " 139400 -32901 32 Lisboa", " 119017 -58802 Vila Baleira", " 177300 14400 Reims", " 178020 3840 Rouen", " 179400 11760 St Quentin", " 175740 14580 Troyes", " 166320 22140 Geneva", " 162720 20520 Grenoble", " 163620 15720 St Etienne", " 61305 -91158 Monte Trigo", " 59818 -87469 Ribeira Brava", " 53759 -84648 Praia", " 60756 -89933 Mindelo", " 101850 -59865 Tenerife", " 156720 25200 Cannes", " 157020 13920 Montpellier", " 155400 21300 Toulon", " 144000 600 Le Mans" }, {"* 186780 780 106 Stansted", // Stansted to Edinburgh "* 187980 -480 6 Cambridge", "* 190620 -4200 46 Nottingham", "* 193680 -5640 63 Leeds", "* 197940 -5820 54 Newcastle", "* 201420 -11520 47 Edinburgh", " 185400 -300 11 London", " 183000 -540 29 Brighton", " 183240 -5040 Southamption", " 189240 4620 Norwich", " 190560 4680 Cromer", " 186840 3300 Colchester", " 186300 -4500 Oxford", " 186900 -7500 Cheltenham", " 192300 -10800 Liverpool", " 194940 -16140 Douglas", " 193560 -9720 Preston", " 194880 -11700 Barrow", " 192180 -5280 Sheffield", " 191340 1200 Skegness", " 193500 -1200 Hull", " 196620 -4440 Redcar", " 195420 -1440 Scarborough", " 188700 -14760 Aberystwyth", " 189840 -13980 Dolgellau", " 191880 -16680 Holyhead", " 206940 -15120 Inverness", " 204480 -18480 Ft William", " 208440 -18600 Ullapool", " 207060 -20340 Shieldaig", " 203340 -10800 Dundee", " 205740 -7560 Aberdeen" }, {"* 186780 780 106 Stansted", // Stansted to Marseilles "* 184020 4740 5 Dover", "* 183420 6960 18 Calais", "* 179640 8160 33 Amiens", "* 175800 8400 35 Paris", "* 172080 12720 155 Auxerre", "* 170400 18000 242 Dijon", "* 166740 17400 175 Macon", "* 164760 17400 173 Lyons", "* 161820 17640 128 Valence", "* 158220 17400 23 Avignon", "* 155880 19380 75 Marseilles", " 185400 -300 London", " 183000 -540 Brighton", " 183240 -5040 Southamption", " 189240 4620 Norwich", " 190560 4680 Cromer", " 186840 3300 Colchester", " 186300 -4500 Oxford", " 186900 -7500 Cheltenham", " 175500 -16920 Brest", " 182280 10980 Lille", " 177300 14400 Reims", " 178020 3840 Rouen", " 179400 11760 St Quentin", " 175740 14580 Troyes", " 166320 22140 Geneva", " 162720 20520 Grenoble", " 163620 15720 St Etienne", " 156720 25200 Cannes", " 157020 13920 Montpellier", " 155400 21300 Toulon", " 144000 600 Le Mans" }, {"* 186780 780 106 Stansted", // Stansted to Seattle "* 189000 -6900 140 Birmingham", "* 192600 -8100 38 Manchester", "* 197640 -10500 29 Carlisle", "* 201120 -15240 40 Glasgow", "* 203100 -19800 29 Oban", "* 209520 -22980 38 Stornoway", "* 231000 -79020 22 Reykjavik", "* 234000 -225000 0 Cape Mercy", "* 231240 -275520 50 Cape Dorset", "* 223800 -336600 0 Tavani", "* 192600 -408600 645 Edmonton", "* 178200 -430200 385 Penticton", "* 175500 -440820 22 Bellingham", "* 171660 -440100 158 Seattle", " 170100 -441000 Tacoma", " 172800 -439800 Everett", " 177300 -443400 Vancouver", " 174600 -444300 Victoria", " 173220 -444600 Port Angeles", " 169200 -445800 Aberdeen", " 166560 -445800 Astoria", " 171000 -433020 Wenatchee", " 178800 -449400 Port Alberni", " 177000 -446400 Nanaimo", " 185400 -300 11 London", " 183000 -540 Brighton", " 183240 -5040 Southamption", " 189240 4620 Norwich", " 190560 4680 Cromer", " 186840 3300 Colchester", " 186300 -4500 Oxford", " 186900 -7500 Cheltenham", " 192300 -10800 Liverpool", " 194940 -16140 Douglas", " 193560 -9720 Preston", " 194880 -11700 Barrow", " 192180 -5280 Sheffield", " 191340 1200 Skegness", " 193500 -1200 Hull", " 196620 -4440 Redcar", " 195420 -1440 Scarborough", " 188700 -14760 Aberystwyth", " 189840 -13980 Dolgellau", " 191880 -16680 Holyhead", " 206940 -15120 Inverness", " 204480 -18480 Ft William", " 208440 -18600 Ullapool", " 207060 -20340 Shieldaig", " 203340 -10800 Dundee", " 205740 -7560 Aberdeen" }, {"* -71674 -158360 928 Carlos Prates", // Carlos Prates to Rio Quente "* -71883 -159119 860 Betim", " -71496 -160589 Pará de Minas", " -70077 -159299 Sete Lagoas", " -71786 -162687 Araújos", " -71918 -163758 Lagoa da Prata", " -73073 -163971 Arcos", " -73661 -163563 Formiga", " -72069 -165462 Bambui", " -68420 -166498 Carmo do Paranaiba", " -69504 -165804 São Gortado", "* -71563 -161945 712 Nova Serrana", " -71054 -162910 Bom Despacho", " -71467 -163487 Moema", "* -71219 -164456 675 Luz", " -71388 -165313 Corrego Danta", "* -70909 -166211 1050 Campos Altos", " -70537 -168990 Araxá", " -68202 -168028 Cruzeiro da Fortaleza", "* -70142 -167574 895 Ibiá", "* -68199 -169173 965 Patrocinio", " -66867 -167479 Patos de Menas", "* -68342 -170861 951 Iraí de Minas", " -67432 -170992 Monte Carmelo", " -68073 -173745 Uberlândia", " -71090 -172563 Uberaba", " -68961 -163615 Abaeté", " -69128 -161787 Pompéu", "* -67959 -172539 975 Trevo 1", "* -67817 -172648 999 Trevo 2", " -72489 -161594 Divinópolis", "* -67121 -173458 1023 Araguari", "* -66754 -174284 1019 Trevo 3", " -65966 -174828 Ponte", "* -65308 -174813 1014 Corumbaíba", " -65043 -174984 Ponte", " -64705 -175128 Marzagão", "* -64006 -175564 663 Rio Quente" }, {"* -71674 -158360 928 Carlos Prates", //Carlos Prates->São Francisco " -69605 -159292 761 Sete Lagoas", " -69414 -159873 761 Paraopeba", "* -68930 -160353 672 JK-Curvelo", "* -67496 -160009 633 Curvelo", "* -66254 -160052 999 Corinto", "* -65202 -159363 534 Augusto de Lima", " -64331 -159023 Buenópolis", "* -64006 -158928 781 Joaquim Felicio", "* -62263 -158166 694 Engenheiro Navarro", "* -61615 -157757 698 Bocaiúva", "* -60184 -157938 661 Montes Claros", "* -58640 -158943 600 Mirabela", " -58275 -159168 Trevo 2", "* -58339 -159943 908 Brasília de Minas", "* -56805 -161479 918 São Francisco" } }; private int lp = 1, // loading phase set to "start loading" NR = RN.length, // number of available routes SR = 0, // number of currently selected route F = 0, // number of features in selected route W = 0, // number of way-points in selected route NF[], // number of features in each route NW[], // number of these that are waypoints L = 0; // language switch private String s = "", // To hold a route or feature. S = ""; // general string private aircraft ac; // ref to the aircraft object private dandb db; // ref to distance and bearing calculation object private route r; // ref to a route object private waypnt w; // ref to a waypoint object private routesel rs; // ref to instance of route selector class private selwp ws; // ref to instance of waypoint selector class private butpanel bp; // ref to the button panel object private msgpanel mp; // instance reference for message display panel private airmap am; // reference to air map canvas object private navpanel np; // panel which displays the numeric data private boolean namesLoaded = false, // route names not yet loaded featuresLoaded = false, // selected route's waypoints not yet loaded trace = false; /* Constructor to create the arrays for the numbers of features and way- points in each route. Then install the names of all the routes in the Routes choice menu and the number of features and way-points for each route in the NF and NW arrays respectively. It then initiates the load- ing of the first route's features. */ loader(int ls, int L, String cb, movmap mm, msgpanel mp, routesel rs, selwp ws, aircraft ac, airmap am, navpanel np, selgeoid gs, butpanel bp, boolean trace){ /* NOTE: some of the above constructor arguements are not used in this implementation of the loader but remain here to maintain compatibility with the rest of the package. */ this.ac = ac; // ref to the aircraft object this.rs = rs; // ref to instance of route selector class this.ws = ws; // ref to instance of waypoint selector class this.bp = bp; // ref to the button panel object this.mp = mp; // instance ref for message display panel this.np = np; // panel which displays the numeric data this.am = am; // reference to air map canvas object this.L = L; // language switch this.trace = trace; // get the reference of the distance and bearing object db = gs.getDandB(); NF = new int[NR]; // array for number of features in each route NW = new int[NR]; // array for number of waypoints in each route } void loadRoute(int sr){ // set up route number 'sr' SR = sr; // global variable for selected route featuresLoaded = false; // selected route's waypoints not yet loaded waypnt.killAll(); // remove all currently installed waypoints F = NF[SR]; // get the number of features in this route W = NW[SR]; // get the number of way-points in this route /* Get the number of waypoints in the selected route and create a new route of that number of waypoints. Clear the previous route's feat- ures from the Choice Menu and set the new number of items needed in the Choice Menu then set lp to start loading the data. */ r = new route(W,ac,bp,trace); ws.clearWaypoints(W); lp = 1; } boolean routeDataLoaded() { if(lp > 0) { // must load data if(!namesLoaded) { loadRoutes(); } if(!featuresLoaded) { loadFeatures(); } lp = 0; // data loading no longer active } return namesLoaded && featuresLoaded; } private void loadRoutes(){ mp.showMsg(MSG[L][0],true,false); rs.clearRoutes(NR); // set up an array in selwp for route names for(int i = 0; i < NR; i++){ // for each route... s = RN[i]; // get the route name string int J = RF[i].length; // number of features in this route NF[i] = J; /* Find the number of features in this route that are way- points and put this number in NW[i]. Way-point entries are prefixed with an asterisk. */ int k = 0; for(int j = 0; j < J; j++) if(RF[i][j].charAt(0) == '*') k++; NW[i] = k; rs.addRoute(s); // route name to route choice menu array } rs.installRoutes(); // install all the routes in the Choice menu namesLoaded = true; // the route names have been loaded loadRoute(0); // set up first route's features & way-points } private void loadFeatures(){ mp.showMsg(MSG[L][1], true, false); for(int i = 0; i < F; i++) { // for each feature in this route... s = RF[SR][i]; // get route feature string /* Create a new way-point object for feature number 'i' containing its latitude & longitude (in radians), its height (in metres), its name plus references to the aircraft & distance-and-bearing instances. */ int hgt = 0; S = (s.substring(16,21)).trim(); if(!S.equals("")) hgt = Integer.parseInt(S); w = new waypnt(secRad(s,1,8),secRad(s,9,16), hgt, s.substring(22),ac,db); /* If this feature is an en-route waypoint, add it to the current route and the reformatted way-point details to the current route's waypoints list. */ if(s.charAt(0) == '*') { r.AddWayPnt(w); ws.addWaypoint(interpret(s)); } } r.init(); // initialize the newly-loaded route r.reset(); // reset aircraft to start of the current route ws.installWaypoints(); // install all the waypoints in the Choice menu featuresLoaded = true; // features for given route now loaded am.atualizar(); // display the initial air map content np.atualizar(); // display the initial navigation data bp.setBlack(); mp.showMsg(MSG[L][2],true,false); } // Converts seconds of arc to radians. private double secRad(String s, int x, int y){ int z = Integer.parseInt((s.substring(x,y)).trim()); return (double)z * Math.PI / 648000; } /* Interpret an incoming waypoint entry back into humanly readable form Format of input line *+000000+000000Name Format of output line *000:00:00N 000:00:00W Name */ private String interpret(String s) { return format(Integer.parseInt((s.substring(1,8)).trim()),true) // Lat + format(Integer.parseInt((s.substring(9,16)).trim()),false) // Long + s.substring(16,21) // Height + s.substring(21); // Name } /* Reformats a latitude or longitude from seconds of arc to a colon-delimited string in degrees, minutes and seconds. */ private String format(int x, boolean lat) { if(x < 0) { // if the latitude or longitude be negative if(lat) // if it's a latitude S = "S"; // then it is South else // else, it must be a longitude S = "W"; // so it must be West x = -x; // reverse its sign to make it positive } else // else, the latitude or longitude is positive if(lat) // so, if it's a latitude S = "N"; // it must be North else // else it must be a longitude S = "E"; // so it must be East int d = x / 3600, // whole degrees s = x % 3600, // seconds left after extracting whole degrees m = s / 60; // whole minutes s %= 60; // remaining seconds after extracting minutes String D = "" + d; // integral number of degrees as a string int l = 3; // length of degrees string is 3 digits if(lat) // but if its a latitude l = 2; // it must be reduced to 2-digits /* Pad out the degrees, minutes and seconds with leading zeros if and as necessary and return the whole lattitude or longitude as a colon-delimited string. */ while(D.length() < l) D = "0" + D; String M = "" + m; while(M.length() < 2) M = "0" + M; String X = "" + s; while(X.length() < 2) X = "0" + X; return D + ":" + M + ":" + X + S + " "; } boolean getNamesLoaded() { return namesLoaded; } boolean DefaultsLoaded() { return (namesLoaded && featuresLoaded); } int getlp() { return lp; } void setlp(int x) { lp = x; } }