translation_filter.h 3.68 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#ifndef INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_AUDIBILITY_FILTER_TRANSLATION_FILTER
#define INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_AUDIBILITY_FILTER_TRANSLATION_FILTER

// API includes
#include <ITA/simulation_scheduler/definitions.h>

// simulation scheduler includes
#include <ITA/simulation_scheduler/audibility_filter/audibility_filter_interface.h>

namespace ITA
{
12
	namespace SimulationScheduler
13
14
15
	{
		class CUpdateScene;

16
		namespace AudibilityFilter
17
18
19
20
21
22
23
24
25
26
		{
			///
			/// \brief Translation filter
			///
			/// This class implements a simple translation filter.
			/// Only if the length of the translation vector between the previous and new source or receiver position exceeds the configured distance, the update is audible. 
			/// 
			class ITA_SIMULATION_SCHEDULER_API CTranslationFilter : public IAudibilityFilter
			{
			public:
27
28
29
30
31
32
33
34
35
				///
				/// \brief Translation modes for the CTranslationFilter.
				/// 
				enum class TranslationModes
				{
					relative, ///< In this mode, the translation relative to the opposite element is considered.
					absolute  ///< In this mode, only the absolute translation of source and receiver is considered.
				};
				
36
37
38
39
40
				///
				/// \brief Configuration class for the translation filter.
				///
				struct ITA_SIMULATION_SCHEDULER_API TranslationFilterConfig : public IAudibilityFilter::AudibilityFilterConfig
				{
41
					explicit TranslationFilterConfig ( );
42

43
44
					double dMinimumTranslation = 5.0;

45
46
					TranslationModes eMode = TranslationModes::absolute;

47
					VistaPropertyList Store ( ) const override;
48

49
					void Load ( const VistaPropertyList& oProperties ) override;
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
				};

				CTranslationFilter ( ) = delete;

				///
				/// \brief Constructor for a CTranslationFilter.
				///
				/// This constructor configures the CTranslationFilter with the given \p oConfig.
				/// \param oConfig the configuration for the CTranslationFilter.
				/// 
				explicit CTranslationFilter ( const TranslationFilterConfig& oConfig );

				// 
				///
				/// \brief Check if the change between \p previousState and \p newUpdate is audible.
				///
66
67
				/// The change between \p previousState and \p newUpdate in absolute mode is audible when the length of the translation vector of source or receiver is larger than the configured minimum.
				/// The change between \p previousState and \p newUpdate in relative mode is audible when the difference of the distances between source and receiver is larger than the configured minimum.
68
69
70
71
				/// \param previousState the previous state of the scene to check against.
				/// \param newUpdate the CUpdateScene to check for audibility.
				/// \return true if the change between \p previousState and \p newUpdate is audible, else false.
				/// 
72
				virtual bool ChangeIsAudible ( const CUpdateScene& previousState, const CUpdateScene& newUpdate ) const override;
73

74
75
76
77
				///
				/// \brief Return a unique type identifying string.
				/// \return a unique type identifying string.
				/// 
78
				static std::string GetType ( );
79

80
81
82
83
				///
				/// \brief Factory function for a filter.
				/// \remark This function should to be static.
				///
84
				static std::unique_ptr<IAudibilityFilter> CreateFilter ( const std::shared_ptr<IAudibilityFilter::AudibilityFilterConfig>& pConfig );
85
86
87
88
89
90

			private:
				///
				/// \brief The minimum translation, above which the filter deems the update audible.
				/// 
				double m_dMinimumTranslation = 1.0;
91
92
93
94
95

				///
				/// \brief Mode in which the translation should be evaluated.
				/// 
				TranslationModes m_eTranslationMode = TranslationModes::absolute;
96
			};
97
98
		} // namespace AudibilityFilter
	} // namespace SimulationScheduler
99
100
101
} // namespace ITA

#endif // INCLUDE_WATCHER_ITA_SIMULATION_SCHEDULER_AUDIBILITY_FILTER_TRANSLATION_FILTER