From f21c1e3a5128c54a9fc9c9421e3f93794ba4922c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C4=81ris=20Narti=C5=A1s?= Date: Thu, 28 Nov 2024 15:26:11 +0200 Subject: [PATCH] r.in.pdal: do not pass unused parameter to functions if "nosrs" is not available --- raster/r.in.pdal/info.cpp | 17 +++++++++++++++++ raster/r.in.pdal/info.h | 7 +++++++ raster/r.in.pdal/main.cpp | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/raster/r.in.pdal/info.cpp b/raster/r.in.pdal/info.cpp index 42051e19c38..da6e0e70742 100644 --- a/raster/r.in.pdal/info.cpp +++ b/raster/r.in.pdal/info.cpp @@ -12,9 +12,14 @@ #include "info.h" #include +#ifdef PDAL_USE_NOSRS void get_extent(struct StringList *infiles, double *min_x, double *max_x, double *min_y, double *max_y, double *min_z, double *max_z, bool nosrs) +#else +void get_extent(struct StringList *infiles, double *min_x, double *max_x, + double *min_y, double *max_y, double *min_z, double *max_z) +#endif { pdal::StageFactory factory; bool first = 1; @@ -75,16 +80,28 @@ void get_extent(struct StringList *infiles, double *min_x, double *max_x, } } +#ifdef PDAL_USE_NOSRS void print_extent(struct StringList *infiles, bool nosrs) +#else +void print_extent(struct StringList *infiles) +#endif { double min_x, max_x, min_y, max_y, min_z, max_z; +#ifdef PDAL_USE_NOSRS get_extent(infiles, &min_x, &max_x, &min_y, &max_y, &min_z, &max_z, nosrs); +#else + get_extent(infiles, &min_x, &max_x, &min_y, &max_y, &min_z, &max_z); +#endif fprintf(stdout, "n=%f s=%f e=%f w=%f b=%f t=%f\n", max_y, min_y, max_x, min_x, min_z, max_z); } +#ifdef PDAL_USE_NOSRS void print_lasinfo(struct StringList *infiles, bool nosrs) +#else +void print_lasinfo(struct StringList *infiles) +#endif { pdal::StageFactory factory; pdal::MetadataNode meta_node; diff --git a/raster/r.in.pdal/info.h b/raster/r.in.pdal/info.h index 88d7be66849..387efd21ef0 100644 --- a/raster/r.in.pdal/info.h +++ b/raster/r.in.pdal/info.h @@ -40,9 +40,16 @@ extern "C" { #include "string_list.h" } +#ifdef PDAL_USE_NOSRS void get_extent(struct StringList *, double *, double *, double *, double *, double *, double *, bool); void print_extent(struct StringList *, bool); void print_lasinfo(struct StringList *, bool); +#else +void get_extent(struct StringList *, double *, double *, double *, double *, + double *, double *); +void print_extent(struct StringList *); +void print_lasinfo(struct StringList *); +#endif #endif // INFO_H diff --git a/raster/r.in.pdal/main.cpp b/raster/r.in.pdal/main.cpp index 46a98d390eb..fe17e80cb08 100644 --- a/raster/r.in.pdal/main.cpp +++ b/raster/r.in.pdal/main.cpp @@ -446,12 +446,20 @@ int main(int argc, char *argv[]) /* If we print extent, there is no need to validate rest of the input */ if (print_extent_flag->answer) { +#ifdef PDAL_USE_NOSRS print_extent(&infiles, over_flag->answer); +#else + print_extent(&infiles); +#endif exit(EXIT_SUCCESS); } if (print_info_flag->answer) { +#ifdef PDAL_USE_NOSRS print_lasinfo(&infiles, over_flag->answer); +#else + print_lasinfo(&infiles); +#endif exit(EXIT_SUCCESS); } @@ -507,8 +515,12 @@ int main(int argc, char *argv[]) if (extents_flag->answer) { double min_x, max_x, min_y, max_y, min_z, max_z; +#ifdef PDAL_USE_NOSRS get_extent(&infiles, &min_x, &max_x, &min_y, &max_y, &min_z, &max_z, over_flag->answer); +#else + get_extent(&infiles, &min_x, &max_x, &min_y, &max_y, &min_z, &max_z); +#endif region.east = xmax = max_x; region.west = xmin = min_x;