Skip to content

Commit a079431

Browse files
committed
Prevent bypassing the fallback to the standard style
1 parent 0102ba5 commit a079431

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

desktop/src/main/java/org/osm2world/console/commands/ConvertCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public Integer call() throws Exception {
123123
OSMDataReaderView osmReaderView = buildInput();
124124

125125
// TODO: enable sharing (most) scene calculations across different LOD
126-
var sceneKey = new SceneInputs(osmReaderView, configOptions.config, extraProperties);
126+
var sceneKey = new SceneInputs(osmReaderView, configOptions.getConfigFiles(), extraProperties);
127127

128128
Scene scene = cachedScenes.containsKey(sceneKey)
129129
? cachedScenes.get(sceneKey)

desktop/src/main/java/org/osm2world/console/commands/GuiCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public Integer call() {
3030
File input = null; // TODO support input
3131
LevelOfDetail lod = null; // TODO support lod
3232

33-
var viewerFrame = new ViewerFrame(configOptions.getO2WConfig(Map.of()), lod, configOptions.config, input);
33+
var viewerFrame = new ViewerFrame(configOptions.getO2WConfig(Map.of()), lod, configOptions.getConfigFiles(), input);
3434
viewerFrame.setVisible(true);
3535

3636
return -1; // tells the main method not to call System.exit

desktop/src/main/java/org/osm2world/console/commands/mixins/ConfigOptions.java

+11-5
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,25 @@
1111
public class ConfigOptions {
1212

1313
@CommandLine.Option(names = {"--config"}, description = "properties file(s) with configuration parameters")
14-
public List<File> config = List.of();
14+
private List<File> config = List.of();
1515

1616
public static final File STANDARD_PROPERTIES_FILE = new File("standard.properties");
1717

18-
public O2WConfig getO2WConfig(Map<String, ?> extraProperties) {
19-
20-
File[] configFiles = config.toArray(new File[0]);
18+
public List<File> getConfigFiles() {
2119

2220
if (config.isEmpty() && STANDARD_PROPERTIES_FILE.isFile()) {
2321
System.out.println("No --config parameter, using default style (" + STANDARD_PROPERTIES_FILE + ").\n");
24-
configFiles = new File[] { STANDARD_PROPERTIES_FILE };
22+
return List.of(STANDARD_PROPERTIES_FILE);
23+
} else {
24+
return config;
2525
}
2626

27+
}
28+
29+
public O2WConfig getO2WConfig(Map<String, ?> extraProperties) {
30+
31+
File[] configFiles = getConfigFiles().toArray(new File[0]);
32+
2733
try {
2834
return new O2WConfig(extraProperties, configFiles);
2935
} catch (Exception e) {

0 commit comments

Comments
 (0)