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

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

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

Rectangle.intersects介绍

[英]Determines whether or not this Rectangle and the specified Rectangle intersect. Two rectangles intersect if their intersection is nonempty.
[中]确定此Rectangle和指定的Rectangle是否相交。如果两个矩形的交点为非空,则它们相交。

代码示例

代码示例来源:origin: alibaba/druid

if (cellRect.intersects(clipBounds)) {
  paintCell(g, cellRect, column);

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

digLocations.removeIf(entry -> r2.contains(entry.getRect()) || !r1.intersects(entry.getRect()));

代码示例来源:origin: magefree/mage

public boolean overlaps(Rectangle r1) {
  return this.getBounds().intersects(r1);
}

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

public boolean add(Rectangle rect) {
  if (bound.isEmpty()) {
    assert (rectList.size() == 0);
    bound.x = rect.x;
    bound.y = rect.y;
    bound.width = rect.width;
    bound.height = rect.height;
    rectList.add(rect);
    return true;
  }
  Rectangle rcInflated = new Rectangle(rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
  if (!bound.intersects(rcInflated))
    return false;
  for (Rectangle r : rectList) {
    if (r.intersects(rcInflated)) {
      if (!r.contains(rect)) {
        enlargeBound(rect);
        rectList.add(rect);
        return true;
      }
    }
  }
  return false;
}

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

public void add(Rectangle rect) {
  boolean newRegion = true;
  Rectangle rcInflated = new Rectangle(rect.x - 1, rect.y - 1, rect.width + 2, rect.height + 2);
  for (Region region : regionList) {
    if (region.getBound().intersects(rcInflated)) {
      newRegion = false;
      break;
    }
  }
  if (newRegion) {
    regionList.add(new Region(rect));
  } else {
    for (Region region : regionList) {
      if (region.add(rect))
        return;
    }
    regionList.add(new Region(rect));
  }
}

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

/**
 * Puts an index in selected state or in other word it selects the byte of the index.
 * @param index
 */
private void putInSelected(int index)
{
  state = SELECTED;
  selectedChar = 0;
  Point point = getPointForIndex(index);
  //for column one
  if (index%16 == 0)
  {
    scrollRectToVisible(new Rectangle(0, HexModel.lineNumber(index) * HexView.CHAR_HEIGHT, 1, 1));
  }
  else if (!getVisibleRect().intersects(point.x, point.y, HexView.CHAR_WIDTH, HexView.CHAR_HEIGHT))
  {
    scrollRectToVisible(new Rectangle(point.x, point.y, HexView.CHAR_WIDTH, HexView.CHAR_HEIGHT));
  }
  selectedIndex = index;
  repaint();
  requestFocusInWindow();
}

代码示例来源:origin: com.alibaba/druid

if (cellRect.intersects(clipBounds)) {
  paintCell(g, cellRect, column);

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

selectedNodes.clear();
for (Node node : getNodes()) {
  if (r.intersects(nodeRect(node))) {
    selectedNodes.add(node.getName());

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

if (!sourceRegion.intersects(baseGridRange.toRectangle()) || sourceRegion.isEmpty())
  throw new DataSourceException("The crop region is invalid.");
sourceRegion.setRect(sourceRegion.intersection(baseGridRange.toRectangle()));

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

if (tileBounds.intersects(roiBounds)) {
  if (tile.draw(roiImage)) {
    added = true;

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

return;
if (!coverageRequestedRasterArea.intersects(coverageRasterArea))
  throw new DataSourceException("The crop region is invalid.");
XRectangle2D.intersect(

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

if (!roi.getBounds().intersects(rasterBounds)) {
  essential = false;
} else {

代码示例来源:origin: mezz/JustEnoughItems

public static boolean intersects(Collection<Rectangle> areas, Rectangle comparisonArea) {
  for (Rectangle area : areas) {
    if (area.intersects(comparisonArea)) {
      return true;
    }
  }
  return false;
}

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

if (cellRect.intersects(clipBounds)) {
  paintCell(g, cellRect, column);

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

+ interp.getTopPadding());
if (!roiBounds.intersects(srcRectExpanded)) {
  roiDisjointTile = true;
} else {

代码示例来源:origin: Audiveris/audiveris

@Override
  public boolean check (Inter inter)
  {
    return inter.getBounds().intersects(columnBox)
            && !(inter instanceof InterEnsemble);
  }
});

代码示例来源:origin: protegeproject/protege

public void clear(Rectangle rectangle) {
  for(Iterator<LinkBox> it = pageLinks.iterator(); it.hasNext(); ) {
    LinkBox link = it.next();
    if(link.getBounds().intersects(rectangle)) {
      it.remove();
    }
  }
}

代码示例来源:origin: mezz/JustEnoughItems

public static Rectangle moveDownToAvoidIntersection(Collection<Rectangle> areas, Rectangle comparisonArea) {
  for (Rectangle area : areas) {
    if (area.intersects(comparisonArea)) {
      Rectangle movedDown = new Rectangle(comparisonArea);
      movedDown.y = area.y + area.height;
      return moveDownToAvoidIntersection(areas, movedDown);
    }
  }
  return comparisonArea;
}

代码示例来源:origin: bobbylight/RSyntaxTextArea

if (tempRect.intersects(clip)) {
  Element lineElement = root.getElement(i);
  int startOffset = lineElement.getStartOffset();

代码示例来源:origin: haraldk/TwelveMonkeys

if (new Rectangle(col, srcRow, colsInTile, rowsInTile).intersects(srcRegion)) {
  int len = stripTileByteCounts != null ? (int) stripTileByteCounts[i] : Integer.MAX_VALUE;
  imageInput.seek(stripTileOffsets != null ? stripTileOffsets[i] : realJPEGOffset);
if (new Rectangle(col, srcRow, colsInTile, rowsInTile).intersects(srcRegion)) {
  int length = stripTileByteCounts != null ? (int) stripTileByteCounts[i] : Short.MAX_VALUE;
  imageInput.seek(stripTileOffsets[i]);

相关文章