import tim.prune.data.RecentFileList;
import tim.prune.data.UnitSet;
import tim.prune.data.UnitSetLibrary;
+import tim.prune.gui.map.MapSourceLibrary;
/**
public static final String KEY_GPS_FORMAT = "prune.gpsformat";
/** Key for GPSBabel filter string */
public static final String KEY_GPSBABEL_FILTER = "prune.gpsbabelfilter";
+ /** Key for GPSBabel import file format */
+ public static final String KEY_IMPORT_FILE_FORMAT = "prune.lastimportfileformat";
/** Key for Povray font */
public static final String KEY_POVRAY_FONT = "prune.povrayfont";
/** Key for the selected unit set */
public static final String KEY_RECENT_FILES = "prune.recentfiles";
/** Key for estimation parameters */
public static final String KEY_ESTIMATION_PARAMS = "prune.estimationparams";
+ /** Key for 3D exaggeration factor */
+ public static final String KEY_HEIGHT_EXAGGERATION = "prune.heightexaggeration";
/** Initialise the default properties */
_colourScheme.loadFromHex(_configValues.getProperty(KEY_COLOUR_SCHEME));
_recentFiles = new RecentFileList(_configValues.getProperty(KEY_RECENT_FILES));
_unitSet = UnitSetLibrary.getUnitSet(_configValues.getProperty(KEY_UNITSET_KEY));
+ // Adjust map source index if necessary
+ adjustSelectedMap();
if (loadFailed) {
throw new ConfigException();
props.put(KEY_EXIFTOOL_PATH, "exiftool");
props.put(KEY_GNUPLOT_PATH, "gnuplot");
props.put(KEY_GPSBABEL_PATH, "gpsbabel");
+ props.put(KEY_IMPORT_FILE_FORMAT, "-1"); // no file format selected
props.put(KEY_KMZ_IMAGE_SIZE, "240");
props.put(KEY_AUTOSAVE_SETTINGS, "0"); // autosave false by default
props.put(KEY_UNITSET_KEY, "unitset.kilometres"); // metric by default
+ props.put(KEY_HEIGHT_EXAGGERATION, "100"); // 100%, no exaggeration
return props;
}
+ /**
+ * Adjust the index of the selected map
+ * (only required if config was loaded from a previous version of GpsPrune)
+ */
+ private static void adjustSelectedMap()
+ {
+ int sourceNum = getConfigInt(Config.KEY_MAPSOURCE_INDEX);
+ int prevNumFixed = getConfigInt(Config.KEY_NUM_FIXED_MAPS);
+ // Number of fixed maps not specified in version <=13, default to 6
+ if (prevNumFixed == 0) prevNumFixed = 6;
+ int currNumFixed = MapSourceLibrary.getNumFixedSources();
+ // Only need to do something if the number has changed
+ if (currNumFixed != prevNumFixed && (sourceNum >= prevNumFixed || sourceNum >= currNumFixed))
+ {
+ sourceNum += (currNumFixed - prevNumFixed);
+ setConfigInt(Config.KEY_MAPSOURCE_INDEX, sourceNum);
+ }
+ setConfigInt(Config.KEY_NUM_FIXED_MAPS, currNumFixed);
+ }
+
/**
* @param inString String to parse
* @return int value of String, or 0 if unparseable