Beispiel #1
0
        public PointD Locate(IFigure owner)
        {
            if (owner != null)
            {
                PolyLineFigure figure = (PolyLineFigure)owner;
                return(GetPosition(figure.Points));
            }

            return(new PointD());
        }
Beispiel #2
0
        public PointD Locate(IFigure owner)
        {
            if (owner != null)
            {
                PolyLineFigure figure = (PolyLineFigure)owner;
                return(figure.PointAt(_index));
            }

            return(new PointD());
        }
Beispiel #3
0
        public override void InvokeEnd(double x, double y, IDrawingView view)
        {
            PolyLineFigure figure = ((PolyLineFigure)Owner);

            // eliminates handles in the middle of a straight line
            if (figure.PointCount > 2 && Index != 0 && Index != (figure.PointCount - 1))
            {
                PointD p1 = figure.PointAt(Index - 1);
                PointD p2 = figure.PointAt(Index + 1);
                if (Geometry.LineContainsPoint(p1.X, p1.Y, p2.X, p2.Y, x, y))
                {
                    figure.RemovePointAt(Index);
                }
            }
            base.InvokeEnd(x, y, view);
        }
Beispiel #4
0
        public override void InvokeEnd(MouseEvent ev)
        {
            PolyLineFigure figure = ((PolyLineFigure)Owner);

            // eliminates handles in the middle of a straight line
            if (figure.PointCount > 2 && Index != 0 && Index != (figure.PointCount - 1))
            {
                PointD p1 = figure.PointAt(Index - 1);
                PointD p2 = figure.PointAt(Index + 1);
                if (Geometry.LineContainsPoint(p1.X, p1.Y, p2.X, p2.Y, ev.X, ev.Y))
                {
                    figure.RemovePointAt(Index);
                }
            }
            base.InvokeEnd(ev);
        }
Beispiel #5
0
        public override void MouseDown(MouseEvent ev)
        {
            SetAnchorCoords(ev.X, ev.Y);
            IDrawingView view = ev.View;

            View = view;

            Gdk.EventType type = ev.GdkEvent.Type;
            if (type == EventType.TwoButtonPress)
            {
                PolyLineFigure connection = (PolyLineFigure)Figure;
                connection.SplitSegment(ev.X, ev.Y);
                view.ClearSelection();
                view.AddToSelection(Figure);
                _handle = view.FindHandle(ev.X, ev.Y) as PolyLineHandle;
                ((Gtk.Widget)view).GdkWindow.Cursor = _handle.CreateCursor();
                _handle.InvokeStart(ev.X, ev.Y, ev.View);
                CreateUndoActivity();
            }
            else
            {
                DefaultTool.MouseDown(ev);
            }
        }
Beispiel #6
0
 public PolyLineHandle(PolyLineFigure figure, ILocator loc, int index) : base(figure, loc)
 {
     Index = index;
 }
Beispiel #7
0
 public LineConnectionHandle(PolyLineFigure figure, ILocator loc, int index) : base(figure, loc, index)
 {
 }