Dem.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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 
18 #ifndef _GAZEBO_DEM_HH_
19 #define _GAZEBO_DEM_HH_
20 
21 #include <ignition/math/Vector3.hh>
22 #include <ignition/math/Angle.hh>
23 
24 #include <gazebo/gazebo_config.h>
25 #include <gazebo/util/system.hh>
26 
27 #ifdef HAVE_GDAL
28 # include <string>
29 # include <vector>
30 
32 
33 namespace gazebo
34 {
35  namespace common
36  {
37  class DemPrivate;
38 
41 
44  class GZ_COMMON_VISIBLE Dem : public HeightmapData
45  {
47  public: Dem();
48 
50  public: virtual ~Dem();
51 
55  public: int Load(const std::string &_filename="");
56 
61  public: double GetElevation(double _x, double _y);
62 
65  public: float GetMinElevation() const;
66 
69  public: float GetMaxElevation() const;
70 
75  public: void GetGeoReferenceOrigin(ignition::math::Angle &_latitude,
76  ignition::math::Angle &_longitude) const;
77 
85  public: unsigned int GetHeight() const;
86 
94  public: unsigned int GetWidth() const;
95 
98  public: double GetWorldWidth() const;
99 
102  public: double GetWorldHeight() const;
103 
114  public: void FillHeightMap(const int _subSampling,
115  const unsigned int _vertSize,
116  const ignition::math::Vector3d &_size,
117  const ignition::math::Vector3d &_scale,
118  const bool _flipY,
119  std::vector<float> &_heights);
120 
127  private: void GetGeoReference(double _x, double _y,
128  ignition::math::Angle &_latitude,
129  ignition::math::Angle &_longitude) const;
130 
135  private: int LoadData();
136 
139  private: DemPrivate *dataPtr;
140  };
142  }
143 }
144 #endif
145 #endif
Encapsulates a generic heightmap data file.
Definition: HeightmapData.hh:39
Forward declarations for the common classes.
Definition: Animation.hh:26
unsigned int GetHeight() const
Get the terrain's height.
void FillHeightMap(const int _subSampling, const unsigned int _vertSize, const ignition::math::Vector3d &_size, const ignition::math::Vector3d &_scale, const bool _flipY, std::vector< float > &_heights)
Create a lookup table of the terrain's height.
common
Definition: FuelModelDatabase.hh:37
Dem()
Constructor.
void GetGeoReferenceOrigin(ignition::math::Angle &_latitude, ignition::math::Angle &_longitude) const
Get the georeferenced coordinates (lat, long) of the terrain's origin in WGS84.
int Load(const std::string &_filename="")
Load a DEM file.
float GetMaxElevation() const
Get the terrain's maximum elevation in meters.
unsigned int GetWidth() const
Get the terrain's width.
float GetMinElevation() const
Get the terrain's minimum elevation in meters.
double GetElevation(double _x, double _y)
Get the elevation of a terrain's point in meters.
virtual ~Dem()
Destructor.
double GetWorldWidth() const
Get the real world width in meters.
Definition: Dem.hh:44
double GetWorldHeight() const
Get the real world height in meters.