Exemplo n.º 1
0
 private void CreatePointModifiers()
 {
     if (m_Settings != null && m_GridBuffer != null)
     {
         m_PointModifiersByTag = PointModifier.CreateModifiers(m_Settings, m_GridBuffer);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// <see cref="PointModifier"/> factory.
        /// </summary>
        /// <param name="settings"><see cref="IEncodingSettings"/></param>
        /// <param name="buffer"><see cref="GridBuffer"/> used by the sensor</param>
        /// <returns>Dictionary of <see cref="PointModifiers"/>s by tag</returns>
        public static IDictionary <string, PointModifier> CreateModifiers(
            IEncodingSettings settings, GridBuffer buffer)
        {
            var modifiers = new Dictionary <string, PointModifier>();

            foreach (string tag in settings.DetectableTags)
            {
                PointModifier modifier = settings.GetPointModifierType(tag) switch
                {
                    PointModifierType.Dilation => new PointModDilation(),
                    PointModifierType.Downsampling => new PointModDownsampling(),
                    PointModifierType.OrthogonalFill => new PointModOrthogonalFill(),
                    PointModifierType.DiagonalFill => new PointModDiagonalFill(),
                    _ => new PointModNone(),
                };
                modifier.Initialize(buffer);
                modifiers.Add(tag, modifier);
            }

            return(modifiers);
        }