[Liblas-devel] (no subject)

Gary Robinson grobinson at intelisum.com
Wed Aug 26 11:40:32 EDT 2009


Skipped content of type multipart/related-------------- next part --------------
// TestLAS.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <liblas/laspoint.hpp>
#include <liblas/lasreader.hpp>
#include <liblas/laswriter.hpp>

#include <fstream>  // std::ifstream
#include <iostream> // std::cout

using namespace liblas;

int _tmain(int argc, _TCHAR* argv[])
{
	//bool bRead = true;
	bool bRead = false;
	
	if(bRead)
	{
		std::ifstream ifs;
		ifs.open("test.las", std::ios::in | std::ios::binary);
		
		liblas::LASReader reader(ifs);
		liblas::LASHeader const& header = reader.GetHeader();

		std::cout << "Signature: " << header.GetFileSignature() << '\n';
		std::cout << "Points count: " << header.GetPointRecordsCount() << '\n';
		
		ifs.close();
	}
	else
	{
		std::ofstream ofs;
		ofs.open("test.las", std::ios::out | std::ios::binary);

		liblas::LASHeader header;
		header.SetDataFormatId(LASHeader::ePointFormat1);

		liblas::LASWriter writer(ofs, header);

		liblas::LASPoint point;
		point.SetCoordinates(10,20,30);
		writer.WritePoint(point);		
	}

	return 0;
}



More information about the Liblas-devel mailing list