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 56006 Details for
Bug 120411
SnapToGeometry.THRESHOLD should be retrieved via accessor method
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]
added getThreshold / setThreshold
threshold patch.txt (text/plain), 5.34 KB, created by
Chris Lee
on 2006-12-20 17:54:10 EST
(
hide
)
Description:
added getThreshold / setThreshold
Filename:
MIME Type:
Creator:
Chris Lee
Created:
2006-12-20 17:54:10 EST
Size:
5.34 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gef >Index: src/org/eclipse/gef/SnapToGeometry.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.gef/src/org/eclipse/gef/SnapToGeometry.java,v >retrieving revision 1.37 >diff -u -r1.37 SnapToGeometry.java >--- src/org/eclipse/gef/SnapToGeometry.java 8 Dec 2005 18:46:04 -0000 1.37 >+++ src/org/eclipse/gef/SnapToGeometry.java 20 Dec 2006 22:46:55 -0000 >@@ -134,6 +134,8 @@ > */ > protected static final double THRESHOLD = 5.0001; > >+private double threshold = THRESHOLD; >+ > boolean cachedCloneBool; > > /** >@@ -165,6 +167,29 @@ > } > > /** >+ * The sensitivity of the snapping. Corrections greater than this value will not occur. >+ * >+ * @return the snapping threshold >+ * @since 3.2 >+ */ >+public double getThreshold () >+{ >+ return threshold; >+} >+ >+/** >+ * Sets the sensitivity of the snapping >+ * >+ * @see #getThreshold() >+ * @param newThreshold the new snapping threshold >+ * @since 3.2 >+ */ >+public void setThreshold (double newThreshold) >+{ >+ threshold = newThreshold; >+} >+ >+/** > * Generates a list of parts which should be snapped to. The list is the original > * children, minus the given exclusions, minus and children whose figures are not visible. > * @since 3.0 >@@ -196,7 +221,7 @@ > * @param vert <code>true</code> if the correction is vertical > * @param near the left/top side of the rectangle > * @param far the right/bottom side of the rectangle >- * @return the correction amount or THRESHOLD if no correction was made >+ * @return the correction amount or #getThreshold () if no correction was made > */ > protected double getCorrectionFor(Entry entries[], Map extendedData, boolean vert, > double near, double far) { >@@ -208,27 +233,27 @@ > if ((int)(near - far) % 2 != 0) > total -= 1.0; > double result = getCorrectionFor(entries, extendedData, vert, total / 2, 0); >- if (result == THRESHOLD) >+ if (result == getThreshold ()) > result = getCorrectionFor(entries, extendedData, vert, near, -1); >- if (result == THRESHOLD) >+ if (result == getThreshold ()) > result = getCorrectionFor(entries, extendedData, vert, far, 1); > return result; > } > > /** >- * Returns the correction value between ± {@link #THRESHOLD}, or the THRESHOLD if no >+ * Returns the correction value between ± {@link #getThreshold ()}, or the #getThreshold () if no > * corrections were found. > * @param entries the entries > * @param extendedData the map for setting values > * @param vert <code>true</code> if vertical > * @param value the value being corrected > * @param side which sides should be considered >- * @return the correction or THRESHOLD if no correction was made >+ * @return the correction or #getThreshold () if no correction was made > */ > protected double getCorrectionFor(Entry entries[], Map extendedData, boolean vert, > double value, int side) { >- double resultMag = THRESHOLD; >- double result = THRESHOLD; >+ double resultMag = getThreshold (); >+ double result = getThreshold (); > > String property; > if (side == -1) >@@ -322,20 +347,20 @@ > } > > if ((snapOrientation & HORIZONTAL) != 0) { >- double xcorrect = THRESHOLD; >+ double xcorrect = getThreshold (); > xcorrect = getCorrectionFor(cols, request.getExtendedData(), true, > baseRect.preciseX, baseRect.preciseRight()); >- if (xcorrect != THRESHOLD) { >+ if (xcorrect != getThreshold ()) { > snapOrientation &= ~HORIZONTAL; > correction.preciseX += xcorrect; > } > } > > if ((snapOrientation & VERTICAL) != 0) { >- double ycorrect = THRESHOLD; >+ double ycorrect = getThreshold (); > ycorrect = getCorrectionFor(rows, request.getExtendedData(), false, > baseRect.preciseY, baseRect.preciseBottom()); >- if (ycorrect != THRESHOLD) { >+ if (ycorrect != getThreshold ()) { > snapOrientation &= ~VERTICAL; > correction.preciseY += ycorrect; > } >@@ -344,7 +369,7 @@ > if ((snapOrientation & EAST) != 0) { > double rightCorrection = getCorrectionFor(cols, request.getExtendedData(), > true, baseRect.preciseRight() - 1, 1); >- if (rightCorrection != THRESHOLD) { >+ if (rightCorrection != getThreshold ()) { > snapOrientation &= ~EAST; > correction.preciseWidth += rightCorrection; > } >@@ -353,7 +378,7 @@ > if ((snapOrientation & WEST) != 0) { > double leftCorrection = getCorrectionFor(cols, request.getExtendedData(), > true, baseRect.preciseX, -1); >- if (leftCorrection != THRESHOLD) { >+ if (leftCorrection != getThreshold ()) { > snapOrientation &= ~WEST; > correction.preciseWidth -= leftCorrection; > correction.preciseX += leftCorrection; >@@ -363,7 +388,7 @@ > if ((snapOrientation & SOUTH) != 0) { > double bottom = getCorrectionFor(rows, request.getExtendedData(), false, > baseRect.preciseBottom() - 1, 1); >- if (bottom != THRESHOLD) { >+ if (bottom != getThreshold ()) { > snapOrientation &= ~SOUTH; > correction.preciseHeight += bottom; > } >@@ -372,7 +397,7 @@ > if ((snapOrientation & NORTH) != 0) { > double topCorrection = getCorrectionFor(rows, request.getExtendedData(), > false, baseRect.preciseY, -1); >- if (topCorrection != THRESHOLD) { >+ if (topCorrection != getThreshold ()) { > snapOrientation &= ~NORTH; > correction.preciseHeight -= topCorrection; > correction.preciseY += topCorrection;
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:
nyssen
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 120411
:
31761
| 56006