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 35562 Details for
Bug 129864
PrecisionRectangle should either override crop or implement 'preciseCrop'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for PrecisionRectangle
129864.txt (text/plain), 3.29 KB, created by
Steven R. Shaw
on 2006-03-01 16:16:06 EST
(
hide
)
Description:
patch for PrecisionRectangle
Filename:
MIME Type:
Creator:
Steven R. Shaw
Created:
2006-03-01 16:16:06 EST
Size:
3.29 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.draw2d >Index: src/org/eclipse/draw2d/geometry/PrecisionRectangle.java >=================================================================== >RCS file: /home/tools/org.eclipse.draw2d/src/org/eclipse/draw2d/geometry/PrecisionRectangle.java,v >retrieving revision 1.15 >diff -u -r1.15 PrecisionRectangle.java >--- src/org/eclipse/draw2d/geometry/PrecisionRectangle.java 3 Jun 2005 20:24:42 -0000 1.15 >+++ src/org/eclipse/draw2d/geometry/PrecisionRectangle.java 1 Mar 2006 21:16:10 -0000 >@@ -77,6 +77,35 @@ > } > > /** >+ * @see org.eclipse.draw2d.geometry.Rectangle#crop(org.eclipse.draw2d.geometry.Insets) >+ */ >+public Rectangle crop(Insets insets) { >+ if (insets == null) >+ return this; >+ setX(preciseX + insets.left); >+ setY(preciseY += insets.top); >+ setWidth(preciseWidth - (insets.getWidth())); >+ setHeight(preciseHeight -= (insets.getHeight())); >+ >+ return this; >+} >+ >+/** >+ * @see org.eclipse.draw2d.geometry.Rectangle#equals(java.lang.Object) >+ */ >+public boolean equals(Object o) { >+ if (o instanceof PrecisionRectangle) { >+ PrecisionRectangle pr = (PrecisionRectangle)o; >+ return pr.preciseX == preciseX && >+ pr.preciseY == preciseY && >+ pr.preciseX == preciseY && >+ pr.preciseY == preciseY; >+ } >+ >+ return super.equals(o); >+} >+ >+/** > * @see org.eclipse.draw2d.geometry.Rectangle#performScale(double) > */ > public void performScale(double factor) { >#P org.eclipse.draw2d.test >Index: src/org/eclipse/draw2d/test/PrecisionRectangleTest.java >=================================================================== >RCS file: src/org/eclipse/draw2d/test/PrecisionRectangleTest.java >diff -N src/org/eclipse/draw2d/test/PrecisionRectangleTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/draw2d/test/PrecisionRectangleTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,39 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.draw2d.test; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.draw2d.geometry.Insets; >+import org.eclipse.draw2d.geometry.PrecisionRectangle; >+import org.eclipse.draw2d.geometry.Rectangle; >+ >+/** >+ * @author sshaw >+ * >+ */ >+public class PrecisionRectangleTest extends TestCase { >+ >+ public void testCrop() { >+ Insets insets = new Insets (2, 2, 2, 2); >+ >+ PrecisionRectangle prect = new PrecisionRectangle(new Rectangle(100, 100, 250, 250)); >+ PrecisionRectangle copy = prect.getPreciseCopy (); >+ prect.performTranslate(30, 30); >+ prect.performScale(2f); >+ prect.crop (insets); >+ prect.performScale(1/2f); >+ prect.performTranslate(-30, -30); >+ >+ assertTrue(!prect.equals (copy)); >+ } >+}
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 129864
: 35562