~ubuntu-branches/ubuntu/wily/liblas/wily

« back to all changes in this revision

Viewing changes to include/liblas/lasreader.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Francesco Paolo Lovergine
  • Date: 2009-10-02 12:36:21 UTC
  • Revision ID: james.westby@ubuntu.com-20091002123621-xrf0hhzxbwloga43
Tags: upstream-1.2.1
ImportĀ upstreamĀ versionĀ 1.2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
* $Id$
 
3
*
 
4
* Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
 
5
* Purpose:  LAS reader class 
 
6
* Author:   Mateusz Loskot, mateusz@loskot.net
 
7
*
 
8
******************************************************************************
 
9
* Copyright (c) 2008, Mateusz Loskot
 
10
* Copyright (c) 2008, Phil Vachon
 
11
*
 
12
* All rights reserved.
 
13
 
14
* Redistribution and use in source and binary forms, with or without 
 
15
* modification, are permitted provided that the following 
 
16
* conditions are met:
 
17
 
18
*     * Redistributions of source code must retain the above copyright 
 
19
*       notice, this list of conditions and the following disclaimer.
 
20
*     * Redistributions in binary form must reproduce the above copyright 
 
21
*       notice, this list of conditions and the following disclaimer in 
 
22
*       the documentation and/or other materials provided 
 
23
*       with the distribution.
 
24
*     * Neither the name of the Martin Isenburg or Iowa Department 
 
25
*       of Natural Resources nor the names of its contributors may be 
 
26
*       used to endorse or promote products derived from this software 
 
27
*       without specific prior written permission.
 
28
 
29
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
 
30
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
 
31
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
 
32
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 
 
33
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 
 
34
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
 
35
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 
 
36
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 
37
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
 
38
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
 
39
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
 
40
* OF SUCH DAMAGE.
 
41
****************************************************************************/
 
42
 
 
43
#ifndef LIBLAS_LASREADER_HPP_INCLUDED
 
44
#define LIBLAS_LASREADER_HPP_INCLUDED
 
45
 
 
46
#include <liblas/lasheader.hpp>
 
47
#include <liblas/laspoint.hpp>
 
48
#include <liblas/lasvariablerecord.hpp>
 
49
#include <liblas/lasspatialreference.hpp>
 
50
#include <liblas/detail/fwd.hpp>
 
51
// std
 
52
#include <iosfwd>
 
53
#include <string>
 
54
#include <memory>
 
55
#include <cstdlib> // std::size_t
 
56
 
 
57
namespace liblas {
 
58
 
 
59
/// \todo To be documented.
 
60
class LASReader
 
61
{
 
62
public:
 
63
 
 
64
    LASReader(std::istream& ifs);
 
65
    ~LASReader();
 
66
 
 
67
    std::size_t GetVersion() const;
 
68
    LASHeader const& GetHeader() const;
 
69
    LASPoint const& GetPoint() const;
 
70
    std::vector<LASVariableRecord> const& GetVLRs() const;
 
71
    /// Allow fetching of the stream
 
72
    std::istream& GetStream() const;
 
73
    bool IsEOF() const;
 
74
 
 
75
    bool ReadNextPoint();
 
76
    bool ReadPointAt(std::size_t n);
 
77
    bool ReadVLR();
 
78
    void Reset();
 
79
 
 
80
    /// Reproject data as they are written if the LASWriter's reference is
 
81
    /// different than the LASHeader's    
 
82
    bool SetSRS(const LASSpatialReference& ref);
 
83
 
 
84
    /// The operator is not const because it updates file stream position.
 
85
    LASPoint const& operator[](std::size_t n);
 
86
 
 
87
private:
 
88
 
 
89
    // Blocked copying operations, declared but not defined.
 
90
    LASReader(LASReader const& other);
 
91
    LASReader& operator=(LASReader const& rhs);
 
92
 
 
93
    void Init(); // throws on error
 
94
 
 
95
    const std::auto_ptr<detail::Reader> m_pimpl;
 
96
    LASHeader m_header;
 
97
    LASPoint m_point;
 
98
    std::vector<LASVariableRecord> m_vlrs;
 
99
};
 
100
 
 
101
} // namespace liblas
 
102
 
 
103
#endif // ndef LIBLAS_LASREADER_HPP_INCLUDED