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 85133 Details for
Bug 212460
Request for extra methods on PrecisionRectangle and a fix on PrecisionPoint
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Corrected patch
GEF_PrecisionUtils_Dec12_Corrections (text/plain), 5.66 KB, created by
Alex Boyko
on 2007-12-12 17:14:42 EST
(
hide
)
Description:
Corrected patch
Filename:
MIME Type:
Creator:
Alex Boyko
Created:
2007-12-12 17:14:42 EST
Size:
5.66 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.draw2d >Index: src/org/eclipse/draw2d/geometry/PrecisionPoint.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/plugins/org.eclipse.draw2d/src/org/eclipse/draw2d/geometry/PrecisionPoint.java,v >retrieving revision 1.10 >diff -u -r1.10 PrecisionPoint.java >--- src/org/eclipse/draw2d/geometry/PrecisionPoint.java 30 Mar 2005 21:27:45 -0000 1.10 >+++ src/org/eclipse/draw2d/geometry/PrecisionPoint.java 12 Dec 2007 22:10:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * Copyright (c) 2000, 2007 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,9 +61,9 @@ > * @param y Y value > */ > public PrecisionPoint(double x, double y) { >- super(x, y); > preciseX = x; > preciseY = y; >+ updateInts(); > } > > /** >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.17 >diff -u -r1.17 PrecisionRectangle.java >--- src/org/eclipse/draw2d/geometry/PrecisionRectangle.java 3 Mar 2006 05:06:29 -0000 1.17 >+++ src/org/eclipse/draw2d/geometry/PrecisionRectangle.java 12 Dec 2007 22:10:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2003, 2005 IBM Corporation and others. >+ * Copyright (c) 2003, 2007 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 >@@ -244,4 +244,137 @@ > height = (int)Math.floor(preciseHeight + preciseY + 0.000000001) - y; > } > >+/** >+ * Updates this Rectangle's bounds to the minimum size which can hold both this >+ * Rectangle and the coordinate (x,y). >+ * >+ * @return <code>this</code> for convenience >+ * @param x1 X coordinate >+ * @param y1 Y coordinate >+ * @since 3.3 >+ */ >+public PrecisionRectangle union(double x1, double y1) { >+ if (x1 < preciseX) { >+ preciseWidth += (preciseX - x1); >+ preciseX = x1; >+ } else { >+ double right = preciseX + preciseWidth; >+ if (x1 >= right) { >+ preciseWidth = x1 - preciseX; >+ } >+ } >+ if (y1 < preciseY) { >+ preciseHeight += (preciseY - y1); >+ preciseY = y1; >+ } else { >+ double bottom = preciseY + preciseHeight; >+ if (y1 >= bottom) { >+ bottom = y1 + 1; >+ preciseHeight = y1 - preciseY; >+ } >+ } >+ updateInts(); >+ return this; >+} >+ >+/** >+ * @see org.eclipse.draw2d.geometry.Rectangle#transpose() >+ */ >+public Rectangle transpose() { >+ double temp = preciseX; >+ preciseX = preciseY; >+ preciseY = temp; >+ temp = preciseWidth; >+ preciseWidth = preciseHeight; >+ preciseHeight = temp; >+ super.transpose(); >+ return this; >+} >+ >+/** >+ * @see org.eclipse.draw2d.geometry.Rectangle#setLocation(org.eclipse.draw2d.geometry.Point) >+ */ >+public Rectangle setLocation(Point loc) { >+ if (loc instanceof PrecisionPoint) { >+ PrecisionPoint preciseLoc = (PrecisionPoint) loc; >+ this.preciseX = preciseLoc.preciseX; >+ this.preciseY = preciseLoc.preciseY; >+ updateInts(); >+ return this; >+ } else { >+ return super.setLocation(loc); >+ } >+} >+ >+/** >+ * Returns the precise geometric centre of the rectangle >+ * >+ * @return <code>PrecisionPoint</code> geometric center of the rectangle >+ * @since 3.3 >+ */ >+public PrecisionPoint getPreciseCenter() { >+ return new PrecisionPoint(preciseX + preciseWidth / 2.0, preciseY + preciseHeight / 2.0); >+} >+ >+/** >+ * Shrinks the sides of this Rectangle by the horizontal and vertical values >+ * provided as input, and returns this Rectangle for convenience. The center of >+ * this Rectangle is kept constant. >+ * >+ * @param h Horizontal reduction amount >+ * @param v Vertical reduction amount >+ * @return <code>this</code> for convenience >+ * @since 3.3 >+ */ >+public Rectangle shrink(double h, double v) { >+ preciseX += h; >+ preciseWidth -= (h + h); >+ preciseY += v; >+ preciseHeight -= (v + v); >+ updateInts(); >+ return this; >+} >+ >+/** >+ * Expands the horizontal and vertical sides of this Rectangle with the values >+ * provided as input, and returns this for convenience. The location of its >+ * center is kept constant. >+ * >+ * @param h Horizontal increment >+ * @param v Vertical increment >+ * @return <code>this</code> for convenience >+ * @since 3.3 >+ */ >+public Rectangle expand(double h, double v) { >+ return shrink(-h, -v); >+} >+ >+public Rectangle shrink(int h, int v) { >+ return shrink((double)h, (double)v); >+} >+ >+/** >+ * Determines whether an (x,y) coordinates is contained within the rectangle >+ * >+ * @param x x coordinate >+ * @param y y coordinate >+ * @return <code>true</code> if coordinate (x,y) is contained within the rectangle >+ * @since 3.3 >+ */ >+public boolean contains(double x, double y) { >+ return preciseX <= x && x <= preciseX + preciseWidth >+ && preciseY <= y && y <= preciseY + preciseHeight; >+} >+ >+/** >+ * @see org.eclipse.draw2d.geometry.Rectangle#contains(org.eclipse.draw2d.geometry.Point) >+ */ >+public boolean contains(Point p) { >+ if (p instanceof PrecisionPoint) { >+ PrecisionPoint pt = (PrecisionPoint)p; >+ return contains(pt.preciseX, pt.preciseY); >+ } >+ return super.contains(p); >+} >+ > }
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
Actions:
View
|
Diff
Attachments on
bug 212460
:
84900
|
85011
|
85133
|
85304
|
85466
|
86005