Exemple #1
0
        private void PointInternal(IToolContext context, double x, double y, Modifier modifier)
        {
            Filters?.Any(f => f.Process(context, ref x, ref y));

            CurrentState = State.StartPoint;

            context.Renderer.SelectedShapes.Remove(_line.StartPoint);
            context.Renderer.SelectedShapes.Remove(_line.Point);
            context.WorkingContainer.Shapes.Remove(_line);

            _line.Point = context.GetNextPoint(x, y, Settings?.ConnectPoints ?? false, Settings?.HitTestRadius ?? 0.0);

            Intersections?.ForEach(i => i.Clear(context));
            Intersections?.ForEach(i => i.Find(context, _line));

            if ((Settings?.SplitIntersections ?? false) && (Intersections?.Any(i => i.Intersections.Count > 0) ?? false))
            {
                LineHelper.SplitByIntersections(context, Intersections, _line);
            }
            else
            {
                context.CurrentContainer.Shapes.Add(_line);
            }

            _line = null;

            Intersections?.ForEach(i => i.Clear(context));
            Filters?.ForEach(f => f.Clear(context));

            context.Release?.Invoke();
            context.Invalidate?.Invoke();
        }
Exemple #2
0
        private void PointInternal(IToolContext context, double x, double y, Modifier modifier)
        {
            Filters?.Any(f => f.Process(context, ref x, ref y));

            context.Renderer.SelectedShapes.Remove(_line.Point);
            _line.Point = context.GetNextPoint(x, y, Settings?.ConnectPoints ?? false, Settings?.HitTestRadius ?? 7.0);
            _points[_points.Count - 1] = _line.Point;

            if (!context.Renderer.SelectedShapes.Contains(_line.Point))
            {
                context.Renderer.SelectedShapes.Add(_line.Point);
            }

            context.WorkingContainer.Shapes.Remove(_line);
            context.CurrentContainer.Shapes.Add(_line);

            _line = new LineShape()
            {
                StartPoint = _points.Last(),
                Point      = context.GetNextPoint(x, y, false, 0.0),
                Style      = context.CurrentStyle
            };
            _points.Add(_line.Point);
            context.WorkingContainer.Shapes.Add(_line);
            context.Renderer.SelectedShapes.Add(_line.Point);

            Intersections?.ForEach(i => i.Clear(context));
            Filters?.ForEach(f => f.Clear(context));

            context.Invalidate?.Invoke();
        }
Exemple #3
0
        private void MovePointInternal(IToolContext context, double x, double y, Modifier modifier)
        {
            Filters?.ForEach(f => f.Clear(context));
            Filters?.Any(f => f.Process(context, ref x, ref y));

            _line.Point.X = x;
            _line.Point.Y = y;

            Intersections?.ForEach(i => i.Clear(context));
            Intersections?.ForEach(i => i.Find(context, _line));

            context.Invalidate?.Invoke();
        }
Exemple #4
0
        private void CleanInternal(IToolContext context)
        {
            Intersections?.ForEach(i => i.Clear(context));
            Filters?.ForEach(f => f.Clear(context));

            CurrentState = State.StartPoint;

            if (_line != null)
            {
                context.WorkingContainer.Shapes.Remove(_line);
                context.Renderer.SelectedShapes.Remove(_line.StartPoint);
                context.Renderer.SelectedShapes.Remove(_line.Point);
                _line = null;
            }

            context.Release?.Invoke();
            context.Invalidate?.Invoke();
        }