Skip to content

Commit

Permalink
r.in.pdal: do not pass unused parameter to functions if "nosrs" is
Browse files Browse the repository at this point in the history
not available
  • Loading branch information
marisn committed Nov 28, 2024
1 parent 7908c0e commit f21c1e3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
17 changes: 17 additions & 0 deletions raster/r.in.pdal/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
#include "info.h"
#include <cmath>

#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;
Expand Down Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions raster/r.in.pdal/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions raster/r.in.pdal/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f21c1e3

Please sign in to comment.