Example #1
0
        //
        // Find the intersection points between this conenction and that; 2 points may result. (2 with arc / segment)
        //
        public void FindIntersection(List <Point> figurePoints, Connection that, out Point pt1, out Point pt2)
        {
            if (that.type == ConnectionType.ARC)
            {
                this.segmentOrArc.FindIntersection(that.segmentOrArc as Arc, out pt1, out pt2);
            }
            else
            {
                this.segmentOrArc.FindIntersection(that.segmentOrArc as Segment, out pt1, out pt2);
            }

            Segment thatSeg = that.segmentOrArc as Segment;
            Arc     thatArc = that.segmentOrArc as Arc;

            Segment thisSeg = this.segmentOrArc as Segment;
            Arc     thisArc = this.segmentOrArc as Arc;

            //
            // Normalize the points to the points in the drawing.
            //
            if (thisSeg != null && thatSeg != null)
            {
                pt1 = Utilities.AcquireRestrictedPoint(figurePoints, pt1, thisSeg, thatSeg);
                pt2 = Utilities.AcquireRestrictedPoint(figurePoints, pt2, thisSeg, thatSeg);
            }
            else if (thisSeg != null && thatArc != null)
            {
                pt1 = Utilities.AcquireRestrictedPoint(figurePoints, pt1, thisSeg, thatArc);
                pt2 = Utilities.AcquireRestrictedPoint(figurePoints, pt2, thisSeg, thatArc);
            }
            else if (thisArc != null && thatSeg != null)
            {
                pt1 = Utilities.AcquireRestrictedPoint(figurePoints, pt1, thatSeg, thisArc);
                pt2 = Utilities.AcquireRestrictedPoint(figurePoints, pt2, thatSeg, thisArc);
            }
            else if (thisArc != null && thatArc != null)
            {
                pt1 = Utilities.AcquireRestrictedPoint(figurePoints, pt1, thisArc, thatArc);
                pt2 = Utilities.AcquireRestrictedPoint(figurePoints, pt2, thisArc, thatArc);
            }
        }