Mateusz-

I made the changes and observed no differences. The debugger still crashes
in the constructor for the LASReader and LASWriter, and the release build
runs without triggering any of the exceptions.

-Thanks

On Wed, Aug 26, 2009 at 5:47 PM, Mateusz Loskot <[email protected]> wrote:

Gary Robinson wrote:
> I attached my cpp file. I was trying first to write a file with a single
> point, then switch that line at the top that is commented out and
recompile
> to read the file back in.

Greg,

Replace your version of the program with my version included below
and run as you did with yours. Observe if anything has changed.


/// mloskot version ////////////////////////////////////////////
#include <liblas/laspoint.hpp>
#include <liblas/lasreader.hpp>
#include <liblas/laswriter.hpp>
#include <exception>
#include <fstream>  // std::ifstream
#include <iostream> // std::cout

using namespace liblas;
int main()
{
   // First run with false, next run with true
   bool bRead = false;
   try
   {
       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);
       }

   }
   catch (std::exception const& e)
   {
       std::cerr << e.what() << std::endl;
   }
   catch (...)
   {
       std::cerr << "unknown error" << std::endl;
   }

   return 0;
}
/// end of mloskot version /////////////////////////////////////////


Best regards,
--
Mateusz Loskot,  <http://mateusz.loskot.net> http://mateusz.loskot.net
Charter Member of OSGeo,  <http://osgeo.org> http://osgeo.org

 

 

Gary Robinson

Software Engineer, Intelisum Inc.

801-924-0660 ext 127

[email protected]

 

Privileged/Confidential Information may be contained in this message.  If
you are not the addressee indicated in this message (or responsible for
delivery of the message to such person), you may not copy or deliver this
message to anyone. In such case, you should destroy this message and kindly
notify the sender by reply email. Please advise immediately if you or your
employer do not consent to Internet email for messages of this kind.

 

<<image001.jpg>>

_______________________________________________
Liblas-devel mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/liblas-devel

Reply via email to