libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout
include
osmscout
elevation
SRTM.h
Go to the documentation of this file.
1
//
2
// SRTM.h
3
// libosmscout
4
//
5
// Created by Vladimir Vyskocil on 06/01/13.
6
// Copyright (c) 2013 Vladimir Vyskocil. All rights reserved.
7
//
8
9
#ifndef libosmscout_SRTM_h
10
#define libosmscout_SRTM_h
11
12
/*
13
This source is part of the libosmscout library
14
Copyright (C) 2009 Tim Teulings
15
16
This library is free software; you can redistribute it and/or
17
modify it under the terms of the GNU Lesser General Public
18
License as published by the Free Software Foundation; either
19
version 2.1 of the License, or (at your option) any later version.
20
21
This library is distributed in the hope that it will be useful,
22
but WITHOUT ANY WARRANTY; without even the implied warranty of
23
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
24
Lesser General Public License for more details.
25
26
You should have received a copy of the GNU Lesser General Public
27
License along with this library; if not, write to the Free Software
28
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
*/
30
31
#include <memory>
32
#include <string>
33
#include <vector>
34
35
#include <
osmscout/GeoCoord.h
>
36
#include <
osmscout/util/GeoBox.h
>
37
38
#include <
osmscout/OSMScoutTypes.h
>
39
40
#include <
osmscout/system/SystemTypes.h
>
41
42
namespace
osmscout
{
43
44
class
OSMSCOUT_API
SRTMData
45
{
46
public
:
47
GeoBox
boundingBox
;
48
size_t
rows
;
49
size_t
columns
;
50
std::vector<int32_t>
heights
;
51
52
int32_t
GetHeight
(
size_t
x,
size_t
y)
const
53
{
54
return
heights
[y*
columns
+x];
55
}
56
};
57
58
using
SRTMDataRef
= std::shared_ptr<SRTMData>;
59
63
class
OSMSCOUT_API
SRTM
64
{
65
public
:
66
static
const
int32_t
nodata
=-32768;
67
68
private
:
69
std::string srtmPath;
70
std::string currentFilename;
71
osmscout::GeoBox fileBoundingBox;
72
size_t
rows;
73
size_t
columns;
74
size_t
patchSize;
75
uint8_t *heights;
76
77
private
:
78
bool
AssureCorrectFileLoaded(
double
latitude,
79
double
longitude);
80
81
std::string CalculateHGTFilename(
int
patchLat,
82
int
patchLon)
const
;
83
84
int32_t GetHeight(
size_t
column,
size_t
row)
const
;
85
86
public
:
87
explicit
SRTM
(
const
std::string& path);
88
89
virtual
~SRTM
();
90
91
int32_t
GetHeightAtLocation
(
const
GeoCoord& coord);
92
SRTMDataRef
GetHeightInBoundingBox
(
const
GeoBox& boundingBox);
93
};
94
95
using
SRTMRef
= std::shared_ptr<SRTM>;
96
}
97
98
#endif
OSMSCOUT_API
#define OSMSCOUT_API
Definition
CoreImportExport.h:45
GeoBox.h
GeoCoord.h
OSMScoutTypes.h
SystemTypes.h
osmscout::SRTMData
Definition
SRTM.h:45
osmscout::SRTMData::heights
std::vector< int32_t > heights
Definition
SRTM.h:50
osmscout::SRTMData::boundingBox
GeoBox boundingBox
Definition
SRTM.h:47
osmscout::SRTMData::columns
size_t columns
Definition
SRTM.h:49
osmscout::SRTMData::GetHeight
int32_t GetHeight(size_t x, size_t y) const
Definition
SRTM.h:52
osmscout::SRTMData::rows
size_t rows
Definition
SRTM.h:48
osmscout::SRTM::nodata
static const int32_t nodata
Definition
SRTM.h:66
osmscout::SRTM::GetHeightAtLocation
int32_t GetHeightAtLocation(const GeoCoord &coord)
osmscout::SRTM::GetHeightInBoundingBox
SRTMDataRef GetHeightInBoundingBox(const GeoBox &boundingBox)
osmscout::SRTM::SRTM
SRTM(const std::string &path)
osmscout::SRTM::~SRTM
virtual ~SRTM()
osmscout
Definition
Area.h:39
osmscout::SRTMDataRef
std::shared_ptr< SRTMData > SRTMDataRef
Definition
SRTM.h:58
osmscout::SRTMRef
std::shared_ptr< SRTM > SRTMRef
Definition
SRTM.h:95
Generated by
1.17.0