Region.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 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 GAZEBO_PLUGIN_EVENTS_REGION_HH_
18 #define GAZEBO_PLUGIN_EVENTS_REGION_HH_
19 
20 #include <string>
21 #include <vector>
22 #include <memory>
23 
24 #include <sdf/sdf.hh>
25 #include <ignition/math/Vector3.hh>
26 #include <ignition/math/Box.hh>
27 
28 namespace gazebo
29 {
31  class Region
32  {
34  public: Region() = default;
35 
37  public: virtual ~Region() = default;
38 
41  public: void Load(const sdf::ElementPtr &_sdf);
42 
46  public: bool Contains(const ignition::math::Vector3d &_p) const;
47 
52  public: friend std::ostream& operator<<(std::ostream &_out,
53  const Region &_region);
54 
56  public: std::string name;
57 
59  public: std::vector<ignition::math::Box> boxes;
60  };
61 
64  typedef std::shared_ptr<Region> RegionPtr;
65 }
66 #endif
std::vector< ignition::math::Box > boxes
The list of volumes inside this region.
Definition: Region.hh:59
void Load(const sdf::ElementPtr &_sdf)
Load from a world file (inside a SimEvent plugin element)
bool Contains(const ignition::math::Vector3d &_p) const
Check if a point lies inside the region.
Region()=default
Constructor.
std::string name
Name of the region (as defined in the world file)
Definition: Region.hh:56
friend std::ostream & operator<<(std::ostream &_out, const Region &_region)
Output operator to print a region to the console.
std::shared_ptr< Region > RegionPtr
Definition: Region.hh:64
virtual ~Region()=default
Destructor.
A region, made of a list of boxes.
Definition: Region.hh:31