private static org.eclipse.dd.dc.Point pointOf(double x, double y) { org.eclipse.dd.dc.Point pt = dc.createPoint(); pt.setX((float) x); pt.setY((float) y); return pt; } }
protected Bounds computeBounds(final org.eclipse.dd.dc.Bounds bounds) { final double x = bounds.getX() * resolutionFactor; final double y = bounds.getY() * resolutionFactor; final double width = bounds.getWidth() * resolutionFactor; final double height = bounds.getHeight() * resolutionFactor; return Bounds.create(x, y, x + width, y + height); }
protected org.eclipse.dd.dc.Bounds getParentActivityBounds(org.eclipse.dd.dc.Bounds parentRect) { if (getShape().getBounds() == null) { throw new IllegalArgumentException( "Cannot set parent bounds if the child " + "has undefined bounds. Use setBounds() first."); } org.eclipse.dd.dc.Bounds relativeBounds = getShape().getBounds(); float x = relativeBounds.getX(); float y = relativeBounds.getY(); float width = relativeBounds.getWidth(); float height = relativeBounds.getHeight(); float parentX = parentRect.getX(); float parentY = parentRect.getY(); org.eclipse.dd.dc.Bounds bounds = dc.createBounds(); bounds.setX(parentX + x - width / 2); bounds.setY(parentY + y - height / 2); bounds.setWidth(width); bounds.setHeight(height); return bounds; }
@Before public void setUp() { when(bounds.getX()).thenReturn(BOUNDS_X); when(bounds.getY()).thenReturn(BOUNDS_Y); when(bounds.getWidth()).thenReturn(BOUNDS_WIDTH); when(bounds.getHeight()).thenReturn(BOUNDS_HEIGHT); when(point.getX()).thenReturn(WAY_POINT_X); when(point.getY()).thenReturn(WAY_POINT_Y); when(definitionResolver.getResolutionFactor()).thenReturn(1d); when(definitionResolver.getEdge(EDGE_ID)).thenReturn(edge); when(definitionResolver.getShape(SHAPE_ID)).thenReturn(shape); when(shape.getBounds()).thenReturn(bounds); }
private Bounds boundsOf(float x, float y, float width, float height) { Bounds bounds = dc.createBounds(); bounds.setX(x); bounds.setY(y); bounds.setWidth(width); bounds.setHeight(height); return bounds; } }
private static Point2D targetPosition(Bounds targetBounds, double factor) { return Point2D.create(0, targetBounds.getHeight() * factor / 2); }
public CircleDimensionSet getCircleDimensionSet() { if (shape == null) { return new CircleDimensionSet(); } return new CircleDimensionSet(new Radius( shape.getBounds().getWidth() * resolutionFactor / 2d)); }
private static org.eclipse.dd.dc.Bounds mockBounds(float x, float y, float width, float height) { org.eclipse.dd.dc.Bounds bounds = mock(org.eclipse.dd.dc.Bounds.class); when(bounds.getX()).thenReturn(x); when(bounds.getY()).thenReturn(y); when(bounds.getWidth()).thenReturn(width); when(bounds.getHeight()).thenReturn(height); return bounds; } }
private Point pointOf(float x, float y) { Point point = dc.createPoint(); point.setX(x); point.setY(y); return point; }
private static void assertPointsEqual(List<Point> expected, List<Point> given, String message) { assertEquals(expected.size(), given.size()); for (int i = 0; i < expected.size(); i++) { Point pe = expected.get(i); Point pg = given.get(i); if (pe.getX() != pg.getX() || pe.getY() != pg.getY()) { failNotEquals(message, expected, given); } } }
public static BPMNShape mockShape(String id, float x, float y, float width, float height) { BPMNShape shape = mock(BPMNShape.class); when(shape.getId()).thenReturn(id); Bounds bounds = mock(Bounds.class); when(bounds.getX()).thenReturn(x); when(bounds.getY()).thenReturn(y); when(bounds.getHeight()).thenReturn(height); when(bounds.getWidth()).thenReturn(width); when(shape.getBounds()).thenReturn(bounds); return shape; }
private static Point pointOf(double x, double y) { Point point = dc.createPoint(); point.setX((float) x); point.setY((float) y); return point; } }
private void assertPoints(List<Point> originalPoints, List<Point2D> points) { assertEquals(originalPoints.size(), points.size()); for (int i = 0; i < points.size(); i++) { assertEquals(originalPoints.get(i).getX(), points.get(i).getX(), 0); assertEquals(originalPoints.get(i).getY(), points.get(i).getY(), 0); } }