void FauxReader::processOptions(const Options& options) { BOX3D bounds = options.getValueOrDefault<BOX3D>("bounds", BOX3D(0, 0, 0, 1, 1, 1)); m_minX = bounds.minx; m_maxX = bounds.maxx; m_minY = bounds.miny; m_maxY = bounds.maxy; m_minZ = bounds.minz; m_maxZ = bounds.maxz; // For backward compatibility. if (m_count == 0) m_count = options.getValueOrThrow<point_count_t>("num_points"); m_mean_x = options.getValueOrDefault<double>("mean_x",0.0); m_mean_y = options.getValueOrDefault<double>("mean_y",0.0); m_mean_z = options.getValueOrDefault<double>("mean_z",0.0); m_stdev_x = options.getValueOrDefault<double>("stdev_x",1.0); m_stdev_y = options.getValueOrDefault<double>("stdev_y",1.0); m_stdev_z = options.getValueOrDefault<double>("stdev_z",1.0); m_mode = string2mode(options.getValueOrThrow<std::string>("mode")); m_numReturns = options.getValueOrDefault("number_of_returns", 0); if (m_numReturns > 10) throw pdal_error("faux: number_of_returns option must be 10 or less."); }
void Crop::processOptions(const Options& options) { m_bounds = options.getValueOrDefault<BOX3D>("bounds", BOX3D()); m_cropOutside = options.getValueOrDefault<bool>("outside", false); m_poly = options.getValueOrDefault<std::string>("polygon", ""); #if !defined(PDAL_HAVE_GEOS) if (!m_poly.empty()) throw pdal_error("Polygon cropping not supported unless built with GEOS"); #endif }
Options Crop::getDefaultOptions() { Options options; Option bounds("bounds",BOX3D(),"bounds to crop to"); Option polygon("polygon", std::string(""), "WKT POLYGON() string to use to filter points"); Option inside("inside", true, "keep points that are inside or outside " "the given polygon"); options.add(inside); options.add(polygon); options.add(bounds); return options; }
void RialtoReader::processOptions(const Options& options) { log()->get(LogLevel::Debug) << "RialtoReader::processOptions()" << std::endl; if (!m_gpkg) { // you can't change the filename or dataset name once we've opened the DB m_filename = options.getValueOrThrow<std::string>("filename"); m_dataset = options.getValueOrDefault<std::string>("dataset", ""); } if (m_dataset == "") { m_dataset = boost::filesystem::path(m_filename).stem().string() + "_tiles"; } m_queryBox = options.getValueOrDefault<BOX3D>("bounds", BOX3D()); m_queryLevel = options.getValueOrDefault<uint32_t>("level", 0xffff); log()->get(LogLevel::Debug) << "process options: bounds=" << m_queryBox << std::endl; }
void FauxReader::processOptions(const Options& options) { BOX3D bounds; try { bounds = options.getValueOrDefault<BOX3D>("bounds", BOX3D(0, 0, 0, 1, 1, 1)); } catch (Option::cant_convert) { std::string s = options.getValueOrDefault<std::string>("bounds"); std::ostringstream oss; oss << getName() << ": Invalid 'bounds' specification: '" << s << "'. Format: '([xmin,xmax],[ymin,ymax],[zmin,zmax])'."; throw pdal_error(oss.str()); } m_minX = bounds.minx; m_maxX = bounds.maxx; m_minY = bounds.miny; m_maxY = bounds.maxy; m_minZ = bounds.minz; m_maxZ = bounds.maxz; // For backward compatibility. if (m_count == 0) m_count = options.getValueOrThrow<point_count_t>("num_points"); if (m_count == 0) { std::ostringstream oss; oss << getName() << ": Option 'count' must be non-zero."; throw pdal_error(oss.str()); } m_mean_x = options.getValueOrDefault<double>("mean_x",0.0); m_mean_y = options.getValueOrDefault<double>("mean_y",0.0); m_mean_z = options.getValueOrDefault<double>("mean_z",0.0); m_stdev_x = options.getValueOrDefault<double>("stdev_x",1.0); m_stdev_y = options.getValueOrDefault<double>("stdev_y",1.0); m_stdev_z = options.getValueOrDefault<double>("stdev_z",1.0); m_mode = string2mode(options.getValueOrThrow<std::string>("mode")); m_numReturns = options.getValueOrDefault("number_of_returns", 0); if (m_numReturns > 10) { std::ostringstream oss; oss << getName() << ": Option 'number_of_returns' must be in the range " "[0,10]."; throw pdal_error(oss.str()); } if (m_count > 1) { m_delX = (m_maxX - m_minX) / (m_count - 1); m_delY = (m_maxY - m_minY) / (m_count - 1); m_delZ = (m_maxZ - m_minZ) / (m_count - 1); } else { m_delX = 0; m_delY = 0; m_delZ = 0; } }
BOX3D toBox(const greyhound::Bounds& bounds) { return BOX3D( bounds.min().x, bounds.min().y, bounds.min().z, bounds.max().x, bounds.max().y, bounds.max().z); }