MVSim
Lightweight simulator for 2.5D vehicles and robots
PropertyRegion.h
1 /*+-------------------------------------------------------------------------+
2  | MultiVehicle simulator (libmvsim) |
3  | |
4  | Copyright (C) 2014-2026 Jose Luis Blanco Claraco |
5  | Copyright (C) 2017 Borys Tymchenko (Odessa Polytechnic University) |
6  | Distributed under 3-clause BSD License |
7  | See COPYING |
8  +-------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <mrpt/math/TPoint3D.h>
13 #include <mvsim/WorldElements/WorldElementBase.h>
14 
15 #include <any>
16 
17 namespace mvsim
18 {
23 {
24  DECLARES_REGISTER_WORLD_ELEMENT(PropertyRegion)
25  public:
26  PropertyRegion(World* parent, const rapidxml::xml_node<char>* root);
27  virtual ~PropertyRegion() = default;
28 
29  // Non-copyable and non-movable
30  PropertyRegion(const PropertyRegion&) = delete;
31  PropertyRegion& operator=(const PropertyRegion&) = delete;
32  PropertyRegion(PropertyRegion&&) = delete;
33  PropertyRegion& operator=(PropertyRegion&&) = delete;
34 
35  virtual void loadConfigFrom(const rapidxml::xml_node<char>* root) override;
36 
37  // The core logic: returns the property value if the point is inside the box
38  virtual std::optional<std::any> queryProperty(
39  const std::string& propertyName, const mrpt::math::TPoint3D& worldXYZ) const override;
40 
41  // No-op for physics and GUI
42  virtual void simul_pre_timestep(const TSimulContext&) override {}
43  virtual void simul_post_timestep(const TSimulContext&) override {}
44  virtual void internalGuiUpdate(
45  const mrpt::optional_ref<mrpt::opengl::COpenGLScene>&,
46  const mrpt::optional_ref<mrpt::opengl::COpenGLScene>&, bool) override
47  {
48  }
49 
50  protected:
51  mrpt::math::TPoint3D boxMin_ = {-1.0, -1.0, -1000.0};
52  mrpt::math::TPoint3D boxMax_ = {1.0, 1.0, 1000.0};
53 
54  std::string propertyName_;
55  std::any propertyValue_;
56 };
57 } // namespace mvsim
Definition: PropertyRegion.h:23
virtual void simul_pre_timestep(const TSimulContext &) override
Definition: PropertyRegion.h:42
virtual void simul_post_timestep(const TSimulContext &) override
Definition: PropertyRegion.h:43
Definition: WorldElementBase.h:28
Definition: World.h:132
Definition: basic_types.h:58