Class Rectangle
- java.lang.Object
-
- com.github.romankh3.image.comparison.model.Rectangle
-
public class Rectangle extends java.lang.ObjectObject contained data for a rectangle.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static RectanglecreateDefault()Create defaultRectangleobject.static RectanglecreateZero()Create instance with zero points.booleanequals(java.lang.Object o)intgetHeight()Count the height of theRectangle.java.awt.PointgetMaxPoint()java.awt.PointgetMinPoint()intgetWidth()Count the width of theRectangle.inthashCode()booleanisOverlapping(Rectangle that)Check is that rectangle overlapp this.voidmakeZeroRectangle()Make zero rectagle.Rectanglemerge(Rectangle that)Create newRectanglevia merging this and that.voidsetDefaultValues()Set default values for rectangle.voidsetMaxPoint(java.awt.Point maxPoint)voidsetMinPoint(java.awt.Point minPoint)java.lang.Integersize()Size of theRectangle, counted as width x height.
-
-
-
Constructor Detail
-
Rectangle
public Rectangle(Rectangle rectangle)
Create clone object based on the providedRectangle.- Parameters:
rectangle- providedRectangleobject.
-
Rectangle
public Rectangle(int minX, int minY, int maxX, int maxY)Create instance of theRectanglebased on the provided coordinates.- Parameters:
minX- minimal X-coordinate.minY- minimal Y-coordinate.maxX- maximal X-coordinate.maxY- maximal Y-coordinate.
-
-
Method Detail
-
createDefault
public static Rectangle createDefault()
Create defaultRectangleobject.- Returns:
- default rectangle
Rectangle.
-
createZero
public static Rectangle createZero()
Create instance with zero points.- Returns:
- created
Rectangleinstance.
-
isOverlapping
public boolean isOverlapping(Rectangle that)
Check is that rectangle overlapp this.- Parameters:
that-Rectanglewhich checks with this.- Returns:
- true if this over lapp that, false otherwise.
-
setDefaultValues
public void setDefaultValues()
Set default values for rectangle.
-
makeZeroRectangle
public void makeZeroRectangle()
Make zero rectagle.
-
size
public java.lang.Integer size()
Size of theRectangle, counted as width x height.- Returns:
- the size of the
Rectangle.
-
getWidth
public int getWidth()
Count the width of theRectangle. Min and max point are included, so real width is +1px- Returns:
- rectangle width.
-
getHeight
public int getHeight()
Count the height of theRectangle. Min and max point are included, so real width is +1px.- Returns:
- rectangle height.
-
getMinPoint
public java.awt.Point getMinPoint()
-
setMinPoint
public void setMinPoint(java.awt.Point minPoint)
-
getMaxPoint
public java.awt.Point getMaxPoint()
-
setMaxPoint
public void setMaxPoint(java.awt.Point maxPoint)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-