本文整理了Java中java.awt.Rectangle.getMaxY
方法的一些代码示例,展示了Rectangle.getMaxY
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.getMaxY
方法的具体详情如下:
包路径:java.awt.Rectangle
类名称:Rectangle
方法名:getMaxY
暂无
代码示例来源:origin: runelite/runelite
@Override
public Rectangle getBounds()
{
final Rectangle bounds = super.getBounds();
final Rectangle parent = getParentBounds(client.getWidget(widgetInfo));
if (parent.isEmpty())
{
return bounds;
}
int x = bounds.x;
int y = bounds.y;
x = Math.max(parent.x, x);
y = Math.max(parent.y, y);
x = Math.min((int)parent.getMaxX() - bounds.width, x);
y = Math.min((int)parent.getMaxY() - bounds.height, y);
bounds.setLocation(x, y);
return bounds;
}
代码示例来源:origin: plantuml/plantuml
private GeneralPath makeIOPath(Diagram diagram) {
if(points.size() != 4) return null;
Rectangle bounds = makeIntoPath().getBounds();
ShapePoint point1 = new ShapePoint((float)bounds.getMinX(), (float)bounds.getMinY());
ShapePoint point2 = new ShapePoint((float)bounds.getMaxX(), (float)bounds.getMinY());
ShapePoint point3 = new ShapePoint((float)bounds.getMaxX(), (float)bounds.getMaxY());
ShapePoint point4 = new ShapePoint((float)bounds.getMinX(), (float)bounds.getMaxY());
float offset = diagram.getCellWidth() / 2;
GeneralPath path = new GeneralPath();
path.moveTo(point1.x + offset, point1.y);
path.lineTo(point2.x + offset, point2.y);
path.lineTo(point3.x - offset, point3.y);
path.lineTo(point4.x - offset, point4.y);
path.closePath();
return path;
}
代码示例来源:origin: plantuml/plantuml
private GeneralPath makeTrapezoidPath(Diagram diagram, boolean inverted) {
if(points.size() != 4) return null;
Rectangle bounds = makeIntoPath().getBounds();
float offset = 0.7f * diagram.getCellWidth(); // fixed slope
if (inverted) offset = -offset;
ShapePoint ul = new ShapePoint((float)bounds.getMinX() + offset, (float)bounds.getMinY());
ShapePoint ur = new ShapePoint((float)bounds.getMaxX() - offset, (float)bounds.getMinY());
ShapePoint br = new ShapePoint((float)bounds.getMaxX() + offset, (float)bounds.getMaxY());
ShapePoint bl = new ShapePoint((float)bounds.getMinX() - offset, (float)bounds.getMaxY());
ShapePoint pointMid = new ShapePoint((float)bounds.getCenterX(), (float)bounds.getMaxY());
GeneralPath path = new GeneralPath();
path.moveTo(ul.x, ul.y);
path.lineTo(ur.x, ur.y);
path.lineTo(br.x, br.y);
path.lineTo(bl.x, bl.y);
path.closePath();
return path;
}
代码示例来源:origin: plantuml/plantuml
private GeneralPath makeDocumentPath(Diagram diagram) {
if(points.size() != 4) return null;
Rectangle bounds = makeIntoPath().getBounds();
ShapePoint point1 = new ShapePoint((float)bounds.getMinX(), (float)bounds.getMinY());
ShapePoint point2 = new ShapePoint((float)bounds.getMaxX(), (float)bounds.getMinY());
ShapePoint point3 = new ShapePoint((float)bounds.getMaxX(), (float)bounds.getMaxY());
ShapePoint point4 = new ShapePoint((float)bounds.getMinX(), (float)bounds.getMaxY());
ShapePoint pointMid = new ShapePoint((float)bounds.getCenterX(), (float)bounds.getMaxY());
GeneralPath path = new GeneralPath();
path.moveTo(point1.x, point1.y);
path.lineTo(point2.x, point2.y);
path.lineTo(point3.x, point3.y);
//int controlDX = diagram.getCellWidth();
//int controlDY = diagram.getCellHeight() / 2;
int controlDX = bounds.width / 6;
int controlDY = bounds.height / 8;
path.quadTo(pointMid.x + controlDX, pointMid.y - controlDY, pointMid.x, pointMid.y);
path.quadTo(pointMid.x - controlDX, pointMid.y + controlDY, point4.x, point4.y);
path.closePath();
return path;
}
代码示例来源:origin: plantuml/plantuml
private GeneralPath makeDecisionPath(Diagram diagram) {
if(points.size() != 4) return null;
Rectangle bounds = makeIntoPath().getBounds();
ShapePoint pointMid = new ShapePoint((float)bounds.getCenterX(), (float)bounds.getCenterY());
ShapePoint left = new ShapePoint((float)bounds.getMinX(), (float)pointMid.getY());
ShapePoint right = new ShapePoint((float)bounds.getMaxX(), (float)pointMid.getY());
ShapePoint top = new ShapePoint((float)pointMid.getX(), (float)bounds.getMinY());
ShapePoint bottom = new ShapePoint((float)pointMid.getX(), (float)bounds.getMaxY());
GeneralPath path = new GeneralPath();
path.moveTo(left.x, left.y);
path.lineTo(top.x, top.y);
path.lineTo(right.x, right.y);
path.lineTo(bottom.x, bottom.y);
path.closePath();
return path;
}
代码示例来源:origin: Activiti/Activiti
public void drawCollapsedMarker(int x,
int y,
int width,
int height) {
// rectangle
int rectangleWidth = MARKER_WIDTH;
int rectangleHeight = MARKER_WIDTH;
Rectangle rect = new Rectangle(x + (width - rectangleWidth) / 2,
y + height - rectangleHeight - 3,
rectangleWidth,
rectangleHeight);
g.draw(rect);
// plus inside rectangle
Line2D.Double line = new Line2D.Double(rect.getCenterX(),
rect.getY() + 2,
rect.getCenterX(),
rect.getMaxY() - 2);
g.draw(line);
line = new Line2D.Double(rect.getMinX() + 2,
rect.getCenterY(),
rect.getMaxX() - 2,
rect.getCenterY());
g.draw(line);
}
代码示例来源:origin: runelite/runelite
@Override
public Dimension render(Graphics2D graphics)
{
final Widget widget = client.getWidget(widgetInfo);
final Rectangle bounds = super.getBounds();
final Rectangle parent = getParentBounds(widget);
if (parent.isEmpty())
{
return null;
}
int x = bounds.x;
int y = bounds.y;
x = Math.max(parent.x, x);
y = Math.max(parent.y, y);
x = Math.min((int)parent.getMaxX() - bounds.width, x);
y = Math.min((int)parent.getMaxY() - bounds.height, y);
bounds.setLocation(x, y);
widget.setOriginalX(0);
widget.setOriginalY(0);
widget.setRelativeX(bounds.x - parent.x);
widget.setRelativeY(bounds.y - parent.y);
return new Dimension(widget.getWidth(), widget.getHeight());
}
代码示例来源:origin: runelite/runelite
private WorldArea getIndicatorLine(Direction direction)
{
switch (direction)
{
case NORTH:
return new WorldArea(bounds.x + 1, (int) bounds.getMaxY(), bounds.width - 1, 1, 0);
case SOUTH:
return new WorldArea(bounds.x + 1, bounds.y, bounds.width - 1, 1, 0);
case WEST:
return new WorldArea(bounds.x, bounds.y + 1, 1, bounds.height - 1, 0);
case EAST:
return new WorldArea((int) bounds.getMaxX(), bounds.y + 1, 1, bounds.height - 1, 0);
}
return null;
}
}
代码示例来源:origin: runelite/runelite
final int clientY = (int) clientCanvasBounds.getMaxY();
final int boundsX = (int) bounds.getMaxX();
final int boundsY = (int) bounds.getMaxY();
代码示例来源:origin: plantuml/plantuml
private GeneralPath makeEllipsePath(Diagram diagram) {
if(points.size() != 4) return null;
Rectangle bounds = makeIntoPath().getBounds();
float xOff = (float) bounds.getWidth() * 0.5f * KAPPA;
float yOff = (float) bounds.getHeight() * 0.5f * KAPPA;
ShapePoint pointMid = new ShapePoint((float)bounds.getCenterX(), (float)bounds.getCenterY());
ShapePoint left = new ShapePoint((float)bounds.getMinX(), (float)pointMid.getY());
ShapePoint right = new ShapePoint((float)bounds.getMaxX(), (float)pointMid.getY());
ShapePoint top = new ShapePoint((float)pointMid.getX(), (float)bounds.getMinY());
ShapePoint bottom = new ShapePoint((float)pointMid.getX(), (float)bounds.getMaxY());
GeneralPath path = new GeneralPath();
path.moveTo(top.x, top.y);
path.curveTo(top.x + xOff, top.y, right.x, right.y - yOff, right.x, right.y);
path.curveTo(right.x, right.y + yOff, bottom.x + xOff, bottom.y, bottom.x, bottom.y);
path.curveTo(bottom.x - xOff, bottom.y, left.x, left.y + yOff, left.x, left.y);
path.curveTo(left.x, left.y - yOff, top.x - xOff, top.y, top.x, top.y);
path.closePath();
return path;
}
代码示例来源:origin: plantuml/plantuml
ShapePoint point1 = new ShapePoint((float)bounds.getMinX(), (float)bounds.getMinY());
ShapePoint point2 = new ShapePoint((float)bounds.getMaxX(), (float)bounds.getMinY());
ShapePoint point3 = new ShapePoint((float)bounds.getMaxX(), (float)bounds.getMaxY());
ShapePoint point4 = new ShapePoint((float)bounds.getMinX(), (float)bounds.getMaxY());
ShapePoint pointMidBottom = new ShapePoint((float)bounds.getCenterX(), (float)bounds.getMaxY());
代码示例来源:origin: apache/geode
public void paint(Graphics2D g, StateColorMap colorMap) {
Rectangle bounds = g.getClipBounds();
if (startY > bounds.getMaxY() || startY + height < bounds.getMinY()) {
return;
}
int x = line.getX();
int width = line.getWidth();
Color color = colorMap.getColor(stateName);
g.setColor(color);
g.fillRoundRect(x, startY, width, height, ARC_SIZE, ARC_SIZE);
g.setColor(Color.BLACK);
}
代码示例来源:origin: runelite/runelite
private Direction getPosition()
{
WorldPoint mine = client.getLocalPlayer().getWorldLocation();
if (mine.getY() >= bounds.getMaxY() && mine.getX() < bounds.getMaxX() && mine.getX() > bounds.getX())
{
return Direction.NORTH;
}
else if (mine.getY() <= bounds.getY() && mine.getX() < bounds.getMaxX() && mine.getX() > bounds.getX())
{
return Direction.SOUTH;
}
else if (mine.getX() >= bounds.getMaxX() && mine.getY() < bounds.getMaxY() && mine.getY() > bounds.getY())
{
return Direction.EAST;
}
else if (mine.getX() <= bounds.getX() && mine.getY() < bounds.getMaxY() && mine.getY() > bounds.getY())
{
return Direction.WEST;
}
return null;
}
代码示例来源:origin: apache/geode
public void highlight(Graphics2D g) {
Rectangle bounds = g.getClipBounds();
if (startY > bounds.getMaxY() || startY + height < bounds.getMinY()) {
return;
}
int x = line.getX();
int width = line.getWidth();
g.drawRoundRect(x, startY, width, height, ARC_SIZE, ARC_SIZE);
}
代码示例来源:origin: apache/geode
public void paint(Graphics2D g) {
Rectangle boundary = g.getClipBounds();
int y = endingState.getStartY();
// don't paint if we're not in the clip area
if (y + ARROW_WIDTH < boundary.getMinY() || y - ARROW_WIDTH > boundary.getMaxY()) {
return;
}
// TODO - we need to clip by X coordinate as well.
boolean isReflexsive = getStartingLine() == getEndingLine();
if (isReflexsive) {
paintReflexive(g);
} else {
paintNormal(g);
}
}
代码示例来源:origin: geotools/geotools
/** Calculates the world bounds of the current screen area. */
private ReferencedEnvelope calculateActualBounds() {
Point2D p0 = new Point2D.Double(screenArea.getMinX(), screenArea.getMinY());
Point2D p1 = new Point2D.Double(screenArea.getMaxX(), screenArea.getMaxY());
screenToWorld.transform(p0, p0);
screenToWorld.transform(p1, p1);
return new ReferencedEnvelope(
Math.min(p0.getX(), p1.getX()),
Math.max(p0.getX(), p1.getX()),
Math.min(p0.getY(), p1.getY()),
Math.max(p0.getY(), p1.getY()),
bounds.getCoordinateReferenceSystem());
}
代码示例来源:origin: knowm/XChart
void prepare(Graphics2D g) {
if (!styler.isToolTipsEnabled()) {
return;
}
// clear lists
dataPointList.clear();
Rectangle clipBounds = g.getClipBounds();
leftEdge = clipBounds.getX() + MARGIN;
rightEdge = clipBounds.getMaxX() - MARGIN * 2;
topEdge = clipBounds.getY() + MARGIN;
bottomEdge = clipBounds.getMaxY() - MARGIN * 2;
}
代码示例来源:origin: geotools/geotools
pts[3] = paintArea.getMinY();
pts[4] = paintArea.getMaxX();
pts[5] = paintArea.getMaxY();
pts[6] = paintArea.getMinX();
pts[7] = paintArea.getMaxY();
worldToScreen.inverseTransform(pts, 0, pts, 0, 4);
double xMin = Double.MAX_VALUE;
代码示例来源:origin: geotools/geotools
@Test
public void coordinateTransform_MatchingAspectRatioDisabled() throws Exception {
MapViewport vp = new MapViewport(false);
// world and screen bounds with different aspect ratios
final ReferencedEnvelope world = WORLD_1_1;
final Rectangle screen = SCREEN_2_1;
vp.setBounds(world);
vp.setScreenArea(screen);
double[] screenXY = {
screen.getMinX(), screen.getMinY(), screen.getMaxX(), screen.getMaxY()
};
double[] worldXY = new double[screenXY.length];
vp.getScreenToWorld().transform(screenXY, 0, worldXY, 0, screenXY.length / 2);
assertEquals(world.getMinX(), worldXY[0], TOL);
assertEquals(world.getMaxY(), worldXY[1], TOL);
assertEquals(world.getMaxX(), worldXY[2], TOL);
assertEquals(world.getMinY(), worldXY[3], TOL);
}
代码示例来源:origin: geotools/geotools
@Test
public void coordinateTransform_MatchingAspectRatioEnabled() throws Exception {
MapViewport vp = new MapViewport(true);
// world and screen bounds with different aspect ratios
final Rectangle screen = SCREEN_2_1;
vp.setBounds(WORLD_1_1);
vp.setScreenArea(screen);
ReferencedEnvelope actualWorld = vp.getBounds();
double[] screenXY = {
screen.getMinX(), screen.getMinY(), screen.getMaxX(), screen.getMaxY()
};
double[] worldXY = new double[screenXY.length];
vp.getScreenToWorld().transform(screenXY, 0, worldXY, 0, screenXY.length / 2);
assertEquals(actualWorld.getMinX(), worldXY[0], TOL);
assertEquals(actualWorld.getMaxY(), worldXY[1], TOL);
assertEquals(actualWorld.getMaxX(), worldXY[2], TOL);
assertEquals(actualWorld.getMinY(), worldXY[3], TOL);
}
内容来源于网络,如有侵权,请联系作者删除!