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
f117faf4
Commit
f117faf4
authored
2 years ago
by
Eric Duminil
Browse files
Options
Download
Email Patches
Plain Diff
Trying picocli
parent
2fd1f409
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pom.xml
+6
-0
pom.xml
src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java
+25
-36
...tadt/regionchooser/RegionChooserCommandLineInterface.java
with
31 additions
and
36 deletions
+31
-36
pom.xml
+
6
-
0
View file @
f117faf4
...
...
@@ -27,6 +27,12 @@
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
info.picocli
</groupId>
<artifactId>
picocli
</artifactId>
<version>
4.6.3
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.osgeo/proj4j -->
<dependency>
<groupId>
org.osgeo
</groupId>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/eu/simstadt/regionchooser/RegionChooserCommandLineInterface.java
+
25
-
36
View file @
f117faf4
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
;
import
java.util.List
;
import
java.util.concurrent.Callable
;
import
picocli.CommandLine
;
import
picocli.CommandLine.Command
;
import
picocli.CommandLine.Parameters
;
/*
* Utility class to launch RegionChooser without GUI.
*/
public
class
RegionChooserCommandLineInterface
@Command
(
name
=
"region_chooser"
,
mixinStandardHelpOptions
=
true
,
version
=
"regionChooser x.x"
,
description
=
"Extracts a region from one or more citygmls."
)
class
RegionChooserCommandLineInterface
implements
Callable
<
Integer
>
{
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
RegionChooserCommandLineInterface
.
class
.
getName
());
@Parameters
(
index
=
"0"
,
description
=
"SRS Name : 'EPSG:31467' or just 31467"
)
String
srsName
;
public
static
void
main
(
String
[]
args
)
throws
IOException
{
LOGGER
.
info
(
String
.
format
(
"Launching RegionChooser %s"
,
RegionChooserUtils
.
getApplicationVersion
()));
if
(
args
.
length
==
0
)
{
displayInfoAndQuit
();
}
@Parameters
(
index
=
"1"
,
description
=
"Output file : output.gml"
)
Path
outputCityGML
;
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
@Parameters
(
index
=
"2..*"
,
arity
=
"1..*"
,
description
=
"The citygml files to extract from : input1.gml input2.gml"
)
List
<
Path
>
citygmls
;
// StringBuilder sb = RegionExtractor.selectRegionDirectlyFromCityGML(wktPolygon, srsName, paths);
//
// File buildingIdsFile = selectSaveFileWithDialog(project,
// csvCitygmls.replace(";", "_").replace(".gml", ""), "selected_region");
// RegionChooserUtils.writeStringBuilderToFile(sb, buildingIdsFile.toPath());
@Override
public
Integer
call
()
throws
Exception
{
// your business logic goes here...
for
(
Path
file
:
citygmls
)
{
System
.
out
.
println
(
file
);
}
return
0
;
}
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
);
// this example implements Callable, so parsing, error handling and handling user
// requests for usage help or version help can be done with one line of code.
public
static
void
main
(
String
...
args
)
{
int
exitCode
=
new
CommandLine
(
new
RegionChooserCommandLineInterface
()).
execute
(
args
);
System
.
exit
(
exitCode
);
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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