+ /**
+ * Get the commands to call
+ * @param inDevice device name to use
+ * @param inFormat format to use
+ * @return String array containing commands
+ */
+ private String[] getCommandArray(String inDevice, String inFormat)
+ {
+ String[] commands = null;
+ final String command = Config.getConfigString(Config.KEY_GPSBABEL_PATH);
+ final boolean loadWaypoints = _waypointCheckbox.isSelected();
+ final boolean loadTrack = _trackCheckbox.isSelected();
+ if (loadWaypoints && loadTrack) {
+ // Both waypoints and track points selected
+ commands = new String[] {command, "-w", "-t", "-i", inFormat,
+ "-f", inDevice, "-o", "gpx", "-F", "-"};
+ }
+ else
+ {
+ // Only waypoints OR track points selected
+ commands = new String[] {command, "-w", "-i", inFormat,
+ "-f", inDevice, "-o", "gpx", "-F", "-"};
+ if (loadTrack) {
+ commands[1] = "-t";
+ }
+ }
+ // Do we want to save the gpx straight to file?
+ if (_saveCheckbox.isSelected()) {
+ // Select file to save to
+ _saveFile = GpxExporter.chooseGpxFile(_parentFrame);
+ if (_saveFile != null) {
+ commands[commands.length-1] = _saveFile.getAbsolutePath();
+ }
+ }
+ return commands;