protected override Roi CreateRoiFromGraphic(IOverlayGraphicsProvider overlayGraphics, RectangleF shapeData)
        {
            EllipsePrimitive graphic = new EllipsePrimitive();

            overlayGraphics.OverlayGraphics.Add(graphic);
            graphic.CoordinateSystem = CoordinateSystem.Source;
            graphic.TopLeft          = shapeData.Location;
            graphic.BottomRight      = shapeData.Location + shapeData.Size;
            graphic.ResetCoordinateSystem();
            return(graphic.GetRoi());
        }
        private GeometricShutter ConvertToGeometricShutter()
        {
            GeometricShutter shutter;

            if (_selectedShutterType == ShutterType.Rectangle)
            {
                RectanglePrimitive primitive = (RectanglePrimitive)_primitiveGraphic;
                primitive.CoordinateSystem = CoordinateSystem.Source;
                Rectangle rectangle =
                    new Rectangle((int)primitive.TopLeft.X, (int)primitive.TopLeft.Y, (int)primitive.Width, (int)primitive.Height);
                primitive.ResetCoordinateSystem();

                shutter = new RectangularShutter(rectangle);
            }
            else if (_selectedShutterType == ShutterType.Polygon)
            {
                PolylineGraphic polyLine = (PolylineGraphic)_primitiveGraphic;
                polyLine.CoordinateSystem = CoordinateSystem.Source;

                List <Point> points = new List <Point>();
                for (int i = 0; i < polyLine.Points.Count; ++i)
                {
                    points.Add(new Point((int)polyLine.Points[i].X, (int)polyLine.Points[i].Y));
                }

                polyLine.ResetCoordinateSystem();
                shutter = new PolygonalShutter(points);
            }
            else
            {
                EllipsePrimitive primitive = (EllipsePrimitive)_primitiveGraphic;
                primitive.CoordinateSystem = CoordinateSystem.Source;
                Rectangle rectangle = new Rectangle((int)primitive.TopLeft.X, (int)primitive.TopLeft.Y, (int)primitive.Width, (int)primitive.Height);
                rectangle = RectangleUtilities.ConvertToPositiveRectangle(rectangle);
                int   radius = rectangle.Width / 2;
                Point center = new Point(rectangle.X + radius, rectangle.Y + radius);
                primitive.ResetCoordinateSystem();

                shutter = new CircularShutter(center, radius);
            }

            RemoveDrawShutterGraphic();
            return(shutter);
        }