Package loci.common

Class Region

java.lang.Object
loci.common.Region

public class Region
extends java.lang.Object
A class for representing a rectangular region. This class is very similar to Rectangle; it mainly exists to avoid problems with AWT, JNI and headless operation.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    int height  
    int width  
    int x  
    int y  
  • Constructor Summary

    Constructors 
    Constructor Description
    Region()  
    Region​(int x, int y, int w, int h)  
  • Method Summary

    Modifier and Type Method Description
    boolean containsPoint​(int xc, int yc)
    Returns true if the point specified by the given X and Y coordinates is contained within this region.
    boolean equals​(java.lang.Object o)  
    int hashCode()  
    Region intersection​(Region r)
    Returns a Region representing the intersection of this Region with the given Region.
    boolean intersects​(Region r)  
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • x

      public int x
    • y

      public int y
    • width

      public int width
    • height

      public int height
  • Constructor Details

    • Region

      public Region()
    • Region

      public Region​(int x, int y, int w, int h)
  • Method Details

    • intersects

      public boolean intersects​(Region r)
      Parameters:
      r - the region to check for intersection
      Returns:
      true if this region intersects the given region
      See Also:
      Rectangle.intersects(java.awt.Rectangle)
    • intersection

      public Region intersection​(Region r)
      Returns a Region representing the intersection of this Region with the given Region. If the two Regions do not intersect, the result is an empty Region.
      Parameters:
      r - the region for which to calculate an intersection (or overlap)
      Returns:
      a Region representing the intersection (overlap) of the two Regions. If the two Regions have no common area, then the width and/or height of the returned Region will be 0. null is never returned.
    • containsPoint

      public boolean containsPoint​(int xc, int yc)
      Returns true if the point specified by the given X and Y coordinates is contained within this region.
      Parameters:
      xc - the integer X coordinate of a point
      yc - the integer Y coordinate of a point
      Returns:
      true if this Region encloses the given point
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object