Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 93877 Details for
Bug 224468
Request: Draw2D enhancements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch
Layout_GEF_Mar27 (text/plain), 9.48 KB, created by
Alex Boyko
on 2008-03-27 17:05:44 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Alex Boyko
Created:
2008-03-27 17:05:44 EDT
Size:
9.48 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.draw2d >Index: src/org/eclipse/draw2d/graph/PopulateRanks.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/graph/PopulateRanks.java,v >retrieving revision 1.1 >diff -u -r1.1 PopulateRanks.java >--- src/org/eclipse/draw2d/graph/PopulateRanks.java 14 Feb 2006 20:19:44 -0000 1.1 >+++ src/org/eclipse/draw2d/graph/PopulateRanks.java 27 Mar 2008 21:04:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2005 IBM Corporation and others. >+ * Copyright (c) 2003, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -61,10 +61,10 @@ > Node prev = null, cur; > for (int n = 0; n < rank.size(); n++) { > cur = rank.getNode(n); >- if (cur instanceof VirtualNode) >- ((VirtualNode)cur).left = prev; >- if (prev instanceof VirtualNode) >- ((VirtualNode)prev).right = cur; >+ cur.left = prev; >+ if (prev != null) { >+ prev.right = cur; >+ } > prev = cur; > } > } >Index: src/org/eclipse/draw2d/graph/VirtualNode.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/graph/VirtualNode.java,v >retrieving revision 1.13 >diff -u -r1.13 VirtualNode.java >--- src/org/eclipse/draw2d/graph/VirtualNode.java 14 Feb 2006 20:19:44 -0000 1.13 >+++ src/org/eclipse/draw2d/graph/VirtualNode.java 27 Mar 2008 21:04:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2005 IBM Corporation and others. >+ * Copyright (c) 2003, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -19,8 +19,6 @@ > */ > public class VirtualNode extends Node { > >-Node left, right; >- > /** > * The next node. > */ >Index: src/org/eclipse/draw2d/graph/TransposeMetrics.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/graph/TransposeMetrics.java,v >retrieving revision 1.1 >diff -u -r1.1 TransposeMetrics.java >--- src/org/eclipse/draw2d/graph/TransposeMetrics.java 14 Feb 2006 20:19:44 -0000 1.1 >+++ src/org/eclipse/draw2d/graph/TransposeMetrics.java 27 Mar 2008 21:04:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -65,6 +65,9 @@ > temp = vnode.y; > vnode.y = vnode.x; > vnode.x = temp; >+ temp = vnode.width; >+ vnode.width = vnode.height; >+ vnode.height = temp; > } > } > g.size.transpose(); >Index: src/org/eclipse/draw2d/graph/Node.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/graph/Node.java,v >retrieving revision 1.11 >diff -u -r1.11 Node.java >--- src/org/eclipse/draw2d/graph/Node.java 15 Feb 2006 22:22:51 -0000 1.11 >+++ src/org/eclipse/draw2d/graph/Node.java 27 Mar 2008 21:04:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2005 IBM Corporation and others. >+ * Copyright (c) 2003, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -46,6 +46,8 @@ > * @since 2.1.2 > */ > public class Node { >+ >+Node left, right; > > Object workingData[] = new Object[3]; > int workingInts[] = new int[4]; >@@ -295,4 +297,22 @@ > }; > } > >+/** >+ * Returns a reference to a node located left from this one >+ * @return <code>Node</code> on the left from this one >+ * @since 3.4 >+ */ >+public Node getLeft() { >+ return left; >+} >+ >+/** >+ * Returns a reference to a node located right from this one >+ * @return <code>Node</code> on the right from this one >+ * @since 3.4 >+ */ >+public Node getRight() { >+ return right; >+} >+ > } >Index: src/org/eclipse/draw2d/geometry/PrecisionRectangle.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/geometry/PrecisionRectangle.java,v >retrieving revision 1.18 >diff -u -r1.18 PrecisionRectangle.java >--- src/org/eclipse/draw2d/geometry/PrecisionRectangle.java 2 Jan 2008 18:51:55 -0000 1.18 >+++ src/org/eclipse/draw2d/geometry/PrecisionRectangle.java 27 Mar 2008 21:04:29 -0000 >@@ -376,4 +376,13 @@ > return preciseHeight; > } > >+/** >+ * @see org.eclipse.draw2d.geometry.Rectangle#setSize(org.eclipse.draw2d.geometry.Dimension) >+ */ >+public Rectangle setSize(Dimension d) { >+ preciseWidth = d.preciseWidth(); >+ preciseHeight = d.preciseHeight(); >+ return super.setSize(d); >+} >+ > } >Index: src/org/eclipse/draw2d/geometry/Geometry.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/geometry/Geometry.java,v >retrieving revision 1.3 >diff -u -r1.3 Geometry.java >--- src/org/eclipse/draw2d/geometry/Geometry.java 24 May 2005 22:47:57 -0000 1.3 >+++ src/org/eclipse/draw2d/geometry/Geometry.java 27 Mar 2008 21:04:29 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2005 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -41,26 +41,33 @@ > * Given the segments: u-------v. s-------t. If s->t is inside the triangle u-v-s, > * then check whether the line u->u splits the line s->t. > */ >- int usX = ux - sx; >- int usY = uy - sy; >- int vsX = vx - sx; >- int vsY = vy - sy; >- int stX = sx - tx; >- int stY = sy - ty; >- long product = cross(vsX, vsY, stX, stY) * cross(stX, stY, usX, usY); >- if (product >= 0) { >- int vuX = vx - ux; >- int vuY = vy - uy; >- int utX = ux - tx; >- int utY = uy - ty; >- product = cross(-usX, -usY, vuX, vuY) * cross(vuX, vuY, utX, utY); >- boolean intersects = product <= 0; >- return intersects; >+ /* Values are casted to long to avoid integer overflows */ >+ long usX = (long) ux - sx; >+ long usY = (long) uy - sy; >+ long vsX = (long) vx - sx; >+ long vsY = (long) vy - sy; >+ long stX = (long) sx - tx; >+ long stY = (long) sy - ty; >+ if (productSign(cross(vsX, vsY, stX, stY), cross(stX, stY, usX, usY)) >= 0) { >+ long vuX = (long) vx - ux; >+ long vuY = (long) vy - uy; >+ long utX = (long) ux - tx; >+ long utY = (long) uy - ty; >+ return productSign(cross(-usX, -usY, vuX, vuY), cross(vuX, vuY, utX, utY)) <= 0; > } > return false; > } > >-private static long cross(int x1, int y1, int x2, int y2) { >+private static int productSign(long x, long y) { >+ if (x == 0 || y == 0) { >+ return 0; >+ } else if (x < 0 ^ y < 0) { >+ return -1; >+ } >+ return 1; >+} >+ >+private static long cross(long x1, long y1, long x2, long y2) { > return x1 * y2 - x2 * y1; > } > >Index: src/org/eclipse/draw2d/geometry/Point.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/geometry/Point.java,v >retrieving revision 1.10 >diff -u -r1.10 Point.java >--- src/org/eclipse/draw2d/geometry/Point.java 2 Jan 2008 18:51:55 -0000 1.10 >+++ src/org/eclipse/draw2d/geometry/Point.java 27 Mar 2008 21:04:29 -0000 >@@ -118,7 +118,7 @@ > * @since 2.0 > */ > public double getDistance(Point pt) { >- return Math.sqrt(getDistance2(pt)); >+ return Math.sqrt(getPreciseDistance2(pt)); > } > > /** >@@ -138,6 +138,12 @@ > return (int)result; > } > >+private double getPreciseDistance2(Point pt) { >+ double i = pt.preciseX() - preciseX(); >+ double j = pt.preciseY() - preciseY(); >+ return i * i + j * j; >+} >+ > /** > * Calculates the orthogonal distance to the specified point. The orthogonal distance is > * the sum of the horizontal and vertical differences. >#P org.eclipse.draw2d.examples >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/examples/org.eclipse.draw2d.examples/META-INF/MANIFEST.MF,v >retrieving revision 1.6 >diff -u -r1.6 MANIFEST.MF >--- META-INF/MANIFEST.MF 26 Feb 2008 15:34:29 -0000 1.6 >+++ META-INF/MANIFEST.MF 27 Mar 2008 21:04:29 -0000 >@@ -7,4 +7,5 @@ > Require-Bundle: org.eclipse.draw2d;bundle-version="[3.2.0,4.0.0)" > Bundle-Vendor: %Plugin.providerName > Bundle-RequiredExecutionEnvironment: J2SE-1.4 >+Export-Package: org.eclipse.draw2d.examples.graph >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
ahunter.eclipse
:
iplog+
aboyko
:
review?
Actions:
View
|
Diff
Attachments on
bug 224468
: 93877