예제 #1
0
 protected override void OnMouseDown(MouseButtonEventArgs e)
 {
     base.OnMouseDown(e);
     if (IsRectangleConditionOk(e))
     {
         _buffPoint      = e.GetPosition(this);
         _buffRoiControl = default;
     }
 }
예제 #2
0
 protected override void OnMouseMove(MouseEventArgs e)
 {
     base.OnMouseMove(e);
     if (IsRectangleConditionOk(e))
     {
         Point  position = e.GetPosition(this);
         Vector vector   = position - _buffPoint;
         var    rect     = new Rect(_buffPoint, vector);
         (double x, double y, double width, double height) =
             rect.GetPositionAndSize();
         if (_buffRoiControl == null)
         {
             _buffRoiControl = new RectangleRoiControl(x, y, width, height);
             _imageViewer.AddRoi(_buffRoiControl);
         }
         RectangleRoiControl rectangleRoiControl = Children
                                                   .OfType <RectangleRoiControl>()
                                                   .Single(roi => roi == _buffRoiControl);
         rectangleRoiControl.SetPositionAndSize(x, y, width, height);
     }
 }
예제 #3
0
 public static AdornerLayer GetAdornerLayer(this RoiControl roiControl)
 {
     return(AdornerLayer.GetAdornerLayer(roiControl));
 }