Skip to content

Commit

Permalink
Disable --format, --exe-python, --qtree-criteria
Browse files Browse the repository at this point in the history
Because they are not used in the 3D Tiles export and we only support 3D Tiles in the current version.
  • Loading branch information
balazsdukai committed Mar 16, 2023
1 parent eadce9e commit 3ae353a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 49 deletions.
88 changes: 44 additions & 44 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ pub struct Cli {
/// Directory for the output.
#[arg(short, long)]
pub output: PathBuf,
/// Output format.
#[arg(long, value_enum)]
pub format: crate::Formats,
/// Create implicit tiling when the output format is 3D Tiles (https://docs.ogc.org/cs/22-025r4/22-025r4.html#toc31).
/// By default, explicit tiling is created for the 3D Tiles output.
#[arg(long = "3dtiles-implicit")]
pub cesium3dtiles_implicit: bool,
// /// Output format.
// #[arg(long, value_enum)]
// pub format: crate::Formats,
/// The CityObject type to use for the 3D Tiles
/// (https://www.cityjson.org/specs/1.1.3/#the-different-city-objects).
/// You can specify it multiple times.
Expand All @@ -52,6 +48,39 @@ pub struct Cli {
/// 3D Tiles (https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata#class).
#[arg(long = "3dtiles-metadata-class")]
pub cesium3dtiles_metadata_class: Option<String>,
/// Create implicit tiling when the output format is 3D Tiles (https://docs.ogc.org/cs/22-025r4/22-025r4.html#toc31).
/// By default, explicit tiling is created for the 3D Tiles output.
#[arg(long = "3dtiles-implicit")]
pub cesium3dtiles_implicit: bool,
/// Set the geometric error on the parent nodes of leafs. This controls at what
/// camera distance leaf nodes become visible, recommended values in between
/// 10 and 15. Higher values make content visible earlier when zooming in.
#[arg(long, short = 'e', default_value = "12")]
pub geometric_error_above_leaf: Option<f64>,
/// Set the 2D cell size for the grid that is used for constructing the quadtree.
#[arg(long, default_value = "250")]
pub grid_cellsize: Option<u16>,
/// Limit the minimum z coordinate for the bounding box that is computed from the
/// features. Useful if the features contain errors with extremely small z
/// coordinates.
#[arg(long)]
pub grid_minz: Option<i32>,
/// Limit the maximum z coordinate for the bounding box that is computed from the
/// features. Useful if the features contain errors with extremely large z
/// coordinates.
#[arg(long)]
pub grid_maxz: Option<i32>,
/// Export the grid and the feature centroids in to .tsv files in the working
/// directory. Used for debugging.
#[arg(long)]
pub grid_export: bool,
/// The capacity of a leaf of the quadtree. If a quadrant has less than or equal
/// the capacity, its subtiles are merged.
#[arg(long, default_value = "42000")]
pub qtree_capacity: Option<usize>,
/// Path to the geoflow executable for clipping and exporting the gltf files.
#[arg(long, value_parser = existing_path)]
pub exe_geof: Option<PathBuf>,
/// LoD to use in output for Building features
#[arg(long)]
pub lod_building: Option<String>,
Expand Down Expand Up @@ -172,47 +201,18 @@ pub struct Cli {
/// Color for GenericCityObject features specified as a hex rgb-color value, eg. #FF0000 is red.
#[arg(long, value_parser = hex_color)]
pub color_generic_city_object: Option<String>,
/// Export the grid and the feature centroids in to .tsv files in the working
/// directory. Used for debugging.
#[arg(long)]
pub grid_export: bool,
/// Set the geometric error on the parent nodes of leafs. This controls at what
/// camera distance leaf nodes become visible, recommended values in between
/// 10 and 15. Higher values make content visible earlier when zooming in.
#[arg(long, short = 'e', default_value = "12")]
pub geometric_error_above_leaf: Option<f64>,
/// Set the cell size for the grid that is used for constructing the quadtree.
#[arg(long, default_value = "250")]
pub grid_cellsize: Option<u16>,
/// Limit the minimum z coordinate for the bounding box that is computed from the
/// features. Useful if the features contain errors with extremely small z
/// coordinates.
#[arg(long)]
pub grid_minz: Option<i32>,
/// Limit the maximum z coordinate for the bounding box that is computed from the
/// features. Useful if the features contain errors with extremely large z
/// coordinates.
#[arg(long)]
pub grid_maxz: Option<i32>,
/// The criteria to check for the quadtree leaf capacity.
#[arg(long, value_enum, default_value = "vertices")]
pub qtree_criteria: Option<crate::spatial_structs::QuadTreeCriteria>,
/// Path to the geoflow executable for clipping and exporting the gltf files.
#[arg(long, value_parser = existing_path)]
pub exe_geof: Option<PathBuf>,
/// Path to the python interpreter (>=3.8) to use for generating CityJSON tiles.
/// The interpreter must have a recent cjio (https://github.com/cityjson/cjio)
/// installed.
#[arg(long, value_parser = existing_path)]
pub exe_python: Option<PathBuf>,
/// The capacity of a leaf of the quadtree. If a quadrant has less than or equal
/// the capacity, its subtiles are merged.
#[arg(long, default_value = "42000")]
pub qtree_capacity: Option<usize>,
// The number of levels to export as content from the quadtree.
// Counted from the leaves.
// #[arg(long, default_value = "0")]
// pub qtree_export_levels: Option<u16>,
// /// The criteria to check for the quadtree leaf capacity.
// #[arg(long, value_enum, default_value = "vertices")]
// pub qtree_criteria: Option<crate::spatial_structs::QuadTreeCriteria>,
// /// Path to the python interpreter (>=3.8) to use for generating CityJSON tiles.
// /// The interpreter must have a recent cjio (https://github.com/cityjson/cjio)
// /// installed.
// #[arg(long, value_parser = existing_path)]
// pub exe_python: Option<PathBuf>,
}

fn existing_canonical_path(s: &str) -> Result<PathBuf, String> {
Expand Down
12 changes: 7 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// Since we have a default value, we can safely unwrap.
let grid_cellsize = cli.grid_cellsize.unwrap();
let geometric_error_above_leaf = cli.geometric_error_above_leaf.unwrap();
let subprocess_config = match cli.format {
let format = crate::Formats::_3DTiles; // override --format
let subprocess_config = match format {
Formats::_3DTiles => {
let mut exe = PathBuf::new();
if let Some(exe_g) = cli.exe_geof {
Expand Down Expand Up @@ -118,15 +119,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
debug!("{:?}", &subprocess_config);
// Since we have a default value, it is safe to unwrap
// let qtree_capacity = 0; // override cli.qtree_capacity
let quadtree_capacity = match &cli.qtree_criteria.unwrap() {
let qtree_criteria = spatial_structs::QuadTreeCriteria::Vertices; // override --qtree-criteria
let quadtree_capacity = match qtree_criteria {
spatial_structs::QuadTreeCriteria::Objects => {
spatial_structs::QuadTreeCapacity::Objects(cli.qtree_capacity.unwrap())
}
spatial_structs::QuadTreeCriteria::Vertices => {
spatial_structs::QuadTreeCapacity::Vertices(cli.qtree_capacity.unwrap())
}
};
let metadata_class: String = match cli.format {
let metadata_class: String = match format {
Formats::_3DTiles => {
if cli.cesium3dtiles_metadata_class.is_none() {
panic!("metadata_class must be set for writing 3D Tiles")
Expand Down Expand Up @@ -312,7 +314,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
.arg(&subprocess_config.script)
.arg(format!(
"--output_format={}",
&cli.format.to_string().to_lowercase()
&format.to_string().to_lowercase()
))
.arg(format!("--output_file={}", &output_file.to_str().unwrap()))
.arg(format!(
Expand Down Expand Up @@ -566,7 +568,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
));
}

if cli.format == Formats::_3DTiles {
if format == Formats::_3DTiles {
// geof specific args
if let Some(ref cotypes) = world.cityobject_types {
if cotypes.contains(&parser::CityObjectType::Building)
Expand Down

0 comments on commit 3ae353a

Please sign in to comment.