SegmentationClassConfiguration.cpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #include <AzCore/Serialization/EditContext.h>
  9. #include <AzCore/Serialization/EditContextConstants.inl>
  10. #include <ROS2Sensors/Lidar/ClassSegmentationBus.h>
  11. #include <ROS2Sensors/Lidar/SegmentationClassConfiguration.h>
  12. namespace ROS2Sensors
  13. {
  14. const SegmentationClassConfiguration SegmentationClassConfiguration::UnknownClass =
  15. SegmentationClassConfiguration{ "Unknown", UnknownClassId, AZ::Colors::White };
  16. const SegmentationClassConfiguration SegmentationClassConfiguration::GroundClass =
  17. SegmentationClassConfiguration{ "Ground", TerrainClassId, AZ::Colors::Brown };
  18. void SegmentationClassConfiguration::Reflect(AZ::ReflectContext* context)
  19. {
  20. if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
  21. {
  22. serializeContext->Class<SegmentationClassConfiguration>()
  23. ->Version(0)
  24. ->Field("className", &SegmentationClassConfiguration::m_className)
  25. ->Field("classId", &SegmentationClassConfiguration::m_classId)
  26. ->Field("classColor", &SegmentationClassConfiguration::m_classColor);
  27. if (AZ::EditContext* ec = serializeContext->GetEditContext())
  28. {
  29. ec->Class<SegmentationClassConfiguration>(
  30. "Lidar Segmentation Class Configuration", "Lidar Segmentation Class configuration")
  31. ->DataElement(
  32. AZ::Edit::UIHandlers::Default, &SegmentationClassConfiguration::m_className, "Class Name", "Name of the class")
  33. ->Attribute(AZ::Edit::Attributes::ContainerCanBeModified, true)
  34. ->DataElement(AZ::Edit::UIHandlers::Default, &SegmentationClassConfiguration::m_classId, "Class Id", "Id of the class")
  35. ->Attribute(AZ::Edit::Attributes::ContainerCanBeModified, true)
  36. ->DataElement(
  37. AZ::Edit::UIHandlers::Default, &SegmentationClassConfiguration::m_classColor, "Class Color", "Color of the class")
  38. ->Attribute(AZ::Edit::Attributes::ContainerCanBeModified, true);
  39. }
  40. }
  41. }
  42. } // namespace ROS2Sensors