public PointD Locate(IFigure owner) { if (owner != null) { PolyLineFigure figure = (PolyLineFigure)owner; return(GetPosition(figure.Points)); } return(new PointD()); }
public PointD Locate(IFigure owner) { if (owner != null) { PolyLineFigure figure = (PolyLineFigure)owner; return(figure.PointAt(_index)); } return(new PointD()); }
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); }
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); }
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); } }
public PolyLineHandle(PolyLineFigure figure, ILocator loc, int index) : base(figure, loc) { Index = index; }
public LineConnectionHandle(PolyLineFigure figure, ILocator loc, int index) : base(figure, loc, index) { }