Package com.applitools.eyes
Class Region
java.lang.Object
com.applitools.eyes.Region
- All Implemented Interfaces:
IRegion,com.helger.commons.compare.IComparable<Region>,Serializable,Comparable<Region>
public class Region
extends Object
implements IRegion, com.helger.commons.compare.IComparable<Region>
Represents a region.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRegion(int left, int top, int width, int height) Instantiates a new Region.Region(int left, int top, int width, int height, CoordinatesType coordinatesType) Instantiates a new Region.Instantiates a new Region.Region(Location location, RectangleSize size) Instantiates a new Region.Region(Location location, RectangleSize size, CoordinatesType coordinatesType) Instantiates a new Region. -
Method Summary
Modifier and TypeMethodDescriptionaddPadding(Padding padding) intbooleanCheck if a specified location is contained within this region.booleanCheck if a region is contained within the current region.booleanexpandToContain(Region region) Expand to contain region.intgetArea()intGets coordinates type.intGets height.getIntersected(Region other) intgetLeft()Gets left.Gets location.Gets middle offset.Gets negative location.intgetRight()getSize()Gets size.getSubRegions(RectangleSize subRegionSize) Gets sub regions.getSubRegions(RectangleSize subRegionSize, boolean isFixedSize) Returns a list of sub-regions which compose the current region.getSubRegions(RectangleSize maxSubRegionSize, int logicalOverlap, double l2pScaleRatio, Rectangle physicalRectInScreenshot, Logger logger) intgetTop()Gets top.intgetWidth()Gets width.inthashCode()voidReplaces this region with the intersection of itself andotherbooleanisEmpty()Is empty boolean.booleanisIntersected(Region other) Check if a region is intersected with the current region.booleanIs size empty boolean.protected voidMake empty.offset(int dx, int dy) Get an offset region.Get an offset region.scale(double scaleRatio) Get a region which is a scaled version of the current region.voidSets coordinates type.voidsetHeight(int value) Sets height.voidsetLeft(int value) Sets left.voidsetLocation(Location location) Set the (top,left) position of the current regionvoidsetSize(RectangleSize size) Sets size.voidsetTop(int value) Sets top.voidsetWidth(int value) Sets width.voidsetX(int x) voidsetY(int y) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.helger.commons.compare.IComparable
isEQ, isGE, isGT, isLE, isLT, isNE
-
Field Details
-
EMPTY
The constant EMPTY.
-
-
Constructor Details
-
Region
public Region(int left, int top, int width, int height) Instantiates a new Region.- Parameters:
left- the lefttop- the topwidth- the widthheight- the height
-
Region
Instantiates a new Region.- Parameters:
left- the lefttop- the topwidth- the widthheight- the heightcoordinatesType- the coordinates type
-
Region
-
Region
Instantiates a new Region.- Parameters:
location- the locationsize- the size
-
Region
Instantiates a new Region.- Parameters:
location- the locationsize- the sizecoordinatesType- the coordinates type
-
Region
-
-
Method Details
-
makeEmpty
protected void makeEmpty()Make empty. -
isEmpty
public boolean isEmpty()Is empty boolean.- Returns:
- true if the region is empty, false otherwise.
-
isSizeEmpty
public boolean isSizeEmpty()Is size empty boolean.- Returns:
- true if the region's size is 0, false otherwise.
-
equals
-
hashCode
-
getLocation
Gets location.- Specified by:
getLocationin interfaceIRegion- Returns:
- The (left, top) position of the current region.
-
getNegativeLocation
Gets negative location.- Returns:
- The (-left, -top) position of the current region.
-
offset
-
offset
-
scale
Get a region which is a scaled version of the current region. IMPORTANT: This also scales the LOCATION(!!) of the region (not just its size).- Parameters:
scaleRatio- The ratio by which to scale the region.- Returns:
- A new region which is a scaled version of the current region.
-
addPadding
-
getSize
Gets size. -
getCoordinatesType
Gets coordinates type.- Specified by:
getCoordinatesTypein interfaceIRegion- Returns:
- The region's coordinate type.
-
setCoordinatesType
Sets coordinates type.- Parameters:
value- the value
-
setSize
Sets size.- Parameters:
size- The updated size of the region.
-
setLocation
Set the (top,left) position of the current region- Parameters:
location- The (top,left) position to set.
-
getSubRegions
Returns a list of sub-regions which compose the current region.- Parameters:
subRegionSize- The default sub-region size to use.isFixedSize- Iffalse, then sub-regions might have a size which is smaller thensubRegionSize(thus there will be no overlap of regions). Otherwise, all sub-regions will have the same size, but sub-regions might overlap.- Returns:
- The sub-regions composing the current region. If
subRegionSizeis equal or greater than the current region, only a single region is returned.
-
getSubRegions
Gets sub regions.- Parameters:
subRegionSize- the sub region size- Returns:
- the sub regions
- See Also:
-
contains
Check if a region is contained within the current region.- Parameters:
other- The region to check if it is contained within the current region.- Returns:
- True if
otheris contained within the current region, false otherwise.
-
contains
Check if a specified location is contained within this region.- Parameters:
location- The location to test.- Returns:
- True if the location is contained within this region, false otherwise.
-
isIntersected
Check if a region is intersected with the current region.- Parameters:
other- The region to check intersection with.- Returns:
- True if the regions are intersected, false otherwise.
-
intersect
Replaces this region with the intersection of itself andother- Parameters:
other- The region with which to intersect.
-
getIntersected
-
getLeft
-
getTop
-
getWidth
-
getHeight
-
setLeft
public void setLeft(int value) Sets left.- Parameters:
value- the value
-
setTop
public void setTop(int value) Sets top.- Parameters:
value- the value
-
getBottom
public int getBottom() -
getRight
public int getRight() -
setWidth
public void setWidth(int value) Sets width.- Parameters:
value- the value
-
setHeight
public void setHeight(int value) Sets height.- Parameters:
value- the value
-
getMiddleOffset
-
expandToContain
-
toString
-
getArea
-
setX
public void setX(int x) -
setY
public void setY(int y) -
getSubRegions
public SubregionForStitching[] getSubRegions(RectangleSize maxSubRegionSize, int logicalOverlap, double l2pScaleRatio, Rectangle physicalRectInScreenshot, Logger logger) -
regionId
-
getRegionId
-
compareTo
- Specified by:
compareToin interfaceComparable<Region>
-