/// <summary>
        /// Initializes a new instance of the <see cref="AnalyticBehaviorManagerForm" /> class.
        /// </summary>
        /// <param name="analyticConfig">The analytic config to manage.</param>
        public AnalyticBehaviorManagerForm(AnalyticConfig analyticConfig)
        {
            InitializeComponent();
            _selectedAnalyticConfig = analyticConfig;

            PopulateAnalyticBehaviors();
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ModifyAnalyticConfigForm" /> class.
        /// </summary>
        /// <param name="analyticConfig">The <paramref name="analyticConfig"/> parameter.</param>
        /// <param name="dataSource">The <paramref name="dataSource"/> parameter.</param>
        public ModifyAnalyticConfigForm(AnalyticConfig analyticConfig, DataSource dataSource)
        {
            InitializeComponent();
            SelectedAnalyticConfig = analyticConfig;

            if (dataSource.IsPTZ)
            {
                var presets = dataSource.PTZController.Presets;
                foreach (var preset in presets)
                {
                    cbxPresets.Items.Add(preset.Name);
                }
            }

            nudMinConfidence.Value  = (decimal)SelectedAnalyticConfig.MinConfidence;
            nudSizeHeight.Value     = SelectedAnalyticConfig.Size.Height;
            nudSizeWidth.Value      = SelectedAnalyticConfig.Size.Width;
            cbxPresets.SelectedItem = SelectedAnalyticConfig.PtzPresetName;
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AddAnalyticBehaviorForm" /> class.
        /// </summary>
        /// <param name="analyticConfig">The selected analytic config.</param>
        /// <param name="analyticBehavior">The analytic behavior to modify, if any.</param>
        public AddAnalyticBehaviorForm(AnalyticConfig analyticConfig, AnalyticBehavior analyticBehavior = null)
        {
            InitializeComponent();
            _selectedAnalyticConfig   = analyticConfig;
            _selectedAnalyticBehavior = analyticBehavior;

            if (_selectedAnalyticBehavior != null)
            {
                Text                  = @"Modify Analytic Behavior";
                btnAdd.Text           = @"Save";
                tbxName.Text          = _selectedAnalyticBehavior.Name;
                ckbxIsEnabled.Checked = _selectedAnalyticBehavior.IsEnabled;
                nudSeverity.Value     = _selectedAnalyticBehavior.Severity;

                if (_selectedAnalyticBehavior.ObjectLineCounter != null)
                {
                    nudEndPointX.Value   = (decimal)_selectedAnalyticBehavior.ObjectLineCounter.EndPoint.X;
                    nudEndPointY.Value   = (decimal)_selectedAnalyticBehavior.ObjectLineCounter.EndPoint.Y;
                    nudStartPointX.Value = (decimal)_selectedAnalyticBehavior.ObjectLineCounter.StartPoint.X;
                    nudStartPointY.Value = (decimal)_selectedAnalyticBehavior.ObjectLineCounter.StartPoint.Y;
                    cbxLineCounterTypes.SelectedIndex = (int)_selectedAnalyticBehavior.ObjectLineCounter.LineCounterType - 1;
                    ckbxIsEventsEnabled.Checked       = _selectedAnalyticBehavior.ObjectLineCounter.EventsEnabled;
                    nudEventWindow.Value       = _selectedAnalyticBehavior.ObjectLineCounter.EventWindowSecs;
                    nudMaxCountThreshold.Value = _selectedAnalyticBehavior.ObjectLineCounter.MaxCountThreshold;
                    tbxLeftCountLabel.Text     = _selectedAnalyticBehavior.ObjectLineCounter.LeftCountLabel;
                    tbxRightCountLabel.Text    = _selectedAnalyticBehavior.ObjectLineCounter.RightCountLabel;
                }

                if (_selectedAnalyticBehavior.ObjectInZone != null)
                {
                    foreach (var point in _selectedAnalyticBehavior.ObjectInZone.Vertices)
                    {
                        var lvItem = new ListViewItem(string.Empty);
                        lvItem.SubItems.Add(point.X.ToString(CultureInfo.InvariantCulture));
                        lvItem.SubItems.Add(point.Y.ToString(CultureInfo.InvariantCulture));
                        lvObjectInZonePoints.Items.Add(lvItem);
                    }
                }

                if (_selectedAnalyticBehavior.ObjectWrongWayZone != null)
                {
                    nudMinTriggerAngle.Value = _selectedAnalyticBehavior.ObjectWrongWayZone.MinTriggerAngle;
                    nudVectorAngle.Value     = _selectedAnalyticBehavior.ObjectWrongWayZone.Vector.Angle;
                    nudVectorX.Value         = (decimal)_selectedAnalyticBehavior.ObjectWrongWayZone.Vector.X;
                    nudVectorY.Value         = (decimal)_selectedAnalyticBehavior.ObjectWrongWayZone.Vector.Y;

                    foreach (var point in _selectedAnalyticBehavior.ObjectWrongWayZone.Zone)
                    {
                        var lvItem = new ListViewItem(string.Empty);
                        lvItem.SubItems.Add(point.X.ToString(CultureInfo.InvariantCulture));
                        lvItem.SubItems.Add(point.Y.ToString(CultureInfo.InvariantCulture));
                        lvObjectWrongWayZonePoints.Items.Add(lvItem);
                    }
                }

                cbxObjectType.SelectedIndex   = (int)_selectedAnalyticBehavior.ObjectType - 1;
                cbxBehaviorType.SelectedIndex = (int)_selectedAnalyticBehavior.BehaviorType - 1;
                cbxBehaviorType.Enabled       = false;
                if (_selectedAnalyticBehavior.ObjectLineCounter?.LineCounterType != null)
                {
                    cbxLineCounterTypes.SelectedIndex = (int)_selectedAnalyticBehavior.ObjectLineCounter.LineCounterType - 1;
                }
                else
                {
                    cbxLineCounterTypes.SelectedIndex = 0;
                }
            }
            else
            {
                cbxObjectType.SelectedIndex       = 0;
                cbxBehaviorType.SelectedIndex     = 0;
                cbxLineCounterTypes.SelectedIndex = 0;
            }
        }