1
/******************************************************************************
4
* Project: libLAS - http://liblas.org - A BSD library for LAS format data.
5
* Purpose: LAS writer class
6
* Author: Mateusz Loskot, mateusz@loskot.net
8
******************************************************************************
9
* Copyright (c) 2008, Mateusz Loskot
11
* All rights reserved.
13
* Redistribution and use in source and binary forms, with or without
14
* modification, are permitted provided that the following
17
* * Redistributions of source code must retain the above copyright
18
* notice, this list of conditions and the following disclaimer.
19
* * Redistributions in binary form must reproduce the above copyright
20
* notice, this list of conditions and the following disclaimer in
21
* the documentation and/or other materials provided
22
* with the distribution.
23
* * Neither the name of the Martin Isenburg or Iowa Department
24
* of Natural Resources nor the names of its contributors may be
25
* used to endorse or promote products derived from this software
26
* without specific prior written permission.
28
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
31
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
32
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
33
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
35
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
36
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
38
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
40
****************************************************************************/
42
#include <liblas/version.hpp>
43
#include <liblas/writer.hpp>
44
#include <liblas/detail/writer/writer.hpp>
45
#include <liblas/detail/writer/zipwriter.hpp>
46
#include <liblas/factory.hpp>
52
#include <cstring> // std::memset
58
Writer::Writer(std::ostream& ofs, Header const& header) :
60
m_pimpl(WriterIPtr( WriterFactory::CreateWithStream(ofs, header) ) )
62
m_pimpl(WriterIPtr(new detail::WriterImpl(ofs)))
66
m_pimpl->SetHeader(header);
67
m_pimpl->WriteHeader();
71
Writer::Writer(Writer const& other)
72
: m_pimpl(other.m_pimpl)
76
Writer& Writer::operator=(Writer const& rhs)
80
m_pimpl = rhs.m_pimpl;
85
Writer::Writer(WriterIPtr ptr) :
96
Header const& Writer::GetHeader() const
98
return m_pimpl->GetHeader();
101
void Writer::SetHeader(Header const& header)
103
return m_pimpl->SetHeader(header);
106
bool Writer::WritePoint(Point const& point)
108
m_pimpl->WritePoint(point);
112
void Writer::WriteHeader()
114
// The writer may update our header as part of its
115
// writing process (change VLRs for SRS's, for instance).
116
m_pimpl->WriteHeader();
119
void Writer::SetTransforms(std::vector<liblas::TransformPtr> const& transforms)
121
m_pimpl->SetTransforms(transforms);
123
std::vector<liblas::FilterPtr> Writer::GetFilters() const
125
return m_pimpl->GetFilters();
128
void Writer::SetFilters(std::vector<liblas::FilterPtr> const& filters)
130
m_pimpl->SetFilters(filters);
132
std::vector<liblas::TransformPtr> Writer::GetTransforms() const
134
return m_pimpl->GetTransforms();
136
} // namespace liblas