[commit] r2450 - trunk/GME/Gme

GMESRC Repository Notifications gme-commit at list.isis.vanderbilt.edu
Wed Feb 26 17:03:02 CST 2014


Author: ksmyth
Date: Wed Feb 26 17:03:01 2014
New Revision: 2450

Log:
Render connection bends better. GME-419

Modified:
   trunk/GME/Gme/GraphicsUtil.cpp

Modified: trunk/GME/Gme/GraphicsUtil.cpp
==============================================================================
--- trunk/GME/Gme/GraphicsUtil.cpp	Wed Feb 26 17:02:51 2014	(r2449)
+++ trunk/GME/Gme/GraphicsUtil.cpp	Wed Feb 26 17:03:01 2014	(r2450)
@@ -351,7 +351,26 @@
 					pen = GetGdipPen(gdip, color, isPrinting, lineType, isViewMagnified, width);
 				}
 			}
-			gdip->DrawLine(pen, last.x, last.y, pt.x, pt.y);
+			if (currEdgeIndex == points.GetSize()-2 /* -2: pt is the second item when currEdgeIndex==0 */)
+			{
+				gdip->DrawLine(pen, last.x, last.y, pt.x, pt.y);
+			}
+			else
+			{
+				using Gdiplus::REAL;
+				using Gdiplus::PointF;
+				PointF flast((REAL)last.x, (REAL)last.y);
+				PointF fpt((REAL)pt.x, (REAL)pt.y);
+				if (last.x == pt.x)
+				{
+					fpt.Y += (REAL)width / 2 * ((flast.Y < fpt.Y) ? 1 : -1);
+				}
+				else if (last.y == pt.y)
+				{
+					fpt.X += (REAL)width / 2 * ((flast.X < fpt.X) ? 1 : -1);
+				}
+				gdip->DrawLine(pen, flast, fpt);
+			}
 			if (drawBullets && currEdgeIndex < numEdges - 1)
 				gdip->FillEllipse(bulletBrush, pt.x - bulletOffset, pt.y - bulletOffset, bulletRadius, bulletRadius);
 			beforeLast = last;


More information about the gme-commit mailing list