city_generator2

Generated conformal 3D meshes representing a city
git clone git://git.meso-star.fr/city_generator2.git
Log | Files | Refs | README | LICENSE

commit 7fb16b86948bb957ac8a8d8c93a5a28f761e2d4e
parent fbeebeca5ccc0586b0374389dfcaa38e1c8b9715
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Fri, 17 Jan 2025 16:15:45 +0100

Add the -s option to specify stardis output file base name

Two files are created: the model file and a script file to define
variables used in the model file.

Diffstat:
MMakefile | 2++
Mconfig.mk | 2++
Mdoc/city_generator2.1.in | 9+++++++++
Msrc/cg_args.c | 14++++++++++++--
Msrc/cg_args.h | 1+
Msrc/cg_city.c | 1-
Msrc/cg_default.h.in | 1+
7 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -77,6 +77,7 @@ src/cg_default.h: config.mk src/cg_default.h.in -e 's/@CG2_MIN_DISTANCE_TO_MAP_LIMITS@/$(CG2_MIN_DISTANCE_TO_MAP_LIMITS)/' \ -e 's/@CG2_MIN_WINDOWS_WIDTH@/$(CG2_MIN_WINDOWS_WIDTH)/' \ -e 's/@CG2_GLAZING_THICKNESS@/$(CG2_GLAZING_THICKNESS)/' \ + -e 's/@CG2_ARGS_DEFAULT_STARDIS_FILES_BASENAME@/$(CG2_ARGS_DEFAULT_STARDIS_FILES_BASENAME)/' \ $@.in > $@ src/cg_version.h: config.mk src/cg_version.h.in @@ -103,6 +104,7 @@ doc/city_generator2.1: doc/city_generator2.1.in -e 's/@CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION@/$(CG2_ARGS_CHANGE_BINARY_DEFAULT_OPTION)/' \ -e 's/@CG2_ARGS_STL_NON_DEFAULT_STR@/$(CG2_ARGS_STL_NON_DEFAULT_STR)/' \ -e 's/@CG2_ARGS_STL_DEFAULT_STR@/$(CG2_ARGS_STL_DEFAULT_STR)/' \ + -e 's/@CG2_ARGS_DEFAULT_STARDIS_FILES_BASENAME@/$(CG2_ARGS_DEFAULT_STARDIS_FILES_BASENAME)/' \ $@.in > $@ ################################################################################ diff --git a/config.mk b/config.mk @@ -25,6 +25,8 @@ CG2_MIN_DISTANCE_TO_MAP_LIMITS = 2 CG2_MIN_WINDOWS_WIDTH = 0.1 # Glazing thickness CG2_GLAZING_THICKNESS = 0.024 +# Default base name for the stardis files +CG2_ARGS_DEFAULT_STARDIS_FILES_BASENAME = stardis_model ################################################################################ # Tools diff --git a/doc/city_generator2.1.in b/doc/city_generator2.1.in @@ -97,6 +97,15 @@ construction mode among other things. Please refer to .Xr city_generator2-input 5 for more information on formats. +.It Fl s Ar base_name +Specify a base name for the stardis files that are created along the STL files. +The two files created are the stardis model file, whose name is +.Ar base_name.txt, and the shell script file name dedicated to set the numerous +script shell variables used in the model file, and whose name is +.Ar base_name.sh. +Default +.Ar base_name +is "@CG2_ARGS_DEFAULT_STARDIS_FILES_BASENAME@". .It Fl v Output version information and exit. .It Fl V Ar level diff --git a/src/cg_args.c b/src/cg_args.c @@ -112,9 +112,9 @@ parse_args { res_T res = RES_OK; int opt; - int info_provided = 0, c_provided = 0, m_provided = 0; + int info_provided = 0, c_provided = 0, m_provided = 0, s_provided = 0; struct args* args; - char option_list[] = "?c:m:hkEF:f:vV:1"; + char option_list[] = "?c:m:hkEF:f:s:vV:1"; ASSERT(allocator && logger && argv && out_args); @@ -135,6 +135,7 @@ parse_args /* Set non-zero default values */ args->binary_export = CG2_ARGS_BINARY_STL_DEFAULT; args->verbosity_level = CG2_ARGS_DEFAULT_VERBOSITY_LEVEL; + args->stardis_basename = CG2_ARGS_DEFAULT_STARDIS_FILES_BASENAME; opterr = 0; /* No default error messages */ while((opt = getopt(argc, argv, option_list)) != -1) { @@ -211,6 +212,15 @@ parse_args args->keep_running_on_errors = 1; break; + case 's': + if(s_provided) { + logger_print(logger, LOG_ERROR, "Option -%c provided twice.\n", opt); + res = RES_BAD_ARG; + goto error; + } + args->stardis_basename = optarg; + s_provided = 1; + break; case 'v': info_provided = 1; diff --git a/src/cg_args.h b/src/cg_args.h @@ -34,6 +34,7 @@ struct args { struct mem_allocator* allocator; struct logger* logger; char* city_filename; + char* stardis_basename; struct darray_names catalog_files; struct darray_names dump_footprint_names; int binary_export; diff --git a/src/cg_city.c b/src/cg_city.c @@ -630,7 +630,6 @@ release_city(struct city* city) res = RES_BAD_ARG; goto error; } - if(city->scpr) SCPR(device_ref_put(city->scpr)); if(city->denoiser) vertex_denoiser_release(city->denoiser); if(city->array_and_tables_initialized) { diff --git a/src/cg_default.h.in b/src/cg_default.h.in @@ -25,5 +25,6 @@ #define CG2_MIN_DISTANCE_TO_MAP_LIMITS @CG2_MIN_DISTANCE_TO_MAP_LIMITS@ #define CG2_MIN_WINDOWS_WIDTH @CG2_MIN_WINDOWS_WIDTH@ #define CG2_GLAZING_THICKNESS @CG2_GLAZING_THICKNESS@ +#define CG2_ARGS_DEFAULT_STARDIS_FILES_BASENAME "@CG2_ARGS_DEFAULT_STARDIS_FILES_BASENAME@" #endif