GeoreferenceBus.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 "GeoreferenceStructures.h"
  10. #include "GeoreferencingTypeIds.h"
  11. #include <AzCore/Component/EntityId.h>
  12. #include <AzCore/EBus/EBus.h>
  13. #include <AzCore/Math/Quaternion.h>
  14. #include <AzCore/Math/Vector3.h>
  15. namespace Georeferencing
  16. {
  17. //! Interface that allows to configure georeferencing of the level.
  18. class GeoreferenceConfigurationRequests
  19. {
  20. public:
  21. AZ_RTTI(GeoreferenceConfigurationRequests, GeoreferenceConfigurationRequestsTypeId);
  22. //! Function sets entity that represents the origin of the georeferencing.
  23. virtual void SetOriginEntity(const AZ::EntityId& entityId) = 0;
  24. //! Function sets location of the origin in WGS84 coordinate system.
  25. virtual void SetOriginCoordinates(const WGS::WGS84Coordinate& origin) = 0;
  26. //! Function returns entity that represents the origin of the georeferencing.
  27. virtual AZ::EntityId GetOriginEntity() = 0;
  28. //! Function returns location of the origin in WGS84 coordinate system.
  29. virtual WGS::WGS84Coordinate GetOriginCoordinates() = 0;
  30. };
  31. class GeoreferenceConfigurationRequestsTraits : public AZ::EBusTraits
  32. {
  33. public:
  34. // EBusTraits overrides ...
  35. static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  36. static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  37. };
  38. using GeoreferenceConfigurationRequestsBus = AZ::EBus<GeoreferenceConfigurationRequests, GeoreferenceConfigurationRequestsTraits>;
  39. //! Interface that allows to convert between level and WGS84 coordinates.
  40. class GeoreferenceRequests
  41. {
  42. public:
  43. AZ_RTTI(GeoreferenceRequests, GeoreferenceRequestsTypeId);
  44. //! Function converts from Level's coordinate system to WGS84.
  45. //! @param xyz Vector3 in Level's coordinate system.
  46. //! @return Vector3 in WGS84 coordinate system as @class WGS::WGS84Coordinate.
  47. virtual WGS::WGS84Coordinate ConvertFromLevelToWGS84(const AZ::Vector3& xyz) = 0;
  48. //! Function converts from WGS84 coordinate system to Level's.
  49. //! @param latLon Vector3 in WGS84 coordinate system, where x is latitude, y is longitude and z is altitude.
  50. //! @return Vector3 in Level's coordinate system.
  51. virtual AZ::Vector3 ConvertFromWGS84ToLevel(const WGS::WGS84Coordinate& latLon) = 0;
  52. //! Function returns rotation from Level's frame to ENU's (East-North-Up) rotation.
  53. //! Function is useful to find georeferencing rotation of the level.
  54. //! @return Quaternion in ENU coordinate system.
  55. virtual AZ::Quaternion GetRotationFromLevelToENU() = 0;
  56. };
  57. class GeoreferenceRequestsTraits : public AZ::EBusTraits
  58. {
  59. public:
  60. // EBusTraits overrides ...
  61. static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  62. static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  63. };
  64. using GeoreferenceRequestsBus = AZ::EBus<GeoreferenceRequests, GeoreferenceRequestsTraits>;
  65. } // namespace Georeferencing