Beispiel #1
0
 void OSMFile::read(T& handler) {
     Osmium::Input::Base<T>* input = m_encoding->is_pbf()
                                     ? static_cast<Osmium::Input::Base<T>*>(new Osmium::Input::PBF<T>(*this, handler))
                                     : static_cast<Osmium::Input::Base<T>*>(new Osmium::Input::XML<T>(*this, handler));
     input->parse();
     delete input;
 }
Beispiel #2
0
        inline void read(const Osmium::OSMFile& file, T& handler) {
            Osmium::Input::Base<T>* input = NULL;

            if (file.encoding()->is_pbf()) {
#ifdef OSMIUM_WITH_PBF_INPUT
                input = static_cast<Osmium::Input::Base<T>*>(new Osmium::Input::PBF<T>(file, handler));
#else
                throw Osmium::OSMFile::FileEncodingNotSupported();
#endif // OSMIUM_WITH_PBF_INPUT
            } else {
#ifdef OSMIUM_WITH_XML_INPUT
                input = static_cast<Osmium::Input::Base<T>*>(new Osmium::Input::XML<T>(file, handler));
#else
                throw Osmium::OSMFile::FileEncodingNotSupported();
#endif // OSMIUM_WITH_XML_INPUT
            }

            input->parse();
            delete input;
        }