Exemplo n.º 1
0
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.");
}
Exemplo n.º 2
0
Reader::Reader(const Options& options)
    : pdal::Reader(options)
    , m_bounds(options.getValueOrThrow<Bounds<double> >("bounds"))
    , m_numPoints(options.getValueOrThrow<boost::uint64_t>("num_points"))
    , m_mode(string2mode(options.getValueOrThrow<std::string>("mode")))
{
    m_schema = Schema(getDefaultDimensions());
}
Exemplo n.º 3
0
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;
    }
}