Changeset 1573:6c8a83eaffdc
- Timestamp:
- 02/12/10 12:32:32 (6 months ago)
- Branch:
- default
- Files:
-
- 5 edited
-
include/liblas/detail/writer/header.hpp (modified) (2 diffs)
-
include/liblas/detail/writer/writer.hpp (modified) (3 diffs)
-
include/liblas/interfaces.hpp (modified) (1 diff)
-
src/detail/writer/writer.cpp (modified) (5 diffs)
-
src/laswriter.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
include/liblas/detail/writer/header.hpp
r1560 r1573 47 47 48 48 #include <liblas/lasheader.hpp> 49 #include <liblas/detail/writer/ writer.hpp>49 #include <liblas/detail/writer/base.hpp> 50 50 51 51 // std … … 61 61 62 62 Header(std::ostream& ofs, liblas::uint32_t& count, LASHeader const& header ); 63 64 LASHeaderGetHeader() const { return m_header; }63 64 const LASHeader& GetHeader() const { return m_header; } 65 65 void write(); 66 66 -
include/liblas/detail/writer/writer.hpp
r1561 r1573 44 44 45 45 #include <liblas/detail/fwd.hpp> 46 #include <liblas/interfaces.hpp> 46 47 #include <liblas/detail/writer/point.hpp> 48 #include <liblas/detail/writer/header.hpp> 47 49 48 #ifndef HAVE_GDAL49 typedef struct OGRCoordinateTransformationHS *OGRCoordinateTransformationH;50 typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH;51 #endif52 53 54 // std55 #include <iosfwd>56 50 57 51 namespace liblas { namespace detail { 58 52 59 class WriterImpl 53 class WriterImpl : public WriterI 60 54 { 61 55 public: … … 65 59 ~WriterImpl(); 66 60 LASVersion GetVersion() const; 67 void WriteHeader(LASHeader& header);61 LASHeader const& WriteHeader(LASHeader const& header); 68 62 void UpdateHeader(LASHeader const& header); 69 void WritePoint Record(LASPoint const& record, const LASHeader& header);63 void WritePoint(LASPoint const& record, const LASHeader& header); 70 64 71 65 std::ostream& GetStream() const; 72 66 73 void SetSRS(const LASSpatialReference& srs, const LASHeader& header);74 67 void SetInputSRS(const LASSpatialReference& srs); 75 68 void SetOutputSRS(const LASSpatialReference& srs, const LASHeader& header); … … 86 79 OGRSpatialReferenceH m_out_ref; 87 80 88 detail::writer::Point* m_point_writer; 81 writer::Point* m_point_writer; 82 writer::Header* m_header_writer; 89 83 90 84 private: -
include/liblas/interfaces.hpp
r1571 r1573 74 74 }; 75 75 76 class WriterI 77 { 78 public: 79 80 virtual LASHeader const& WriteHeader(const LASHeader& header) = 0; 81 virtual void UpdateHeader(const LASHeader& header) = 0; 82 virtual void WritePoint(const LASPoint& point, const LASHeader& header) = 0; 83 84 virtual void SetInputSRS(const LASSpatialReference& srs) = 0; 85 virtual void SetOutputSRS(const LASSpatialReference& srs, const LASHeader& header) = 0; 86 87 virtual ~WriterI() {}; 88 // virtual LASHeader const& ReadHeader() = 0; 89 // virtual LASPoint const& ReadNextPoint(const LASHeader& header) = 0; 90 // virtual LASPoint const& ReadPointAt(std::size_t n, const LASHeader& header) = 0; 91 // 92 // virtual void Reset(const LASHeader& header) = 0; 93 // virtual void SetInputSRS(const LASSpatialReference& srs) = 0; 94 // virtual void SetOutputSRS(const LASSpatialReference& srs, const LASHeader& header) = 0; 95 // 96 // virtual ~ReaderI() {}; 97 }; 76 98 } // namespace liblas 77 99 -
src/detail/writer/writer.cpp
r1560 r1573 57 57 58 58 WriterImpl::WriterImpl(std::ostream& ofs) : 59 m_ofs(ofs), m_transform(0), m_in_ref(0), m_out_ref(0), m_point_writer(0), m_pointCount(0) 60 { 61 } 62 63 64 void WriterImpl::WriteHeader(LASHeader& header) 65 { 66 detail::writer::Header hwriter(m_ofs,m_pointCount, header ); 67 hwriter.write(); 68 header = hwriter.GetHeader(); 69 59 m_ofs(ofs), 60 m_transform(0), 61 m_in_ref(0), 62 m_out_ref(0), 63 m_point_writer(0), 64 m_header_writer(0), 65 m_pointCount(0) 66 { 67 } 68 69 70 LASHeader const& WriterImpl::WriteHeader(LASHeader const& header) 71 { 72 m_header_writer = new detail::writer::Header(m_ofs,m_pointCount, header ); 73 m_header_writer->write(); 74 return m_header_writer->GetHeader(); 70 75 } 71 76 … … 82 87 } 83 88 84 void WriterImpl::WritePoint Record(LASPoint const& point, const LASHeader& header)89 void WriterImpl::WritePoint(LASPoint const& point, const LASHeader& header) 85 90 { 86 91 if (m_point_writer == 0) { … … 97 102 WriterImpl::~WriterImpl() 98 103 { 99 if (m_point_writer != 0)100 delete m_point_writer;101 104 102 105 #ifdef HAVE_GDAL … … 111 114 } 112 115 #endif 116 117 if (m_point_writer != 0) 118 delete m_point_writer; 119 120 if (m_header_writer != 0) 121 delete m_header_writer; 122 113 123 } 114 124 … … 132 142 } 133 143 134 void WriterImpl::SetSRS(const LASSpatialReference& srs , const LASHeader& header)135 {136 SetOutputSRS(srs, header);137 }138 144 139 145 void WriterImpl::SetInputSRS(const LASSpatialReference& srs ) -
src/laswriter.cpp
r1560 r1573 79 79 } 80 80 81 m_pimpl->WritePoint Record(point, m_header);81 m_pimpl->WritePoint(point, m_header); 82 82 83 83 return true; … … 91 91 void LASWriter::WriteHeader(LASHeader& header) 92 92 { 93 m_pimpl->WriteHeader(header); 94 m_header = header; 93 // The writer may update our header as part of its 94 // writing process (change VLRs for SRS's, for instance). 95 m_header = m_pimpl->WriteHeader(header); 95 96 } 96 97
Note: See TracChangeset
for help on using the changeset viewer.
