public void captureHorizontalPositions(final double left, final double right) { final double width = m_box.getWidth(); m_left = left; m_hCenter = m_left + (width / 2); m_right = right; }
public void captureHorizontalPositions(final double left, final double right) { final double width = m_box.getWidth(); m_left = left; m_hCenter = m_left + (width / 2); m_right = right; }
protected double getLegendEntryWidth(Text entry) { if (entry != null) return entry.getBoundingBox().getWidth() + LEGEND_RECTANGLE_WIDTH + LEGEND_WIDTH_SEPARATION; return 0; }
private double checkRotation(double maxWidth) { if (labels != null && !labels.isEmpty()) { for (BarChartLabel label : labels) { if (label.getLabel().getBoundingBox().getWidth() > maxWidth) return -45; } } return 0; }
public AutoGrid build() { assert null != boundingBox; final double max = isHorizontal(direction) ? boundingBox.getWidth() : boundingBox.getHeight(); return new AutoGrid(pad, size, direction, max); } }
private double[] getChildRelativeCoordinates(final BoundingBox bb) { final double bbx = bb.getX(); final double bby = bb.getY(); final double bbw = bb.getWidth(); final double bbh = bb.getHeight(); final double x = -bbx - (bbw / 2); final double y = -bby - (bbh / 2); return new double[] { x, y }; }
private ToolboxImpl updateGridSize() { final BoundingBox boundingBox = shapeBoundingBoxSupplier.get(); final double margin = getGrid().getMargin() * 2; return setGridSize(boundingBox.getWidth() + margin, boundingBox.getHeight() + margin); }
private double[] getChildRelativeCoordinates(final BoundingBox bb) { final double bbx = bb.getX(); final double bby = bb.getY(); final double bbw = bb.getWidth(); final double bbh = bb.getHeight(); final double x = -bbx - (bbw / 2); final double y = -bby - (bbh / 2); return new double[] { x, y }; }
@Override public BoxDecorator setBoundingBox(final BoundingBox boundingBox) { final double offset = -(padding / 2); rect(decorator, boundingBox.getWidth() + padding, boundingBox.getHeight() + padding, DECORATOR_CORNER_RADIUS) .setX(offset) .setY(offset); return this; }
public static Point2D findCenter(final BoundingBox box) { return new Point2D(box.getX() + (box.getWidth() / 2), box.getY() + (box.getHeight() / 2)); }
public static void scale(final Shape shape, final double width, final double height) { final BoundingBox bb = shape.getBoundingBox(); final double[] scale = getScaleFactor(bb.getWidth(), bb.getHeight(), width, height); shape.setScale(scale[0], scale[1]); }
@Override public void layout(final WiresContainer container) { double x = LEFT_MARGIN_PADDING; for (WiresShape ws : container.getChildShapes()) { ws.setLocation(new Point2D(x, PADDING_Y)); x = x + ws.getPath().getBoundingBox().getWidth() + PADDING_X; } } }
@Override protected final boolean apply(final Context2D context) { context.beginPath(); context.rect(m_bbox.getX(), m_bbox.getY(), m_bbox.getWidth(), m_bbox.getHeight()); context.clip(); return true; } }
@Override protected final boolean apply(final Context2D context) { context.beginPath(); context.rect(m_bbox.getX(), m_bbox.getY(), m_bbox.getWidth(), m_bbox.getHeight()); context.clip(); return true; } }
public BoundingPoints(BoundingBox bbox) { double x = bbox.getX(); double y = bbox.getY(); double w = bbox.getWidth(); double h = bbox.getHeight(); m_array.push(new Point2D(x + 0, y + 0)); m_array.push(new Point2D(x + w, y + 0)); m_array.push(new Point2D(x + w, y + h)); m_array.push(new Point2D(x + 0, y + h)); }
private Point2D calculateAbsCandidateLocation(final WiresShape shape, final WiresMagnet shapeMagnet) { final Point2D trgLocation = new Point2D(shapeMagnet.getX(), shapeMagnet.getY()); final BoundingBox shapeBB = shape.getPath().getBoundingBox(); final BoundingBox box = shape.getPath().getBoundingBox(); final double newX = trgLocation.getX() - shapeBB.getMinX() - (box.getWidth() / 2); final double newY = trgLocation.getY() - shapeBB.getMinY() - (box.getHeight() / 2); return new Point2D(newX, newY); }
private Point2D calculateAbsCandidateLocation(final WiresShape shape, final WiresMagnet shapeMagnet) { final Point2D trgLocation = new Point2D(shapeMagnet.getX(), shapeMagnet.getY()); final BoundingBox shapeBB = shape.getPath().getBoundingBox(); final BoundingBox box = shape.getPath().getBoundingBox(); final double newX = trgLocation.getX() - shapeBB.getMinX() - (box.getWidth() / 2); final double newY = trgLocation.getY() - shapeBB.getMinY() - (box.getHeight() / 2); return new Point2D(newX, newY); }
public final String toJSONString() { final JSONObject object = new JSONObject(); object.put("x", new JSONNumber(getX())); object.put("y", new JSONNumber(getY())); object.put("width", new JSONNumber(getWidth())); object.put("height", new JSONNumber(getHeight())); return object.toString(); }
public WiresShape(final MultiPath path, final LayoutContainer layoutContainer) { super(layoutContainer.getGroup()); m_path = path; m_ctrls = null; m_resizable = true; m_innerLayoutContainer = layoutContainer; m_innerLayoutContainer.getGroup().setEventPropagationMode(EventPropagationMode.FIRST_ANCESTOR); m_innerLayoutContainer.add(m_path); final BoundingBox box = m_path.refresh().getBoundingBox(); m_innerLayoutContainer.setOffset(new Point2D(box.getX(), box.getY())).setSize(box.getWidth(), box.getHeight()).execute(); }
public final String toJSONString() { final JSONObject object = new JSONObject(); object.put("x", new JSONNumber(getX())); object.put("y", new JSONNumber(getY())); object.put("width", new JSONNumber(getWidth())); object.put("height", new JSONNumber(getHeight())); return object.toString(); }