Gazebo Common

API Reference

6.0.1
Dem.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GZ_COMMON_GEOSPATIAL_DEM_HH_
18#define GZ_COMMON_GEOSPATIAL_DEM_HH_
19
20#include <memory>
21#include <string>
22#include <vector>
23
24#include <gz/math/Vector3.hh>
25#include <gz/math/Angle.hh>
27
28#include <gz/common/geospatial/Export.hh>
30
31#include <gz/utils/ImplPtr.hh>
32
33
34namespace gz
35{
36 namespace common
37 {
40 class GZ_COMMON_GEOSPATIAL_VISIBLE Dem : public HeightmapData
41 {
43 public: Dem();
44
46 public: virtual ~Dem();
47
53 const math::SphericalCoordinates &_worldSphericalCoordinates);
54
59 public: unsigned int RasterXSizeLimit();
60
65 public: void SetRasterXSizeLimit(
66 const unsigned int &_xLimit);
67
72 public: unsigned int RasterYSizeLimit();
73
78 public: void SetRasterYSizeLimit(
79 const unsigned int &_yLimit);
80
84 public: int Load(const std::string &_filename = "");
85
91 public: double Elevation(double _x, double _y);
92
95 public: float MinElevation() const override;
96
99 public: float MaxElevation() const override;
100
106 public: bool GeoReferenceOrigin(gz::math::Angle &_latitude,
107 gz::math::Angle &_longitude) const;
108
116 public: unsigned int Height() const override;
117
125 public: unsigned int Width() const override;
126
129 public: double WorldWidth() const;
130
133 public: double WorldHeight() const;
134
145 public: void FillHeightMap(const int _subSampling,
146 const unsigned int _vertSize,
147 const gz::math::Vector3d &_size,
148 const gz::math::Vector3d &_scale,
149 const bool _flipY,
150 std::vector<float> &_heights) const override;
151
159 private: bool GeoReference(double _x, double _y,
160 gz::math::Angle &_latitude,
161 gz::math::Angle &_longitude) const;
162
167 private: int LoadData();
168
169 // Documentation inherited.
170 public: std::string Filename() const override;
171
174 GZ_UTILS_IMPL_PTR(dataPtr)
175 };
176 }
177}
178#endif