public final boolean intersects(final BoundingBox other) { if (getMaxX() < other.getMinX()) { return false; // this is left of other } if (getMinX() > other.getMaxX()) { return false; // this is right of other } if (getMaxY() < other.getMinY()) { return false; // this is above other } if (getMinY() > other.getMaxY()) { return false; // this is below other } return true; // boxes overlap }
public final boolean intersects(final BoundingBox other) { if (getMaxX() < other.getMinX()) { return false; // this is left of other } if (getMinX() > other.getMaxX()) { return false; // this is right of other } if (getMaxY() < other.getMinY()) { return false; // this is above other } if (getMinY() > other.getMaxY()) { return false; // this is below other } return true; // boxes overlap }
public final boolean intersects(final BoundingBox other) { if (getMaxX() < other.getMinX()) { return false; // this is left of other } if (getMinX() > other.getMaxX()) { return false; // this is right of other } if (getMaxY() < other.getMinY()) { return false; // this is above other } if (getMinY() > other.getMaxY()) { return false; // this is below other } return true; // boxes overlap }
@Override public boolean isOutOfBounds(final double dx, final double dy) { // Check the location bounds, if any. if (null != getConstrainedBounds()) { final double shapeMinX = shapeBounds.getMinX() + dx; final double shapeMinY = shapeBounds.getMinY() + dy; final double shapeMaxX = shapeMinX + (shapeBounds.getMaxX() - shapeBounds.getMinX()); final double shapeMaxY = shapeMinY + (shapeBounds.getMaxY() - shapeBounds.getMinY()); if ((shapeMinX <= getConstrainedBounds().getMinX()) || (shapeMaxX >= getConstrainedBounds().getMaxX()) || (shapeMinY <= getConstrainedBounds().getMinY()) || (shapeMaxY >= getConstrainedBounds().getMaxY())) { // Bounds are exceeded as from last adjusted location, so // just accept adjust and keep current location value. return true; } } return false; }
@Override public boolean isOutOfBounds(final double dx, final double dy) { // Check the location bounds, if any. if (null != getConstrainedBounds()) { final double shapeMinX = shapeBounds.getMinX() + dx; final double shapeMinY = shapeBounds.getMinY() + dy; final double shapeMaxX = shapeMinX + (shapeBounds.getMaxX() - shapeBounds.getMinX()); final double shapeMaxY = shapeMinY + (shapeBounds.getMaxY() - shapeBounds.getMinY()); if ((shapeMinX <= getConstrainedBounds().getMinX()) || (shapeMaxX >= getConstrainedBounds().getMaxX()) || (shapeMinY <= getConstrainedBounds().getMinY()) || (shapeMaxY >= getConstrainedBounds().getMaxY())) { // Bounds are exceeded as from last adjusted location, so // just accept adjust and keep current location value. return true; } } return false; }
@Override public boolean isOutOfBounds(final double dx, final double dy) { // Check the location bounds, if any. if (null != getConstrainedBounds()) { final double shapeMinX = shapeBounds.getMinX() + dx; final double shapeMinY = shapeBounds.getMinY() + dy; final double shapeMaxX = shapeMinX + (shapeBounds.getMaxX() - shapeBounds.getMinX()); final double shapeMaxY = shapeMinY + (shapeBounds.getMaxY() - shapeBounds.getMinY()); if ((shapeMinX <= getConstrainedBounds().getMinX()) || (shapeMaxX >= getConstrainedBounds().getMaxX()) || (shapeMinY <= getConstrainedBounds().getMinY()) || (shapeMaxY >= getConstrainedBounds().getMaxY())) { // Bounds are exceeded as from last adjusted location, so // just accept adjust and keep current location value. return true; } } return false; }
@Override public BoundingBox getBoundingBox() { final com.ait.lienzo.client.core.types.BoundingBox bb = getGroup().getBoundingBox(); return new BoundingBox(bb.getMinX(), bb.getMinY(), bb.getMaxX(), bb.getMaxY()); }
@Override public BoundingBox getBoundingBox() { final com.ait.lienzo.client.core.types.BoundingBox bb = getGroup().getBoundingBox(); return new BoundingBox(bb.getMinX(), bb.getMinY(), bb.getMaxX(), bb.getMaxY()); }
@Override public BoundingBox getBoundingBox() { final com.ait.lienzo.client.core.types.BoundingBox bb = get().getBoundingBox(); return new BoundingBox(bb.getMinX(), bb.getMinY(), bb.getMaxX(), bb.getMaxY()); }
@Override public void updateIndex() { // circles xy are in centre, where as others are top left. // For this reason we must use getBoundingBox, which uses BoundingPoints underneath, when ensures the shape x/y is now top left. m_box = AlignAndDistribute.getBoundingBox(m_group); final double left = m_box.getMinX(); final double right = m_box.getMaxX(); final double top = m_box.getMinY(); final double bottom = m_box.getMaxY(); final boolean leftChanged = left != m_left; final boolean rightChanged = right != m_right; final boolean topChanged = top != m_top; final boolean bottomChanged = bottom != m_bottom; if (!leftChanged && !rightChanged && !topChanged && !bottomChanged) { // this can happen when the event batching triggers after a drag has stopped, but the event change was due to the dragging. // @dean REVIEW return; } //BoundingBox box = AlignAndDistribute.getBoundingBox(m_group); updateIndex(leftChanged, rightChanged, topChanged, bottomChanged, left, right, top, bottom); }
@Override public void updateIndex() { // circles xy are in centre, where as others are top left. // For this reason we must use getBoundingBox, which uses BoundingPoints underneath, when ensures the shape x/y is now top left. m_box = AlignAndDistribute.getBoundingBox(m_group); final double left = m_box.getMinX(); final double right = m_box.getMaxX(); final double top = m_box.getMinY(); final double bottom = m_box.getMaxY(); final boolean leftChanged = left != m_left; final boolean rightChanged = right != m_right; final boolean topChanged = top != m_top; final boolean bottomChanged = bottom != m_bottom; if (!leftChanged && !rightChanged && !topChanged && !bottomChanged) { // this can happen when the event batching triggers after a drag has stopped, but the event change was due to the dragging. // @dean REVIEW return; } //BoundingBox box = AlignAndDistribute.getBoundingBox(m_group); updateIndex(leftChanged, rightChanged, topChanged, bottomChanged, left, right, top, bottom); }
public final boolean contains(final Point2D p) { return (getMinX() <= p.getX()) && (getMaxX() >= p.getX()) && (getMinY() <= p.getY()) && (getMaxY() >= p.getY()); }
public final boolean contains(final Point2D p) { return (getMinX() <= p.getX()) && (getMaxX() >= p.getX()) && (getMinY() <= p.getY()) && (getMaxY() >= p.getY()); }
public final boolean contains(final Point2D p) { return (getMinX() <= p.getX()) && (getMaxX() >= p.getX()) && (getMinY() <= p.getY()) && (getMaxY() >= p.getY()); }
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); }
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); }