java.awt.Polygon.getBounds2D()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(150)

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

Polygon.getBounds2D介绍

暂无

代码示例

代码示例来源:origin: org.softsmithy.lib/lib-core

/**
 * Returns the high precision bounding box of the Shape.
 *
 * @return   a Rectangle2D that precisely bounds the Shape.
 * @see      #getBounds()
 */
public Rectangle2D getBounds2D() {
  return fPolygon.getBounds2D();
}

代码示例来源:origin: org.softsmithy.lib/softsmithy-lib-awt

/**
 * Returns the high precision bounding box of the Shape.
 *
 * @return   a Rectangle2D that precisely bounds the Shape.
 * @see      #getBounds()
 */
@Override
public Rectangle2D getBounds2D() {
  return fPolygon.getBounds2D();
}

代码示例来源:origin: girtel/Net2Plan

Point posCenter(Point posTopLeftCorner)
{
  return new Point(posTopLeftCorner.x + (int) (shapeLineToCreateByPainter.getBounds2D().getWidth() / 2), posTopLeftCorner.y + (int) (shapeLineToCreateByPainter.getBounds2D().getHeight()));
}

代码示例来源:origin: aseldawy/spatialhadoop2

@Override
public Rectangle getMBR() {
 Rectangle2D mbr = super.getBounds2D();
 return new Rectangle(mbr.getMinX(), mbr.getMinY(),
   mbr.getMaxX(), mbr.getMaxY());
}

代码示例来源:origin: aseldawy/spatialhadoop2

@Override
public boolean isIntersected(Shape s) {
 Rectangle2D mbr = super.getBounds2D();
 return super.intersects(mbr.getMinX(), mbr.getMinY(),
   mbr.getWidth(), mbr.getHeight());
}

代码示例来源:origin: gurkenlabs/litiengine

private static Point assessHexStaggering(StaggerAxis staggerAxis, StaggerIndex staggerIndex, Point tileLocation, int s, int t, int r, int jumpWidth, int jumpHeight, double mouseX, double mouseY) {
 int xIndex = tileLocation.x;
 int yIndex = tileLocation.y;
 int x = isStaggeredRowOrColumn(staggerIndex, yIndex) && staggerAxis == StaggerAxis.Y ? xIndex * jumpWidth + r : xIndex * jumpWidth;
 int y = isStaggeredRowOrColumn(staggerIndex, xIndex) && staggerAxis == StaggerAxis.X ? yIndex * jumpHeight + r : yIndex * jumpHeight;
 Polygon hex = GeometricUtilities.getHex(x, y, staggerAxis, s, r, t);
 //we don't need any further computation if the mouse is already inside the hex
 if (hex.contains(mouseX, mouseY)) {
  return new Point(xIndex, yIndex);
 } else if (mouseY < hex.getBounds2D().getY() + hex.getBounds2D().getHeight() / 2) { //is the mouse in the upper left triangle outside the hex -> switch to the hex left and above the current hex
  if (staggerAxis == StaggerAxis.X) {
   yIndex = isStaggeredRowOrColumn(staggerIndex, xIndex) ? yIndex : yIndex - 1;
   xIndex -= 1;
  }
  if (staggerAxis == StaggerAxis.Y) {
   xIndex = isStaggeredRowOrColumn(staggerIndex, yIndex) ? xIndex : xIndex - 1;
   yIndex -= 1;
  }
 } else if (mouseY >= hex.getBounds2D().getY() + hex.getBounds2D().getHeight() / 2) { //is the mouse in the lower left triangle outside the hex-> switch to the hex left and below the current hex
  if (staggerAxis == StaggerAxis.X) {
   yIndex = isStaggeredRowOrColumn(staggerIndex, xIndex) ? yIndex + 1 : yIndex;
   xIndex -= 1;
  }
  if (staggerAxis == StaggerAxis.Y) {
   xIndex = isStaggeredRowOrColumn(staggerIndex, yIndex) ? xIndex + 1 : xIndex;
   yIndex -= 1;
  }
 }
 return new Point(xIndex, yIndex);
}

代码示例来源:origin: stackoverflow.com

Rectangle2D rec = polygon.getBounds2D();

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

final Rectangle bounds = rasterSpaceROI.getBounds2D().getBounds();
Rectangle.intersect(bounds, sourceGridRange, bounds);
if (bounds.isEmpty())

代码示例来源:origin: org.geotools/gt2-coverage

modelSpaceROI, ProjectiveTransform
        .create(sourceWorldToGridTransform), points);
final boolean doMosaic = decideJAIOperation(parameters,rasterSpaceROI.getBounds2D(), points);
if (doMosaic) {
    assert isSimpleTransform==false;

代码示例来源:origin: org.geotools/gt-coverage

if(finalRasterArea.isEmpty())
    throw new CannotCropException(Errors.format(ErrorKeys.CANT_CROP));
final boolean doMosaic = decideJAIOperation(roiTolerance, rasterSpaceROI.getBounds2D(), points);
if (doMosaic || cropROI != null) {
  final Rectangle bounds = rasterSpaceROI.getBounds2D().getBounds();
  Rectangle.intersect(bounds, sourceGridRange, bounds);
  if(bounds.isEmpty())

相关文章