Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eric Duminil
RegionChooser
Commits
2fd1f409
Commit
2fd1f409
authored
Oct 07, 2022
by
Eric Duminil
Browse files
Starting commandline interface
parent
99a08343
Changes
3
Show whitespace changes
Inline
Side-by-side
src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java
0 → 100644
View file @
2fd1f409
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
);
}
}
src/main/java/eu/simstadt/regionchooser/RegionChooserFX.java
View file @
2fd1f409
package
eu.simstadt.regionchooser
;
package
eu.simstadt.regionchooser
;
import
java.time.LocalDate
;
import
java.util.Objects
;
import
javafx.application.Application
;
import
javafx.application.Application
;
import
javafx.scene.Scene
;
import
javafx.scene.Scene
;
import
javafx.scene.image.Image
;
import
javafx.scene.image.Image
;
...
@@ -23,7 +21,7 @@ public class RegionChooserFX extends Application
...
@@ -23,7 +21,7 @@ public class RegionChooserFX extends Application
@Override
@Override
public
void
start
(
Stage
stage
)
{
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"
));
Scene
scene
=
new
Scene
(
new
RegionChooserBrowser
(),
1024
,
720
,
Color
.
web
(
"#666970"
));
stage
.
getIcons
().
addAll
(
APP_ICON_48
);
stage
.
getIcons
().
addAll
(
APP_ICON_48
);
stage
.
setScene
(
scene
);
stage
.
setScene
(
scene
);
...
@@ -33,16 +31,5 @@ public void start(Stage stage) {
...
@@ -33,16 +31,5 @@ public void start(Stage stage) {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
launch
(
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
()));
}
}
}
src/main/java/eu/simstadt/regionchooser/RegionChooserUtils.java
View file @
2fd1f409
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
import
java.io.IOException
;
import
java.io.IOException
;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Path
;
import
java.time.LocalDate
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.Optional
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -161,4 +163,15 @@ public static void writeStringBuilderToFile(StringBuilder sb, Path outputFile) t
...
@@ -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
()));
}
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment