]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/load/BabelFileFormats.java
Version 13, August 2011
[GpsPrune.git] / tim / prune / load / BabelFileFormats.java
1 package tim.prune.load;
2
3 /**
4  * Class to manage the list of file formats supported by Gpsbabel
5  * (older versions of gpsbabel might not support all of these, of course).
6  * Certain supported formats such as txt, csv, gpx are not included here
7  * as GpsPrune can already load them directly.
8  */
9 public abstract class BabelFileFormats
10 {
11         /**
12          * @return an object array for the format descriptions
13          */
14         public static Object[] getDescriptions() {
15                 return getColumn(0);
16         }
17
18         /**
19          * Find the (first) appropriate file format for the given file suffix
20          * @param inSuffix end of filename including .
21          * @return matching index or -1 if not found
22          */
23         public static int getIndexForFileSuffix(String inSuffix)
24         {
25                 if (inSuffix != null && inSuffix.length() > 1)
26                 {
27                         final String[] suffixes = getColumn(2);
28                         for (int i=0; i<suffixes.length; i++)
29                                 if (suffixes[i] != null && suffixes[i].equalsIgnoreCase(inSuffix))
30                                         return i;
31                 }
32                 return -1;
33         }
34
35         /**
36          * Get the format name for the selected row
37          * @param inIndex index of selected format
38          * @return name of this format to give to gpsbabel
39          */
40         public static String getFormat(int inIndex)
41         {
42                 String[] formats = getColumn(1);
43                 if (inIndex >= 0 && inIndex < formats.length)
44                         return formats[inIndex];
45                 return null;
46         }
47
48         /**
49          * Extract the specified column of the data array
50          * @param inIndex column index from 0 to 2
51          * @return string array containing required data
52          */
53         private static String[] getColumn(int inIndex)
54         {
55                 final String[] allFormats = {
56                         "Alan Map500 tracklogs", "alantrl", ".trl",
57                         "Alan Map500 waypoints and routes", "alanwpr", ".wpr",
58                         "Brauniger IQ Series Barograph Download", "baroiq", null,
59                         "Bushnell GPS Trail file", "bushnell_trl", null,
60                         "Bushnell GPS Waypoint file", "bushnell", null,
61                         "Cambridge/Winpilot glider software", "cambridge", null,
62                         "CarteSurTable data file", "cst", null,
63                         "Cetus for Palm/OS", "cetus", null,
64                         "CoastalExplorer XML", "coastexp", null,
65                         "Columbus/Visiontac V900 files", "v900", ".csv",
66                         "CompeGPS data files", "compegps", ".wpt/.trk/.rte",
67                         "CoPilot Flight Planner for Palm/OS", "copilot", null,
68                         "cotoGPS for Palm/OS", "coto", null,
69                         "Data Logger iBlue747 csv", "iblue747", null,
70                         "Dell Axim Navigation System file format", "axim_gpb", ".gpb",
71                         "DeLorme .an1 (drawing) file", "an1", null,
72                         "DeLorme GPL", "gpl", null,
73                         "DeLorme PN-20/PN-30/PN-40 USB protocol", "delbin", null,
74                         "DeLorme Street Atlas Plus", "saplus", null,
75                         "DeLorme Street Atlas Route", "saroute", null,
76                         "DeLorme XMap HH Native .WPT", "xmap", null,
77                         "DeLorme XMap/SAHH 2006 Native .TXT", "xmap2006", null,
78                         "DeLorme XMat HH Street Atlas USA .WPT (PPC)", "xmapwpt", null,
79                         "Destinator Itineraries", "destinator_itn", ".dat",
80                         "Destinator Points of Interest", "destinator_poi", ".dat",
81                         "Destinator TrackLogs", "destinator_trl", ".dat",
82                         "EasyGPS binary format", "easygps", null,
83                         "Enigma binary waypoint file", "enigma", ".ert",
84                         "FAI/IGC Flight Recorder Data Format", "igc", null,
85                         "Franson GPSGate Simulation", "gpssim", null,
86                         "Fugawi", "fugawi", null,
87                         "G7ToWin data files", "g7towin", ".g7t",
88                         "Garmin 301 Custom position and heartrate", "garmin301", null,
89                         "Garmin Logbook XML", "glogbook", null,
90                         "Garmin MapSource - gdb", "gdb", null,
91                         "Garmin MapSource - mps", "mapsource", null,
92                         "Garmin PCX5", "pcx", null,
93                         "Garmin POI database", "garmin_poi", null,
94                         "Garmin Points of Interest", "garmin_gpi", ".gpi",
95                         "Garmin Training Center", "gtrnctr", null,
96                         "Garmin Training Center", "gtrnctr", ".tcx",
97                         "Geocaching.com .loc", "geo", null,
98                         "GeocachingDB for Palm/OS", "gcdb", null,
99                         "Geogrid-Viewer ascii overlay file", "ggv_ovl", ".ovl",
100                         "Geogrid-Viewer tracklogs", "ggv_log", ".log",
101                         "GEOnet Names Server (GNS)", "geonet", null,
102                         "GeoNiche .pdb", "geoniche", null,
103                         "GlobalSat DG-100/BT-335 Download", "dg-100", null,
104                         "Google Maps XML", "google", null,
105                         "Google Navigator Tracklines", "gnav_trl", ".trl",
106                         "GoPal GPS track log", "gopal", ".trk",
107                         "GpilotS", "gpilots", null,
108                         "GPS TrackMaker", "gtm", null,
109                         "GpsDrive Format", "gpsdrive", null,
110                         "GpsDrive Format for Tracks", "gpsdrivetrack", null,
111                         "GPSman", "gpsman", null,
112                         "GPSPilot Tracker for Palm/OS", "gpspilot", null,
113                         "gpsutil", "gpsutil", null,
114                         "HikeTech", "hiketech", null,
115                         "Holux (gm-100) .wpo Format", "holux", null,
116                         "Holux M-241 (MTK based) Binary File Format", "m241-bin", null,
117                         "Holux M-241 (MTK based) download", "m241", null,
118                         "Honda/Acura Navigation System VP Log File Format", "vpl", null,
119                         "HSA Endeavour Navigator export File", "hsandv", null,
120                         "Humminbird tracks", "humminbird_ht", ".ht",
121                         "Humminbird waypoints and routes", "humminbird", ".hwr",
122                         "IGN Rando track files", "ignrando", null,
123                         "iGO2008 points of interest", "igo2008_poi", ".upoi",
124                         "IGO8 .trk", "igo8", null,
125                         "Jelbert GeoTagger data file", "jtr", null,
126                         "Jogmap.de XML format", "jogmap", null,
127                         "Kartex 5 Track File", "ktf2", null,
128                         "Kartex 5 Waypoint File", "kwf2", null,
129                         "Kompass (DAV) Track", "kompass_tk", ".tk",
130                         "Kompass (DAV) Waypoints", "kompass_wp", ".wp",
131                         "KuDaTa PsiTrex text", "psitrex", null,
132                         "Lowrance USR", "lowranceusr", null,
133                         "Magellan Explorist Geocaching", "maggeo", null,
134                         "Magellan Mapsend", "mapsend", null,
135                         "Magellan NAV Companion for Palm/OS", "magnav", null,
136                         "Magellan SD files (as for eXplorist)", "magellanx", null,
137                         "Magellan SD files (as for Meridian)", "magellan", null,
138                         "Magellan serial protocol", "magellan", null,
139                         "MagicMaps IK3D project file", "ik3d", ".ikt",
140                         "Map&Guide 'TourExchangeFormat' XML", "tef", null,
141                         "Map&Guide to Palm/OS exported files", "mag_pdb", ".pdb",
142                         "MapAsia track file", "mapasia_tr7", ".tr7",
143                         "Mapopolis.com Mapconverter CSV", "mapconverter", null,
144                         "MapTech Exchange Format", "mxf", null,
145                         "Memory-Map Navigator overlay files", "mmo", ".mmo",
146                         "Microsoft AutoRoute 2002 (pin/route reader)", "msroute", null,
147                         "Microsoft Streets and Trips (pin/route reader)", "msroute", null,
148                         "Microsoft Streets and Trips 2002-2007", "s_and_t", null,
149                         "Mobile Garmin XT Track files", "garmin_xt", null,
150                         "Motorrad Routenplaner (Map&Guide) .bcr files", "bcr", null,
151                         "MS PocketStreets 2002 Pushpin", "psp", null,
152                         "MTK Logger (iBlue 747,...) Binary File Format", "mtk-bin", null,
153                         "MTK Logger (iBlue 747,Qstarz BT-1000,...) download", "mtk", null,
154                         "National Geographic Topo .tpg (waypoints)", "tpg", null,
155                         "National Geographic Topo 2.x .tpo", "tpo2", null,
156                         "National Geographic Topo 3.x/4.x .tpo", "tpo3", null,
157                         "Navicache.com XML", "navicache", null,
158                         "Navigon Mobile Navigator .rte files", "nmn4", null,
159                         "Navigon Waypoints", "navigonwpt", null,
160                         "NaviGPS GT-11/BGT-11 Download", "navilink", null,
161                         "NaviGPS GT-31/BGT-31 datalogger", "sbp", ".sbp",
162                         "NaviGPS GT-31/BGT-31 SiRF binary logfile", "sbn", ".sbn",
163                         "Naviguide binary route file", "naviguide", ".twl",
164                         "Navitel binary track", "navitel_trk", ".bin",
165                         "Navitrak DNA marker format", "dna", null,
166                         "NetStumbler Summary File", "netstumbler", "text",
167                         "NIMA/GNIS Geographic Names File", "nima", null,
168                         "Nokia Landmark Exchange", "lmx", null,
169                         "OpenStreetMap data files", "osm", ".osm",
170                         "OziExplorer", "ozi", null,
171                         "PalmDoc Output", "palmdoc", null,
172                         "PathAway Database for Palm/OS", "pathaway", null,
173                         "PocketFMS breadcrumbs", "pocketfms_bc", null,
174                         "PocketFMS flightplan", "pocketfms_fp", ".xml",
175                         "PocketFMS waypoints", "pocketfms_wp", ".txt",
176                         "Quovadis", "quovadis", null,
177                         "Raymarine Waypoint File", "raymarine", ".rwf",
178                         "Ricoh GPS Log File", "ricoh", null,
179                         "See You flight analysis data", "cup", null,
180                         "Skymap / KMD150 ascii files", "skyforce", null,
181                         "SkyTraq Venus based loggers (download)", "skytraq", null,
182                         "SkyTraq Venus based loggers Binary File Format", "skytraq-bin", null,
183                         "Sportsim track files (part of zipped .ssz files)", "sportsim", null,
184                         "SubRip subtitles for video mapping", "subrip", ".srt",
185                         "Suunto Trek Manager (STM) .sdf files", "stmsdf", null,
186                         "Suunto Trek Manager (STM) WaypointPlus files", "stmwpp", null,
187                         "Swiss Map 25/50/100", "xol", ".xol",
188                         "TomTom Itineraries", "tomtom_itn", ".itn",
189                         "TomTom Places Itineraries", "tomtom_itn_places", ".itn",
190                         "TomTom POI file", "tomtom_asc", ".asc",
191                         "TomTom POI file", "tomtom", ".ov2",
192                         "TopoMapPro Places File", "tmpro", null,
193                         "TrackLogs digital mapping", "dmtlog", ".trl",
194                         "U.S. Census Bureau Tiger Mapping Service", "tiger", null,
195                         "Vcard Output (for iPod)", "vcard", null,
196                         "VidaOne GPS for Pocket PC", "vidaone", ".gpb",
197                         "Vito Navigator II tracks", "vitosmt", null,
198                         "Vito SmartMap tracks", "vitovtt", ".vtt",
199                         "WiFiFoFum 2.0 for PocketPC XML", "wfff", null,
200                         "Wintec TES file", "wintec_tes", null,
201                         "Wintec WBT-100/200 Binary File Format", "wbt-bin", null,
202                         "Wintec WBT-100/200 GPS Download", "wbt", null,
203                         "Wintec WBT-201/G-Rays 2 Binary File Format", "wbt-tk1", null,
204                         "XAiOX iTrackU Logger", "itracku", null,
205                         "XAiOX iTrackU Logger Binary File Format", "itracku-bin", null,
206                         "Yahoo Geocode API data", "yahoo", null,
207                 };
208                 // Copy elements into new array
209                 final int numRows = allFormats.length / 3;
210                 String[] result = new String[numRows];
211                 for (int i=0; i<numRows; i++) {
212                         result[i] = allFormats[i*3 + inIndex];
213                 }
214                 return result;
215         }
216 }