Skip to content

Commit 99b991a

Browse files
authored
Merge pull request #40 from Omega3395/develop
Add projection option to command line interface
2 parents fe03685 + 46e6cb0 commit 99b991a

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

crdesigner/ui/command_line.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ def main(
7373
force_overwrite: Annotated[
7474
bool, typer.Option(help="Overwrite existing CommonRoad file")
7575
] = False,
76+
projection: Annotated[
77+
Optional[str], typer.Option(help="Projection string for coordinate transformation")
78+
] = None,
7679
author: Annotated[str, typer.Option(..., help="Your name")] = "",
7780
affiliation: Annotated[
7881
str,
@@ -85,6 +88,10 @@ def main(
8588
elif ctx.invoked_subcommand is None and input_file is None:
8689
start_gui()
8790
else:
91+
# Set projection if provided
92+
if projection is not None:
93+
general_config.proj_string_cr = projection
94+
8895
# copied from commonroad-dataset-converter
8996
frame = inspect.currentframe()
9097
assert frame is not None
@@ -146,9 +153,6 @@ def odrcr(ctx: typer.Context):
146153
@cli.command()
147154
def lanelet2cr(
148155
ctx: typer.Context,
149-
proj: Annotated[
150-
Optional[str], typer.Option(..., help="Overwrite existing CommonRoad file")
151-
] = None,
152156
adjacencies: Annotated[
153157
bool,
154158
typer.Option(
@@ -166,8 +170,6 @@ def lanelet2cr(
166170
] = False,
167171
):
168172
config_lanelet2 = lanelet2_config
169-
if proj is not None:
170-
general_config.proj_string_cr = proj
171173
config_lanelet2.adjacencies = adjacencies
172174
config_lanelet2.left_driving = left_driving
173175
scenario = lanelet_to_commonroad(ctx.obj["input_file"], lanelet2_conf=config_lanelet2)
@@ -184,17 +186,12 @@ def lanelet2cr(
184186
@cli.command()
185187
def crlanelet2(
186188
ctx: typer.Context,
187-
proj: Annotated[
188-
Optional[str], typer.Option(..., help="Overwrite existing CommonRoad file")
189-
] = None,
190189
autoware: Annotated[bool, typer.Option(..., help="Overwrite existing CommonRoad file")] = False,
191190
local_coordinates: Annotated[
192191
bool, typer.Option(..., help="Overwrite existing CommonRoad file")
193192
] = False,
194193
):
195194
config = lanelet2_config
196-
if proj is not None:
197-
general_config.proj_string_cr = proj
198195
config.autoware = autoware
199196
config.use_local_coordinates = local_coordinates
200197
commonroad_to_lanelet(ctx.obj["input_file"], ctx.obj["output_file"], config=config)

0 commit comments

Comments
 (0)