Beispiel #1
0
        private bool PickEdge(TWire edge, Point p, Graphics g)
        {
            ElementTypeInfo fromInfo  = GetElementTypeInfo(edge.FromNode, g);
            TPin            inputPin  = edge.ToRoute;
            TPin            outputPin = edge.FromRoute;

            Point p1 = edge.FromNode.Bounds.Location;
            int   x1 = p1.X + fromInfo.Size.Width;
            int   y1 = p1.Y + GetPinOffset(outputPin.Index);

            Point p2 = edge.ToNode.Bounds.Location;
            int   x2 = p2.X;
            int   y2 = p2.Y + GetPinOffset(inputPin.Index);

            int tanLen = GetTangentLength(x1, x2);

            BezierCurve2F curve = new BezierCurve2F(
                new Vec2F(x1, y1),
                new Vec2F(x1 + tanLen, y1),
                new Vec2F(x2 - tanLen, y2),
                new Vec2F(x2, y2));

            Vec2F hitPoint = new Vec2F();

            return(BezierCurve2F.Pick(curve, new Vec2F(p.X, p.Y), m_theme.PickTolerance, ref hitPoint));
        }
Beispiel #2
0
        private bool Pick(TEdge edge, Vec2F v)
        {
            int tolerance = m_theme.PickTolerance;

            Point p1, p2, p3, p4;

            GetTransitionPoints(edge, out p1, out p2, out p3, out p4);

            // check for hit on transition, away from endpoints
            BezierCurve2F curve    = new BezierCurve2F(p1, p2, p3, p4);
            Vec2F         hitPoint = new Vec2F();

            return(BezierCurve2F.Pick(curve, v, m_theme.PickTolerance, ref hitPoint));
        }