Java Code Examples for org.eclipse.draw2d.geometry.Point#preciseX()
The following examples show how to use
org.eclipse.draw2d.geometry.Point#preciseX() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AdjustIdentityAnchorCommand.java From statecharts with Eclipse Public License 1.0 | 5 votes |
private double computeNewXRelativeLocation(int direction, Point currentRelativePoint, double logicalWidthDelta) { if (direction == PositionConstants.NORTH_WEST || direction == PositionConstants.WEST || direction == PositionConstants.SOUTH_WEST) { return currentRelativePoint.preciseX() + logicalWidthDelta; } else { return currentRelativePoint.preciseX(); } }
Example 2
Source File: RelativeBendpointUtil.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public void forceLocation(Connection conn, RelativeBendpoint relbp, double locX, double locY) { float w = 0; Dimension d2 = new Dimension(); PrecisionDimension d1 = new PrecisionDimension(); // compute d1 based on source anchor PrecisionPoint a1 = new PrecisionPoint(conn.getSourceAnchor().getReferencePoint()); Point a1Copy = a1.getCopy(); conn.translateToRelative(a1Copy); // x = a1.preciseX() + d1.preciseWidth() // <=> x - a1.preciseX() = d1.preciseWidth() d1.setPreciseWidth(locX - a1Copy.preciseX()); d1.setPreciseHeight(locY - a1Copy.preciseY()); relbp.setRelativeDimensions(d1, d2); relbp.setWeight(w); // ensure location is correct Point location = relbp.getLocation(); if (Math.abs(location.preciseX() - locX) > 0.1) { throw new IllegalStateException( "cannot force location-x: expected <" + locX + "> but got <" + location.preciseX() + ">"); } if (Math.abs(location.preciseY() - locY) > 0.1) { throw new IllegalStateException( "cannot force location-y: expected <" + locY + "> but got <" + location.preciseY() + ">"); } }
Example 3
Source File: DraggableElementCreationTool.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void snapPoint(CreateRequest request) { if (helper != null && figure != null) { final PrecisionRectangle baseRect = sourceRectangle.getPreciseCopy(); final PrecisionRectangle jointRect = compoundSrcRect.getPreciseCopy(); Point location = getLocation().getTranslated(-figure.getSize().width / 2, -figure.getSize().height / 2); final PrecisionPoint preciseDelta = new PrecisionPoint(location.preciseX(), location.preciseY()); baseRect.translate(preciseDelta); jointRect.translate(preciseDelta); helper.snapPoint(request, PositionConstants.HORIZONTAL | PositionConstants.VERTICAL, new PrecisionRectangle[] { baseRect, jointRect }, preciseDelta); request.setLocation(preciseDelta); } }
Example 4
Source File: GeometryUtil.java From statecharts with Eclipse Public License 1.0 | 4 votes |
public V3(Point p) { this(p.preciseX(), p.preciseY(), 1); }
Example 5
Source File: GeometryUtil.java From statecharts with Eclipse Public License 1.0 | 4 votes |
public boolean contains(Rectangle r, Point p) { return (equalsImprecise(p.preciseY(), r.y) || (p.preciseY() > r.y)) && (equalsImprecise(p.preciseY(), r.y + r.h) || (p.preciseY() < (r.y + r.h))) && (equalsImprecise(p.preciseX(), r.x) || (p.preciseX() > r.x)) && (equalsImprecise(p.preciseX(), r.x + r.w) || (p.preciseX() < (r.x + r.w))); }
Example 6
Source File: GeometryUtil.java From statecharts with Eclipse Public License 1.0 | 4 votes |
public PrecisionPoint getAdded(Point v, Point w) { return new PrecisionPoint(v.preciseX() + w.preciseX(), v.preciseY() + w.preciseY()); }
Example 7
Source File: GeometryUtil.java From statecharts with Eclipse Public License 1.0 | 4 votes |
public double getDotProduct(Point p, Point other) { return (p.preciseX() * other.preciseX()) + (p.preciseY() * other.preciseY()); }
Example 8
Source File: GeometryUtil.java From statecharts with Eclipse Public License 1.0 | 4 votes |
public PrecisionPoint getNormalized(Point vector) { double f = 1 / getLength(vector); return new PrecisionPoint(f * vector.preciseX(), f * vector.preciseY()); }
Example 9
Source File: GeometryUtil.java From statecharts with Eclipse Public License 1.0 | 4 votes |
public PrecisionPoint getOrthogonalComplement(Point vector) { return new PrecisionPoint(-vector.preciseY(), vector.preciseX()); }
Example 10
Source File: GeometryUtil.java From statecharts with Eclipse Public License 1.0 | 4 votes |
public PrecisionPoint toPP(Point point) { return point instanceof PrecisionPoint ? (PrecisionPoint) point : new PrecisionPoint(point.preciseX(), point.preciseY()); }