@Override public BoundingBox getBoundingBox() { double wide = 0; double high = 0; for (final BoundingBox bbox : m_frames) { wide = Math.max(wide, bbox.getWidth()); high = Math.max(high, bbox.getHeight()); } return new BoundingBox(0, 0, wide, high); }
private double[] calculateSelectionShapeForExternallyConnectedConnectors(final int dx, final int dy, final BoundingBox originalBox) { final BoundingBox box = new BoundingBox(); if (null != originalBox) { box.add(originalBox); } box.offset(dx, dy); if (m_selected.m_externallyConnected.isEmpty()) { return new double[] { box.getMinX() - SELECTION_PADDING, box.getMinY() - SELECTION_PADDING }; } double width = null != originalBox ? originalBox.getWidth() : 0d; double height = null != originalBox ? originalBox.getHeight() : 0d; if (!m_selected.m_externallyConnected.isEmpty()) { for (final WiresConnector connector : m_selected.m_externallyConnected) { box.add(connector.getHead().getComputedBoundingPoints().getBoundingBox()); box.add(connector.getTail().getComputedBoundingPoints().getBoundingBox()); box.add(connector.getLine().getComputedBoundingPoints().getBoundingBox()); } width = box.getMaxX() - box.getMinX(); height = box.getMaxY() - box.getMinY(); } return new double[] { box.getMinX(), box.getMinY(), width, height }; }
@Override public boolean clip(final Context2D context) { context.beginPath(); //Left edge context.rect(0, 0, innerBoundingBox.getMinX(), outerBoundingBox.getHeight()); //Top edge context.rect(innerBoundingBox.getMinX(), 0, innerBoundingBox.getWidth(), innerBoundingBox.getMinY()); //Bottom edge context.rect(innerBoundingBox.getMinX(), innerBoundingBox.getMaxY(), innerBoundingBox.getWidth(), outerBoundingBox.getMaxY() - innerBoundingBox.getMaxY()); //Right edge context.rect(innerBoundingBox.getMaxX(), 0, outerBoundingBox.getMaxX() - innerBoundingBox.getMaxX(), outerBoundingBox.getHeight()); context.clip(); return true; }
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 BoundingBox getBoundingBox() { return new BoundingBox(0, 0, m_dest_wide, m_dest_high); } }
void setTextBoundaries(BoundingBox boundaries) { switch (getLayout()) { case LEFT: if (null != boundaries) { textWrapper.setWrapBoundaries(new BoundingBox(boundaries.getMinY(), boundaries.getMaxX(), boundaries.getMaxY(), boundaries.getMaxX())); } break; case RIGHT: if (null != boundaries) { textWrapper.setWrapBoundaries(new BoundingBox(boundaries.getMinY(), boundaries.getMaxX(), boundaries.getMaxY(), boundaries.getMaxX())); } break; case TOP: case CENTER: case BOTTOM: default: textWrapper.setWrapBoundaries(boundaries); break; } } }
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; }
/** * Returns TextMetrics, which includes an approximate value for * height. As close as we can estimate it at this time. * * @param context * @return TextMetric or null if the text is empty or null */ public double getLineHeight(final Context2D context) { return getBoundingBoxForString("Mg").getHeight(); }
private double[] calculateSelectionShapeForExternallyConnectedConnectors(final int dx, final int dy, final BoundingBox originalBox) { final BoundingBox box = new BoundingBox(); if (null != originalBox) { box.add(originalBox); } box.offset(dx, dy); if (m_selected.m_externallyConnected.isEmpty()) { return new double[] { box.getMinX() - SELECTION_PADDING, box.getMinY() - SELECTION_PADDING }; } double width = null != originalBox ? originalBox.getWidth() : 0d; double height = null != originalBox ? originalBox.getHeight() : 0d; if (!m_selected.m_externallyConnected.isEmpty()) { for (final WiresConnector connector : m_selected.m_externallyConnected) { box.add(connector.getHead().getComputedBoundingPoints().getBoundingBox()); box.add(connector.getTail().getComputedBoundingPoints().getBoundingBox()); box.add(connector.getLine().getComputedBoundingPoints().getBoundingBox()); } width = box.getMaxX() - box.getMinX(); height = box.getMaxY() - box.getMinY(); } return new double[] { box.getMinX(), box.getMinY(), width, height }; }
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); }
@Override public BoundingBox getBoundingBox() { return new BoundingBox(getPolygon()); }
protected double getLegendEntryWidth(Text entry) { if (entry != null) return entry.getBoundingBox().getWidth() + LEGEND_RECTANGLE_WIDTH + LEGEND_WIDTH_SEPARATION; return 0; }
/** * Returns TextMetrics, which includes an approximate value for * height. As close as we can estimate it at this time. * * @param context * @return TextMetric or null if the text is empty or null */ public double getLineHeight(final Context2D context) { return getBoundingBoxForString("Mg").getHeight(); }
private double[] calculateSelectionShapeForExternallyConnectedConnectors(final int dx, final int dy, final BoundingBox originalBox) { final BoundingBox box = new BoundingBox(); if (null != originalBox) { box.add(originalBox); } box.offset(dx, dy); if (m_selected.m_externallyConnected.isEmpty()) { return new double[] { box.getMinX() - SELECTION_PADDING, box.getMinY() - SELECTION_PADDING }; } double width = null != originalBox ? originalBox.getWidth() : 0d; double height = null != originalBox ? originalBox.getHeight() : 0d; if (!m_selected.m_externallyConnected.isEmpty()) { for (final WiresConnector connector : m_selected.m_externallyConnected) { box.add(connector.getHead().getComputedBoundingPoints().getBoundingBox()); box.add(connector.getTail().getComputedBoundingPoints().getBoundingBox()); box.add(connector.getLine().getComputedBoundingPoints().getBoundingBox()); } width = box.getMaxX() - box.getMinX(); height = box.getMaxY() - box.getMinY(); } return new double[] { box.getMinX(), box.getMinY(), width, height }; }