コード例 #1
0
        private void button_camDel_Click(object sender, EventArgs e)
        {
            if (_selectedNode != null)
            {
                ANPRCam targetCam = new ANPRCam();

                foreach (ANPRCam cam in _anprCamList)
                {
                    if (cam.node.Equals(_selectedNode))
                    {
                        targetCam = cam;
                        break;
                    }
                }

                if (targetCam.markersOverlay != null)
                {
                    _anprCamList.Remove(targetCam);
                    targetCam.markersOverlay.Markers.Clear();
                    gMapControl1.Overlays.Remove(targetCam.markersOverlay);
                    treeView1.Nodes.Remove(_selectedNode);
                }
            }
            else
            {
                MessageBox.Show("삭제할 카메라를 선택해 주세요.");
                return;
            }
        }
コード例 #2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            _selectedNode = treeView1.SelectedNode;

            ANPRCam targetCam = new ANPRCam();

            foreach (ANPRCam cam in _anprCamList)
            {
                if (cam.node.Equals(_selectedNode))
                {
                    targetCam = cam;
                    break;
                }
            }

            gMapControl1.Position = targetCam.position;

            // set values in setting UI
            textBox_camID.Text                  = targetCam.camid.ToString();
            textBox_name.Text                   = targetCam.name;
            textBox_address.Text                = targetCam.address;
            textBox_camUsername.Text            = targetCam.username;
            textBox_camPassword.Text            = targetCam.password;
            comboBox_manufacturer.SelectedIndex = (int)targetCam.manufacturer;
            //
        }
コード例 #3
0
        private void button_camAdd_Click(object sender, EventArgs e)
        {
            if (textBox_camID.Text.Length < 1 || textBox_name.Text.Length < 1)
            {
                MessageBox.Show("카메라 ID와 RTSP 주소를 확인해 주세요.");
                return;
            }

            // if camid exists, replace it
            foreach (ANPRCam existCam in _anprCamList)
            {
                if (existCam.camid == Convert.ToInt32(textBox_camID.Text, 10))
                {
                    // exist!
                    existCam.node.Text = "카메라 " + textBox_camID.Text + " - " + textBox_name.Text;
                    existCam.position  = gMapControl1.Position;
                    existCam.markersOverlay.Markers[0].Position = existCam.position;
                    existCam.name         = textBox_name.Text;
                    existCam.address      = textBox_address.Text;
                    existCam.username     = textBox_camUsername.Text;
                    existCam.password     = textBox_camPassword.Text;
                    existCam.manufacturer = (Constants.MANUFACTURER)comboBox_manufacturer.SelectedIndex;
                    return;
                }
            }

            TreeNode camNode = new TreeNode("카메라 " + textBox_camID.Text + " - " + textBox_name.Text, 0, 0);

            treeView1.Nodes.Add(camNode);

            ANPRCam newcam = new ANPRCam();

            newcam.camid          = Convert.ToInt32(textBox_camID.Text, 10);
            newcam.name           = textBox_name.Text;
            newcam.address        = textBox_address.Text;
            newcam.username       = textBox_camUsername.Text;
            newcam.password       = textBox_camPassword.Text;
            newcam.manufacturer   = (Constants.MANUFACTURER)comboBox_manufacturer.SelectedIndex;
            newcam.node           = camNode;
            newcam.markersOverlay = new GMapOverlay("markers");
            gMapControl1.Overlays.Add(newcam.markersOverlay);
            GMarkerGoogle marker = new GMarkerGoogle(gMapControl1.Position, GMarkerGoogleType.green);

            newcam.markersOverlay.Markers.Add(marker);
            newcam.position = gMapControl1.Position;

            _anprCamList.Add(newcam);
        }