Exemple #1
0
        public void MouseUp(MouseEventArgs e)
        {
            if (_annoShapeModel != null)
            {
                mGetCurrentSize();
                switch (selectedShapeType)
                {
                case ShapeType.boundingbox:
                    _annoShapeModel.row.Add(_annoShapeModel.row[0] + OriginalHeight * boundingBoxShape.Height / CurrentHeight);
                    _annoShapeModel.col.Add(_annoShapeModel.col[0] + OriginalWidth * boundingBoxShape.Width / CurrentWidth);

                    _annoShapeModel.width  = _annoShapeModel.col[1] - _annoShapeModel.col[0];
                    _annoShapeModel.height = _annoShapeModel.row[1] - _annoShapeModel.row[0];

                    GetCamWindowView().ImageCanvas.Children.Remove(boundingBoxShape);
                    if (_annoShapeModel.width < 30 | _annoShapeModel.height < 30)
                    {
                        _annoShapeModel = null;
                        return;
                    }
                    mRegisterAnnShape(_annoShapeModel);

                    mDrawAnnShapeModel(_annoShapeModel);

                    ShellView.ShapeDataGrid.SelectedIndex = AnnoShapeModelCollection.IndexOf(_annoShapeModel);

                    _annoShapeModel = null;
                    break;

                case ShapeType.point:
                    _annoShapeModel.row.Add(OriginalHeight * downPoint.Y / CurrentHeight);
                    _annoShapeModel.col.Add(OriginalWidth * downPoint.X / CurrentWidth);

                    _annoShapeModel.width  = OriginalWidth * 8 / CurrentWidth;
                    _annoShapeModel.height = OriginalHeight * 8 / CurrentHeight;

                    mRegisterAnnShape(_annoShapeModel);

                    GetCamWindowView().ImageCanvas.Children.Remove(pointShape);
                    mDrawAnnShapeModel(_annoShapeModel);

                    ShellView.ShapeDataGrid.SelectedIndex = AnnoShapeModelCollection.IndexOf(_annoShapeModel);

                    _annoShapeModel = null;
                    break;

                case ShapeType.line:
                    _annoShapeModel.row.Add(OriginalHeight * downPoint.Y / CurrentHeight);
                    _annoShapeModel.col.Add(OriginalWidth * downPoint.X / CurrentWidth);
                    break;

                case ShapeType.polygon:
                    _annoShapeModel.row.Add(OriginalHeight * downPoint.Y / CurrentHeight);
                    _annoShapeModel.col.Add(OriginalWidth * downPoint.X / CurrentWidth);
                    break;
                }
            }
            GC.Collect();
        }
Exemple #2
0
 public int mDecideShapeid()
 {
     if (AnnoShapeModelCollection.Count == 0)
     {
         return(0);
     }
     else
     {
         return(AnnoShapeModelCollection.Max().shapeid + 1);
     }
 }
Exemple #3
0
        public void AnnMouseRightButtonDown(object sender)
        {
            var            menuItem           = (MenuItem)sender;
            var            contextMenu        = (ContextMenu)menuItem.Parent;
            var            item               = (DataGrid)contextMenu.PlacementTarget;
            AnnoShapeModel thisAnnoShapeModel = (AnnoShapeModel)item.SelectedItem;

            if (thisAnnoShapeModel != null)
            {
                CamWindow.ImageCanvas.Children.Remove(thisAnnoShapeModel.Shape);
                AnnoShapeModelCollection.Remove(thisAnnoShapeModel);
            }
        }
Exemple #4
0
        private void DeleteShape(object sender, MouseButtonEventArgs e)
        {
            System.Windows.Shapes.Shape selectedRectangle = sender as System.Windows.Shapes.Shape;


            foreach (AnnoShapeModel shapeModel in AnnoShapeModelCollection)
            {
                if (shapeModel.Shape == selectedRectangle)
                {
                    GetCamWindowView().ImageCanvas.Children.Remove(selectedRectangle);
                    AnnoShapeModelCollection.Remove(shapeModel);
                    break;
                }
            }
        }
Exemple #5
0
        public void MouseDoubleClick(MouseEventArgs e)
        {
            if (_annoShapeModel != null)
            {
                switch (selectedShapeType)
                {
                case ShapeType.line:
                    if (polylineCollection.Count == 2)
                    {
                        polylineCollection.Clear();
                        return;
                    }
                    mRegisterAnnShape(_annoShapeModel);
                    GetCamWindowView().ImageCanvas.Children.Remove(lineShape);
                    polylineCollection.Clear();
                    break;

                case ShapeType.polygon:
                    if (polygonCollection.Count == 2)
                    {
                        polygonCollection.Clear();
                        return;
                    }
                    mRegisterAnnShape(_annoShapeModel);
                    GetCamWindowView().ImageCanvas.Children.Remove(polygonShape);
                    polygonCollection.Clear();
                    break;

                default:
                    return;
                }
                mDrawAnnShapeModel(_annoShapeModel);
                e.Handled = true;
                ShellView.ShapeDataGrid.SelectedIndex = AnnoShapeModelCollection.IndexOf(_annoShapeModel);
                httpRequestClient.addAnnotation(_annoShapeModel);
                _annoShapeModel = null;
            }
        }
Exemple #6
0
 public void mClearAnnShape()
 {
     AnnoShapeModelCollection.Clear();
 }
Exemple #7
0
 public void mRegisterAnnShape(AnnoShapeModel annoShapeModel)
 {
     AnnoShapeModelCollection.Add(annoShapeModel);
 }