ROS2FrameEditorSystemComponent.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include "ROS2FrameGameSystemComponent.h"
  10. #include "ROS2FrameSystemBus.h"
  11. #include <AzCore/Component/Component.h>
  12. #include <AzCore/Component/Entity.h>
  13. #include <AzCore/Component/EntityId.h>
  14. #include <AzCore/Component/TickBus.h>
  15. #include <AzCore/Component/TransformBus.h>
  16. #include <AzCore/Math/Transform.h>
  17. #include <AzCore/RTTI/RTTIMacros.h>
  18. #include <AzCore/std/containers/map.h>
  19. #include <AzCore/std/containers/vector.h>
  20. #include <AzCore/std/string/string.h>
  21. #include <AzToolsFramework/API/ToolsApplicationAPI.h>
  22. #include <ROS2/Frame/ROS2FrameConfiguration.h>
  23. namespace ROS2
  24. {
  25. //! Component which manages the frame entities and their hierarchy.
  26. //! It is responsible for updating the namespaces of the frame entities and their children.
  27. //! It also notifies the ROS2FrameEditorComponent about changes in the tree.
  28. //! Used to register, unregister, track the frame entities in the level entity tree.
  29. class ROS2FrameEditorSystemComponent
  30. : public ROS2FrameGameSystemComponent
  31. , protected AzToolsFramework::EntitySelectionEvents::Bus::MultiHandler
  32. , protected AZ::TransformNotificationBus::MultiHandler
  33. {
  34. public:
  35. AZ_COMPONENT(ROS2FrameEditorSystemComponent, "{360c4b45-ac02-42d2-9e1a-1d77eb22a054}");
  36. ROS2FrameEditorSystemComponent();
  37. ~ROS2FrameEditorSystemComponent() = default;
  38. static void Reflect(AZ::ReflectContext* context);
  39. // AZ::Component overrides.
  40. void Activate() override;
  41. void Deactivate() override;
  42. private:
  43. // ROS2FrameSystemInterface::Registrar overrides.
  44. void RegisterFrame(const AZ::EntityId& frameEntityId) override;
  45. void UnregisterFrame(const AZ::EntityId& frameEntityId) override;
  46. // EntitySelectionEvents::Bus::MultiHandler overrides.
  47. void OnSelected() override;
  48. //! AZ::TransformNotificationBus::MultiHandler overrides.
  49. void OnParentChanged(AZ::EntityId oldParent, AZ::EntityId newParent) override;
  50. AZStd::set<AZ::EntityId> m_registeredEntities; //!< Set of all registered frame entities.
  51. };
  52. } // namespace ROS2