Skip to content

Commit

Permalink
add trip filter for trip start OR end in shp area (matsim-org#3269)
Browse files Browse the repository at this point in the history
  • Loading branch information
simei94 authored May 15, 2024
1 parent e8458ed commit f623322
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ boolean hasDashboard(Class<? extends Dashboard> d, String context) {
* Generate the dashboards specification and writes .yaml files to {@code dir}.
*/
public void generate(Path dir) throws IOException {
generate(dir, false);
}

/**
* Generate the dashboards specification and writes .yaml files to {@code dir}.
* @param dir target directory
* @param append if true, existing dashboards will not be overwritten
*/
public void generate(Path dir, boolean append) throws IOException {

ObjectMapper mapper = new ObjectMapper(new YAMLFactory()
.disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER)
Expand Down Expand Up @@ -157,6 +166,11 @@ public void generate(Path dir) throws IOException {
yaml.subtabs = layout.getTabs();

Path out = dir.resolve("dashboard-" + i + ".yaml");

while (append && Files.exists(out)) {
out = dir.resolve("dashboard-" + ++i + ".yaml");
}

writer.writeValue(out.toFile(), yaml);

i++;
Expand Down

0 comments on commit f623322

Please sign in to comment.