/* ---- 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 "lasheader.h" #include /* 1 Implementation of las components */ bool lasHeader::read(std::ifstream& file){ file.read(reinterpret_cast(&signature), 4); if( (std::string(signature,4)!="LASF")){ return false; } file.read(reinterpret_cast(&source_id), 2); file.read(reinterpret_cast(&global_Encoding),2); file.read(reinterpret_cast(&project_id1),4); file.read(reinterpret_cast(&project_id2),2); file.read(reinterpret_cast(&project_id3),2); file.read(reinterpret_cast(&project_id4),8); file.read(reinterpret_cast(&major_version),1); file.read(reinterpret_cast(&minor_version), 1); file.read(systemIdentifier, 32); file.read(generatingSoftware, 32); file.read(reinterpret_cast(&dayOfYear), 2); file.read(reinterpret_cast(&year), 2); file.read(reinterpret_cast(&header_size), 2); file.read(reinterpret_cast(&offset_to_point_data), 4); file.read(reinterpret_cast(&number_of_variable_records), 4); file.read(reinterpret_cast(&point_data_format), 1); file.read(reinterpret_cast(&point_data_length), 2); file.read(reinterpret_cast(&legacy_number_of_points), 4); file.read(reinterpret_cast( &legacy_number_of_points_by_return), 20); file.read(reinterpret_cast(&x_scale), 8); file.read(reinterpret_cast(&y_scale), 8); file.read(reinterpret_cast(&z_scale), 8); file.read(reinterpret_cast(&x_offset), 8); file.read(reinterpret_cast(&y_offset), 8); file.read(reinterpret_cast(&z_offset), 8); file.read(reinterpret_cast(&max_x), 8); file.read(reinterpret_cast(&min_x), 8); file.read(reinterpret_cast(&max_y), 8); file.read(reinterpret_cast(&min_y), 8); file.read(reinterpret_cast(&max_z), 8); file.read(reinterpret_cast(&min_z), 8); if(major_version==1 && minor_version < 4){ start_of_waveform_data_packet_record = 0; start_of_first_extended_vlr = 0; number_of_evlr = 0; number_of_point_records = 0; memset(reinterpret_cast(number_of_points_by_return),0,120); } else { file.read(reinterpret_cast( &start_of_waveform_data_packet_record), 8); file.read(reinterpret_cast(&start_of_first_extended_vlr), 8); file.read(reinterpret_cast(&number_of_evlr), 4); file.read(reinterpret_cast(&number_of_point_records), 8); file.read(reinterpret_cast(&number_of_points_by_return), 120); } return true; } std::ostream& lasHeader::print(std::ostream& out) const{ out << " ------------ LAS Header -----------------" << std::endl; out << "signature: " << std::string(signature,4) << std::endl; out << "source_id: " << source_id << std::endl; out << "global_Encoding: " << global_Encoding << std::endl; out << "project_id1: " << project_id1 << std::endl; out << "project_id2: " << project_id2 << std::endl; out << "project_id3: " << project_id3 << std::endl; for(int i=0;i<8;i++){ out << "project_id4["< 1 || minor_version >= 4){ out << "start_of_waveform_data_packet_record: " << start_of_waveform_data_packet_record << std::endl; out << "start_of_first_extended_vlr: " << start_of_first_extended_vlr << std::endl; out << "number_of_evlr: " << number_of_evlr << std::endl; out << "number_of_point_records: " << number_of_point_records << std::endl; for(int i=0;i<15;i++){ out << "number_of_points_by_return["<