Satellite Observers Workbench. NOT yet complete, just published for forum posters to \"cherry pick\" pieces of code as requiered as an example.
stations.c
00001 /**************************************************************************** 00002 * Copyright 2010 Andy Kirkham, Stellar Technologies Ltd 00003 * 00004 * This file is part of the Satellite Observers Workbench (SOWB). 00005 * 00006 * SOWB is free software: you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * SOWB is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with SOWB. If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * $Id: main.cpp 5 2010-07-12 20:51:11Z ajk $ 00020 * 00021 ***************************************************************************/ 00022 00023 #include "stations.h" 00024 00025 /** COSPAR observing stations around the World. 00026 */ 00027 const STATION_t stations[] = { 00028 00029 { 2010, "MM", 30.3340, -97.7610, 160., "5105 Crestway Dr." }, 00030 { 2011, "MM", 30.3150, -97.8661, 300., "Bee Caves Rsrch Ctr" }, 00031 { 2420, "RE", 55.9486, -3.1386, 40., "Russell Eberst" }, 00032 { 2675, "DB", 52.1358, -2.3264, 70., "David Brierley" }, 00033 { 2676, "DB", 52.1273, -2.3365, 107., "David Brierley" }, 00034 { 2018, "PW", 51.0945, -1.1188, 150., "Peter Wakelin" }, 00035 { 2701, "TM", 43.6876, -79.3924, 230., "Ted Molczan" }, 00036 { 3022, "JC", 48.7389, 3.4589, 52., "Jean-Paul Cornec" }, 00037 { 5917, "BG", 59.3418, 18.0545, 33., "Bjorn Gimle" }, 00038 { 5918, "BG", 59.2985, 18.1045, 44., "Bjorn Gimle" }, 00039 { 5919, "BG", 59.2615, 18.6206, 33., "Bjorn Gimle" }, 00040 { 9987, "BF", 59.3418, 18.0545, 30., "Bjorn Gimle" }, 00041 { 100, "SG", 59.4628, 17.9137, 30., "Sven Grahn" }, 00042 { 8305, "PG", 26.2431, -98.2163, 30., "Paul Gabriel" }, 00043 { 2563, "PN", 51.0524, 2.4043, 10., "Pierre Nierinck" }, 00044 { 6226, "SC", 28.4861, -97.8194, 110., "Scott Campbell" }, 00045 { 8539, "SN", 39.4707, -79.3388, 839., "Steve Newcomb" }, 00046 { 2751, "BM", 51.3440, -1.9849, 125., "Bruce MacDonald" }, 00047 { 2756, "AK", 56.0907, -3.1623, 25., "Andy Kirkham" }, /* wow, that's me! Shame I no longer live there. */ 00048 { 433, "GR", -33.9406, 18.5129, 10., "Greg Roberts" }, 00049 { 4541, "AR", 41.9639, 12.4531, 80., "Alberto Rango" }, 00050 { 4542, "AR", 41.9683, 12.4545, 80., "Alberto Rango" }, 00051 { 4641, "AR", 41.1060, 16.9010, 70., "Alberto Rango" }, 00052 { 2115, "MW", 51.3286, 0.7950, 75., "Mike Waterman" }, 00053 { 1775, "KF", 44.6062, -75.6910, 200., "Kevin Fettner" }, 00054 { 1747, "DD", 45.7275, -72.3526, 191., "Daniel Deak" }, 00055 { 8597, "TB", -34.9638, 138.6333, 100., "Tony Beresford" }, 00056 { 8730, "EC", 30.3086, -97.7279, 150., "Ed Cannon" }, 00057 { 9730, "MM", 30.3150, -97.8660, 280., "BCRC (0002)" }, 00058 { 4353, "ML", 52.1541, 4.4908, 0., "Marco Langbroek" }, 00059 { 4354, "ML", 52.1168, 4.5602, -2., "Marco Langbroek" }, 00060 { 710, "LS", 52.3261, 10.6756, 85., "Lutz Schindler" }, 00061 { 1056, "MK", 57.0122, 23.9833, 4., "Martins Keruss" }, 00062 { 110, "LK", 32.5408, -96.8906, 200., "Lyn Kennedy" }, 00063 { 11, "VA", 44.7269, 34.0167, 580., "Crimea Astrophysical Observ." }, 00064 { 70, "BC", 53.2233, -0.6003, 30., "Bob Christy" }, 00065 { 8335, "BY", 35.8311, -96.1471, 335., "Brad Young" }, 00066 { 8336, "BY", 36.1397, -95.9838, 205., "Brad Young" }, 00067 { 8337, "BY", 36.9557, -96.5518, 395., "Brad Young" }, 00068 { 4160, "BD", 51.2793, 5.4768, 35., "Bram Dorreman" }, 00069 { 9011, "RM", 50.9310, 2.4053, 72., "Richard Miles" }, 00070 { 20, "PM", 50.7453, 2.1107, 70., "Paul Marsh" }, 00071 { 40, "IR", 50.7453, 2.1107, 70., "Ian Roberts" }, 00072 { 90, "RF", 50.7453, 2.1107, 70., "Richard Flagg" }, 00073 { 1, "AK", 56.1923, -3.0340, 53., "SOWB Test Station" }, /* Used for testing the SOWB. */ 00074 { 0, "uk", 0.0000, 0.0000, 0., "Unknown station location" } /* Always the last entry. */ 00075 }; 00076 00077 /** cospar_station_at 00078 * 00079 * Given a latitude and longitude is the point within a +/-0.0005 degree 00080 * box of a given station? If so, return a handle (array index) for that 00081 * station. 00082 * 00083 * @param double latitude 00084 * @param double longitude 00085 * @return int index 00086 */ 00087 int cospar_station_at(double latitude, double longitude) { 00088 int i; 00089 double high, low; 00090 00091 for (i = 0; stations[i].cospar != 0; i++) { 00092 high = stations[i].latitude + 0.0005; 00093 low = stations[i].latitude - 0.0005; 00094 if (latitude <= high && latitude >= low) { 00095 high = stations[i].longitude + 0.0005; 00096 low = stations[i].longitude - 0.0005; 00097 if (longitude <= high && longitude >= low) { 00098 return i; 00099 } 00100 } 00101 } 00102 00103 return i; 00104 } 00105 00106 /** station 00107 * 00108 * Given an array index value, return a pointer to the station information structure. 00109 * The proceedure is basically a look-up opertaion. 00110 * 00111 * @param int index 00112 * @return STATION_t * 00113 */ 00114 const STATION_t * cospar_station(int index) { 00115 return &stations[index]; 00116 }
Generated on Tue Jul 12 2022 18:05:35 by 1.7.2