Exemple #1
0
		private void putEndPointsAtNodeBorders(bool routing, Link orgnLink, Link destLink)
		{
			PointF ptOrg = orgnLink.getInitialPt();
			PointF ptDest = destLink.getInitialPt();

			if (!orgnLink.objsIntersect(destLink))
			{
				// if destination and source do not intersect, use the points
				// where the line connecting their centers crosses their outlines
				if (style == ArrowStyle.Cascading)
					updateEndPtsPrp();
				ptOrg = orgnLink.getIntersection(ptOrg,
					routing ? ptDest : points[1]);
				ptDest = destLink.getIntersection(ptDest,
					routing ? ptOrg : points[points.Count - 2]);
			}
			else
			{
				// if the arrow will be rerouted, choose the closest points on the
				// horizontal line intersections with the node outlines. These points
				// should not be contained within a node
				if (routing)
					chooseRouteOutlinePoints(orgnLink, destLink, ref ptOrg, ref ptDest);
			}

			// snap to nearest anchors
			ptOrg = orgnLink.getNode().getAnchor(
				ptOrg, this, false, ref orgnAnchor);
			ptDest = destLink.getNode().getAnchor(
				ptDest, this, true, ref destAnchor);

			if (style != ArrowStyle.Cascading)
				retain(ptOrg.X - points[0].X, ptOrg.Y - points[0].Y, true);
			points[0] = ptOrg;
			if (style != ArrowStyle.Cascading)
				retain(ptDest.X - points[points.Count - 1].X, ptDest.Y - points[points.Count - 1].Y, false);
			points[points.Count - 1] = ptDest;

			if (style == ArrowStyle.Cascading)
				updateEndPtsPrp();
		}
Exemple #2
0
		private void setEndPoints(Link orgnLink, Link destLink, PointF end)
		{
			reflexive = destLink.sameNode(orgnLink);

			// align the end points of the arrow to the outlines of the connected nodes
			if (orgnLink.calcIntrs())
				ptOrg = points[0] = orgnLink.getInitialPt();
			if (destLink.calcIntrs())
				ptEnd = destLink.getInitialPt();
			else
				ptEnd = end;

			if (!orgnLink.objsIntersect(destLink) && !reflexive)
			{
				if (orgnLink.calcIntrs())
					ptOrg = points[0] = orgnLink.getIntersection(ptOrg, ptEnd);
				if (destLink.calcIntrs())
					ptEnd = destLink.getIntersection(ptEnd, ptOrg);
			}
			else
			{
				// if the arrow will be routed, choose the closest points on the
				// horizontal line intersections with the node outlines. These points
				// should not be contained within a node
				if (autoRoute && !dynamic && orgnAnchor == -1 && destAnchor == -1)
				{
					chooseRouteOutlinePoints(orgnLink, destLink, ref ptOrg, ref ptEnd);
					points[0] = ptOrg;
				}
			}
		}
Exemple #3
0
		internal void setOrgAndDest(Link orgLink, Link trgLink)
		{
			orgnLink = orgLink;
			destLink = trgLink;

			// place the end points of the arrow at their respective object edge
			points[0] = orgnLink.getInitialPt();
			points[points.Count-1] = destLink.getInitialPt();
			if (!orgnLink.objsIntersect(destLink))
			{
				points[0] = orgnLink.getIntersection(points[0], points[points.Count-1]);
				points[points.Count-1] = destLink.getIntersection(points[points.Count-1], points[0]);
			}

			points[0] = orgnLink.getAnchor(points[0], this, false, ref orgnAnchor);
			points[points.Count-1] = destLink.getAnchor(points[points.Count-1], this, true, ref destAnchor);

			// set reflexive arrow position & form
			reflexive = orgnLink.sameNode(destLink);
			if (reflexive)
			{
				setReflexive();
			}
			else
			{
				// compute the arrow points
				updatePoints(points[points.Count-1]);
				if (dynamic)
					updatePosFromOrgAndDest(true);
			}

			rectFromPoints();

			// relative position to nodes
			orgnLink.saveEndRelative();
			destLink.saveEndRelative();

			doRoute();
		}