Skip to content

Commit

Permalink
add trip filter for trip start OR end in shp area
Browse files Browse the repository at this point in the history
  • Loading branch information
simei94 committed May 14, 2024
1 parent e8458ed commit 0be52bc
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 0be52bc

Please sign in to comment.