Community
Participate
Working Groups
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022) Build Identifier: 20090619-0625 I use the method "intersect" method of class "org.eclipse.gmf.runtime.draw2d.ui.geometry.LineSeg" to get the intersection points of connections, in this method the "containsPoint" method will be invoked, if the connection is verg long, the "containsPoint" method will cause a integer overflow error, this is because the connection length is treated as integer. The integer overflow statements are : double lengthOfSegment = Math.sqrt((origin.x - terminus.x)*(origin.x - terminus.x) + (origin.y - terminus.y)*(origin.y - terminus.y)); double lengthFromOriginToPoint = Math.sqrt((origin.x - aPoint.x)*(origin.x - aPoint.x) + (origin.y - aPoint.y)*(origin.y - aPoint.y)); double lengthFromTerminusToPoint = Math.sqrt((terminus.x - aPoint.x)*(terminus.x - aPoint.x) + (terminus.y - aPoint.y)*(terminus.y - aPoint.y)); Reproducible: Always
My suggestion is to use the "getDistance" method from class "Point" to calculation the length of a connection, updated code will be like this: public final boolean containsPoint(final Point aPoint, final int tolerance) { double lengthOfSegment = origin.getDistance(terminus); double lengthFromOriginToPoint = origin.getDistance(aPoint); double lengthFromTerminusToPoint = terminus.getDistance(aPoint); return lengthFromTerminusToPoint + lengthFromOriginToPoint - lengthOfSegment <= tolerance; }
Hi Alex, cab you check this one out? Not sure if this team has the patch / fix we made in Bug 246288
The fix proposed in the comment looks good to me. I'll commit it today/tomorrrow. Do we want to commit this for 2.2.2 or just 2.3 as it stands?
The team requested it go into CVS for Ganymede/3.4.2. So that would be R2_1_maintance, R2_2_maintance and HEAD.
Done, committed for all 3 streams
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug