]> gitweb.fperrin.net Git - GpsPrune.git/blob - src/tim/prune/load/BabelFileFormats.java
5c54dfb5f574cf2d33a676fec30d1c93c33c1d06
[GpsPrune.git] / src / 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 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 String[] 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                         {
30                                 if (suffixes[i] != null && suffixes[i].equalsIgnoreCase(inSuffix))
31                                         return i;
32                         }
33                 }
34                 return -1;
35         }
36
37         /**
38          * Get the format name for the selected row
39          * @param inIndex index of selected format
40          * @return name of this format to give to gpsbabel
41          */
42         public static String getFormat(int inIndex)
43         {
44                 String[] formats = getColumn(1);
45                 if (inIndex >= 0 && inIndex < formats.length)
46                         return formats[inIndex];
47                 return null;
48         }
49
50         /**
51          * Extract the specified column of the data array
52          * @param inIndex column index from 0 to 2
53          * @return string array containing required data
54          */
55         private static String[] getColumn(int inIndex)
56         {
57                 final String[] allFormats = {
58                         "Alan Map500 tracklogs", "alantrl", ".trl",
59                         "Alan Map500 waypoints and routes", "alanwpr", ".wpr",
60                         "Brauniger IQ Series Barograph Download", "baroiq", null,
61                         "Bushnell GPS Trail file", "bushnell_trl", null,
62                         "Bushnell GPS Waypoint file", "bushnell", null,
63                         "Cambridge/Winpilot glider software", "cambridge", null,
64                         "CarteSurTable data file", "cst", null,
65                         "Columbus/Visiontac V900 files", "v900", ".csv",
66                         "CompeGPS data files", "compegps", ".wpt/.trk/.rte",
67                         "Data Logger iBlue747 csv", "iblue747", null,
68                         "Data Logger iBlue757 csv", "iblue757", null,
69                         "DeLorme .an1 (drawing) file", "an1", null,
70                         "DeLorme GPL", "gpl", null,
71                         "DeLorme PN-20/PN-30/PN-40 USB protocol", "delbin", null,
72                         "DeLorme Street Atlas Plus", "saplus", null,
73                         "DeLorme Street Atlas Route", "saroute", null,
74                         "DeLorme XMap HH Native .WPT", "xmap", null,
75                         "DeLorme XMap/SAHH 2006 Native .TXT", "xmap2006", null,
76                         "DeLorme XMat HH Street Atlas USA .WPT (PPC)", "xmapwpt", null,
77                         "Destinator Itineraries", "destinator_itn", ".dat",
78                         "Destinator Points of Interest", "destinator_poi", ".dat",
79                         "Destinator TrackLogs", "destinator_trl", ".dat",
80                         "EasyGPS binary format", "easygps", null,
81                         "Energym training watch", "energympro", null,
82                         "Enigma binary waypoint file", "enigma", ".ert",
83                         "F90G log file", "f90g", null,
84                         "FAI/IGC Flight Recorder Data Format", "igc", null,
85                         "FlySight", "flysight", null,
86                         "Franson GPSGate Simulation", "gpssim", null,
87                         "Fugawi", "fugawi", null,
88                         "G7ToWin data files", "g7towin", ".g7t",
89                         "Garmin 301 Custom position and heartrate", "garmin301", null,
90                         "Garmin FIT activity file", "garmin_fit", ".fit",
91                         "Garmin Logbook XML", "glogbook", null,
92                         "Garmin MapSource - gdb", "gdb", null,
93                         "Garmin MapSource - mps", "mapsource", null,
94                         "Garmin Mobile XT Track files", "garmin_xt", null,
95                         "Garmin PCX5", "pcx", null,
96                         "Garmin POI database", "garmin_poi", null,
97                         "Garmin Points of Interest", "garmin_gpi", ".gpi",
98                         "Garmin Training Center", "gtrnctr", ".tcx",
99                         "Geocaching.com .loc", "geo", null,
100                         "GeocachingDB for Palm/OS", "gcdb", null,
101                         "Geogrid-Viewer ascii overlay file", "ggv_ovl", ".ovl",
102                         "Geogrid-Viewer tracklogs", "ggv_log", ".log",
103                         "GEOnet Names Server (GNS)", "geonet", null,
104                         "GlobalSat DG-100/BT-335", "dg-100", null,
105                         "GlobalSat DG-200", "dg-200", null,
106                         "Google Directions", "googledir", null,
107                         "Google Maps XML", "google", null,
108                         "Google Navigator Tracklines", "gnav_trl", ".trl",
109                         "GoPal GPS track log", "gopal", ".trk",
110                         "GPS TrackMaker", "gtm", null,
111                         "GPSman", "gpsman", null,
112                         "gpsutil", "gpsutil", null,
113                         "GPX", "gpx", ".gpx",
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                         "Humminbird tracks", "humminbird_ht", ".ht",
120                         "Humminbird waypoints and routes", "humminbird", ".hwr",
121                         "IGN Rando track files", "ignrando", null,
122                         "iGO2008 points of interest", "igo2008_poi", ".upoi",
123                         "IGO8 .trk", "igo8", null,
124                         "Jelbert GeoTagger data file", "jtr", null,
125                         "Jogmap.de XML format", "jogmap", null,
126                         "Kompass (DAV) Track", "kompass_tk", ".tk",
127                         "Kompass (DAV) Waypoints", "kompass_wp", ".wp",
128                         "KuDaTa PsiTrex text", "psitrex", null,
129                         "Lowrance USR", "lowranceusr", null,
130                         "Lowrance USR version 4", "lowranceusr4", null,
131                         "Magellan Explorist Geocaching", "maggeo", null,
132                         "Magellan Mapsend", "mapsend", null,
133                         "Magellan SD files (as for eXplorist)", "magellanx", null,
134                         "Magellan SD files (as for Meridian)", "magellan", null,
135                         "Magellan serial protocol", "magellan", null,
136                         "MagicMaps IK3D project file", "ik3d", ".ikt",
137                         "Map&Guide 'TourExchangeFormat' XML", "tef", null,
138                         "MapAsia track file", "mapasia_tr7", ".tr7",
139                         "Mapopolis.com Mapconverter CSV", "mapconverter", null,
140                         "MapTech Exchange Format", "mxf", null,
141                         "MediaTek Locus", "mtk_locus", null,
142                         "Memory-Map Navigator overlay files", "mmo", ".mmo",
143                         "Microsoft Streets and Trips 2002-2007", "s_and_t", null,
144                         "Motorrad Routenplaner (Map&Guide) .bcr files", "bcr", null,
145                         "MTK Logger (iBlue 747,...) Binary File Format", "mtk-bin", null,
146                         "MTK Logger (iBlue 747,Qstarz BT-1000,...) download", "mtk", null,
147                         "MyNav TRC format", "mynav", null,
148                         "National Geographic Topo .tpg (waypoints)", "tpg", null,
149                         "National Geographic Topo 2.x .tpo", "tpo2", null,
150                         "National Geographic Topo 3.x/4.x .tpo", "tpo3", null,
151                         "Navicache.com XML", "navicache", null,
152                         "Navigon Mobile Navigator .rte files", "nmn4", null,
153                         "Navigon Waypoints", "navigonwpt", null,
154                         "NaviGPS GT-11/BGT-11 Download", "navilink", null,
155                         "NaviGPS GT-31/BGT-31 datalogger", "sbp", ".sbp",
156                         "NaviGPS GT-31/BGT-31 SiRF binary logfile", "sbn", ".sbn",
157                         "Naviguide binary route file", "naviguide", ".twl",
158                         "Navitel binary track", "navitel_trk", ".bin",
159                         "Navitrak DNA marker format", "dna", null,
160                         "NetStumbler Summary File", "netstumbler", "text",
161                         "NIMA/GNIS Geographic Names File", "nima", null,
162                         "Nokia Landmark Exchange", "lmx", null,
163                         "OpenStreetMap data files", "osm", ".osm",
164                         "OziExplorer", "ozi", null,
165                         "PocketFMS breadcrumbs", "pocketfms_bc", null,
166                         "PocketFMS flightplan", "pocketfms_fp", ".xml",
167                         "PocketFMS waypoints", "pocketfms_wp", ".txt",
168                         "Quovadis", "quovadis", null,
169                         "Raymarine Waypoint File", "raymarine", ".rwf",
170                         "Ricoh GPS Log File", "ricoh", null,
171                         "See You flight analysis data", "cup", null,
172                         "Skymap / KMD150 ascii files", "skyforce", null,
173                         "SkyTraq Venus based loggers (download)", "skytraq", null,
174                         "SkyTraq Venus based loggers Binary File Format", "skytraq-bin", null,
175                         "Sportsim track files (part of zipped .ssz files)", "sportsim", null,
176                         "SubRip subtitles for video mapping", "subrip", ".srt",
177                         "Suunto Trek Manager (STM) .sdf files", "stmsdf", null,
178                         "Suunto Trek Manager (STM) WaypointPlus files", "stmwpp", null,
179                         "Swiss Map 25/50/100", "xol", ".xol",
180                         "TomTom Itineraries", "tomtom_itn", ".itn",
181                         "TomTom Places Itineraries", "tomtom_itn_places", ".itn",
182                         "TomTom POI file", "tomtom_asc", ".asc",
183                         "TomTom POI file", "tomtom", ".ov2",
184                         "TopoMapPro Places File", "tmpro", null,
185                         "TrackLogs digital mapping", "dmtlog", ".trl",
186                         "U.S. Census Bureau Tiger Mapping Service", "tiger", null,
187                         "Vcard Output (for iPod)", "vcard", null,
188                         "VidaOne GPS for Pocket PC", "vidaone", ".gpb",
189                         "Vito Navigator II tracks", "vitosmt", null,
190                         "Vito SmartMap tracks", "vitovtt", ".vtt",
191                         "WiFiFoFum 2.0 for PocketPC XML", "wfff", null,
192                         "Wintec TES file", "wintec_tes", null,
193                         "Wintec WBT-100/200 Binary File Format", "wbt-bin", null,
194                         "Wintec WBT-100/200 GPS Download", "wbt", null,
195                         "Wintec WBT-201/G-Rays 2 Binary File Format", "wbt-tk1", null,
196                         "XAiOX iTrackU Logger", "itracku", null,
197                         "XAiOX iTrackU Logger Binary File Format", "itracku-bin", null,
198                         "Yahoo Geocode API data", "yahoo", null,
199                 };
200                 // Copy elements into new array
201                 final int numRows = allFormats.length / 3;
202                 String[] result = new String[numRows];
203                 for (int i=0; i<numRows; i++) {
204                         result[i] = allFormats[i*3 + inIndex];
205                 }
206                 return result;
207         }
208 }