Exemplo n.º 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);

                    httpRequestClient.addAnnotation(_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);

                    httpRequestClient.addAnnotation(_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();
        }