java.awt.Rectangle.getMinY()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(134)

本文整理了Java中java.awt.Rectangle.getMinY方法的一些代码示例,展示了Rectangle.getMinY的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rectangle.getMinY方法的具体详情如下:
包路径:java.awt.Rectangle
类名称:Rectangle
方法名:getMinY

Rectangle.getMinY介绍

暂无

代码示例

代码示例来源: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: 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

private GeneralPath makeStoragePath(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 pointMidTop = new ShapePoint((float)bounds.getCenterX(), (float)bounds.getMinY());
  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: 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: geotools/geotools

@Override
public Position getNextPosition() {
  if (symbols > targetSymbolCount || r >= rows) {
    return null;
  }
  attempts++;
  // System.out.println("Grid position: " + c + ", " + r + ", deltas: " + deltaX + "," +
  // deltaY + " target area: " + targetArea);
  position.x =
      (int)
          Math.round(
              targetArea.getMinX()
                  + c * deltaX
                  + random.nextDouble() * deltaX);
  position.y =
      (int)
          Math.round(
              targetArea.getMinY()
                  + r * deltaY
                  + random.nextDouble() * deltaY);
  if (randomRotation) {
    position.rotation = random.nextDouble() * 360;
  }
  // System.out.println("Position: " + position);
  return position;
}

代码示例来源:origin: RaiMan/SikuliX2

|| p.y > rect.getMinY() - 5 && p.y < rect.getMaxY() + 5) {

代码示例来源:origin: geotools/geotools

public void paint(Graphics g) {
    super.paint(g);
    Graphics2D g2d = (Graphics2D) g;
    g2d.setColor(Color.black);
    g2d.setTransform(
        AffineTransform.getTranslateInstance(
            -shp.getBounds().getMinX(), -shp.getBounds().getMinY()));
    g2d.draw(shp);
    g2d.dispose();
  }
}

代码示例来源:origin: geotools/geotools

pts[1] = paintArea.getMinY();
pts[2] = paintArea.getMaxX();
pts[3] = paintArea.getMinY();
pts[4] = paintArea.getMaxX();
pts[5] = paintArea.getMaxY();

代码示例来源:origin: geotools/geotools

pts[1] = paintArea.getMinY();
pts[2] = paintArea.getMaxX();
pts[3] = paintArea.getMinY();
pts[4] = paintArea.getMaxX();
pts[5] = paintArea.getMaxY();

代码示例来源:origin: geotools/geotools

displayArea.getMinX(),
displayArea.getMaxX(),
displayArea.getMinY(),
displayArea.getMaxY()));

代码示例来源:origin: apache/pdfbox

Math.pow(deviceBounds.getMaxY() - deviceBounds.getMinY(), 2));
factor = (int) Math.ceil(dist);

代码示例来源:origin: apache/pdfbox

Math.pow(deviceBounds.getMaxY() - deviceBounds.getMinY(), 2));
factor = (int) Math.ceil(dist);

代码示例来源: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);
}

相关文章