Exemplo n.º 1
0
void PipelineManager::readPipeline(const std::string& filename)
{
    if (FileUtils::extension(filename) == ".xml")
    {
        PipelineReaderXML pipeReader(*this);
        return pipeReader.readPipeline(filename);
    }
    else if (FileUtils::extension(filename) == ".json")
    {
        PipelineReaderJSON pipeReader(*this);
        return pipeReader.readPipeline(filename);
    }
    else
    {
        Utils::closeFile(m_input);
        m_input = Utils::openFile(filename);
        readPipeline(*m_input);
    }
}
Exemplo n.º 2
0
void PipelineReaderJSON::readPipeline(const std::string& filename)
{
    m_inputJSONFile = filename;

    std::istream* input = Utils::openFile(filename);
    if (!input)
    {
        throw pdal_error("JSON pipeline: Unable to open stream for "
            "file \"" + filename + "\"");
    }

    try
    {
        readPipeline(*input);
    }
    catch (...)
    {
        Utils::closeFile(input);
        throw;
    }

    Utils::closeFile(input);
    m_inputJSONFile = "";
}
Exemplo n.º 3
0
void PipelineManager::readPipeline(const std::string& filename)
{
    if (FileUtils::extension(filename) == ".json")
    {
        PipelineReaderJSON pipeReader(*this);
        return pipeReader.readPipeline(filename);
    }
    else
    {
        Utils::closeFile(m_input);
        m_input = Utils::openFile(filename);
        if (!m_input)
            throw pdal_error("Can't open file '" + filename + "' as pipeline "
                "input.");
        try
        {
            readPipeline(*m_input);
        }
        catch (const pdal_error& err)
        {
            throw pdal_error(filename + ": " + err.what());
        }
    }
}