Beispiel #1
0
        private AnchorLine GetNewAnchorLine()
        {
            var anchorLine = new AnchorLine(new ColorContainer(Color.Black, UpdateBitmapChannel))
            {
                Id = _lastLineId
            };

            _lastLineId++;
            return(anchorLine);
        }
Beispiel #2
0
        private void ResetAnchorLines()
        {
            if (_anchorLines.Any())
            {
                _anchorLines.Clear();
            }

            _lastLineId = 0;

            _activeAnchorLine          = GetNewAnchorLine();
            _activeAnchorLine.IsActive = true;

            _anchorLines.Add(ActiveAnchorLine);
        }
        public void GetBitmap_OneAnchorLine_ThreePoints_RectangleAndEllipseAndCrossAreDrawn()
        {
            var line = new AnchorLine(new ColorContainer(new Color(), null));

            line.Points.AddRange(new List <AnchorPoint>
            {
                new AnchorPoint(new Point(), true, null),
                new AnchorPoint(new Point(), false, null),
                new AnchorPoint(new Point(), false, null)
            });
            _bitmapChannel.AnchorLines = new List <AnchorLine> {
                line
            };
            _bitmapChannel.Curves = new List <Curve>();

            _target.GetBitmap(_bitmapChannel, _graphicsGetter);

            _graphics.AssertWasCalled(x => x.DrawRectangle(new Pen(new Color()), 0, 0, 0, 0), o => o.IgnoreArguments());
            _graphics.AssertWasCalled(x => x.DrawEllipse(new Pen(new Color()), 0, 0, 0, 0), o => o.IgnoreArguments());
            _graphics.AssertWasCalled(x => x.DrawLine(new Pen(new Color()), 0, 0, 0, 0), o => o.IgnoreArguments());
            _graphics.AssertWasCalled(x => x.DrawLine(new Pen(new Color()), 0, 0, 0, 0), o => o.IgnoreArguments());
        }
 private Pen GetPen(AnchorPoint point, AnchorLine line)
 {
     return(line.IsActive
         ? (point.IsActive ? _activePointPen : _passivePointPen)
         : new Pen(line.Color));
 }
 public AnchorPoint Get(Point point, AnchorLine anchorLine)
 {
     return(anchorLine.Points.FirstOrDefault(anchorPoint => Math.Sqrt(Math.Pow(point.X - anchorPoint.Position.X, 2) + Math.Pow(point.Y - anchorPoint.Position.Y, 2)) <= SelectionRadius));
 }