Gazebo Common

API Reference

4.7.0
gz/common/Dem.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 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 IGNITION_COMMON_DEM_HH_
18 #define IGNITION_COMMON_DEM_HH_
19 
20 #include <memory>
21 #include <gz/math/Vector3.hh>
22 #include <gz/math/Angle.hh>
23 
24 #include <gz/common/config.hh>
25 #include <gz/common/graphics/Export.hh>
26 
27 #include <ignition/utils/ImplPtr.hh>
28 
29 #ifdef HAVE_GDAL
30 # include <string>
31 # include <vector>
32 
34 
35 namespace ignition
36 {
37  namespace common
38  {
41  class IGNITION_COMMON_GRAPHICS_VISIBLE Dem : public HeightmapData
42  {
44  public: Dem();
45 
47  public: virtual ~Dem();
48 
52  public: int Load(const std::string &_filename = "");
53 
58  public: double Elevation(double _x, double _y);
59 
62  public: float MinElevation() const;
63 
66  public: float MaxElevation() const;
67 
72  public: void GeoReferenceOrigin(ignition::math::Angle &_latitude,
73  ignition::math::Angle &_longitude) const;
74 
82  public: unsigned int Height() const;
83 
91  public: unsigned int Width() const;
92 
95  public: double WorldWidth() const;
96 
99  public: double WorldHeight() const;
100 
111  public: void FillHeightMap(const int _subSampling,
112  const unsigned int _vertSize,
113  const ignition::math::Vector3d &_size,
114  const ignition::math::Vector3d &_scale,
115  const bool _flipY,
116  std::vector<float> &_heights);
117 
124  private: void GeoReference(double _x, double _y,
125  ignition::math::Angle &_latitude,
126  ignition::math::Angle &_longitude) const;
127 
132  private: int LoadData();
133 
136  IGN_UTILS_IMPL_PTR(dataPtr)
137  };
138  }
139 }
140 #endif
141 #endif
Forward declarations for the common classes.
STL class.
STL class.