Commit 548c65d8 authored by Nick Dunning's avatar Nick Dunning
Browse files

Add interface for entity visibility

parent d987e505
......@@ -26,6 +26,20 @@
namespace mantle_api
{
struct SensorVisibilityConfig
  • Looks good. Quite flexible. I guess the SensorVisibilityConfig would need a comment on how to use it. E.g. what happens, if the vector is empty? What happens with the other sensors, which are not listed? Can you specify to make the entity (in-)visible for all sensors at once without naming every sensor explicitly?

  • We resolved this with another commit by having only one bool for sensor and explaining in the source code with a comment on how to use the interface

Please register or sign in to reply
{
std::string name{"sensor"};
bool visibility{true};
};
struct EntityVisibilityConfig
{
bool graphics{true};
bool traffic{true};
std::vector<SensorVisibilityConfig> sensors{};
};
/// Base interface for all static and dynamic scenario entities.
class IEntity : public IIdentifiable
{
......@@ -54,6 +68,9 @@ class IEntity : public IIdentifiable
virtual void SetAssignedLaneIds(const std::vector<std::uint64_t>& assigned_lane_ids) = 0;
virtual std::vector<std::uint64_t> GetAssignedLaneIds() const = 0;
virtual void SetVisibility(const EntityVisibilityConfig& visibility) = 0;
virtual EntityVisibilityConfig GetVisibility() const = 0;
};
class IVehicle : public virtual IEntity
......
......@@ -75,6 +75,9 @@ class MockVehicle : public mantle_api::IVehicle
MOCK_METHOD(void, SetAssignedLaneIds, (const std::vector<std::uint64_t>& ids), (override));
MOCK_METHOD(std::vector<std::uint64_t>, GetAssignedLaneIds, (), (const, override));
MOCK_METHOD(void, SetVisibility, (const EntityVisibilityConfig& visibility), (override));
MOCK_METHOD(EntityVisibilityConfig, GetVisibility, (), (const, override));
void SetProperties(std::unique_ptr<mantle_api::EntityProperties> properties) override { properties_ = std::move(properties); }
mantle_api::VehicleProperties* GetProperties() const override
{
......@@ -155,6 +158,9 @@ class MockPedestrian : public mantle_api::IPedestrian
MOCK_METHOD(void, SetAssignedLaneIds, (const std::vector<std::uint64_t>& ids), (override));
MOCK_METHOD(std::vector<std::uint64_t>, GetAssignedLaneIds, (), (const, override));
MOCK_METHOD(void, SetVisibility, (const EntityVisibilityConfig& visibility), (override));
MOCK_METHOD(EntityVisibilityConfig, GetVisibility, (), (const, override));
void SetProperties(std::unique_ptr<mantle_api::EntityProperties> properties) override { properties_ = std::move(properties); }
mantle_api::PedestrianProperties* GetProperties() const override
{
......@@ -198,6 +204,9 @@ class MockStaticObject : public mantle_api::IStaticObject
MOCK_METHOD(void, SetAssignedLaneIds, (const std::vector<std::uint64_t>& ids), (override));
MOCK_METHOD(std::vector<std::uint64_t>, GetAssignedLaneIds, (), (const, override));
MOCK_METHOD(void, SetVisibility, (const EntityVisibilityConfig& visibility), (override));
MOCK_METHOD(EntityVisibilityConfig, GetVisibility, (), (const, override));
void SetProperties(std::unique_ptr<mantle_api::EntityProperties> properties) override { properties_ = std::move(properties); }
mantle_api::StaticObjectProperties* GetProperties() const override
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment