/* ---- This file is part of SECONDO. Copyright (C) 2018, University in Hagen, Department of Computer Science, Database Systems for New Applications. SECONDO is free software{} you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation{} either version 2 of the License, or (at your option) any later version. SECONDO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY{} without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with SECONDO{} if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ---- */ #include "vlr.h" #include vlr* vlr::read(std::ifstream& in, bool extended){ vlr* r1 = new vlr(); in.read(reinterpret_cast(&r1->reserved),2); in.read(r1->userId,16); in.read(reinterpret_cast(&r1->recordId),2); if(extended){ in.read(reinterpret_cast(&r1->recordLength),8); } else { uint16_t length; in.read(reinterpret_cast(&length),2); r1->recordLength = length; } in.read(r1->description,32); vlr* r2=0; // check all known VLRs if(!r2) r2 = LASF_Projection_2111::create(*r1,in); if(!r2) r2 = LASF_Projection_2112::create(*r1,in); if(!r2) r2 = LASF_Projection_34735::create(*r1,in); if(!r2) r2 = LASF_Projection_34736::create(*r1,in); if(!r2) r2 = LASF_Projection_34737::create(*r1,in); if(!r2) { // jump over data record in.seekg(r1->recordLength,std::ios::cur); //std::cout << "found unknown vlr" << std::endl; //r1->print(std::cout) << std::endl; } delete r1; if(in.good()){ return r2; } else { delete r2; return 0; } } bool LASF_Projection_34735::read(std::ifstream& in){ size_t r = 0; in.read(reinterpret_cast(&wKeyDirectoryVersion),2); r += 2; in.read(reinterpret_cast(&wKeyRevision),2); r += 2; in.read(reinterpret_cast(&wMinorRevision),2); r += 2; in.read(reinterpret_cast(&wNumberOfKeys),2); r += 2; for(size_t i=0;i= r); size_t ignore = recordLength - r; if(ignore > 0 ){ in.seekg(ignore,std::ios::cur); } return in.good(); }