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

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

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

Rectangle.equals介绍

[英]Checks whether two rectangles are equal.

The result is true if and only if the argument is not null and is a Rectangle object that has the same top-left corner, width, and height as this Rectangle.
[中]检查两个矩形是否相等。
结果是true当且仅当参数不是null并且是一个Rectangle对象,该对象具有与此Rectangle相同的左上角、宽度和高度时。

代码示例

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

gridRange.getSpan(0),
        gridRange.getSpan(1));
if (!thisRectangle.equals(thatRectangle)) {
  if (!canSupportHeterogeneousCoverages) {
    throw new IllegalArgumentException(

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

final boolean chatboxBoundsChanged = chatbox == null || !chatbox.getBounds().equals(chatboxBounds);
final boolean viewportChanged = !client.getViewportWidget().getBounds().equals(viewportBounds);

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

!shape.getBounds().equals(getBounds())) {
shape = new Ellipse2D.Float(0, 0, 
 getWidth(), getHeight());

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

if (mapContent.getViewport().getScreenArea().equals(getVisibleRect())) {
  return;

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

public void testPolygonShape() throws TransformException, FactoryException {
  GeometryFactory geomFac = new GeometryFactory();
  Polygon polygon = makeSamplePolygon(geomFac, 0, 0);
  LiteShape2 lineShape =
      new LiteShape2(
          polygon,
          ProjectiveTransform.create(new AffineTransform()),
          new Decimator(ProjectiveTransform.create(new AffineTransform())),
          false);
  assertFalse(lineShape.contains(0, 0));
  assertTrue(lineShape.contains(100, 100));
  assertFalse(lineShape.contains(50, 50, 10, 10));
  assertTrue(lineShape.contains(100, 100, 10, 10));
  assertTrue(lineShape.contains(new java.awt.Point(70, 90)));
  assertFalse(lineShape.contains(new java.awt.geom.Rectangle2D.Float(50, 50, 10, 10)));
  assertTrue(lineShape.getBounds2D().equals(new Rectangle2D.Double(60, 70, 70, 50)));
  assertTrue(lineShape.getBounds().equals(new java.awt.Rectangle(60, 70, 70, 50)));
  assertTrue(lineShape.intersects(0, 0, 100, 100));
  assertTrue(lineShape.intersects(new Rectangle2D.Double(0, 0, 100, 100)));
  assertFalse(lineShape.intersects(55, 55, 3, 100));
  assertFalse(lineShape.intersects(new Rectangle2D.Double(55, 55, 3, 100)));
}

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

public void testLineShape() throws TransformException, FactoryException {
  GeometryFactory geomFac = new GeometryFactory();
  LineString lineString = makeSampleLineString(geomFac, 0, 0);
  AffineTransform affineTransform = new AffineTransform();
  LiteShape lineShape = new LiteShape(lineString, affineTransform, false);
  assertFalse(lineShape.contains(0, 0));
  assertTrue(lineShape.contains(60, 60));
  assertFalse(lineShape.contains(50, 50, 10, 10));
  assertTrue(lineShape.contains(new java.awt.Point(60, 60)));
  assertFalse(lineShape.contains(new java.awt.geom.Rectangle2D.Float(50, 50, 10, 10)));
  assertTrue(lineShape.getBounds2D().equals(new Rectangle2D.Double(50, 50, 80, 250)));
  assertTrue(lineShape.getBounds().equals(new java.awt.Rectangle(50, 50, 80, 250)));
  assertTrue(lineShape.intersects(0, 0, 100, 100));
  assertTrue(lineShape.intersects(new Rectangle2D.Double(0, 0, 100, 100)));
  assertFalse(lineShape.intersects(55, 55, 3, 100));
  assertFalse(lineShape.intersects(new Rectangle2D.Double(55, 55, 3, 100)));
}

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

public void testLineShape2() throws TransformException, FactoryException {
  GeometryFactory geomFac = new GeometryFactory();
  LineString lineString = makeSampleLineString(geomFac, 0, 0);
  MathTransform transform = ProjectiveTransform.create(new AffineTransform());
  Decimator decimator = new Decimator(transform);
  LiteShape2 lineShape = new LiteShape2(lineString, transform, decimator, false);
  assertFalse(lineShape.contains(0, 0));
  assertTrue(lineShape.contains(60, 60));
  assertFalse(lineShape.contains(50, 50, 10, 10));
  assertTrue(lineShape.contains(new java.awt.Point(60, 60)));
  assertFalse(lineShape.contains(new java.awt.geom.Rectangle2D.Float(50, 50, 10, 10)));
  assertTrue(lineShape.getBounds2D().equals(new Rectangle2D.Double(50, 50, 80, 250)));
  assertTrue(lineShape.getBounds().equals(new java.awt.Rectangle(50, 50, 80, 250)));
  assertTrue(lineShape.intersects(0, 0, 100, 100));
  assertTrue(lineShape.intersects(new Rectangle2D.Double(0, 0, 100, 100)));
  assertFalse(lineShape.intersects(55, 55, 3, 100));
  assertFalse(lineShape.intersects(new Rectangle2D.Double(55, 55, 3, 100)));
}

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

if (!currentExtent.equals(union)) {
  performMosaic = true;
  if (border) {
    if (!PlanarImage.wrapRenderedImage(sources[i]).getBounds().equals(union)) {

代码示例来源:origin: org.apache.xmlgraphics/batik-util

/**
 * Sets a Rectangle preference. If null removes it.
 */
public void setRectangle(String key, Rectangle value)
{
  if (value != null && !value.equals(getDefault(key)))
    internal.setProperty(key, value.x+" "+value.y+" "+
               value.width+ ' ' +value.height);
  else
    internal.remove(key);
}

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

public void setDetachedBounds(Rectangle detachedBounds) {
  if ((this.detachedBounds != null && this.detachedBounds.equals(detachedBounds)) || detachedBounds == null)
    return;
  this.detachedBounds = detachedBounds;
  firePropertyChangeEvent("detachedBounds", null, detachedBounds);
}

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

if (imageBounds.equals(bounds) && rasterMask == null) {

代码示例来源:origin: JetBrains/jediterm

public Rectangle layout(JComponent c, Rectangle bounds) {
  final Rectangle now = c.getBounds();
  if (!bounds.equals(now)) {
    c.setBounds(bounds);
  }
  c.putClientProperty(LAYOUT_DONE, Boolean.TRUE);
  return bounds;
}

代码示例来源:origin: JetBrains/jediterm

static void hideNull(Component component) {
 if (component instanceof NullableComponent) {
  if (!component.getBounds().equals(myNullBounds)) {
   component.setBounds(myNullBounds);
   component.validate();
  }
 }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

private boolean sizeChanged()
{
  if((oldComponentInnards==null) || (componentInnards==null))
  {
    return true;
  }
  oldComponentInnards.setRect(componentInnards);
  componentInnards=SwingUtilities.calculateInnerArea(progressBar,
                                    componentInnards);
  return !oldComponentInnards.equals(componentInnards);
}

代码示例来源:origin: org.geotools/gt-widgets-swing-pending

protected boolean checkAspect() {
  boolean changed = false;
  Rectangle newRect = comp.getBounds();
  if (!newRect.equals(oldRect) || !mapArea.equals(oldMapArea)) {
    changed = true;
    oldRect = newRect;
    oldMapArea = mapArea;
  }
  return changed;
}

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

.retainFirstBand()
        .getPlanarImage();
if (!alpha.getBounds().equals(imageWorker.getPlanarImage().getBounds())) {

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

if (finalRasterArea.equals(sourceGridRange) && isSimpleTransform && cropROI == null)
  return sourceCoverage;
        && bounds.getBounds().equals(sourceGridRange)
        && isSimpleTransform
        && nodata == null

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

sourceImage = PlanarImage.wrapRenderedImage(sourceCoverage.getRenderedImage());
w.setImage(sourceImage);
if (targetBB.equals(sourceBB)) {
if ((automaticGR || targetBB.equals(sourceBB)) && allSteps instanceof AffineTransform) {
  if (automaticGG) {

代码示例来源:origin: net.imagej/ij

/** Checks whether two rectangles are equal. */
public boolean equals(Object obj) {
  if (obj instanceof Roi) {
    Roi roi2 = (Roi)obj;
    if (type!=roi2.getType()) return false;
    if (!getBounds().equals(roi2.getBounds())) return false;
    if (getLength()!=roi2.getLength()) return false;
    return true;
  } else
    return false;
}

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

@Override
public boolean isSameAs (Inter that)
{
  if ((this.getShape() != that.getShape()) || !this.getBounds().equals(that.getBounds())) {
    return false;
  }
  if ((this.getGlyph() != null) && (that.getGlyph() != null)) {
    return this.getGlyph().isIdentical(that.getGlyph());
  }
  return true;
}

相关文章