Exemplo n.º 1
0
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            // runtime rectangle remove v8.1
            if ((e.Button == MouseButtons.Right) && (rectangles.Count > 0))
            {
                Rectangle last      = rectangles.GetRectangleList().Last();
                ImgLabel  lastLabel = ActiveImage.AnnotatedLabels.Last();
                ActiveImage.AnnotatedLabels.Remove(lastLabel);
                PopulateAnnotatedLabelsList(ActiveImage.AnnotatedLabels);

                //rectangles.RemoveAt(rectangles.Count - 1);

                ctxClassLebels.Hide();
            }
            else
            {
                if (pictureBox1.Image != null)
                {
                    ctxClassLebels.Show(e.X + splitContainer1.Left, e.Y + splitContainer1.Top);
                }

                if (drawing)
                {
                    drawing = false;
                    var rc = getRectangle();
                    if (rc.Width > 0 && rc.Height > 0)
                    {
                        rectangles.Add(new HBRectangle {
                            rectangle = rc, Id = rectangles.GetRectangleList().Count() + 1
                        });
                    }
                    pictureBox1.Invalidate();
                }
            }
        }
Exemplo n.º 2
0
        private void btnUpdateLabels_Click(object sender, EventArgs e)
        {
            DialogResult    res           = MessageBox.Show("Do you really want to Update", "Update Labels", MessageBoxButtons.YesNo);
            List <ImgLabel> updatedLabels = new List <ImgLabel>();

            if (res == DialogResult.Yes)
            {
                foreach (var item in chkLLabelList.CheckedItems)
                {
                    // if(item.ToString().Split('_')[0] == )
                    ImgLabel label = ActiveImage.AnnotatedLabels.Where(l => l.Id.ToString() == item.ToString().Split('_')[0]).FirstOrDefault();
                    label.Id = updatedLabels.Count() + 1;
                    updatedLabels.Add(label);
                }

                ActiveImage.AnnotatedLabels = updatedLabels;
                updateProjectJson();
                PopulateAnnotatedLabelsList(ActiveImage.AnnotatedLabels);
            }
        }