Commit 2fd1f409 authored by Eric Duminil's avatar Eric Duminil
Browse files

Starting commandline interface

No related merge requests found
Showing with 63 additions and 15 deletions
+63 -15
package eu.simstadt.regionchooser;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.logging.Logger;
import java.util.stream.Stream;
/*
* Utility class to launch RegionChooser without GUI.
*/
public class RegionChooserCommandLineInterface
{
private static final Logger LOGGER = Logger.getLogger(RegionChooserCommandLineInterface.class.getName());
public static void main(String[] args) throws IOException {
LOGGER.info(String.format("Launching RegionChooser %s", RegionChooserUtils.getApplicationVersion()));
if (args.length == 0) {
displayInfoAndQuit();
}
Path[] paths = Stream.of(args).map(Paths::get).toArray(Path[]::new);
for (Path path : paths) {
System.out.println(path);
}
//TODO: Also get output file
//TODO: Also get EPSG
//TODO: Also get WKT polygon
// StringBuilder sb = RegionExtractor.selectRegionDirectlyFromCityGML(wktPolygon, srsName, paths);
//
// File buildingIdsFile = selectSaveFileWithDialog(project,
// csvCitygmls.replace(";", "_").replace(".gml", ""), "selected_region");
// RegionChooserUtils.writeStringBuilderToFile(sb, buildingIdsFile.toPath());
}
private static void displayInfoAndQuit() {
LOGGER.info(
"Please add one directory path as argument. Either a repository path in order to list the available projects:\n"
+ " java -d64 -classpath lib/*;workflows/* eu.simstadt.desktop.SimStadtCommandLineInterface ..\\TestRepository\n"
+ "Or a project path in order to list the available workflows:\n"
+ " java -d64 -classpath lib/*;workflows/* eu.simstadt.desktop.SimStadtCommandLineInterface ..\\TestRepository\\Gruenbuehl.proj\n"
+ "Or a workflow path in order to launch the workflow:\n"
+ " java -d64 -classpath lib/*;workflows/* eu.simstadt.desktop.SimStadtCommandLineInterface ..\\TestRepository\\Gruenbuehl.proj\\a.step");
System.exit(0);
}
}
package eu.simstadt.regionchooser;
import java.time.LocalDate;
import java.util.Objects;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.image.Image;
......@@ -23,7 +21,7 @@ public class RegionChooserFX extends Application
@Override
public void start(Stage stage) {
stage.setTitle("RegionChooser " + getApplicationVersion());
stage.setTitle("RegionChooser " + RegionChooserUtils.getApplicationVersion());
Scene scene = new Scene(new RegionChooserBrowser(), 1024, 720, Color.web("#666970"));
stage.getIcons().addAll(APP_ICON_48);
stage.setScene(scene);
......@@ -33,16 +31,5 @@ public void start(Stage stage) {
public static void main(String[] args) {
launch(args);
}
/**
* Returns application version, if it has been written in the JAR file during deployment.
*
* e.g. "0.9.1-SNAPSHOT (rev. 73cbe48e, 2018-07-20)"
*/
private String getApplicationVersion() {
Package regionChooserJar = RegionChooserFX.class.getPackage();
return Objects.toString(regionChooserJar.getImplementationVersion(),
String.format("development version (%s)", LocalDate.now()));
}
}
......@@ -4,6 +4,8 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.time.LocalDate;
import java.util.Objects;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -161,4 +163,15 @@ public static void writeStringBuilderToFile(StringBuilder sb, Path outputFile) t
}
}
}
/**
* Returns application version, if it has been written in the JAR file during deployment.
*
* e.g. "0.9.1-SNAPSHOT (rev. 73cbe48e, 2018-07-20)"
*/
public static String getApplicationVersion() {
Package regionChooserJar = RegionChooserFX.class.getPackage();
return Objects.toString(regionChooserJar.getImplementationVersion(),
String.format("development version (%s)", LocalDate.now()));
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment