~ubuntu-branches/ubuntu/trusty/liblas/trusty-proposed

« back to all changes in this revision

Viewing changes to include/liblas/lasspatialreference.hpp

  • Committer: Package Import Robot
  • Author(s): Francesco Paolo Lovergine
  • Date: 2014-01-05 17:00:29 UTC
  • mfrom: (7.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140105170029-ddtp0j63x5jvck2u
Tags: 1.7.0+dfsg-2
Fixed missing linking of system boost component.
(closes: #733282)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/******************************************************************************
2
 
 * $Id: lasspatialreference.hpp 1091 2009-03-10 20:17:35Z hobu $
3
 
 *
4
 
 * Project:  libLAS - http://liblas.org - A BSD library for LAS format data.
5
 
 * Purpose:  LAS Spatial Reference class 
6
 
 * Author:   Howard Butler, hobu.inc@gmail.com
7
 
 *
8
 
 ******************************************************************************
9
 
 * Copyright (c) 2009, Howard Butler
10
 
 *
11
 
 * All rights reserved.
12
 
 * 
13
 
 * Redistribution and use in source and binary forms, with or without 
14
 
 * modification, are permitted provided that the following 
15
 
 * conditions are met:
16
 
 * 
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.
27
 
 * 
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 
39
 
 * OF SUCH DAMAGE.
40
 
 ****************************************************************************/
41
 
 
42
 
#ifndef LIBLAS_LASSPATIALREFERENCE_HPP_INCLUDED
43
 
#define LIBLAS_LASSPATIALREFERENCE_HPP_INCLUDED
44
 
 
45
 
#include <liblas/lasvariablerecord.hpp>
46
 
#include <liblas/cstdint.hpp>
47
 
#include <liblas/detail/fwd.hpp>
48
 
#include <liblas/detail/utility.hpp>
49
 
#include <liblas/exception.hpp>
50
 
#include <liblas/capi/las_config.h>
51
 
 
52
 
// GDAL OSR
53
 
#ifdef HAVE_GDAL
54
 
#include "ogr_srs_api.h"
55
 
#include "cpl_port.h"
56
 
#include "cpl_serv.h"
57
 
#include "geo_tiffp.h"
58
 
#define CPL_ERROR_H_INCLUDED
59
 
 
60
 
#include "geo_normalize.h"
61
 
#include "geovalues.h"
62
 
#include "ogr_spatialref.h"
63
 
#include "gdal.h"
64
 
#include "xtiffio.h"
65
 
#include "cpl_multiproc.h"
66
 
 
67
 
#endif
68
 
 
69
 
// GeoTIFF
70
 
#ifdef HAVE_LIBGEOTIFF
71
 
#include "geotiff.h"
72
 
#include "geo_simpletags.h"
73
 
#include "geo_normalize.h"
74
 
#include "geo_simpletags.h"
75
 
#include "geovalues.h"
76
 
#endif // HAVE_LIBGEOTIFF
77
 
 
78
 
// std
79
 
#include <stdexcept> // std::out_of_range
80
 
#include <cstdlib> // std::size_t
81
 
#include <string>
82
 
 
83
 
// Fake out the compiler if we don't have libgeotiff
84
 
#ifndef HAVE_LIBGEOTIFF
85
 
typedef struct GTIFS * GTIF;
86
 
typedef struct ST_TIFFS * ST_TIFF;
87
 
#endif
88
 
 
89
 
namespace liblas {
90
 
 
91
 
/// Spatial Reference System container for libLAS
92
 
class LASSpatialReference
93
 
{
94
 
public:
95
 
 
96
 
    /// Default constructor.
97
 
    LASSpatialReference();
98
 
 
99
 
    /// Destructor.
100
 
    /// If libgeotiff is enabled, deallocates libtiff and libgeotiff objects used internally.
101
 
    ~LASSpatialReference();
102
 
 
103
 
    /// Constructor creating LASSpatialReference instance from given Variable-Length Record.
104
 
    LASSpatialReference(const std::vector<LASVariableRecord>& vlrs);
105
 
 
106
 
    /// Copy constryctor.
107
 
    LASSpatialReference(LASSpatialReference const& other);
108
 
 
109
 
    /// Assignment operator.
110
 
    LASSpatialReference& operator=(LASSpatialReference const& rhs);
111
 
    
112
 
    /// Returns a pointer to the internal GTIF*.  Only available if 
113
 
    /// you have libgeotiff linked in.
114
 
    const GTIF* GetGTIF();
115
 
    
116
 
    void SetGTIF(const GTIF* gtiff, const ST_TIFF* tiff);
117
 
 
118
 
    /// Returns the OGC WKT describing Spatial Reference System.
119
 
    /// If GDAL is linked, it uses GDAL's operations and methods to determine 
120
 
    /// the WKT.  If GDAL is not linked, no WKT is returned.
121
 
    std::string GetWKT() const;
122
 
    
123
 
    /// Sets the SRS using GDAL's OGC WKT. If GDAL is not linked, this 
124
 
    /// operation has no effect.
125
 
    /// \param v - a string containing the WKT string.  
126
 
    void SetWKT(std::string const& v);
127
 
    
128
 
    /// Returns the Proj.4 string describing the Spatial Reference System.
129
 
    /// If GDAL is linked, it uses GDAL's operations and methods to determine 
130
 
    /// the Proj.4 string -- otherwise, if libgeotiff is linked, it uses 
131
 
    /// that.  Note that GDAL's operations are much more mature and 
132
 
    /// support more coordinate systems and descriptions.
133
 
    std::string GetProj4() const;
134
 
 
135
 
    /// Sets the Proj.4 string describing the Spatial Reference System.
136
 
    /// If GDAL is linked, it uses GDAL's operations and methods to determine 
137
 
    /// the Proj.4 string -- otherwise, if libgeotiff is linked, it uses 
138
 
    /// that.  Note that GDAL's operations are much more mature and 
139
 
    /// support more coordinate systems and descriptions.
140
 
    /// \param v - a string containing the Proj.4 string.
141
 
    void SetProj4(std::string const& v);
142
 
    
143
 
    /// Set the LASVLRs for the LASSpatialReference.  SetVLRs will only copy 
144
 
    /// VLR records that pertain to the GeoTIFF keys, and extraneous 
145
 
    /// VLR records will not be copied.
146
 
    /// \param vlrs - A list of VLRs that contains VLRs describing GeoTIFF keys
147
 
    void SetVLRs(const std::vector<LASVariableRecord>& vlrs);
148
 
    
149
 
    /// Add a VLR representing GeoTIFF keys to the SRS
150
 
    void AddVLR(const LASVariableRecord& vlr);
151
 
    
152
 
    /// Return a copy of the LASVLRs that LASSpatialReference maintains
153
 
    std::vector<LASVariableRecord> GetVLRs() const;
154
 
 
155
 
private:
156
 
 
157
 
    GTIF* m_gtiff;
158
 
    ST_TIFF* m_tiff;
159
 
 
160
 
    std::vector<LASVariableRecord> m_vlrs;
161
 
    bool IsGeoVLR(const LASVariableRecord& vlr) const;
162
 
 
163
 
    /// Reset the VLRs of the LASSpatialReference using the existing GTIF* and ST_TIF*
164
 
    /// Until this method is called, 
165
 
    /// the LASSpatialReference will only contain a SRS description using the VLRs 
166
 
    /// that it was first instantiated with.  SetWKT and SetProj4 can 
167
 
    /// be used to change the GTIF* 
168
 
    void ResetVLRs();
169
 
};
170
 
 
171
 
} // namespace liblas
172
 
 
173
 
#ifdef HAVE_GDAL
174
 
LAS_C_START
175
 
char LAS_DLL * GTIFGetOGISDefn(GTIF*, GTIFDefn*);
176
 
int  LAS_DLL   GTIFSetFromOGISDefn(GTIF*, const char*);
177
 
 
178
 
void SetLinearUnitCitation(GTIF* psGTIF, char* pszLinearUOMName);
179
 
void SetGeogCSCitation(GTIF* psGTIF, OGRSpatialReference* poSRS, char* angUnitName, int nDatum, short nSpheroid);
180
 
LAS_C_END
181
 
#endif
182
 
 
183
 
#endif // LIBLAS_LASSPATIALREFERENCE_HPP_INCLUDED