Package org.sikuli.script
Class Location
- java.lang.Object
-
- org.sikuli.script.Element
-
- org.sikuli.script.Location
-
- All Implemented Interfaces:
java.lang.Comparable<Location>
public class Location extends org.sikuli.script.Element implements java.lang.Comparable<Location>
A point like AWT.Point using global coordinates (x, y). hence modifications might move location out of any screen (not checked as is done with region)
-
-
Constructor Summary
Constructors Constructor Description Location(double x, double y)
to allow calculated x and y that might not be integersLocation(int x, int y)
a new point at the given coordinatesLocation(java.awt.Point point)
create from AWT pointLocation(Location loc)
duplicates the pointLocation(Offset offset)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Location
above(int dy)
creates a point at the given offset above, might be negative
might create a point outside of any screen, not checkedLocation
below(int dy)
creates a point at the given offset below, might be negative
might create a point outside of any screen, not checkedint
compareTo(Location loc)
Location
copyTo(int scrID)
new point with same offset to current screen's top left on given screenLocation
copyTo(org.sikuli.script.support.IScreen screen)
New point with same offset to current screen's top left on given screenboolean
equals(java.lang.Object oThat)
java.awt.Color
getColor()
Get the color at the given Point for details: see java.awt.Robot and ...Colorstatic Location
getDefaultInstance4py()
Image
getImage()
Offset
getOffset(Location loc)
the offset of given point to this LocationRegion
grow()
create a region with this point as center and size Settings.DefaultPaddingRegion
grow(int wh)
create a region with this point as center and the given sizeRegion
grow(int w, int h)
create a region with this point as center and the given sizeRegion
grow(int CREATE_X_DIRECTION, int CREATE_Y_DIRECTION, int w, int h)
create a region with a corner at this point
as specified with x y
0 0 top left
0 1 bottom left
1 0 top right
1 1 bottom rightLocation
left(int dx)
creates a point at the given offset to the left, might be negative
might create a point outside of any screen, not checkedstatic Location
make4py(java.util.ArrayList args)
Location
move(int X, int Y)
convenience: like awt pointLocation
moveFor(int dx, int dy)
Deprecated.Location
moveTo(int X, int Y)
Deprecated.usemove(int, int)
Location
offset(int dx, int dy)
creates a point at the given offset, might be negative
might create a point outside of any screen, not checkedLocation
offset(java.lang.Object whatever)
creates a point at the given offset, might be negative
might create a point outside of any screen, not checkedLocation
right(int dx)
creates a point at the given offset to the right, might be negative
might create a point outside of any screen, not checkedjava.lang.String
toJSON()
java.lang.String
toString()
java.lang.String
toStringShort()
Location
translate(int dx, int dy)
convenience: like awt pointRegion
union(Location loc)
creates aRegion
with the given points as top-left and bottom-right corners-
Methods inherited from class org.sikuli.script.Element
asFakeImage, asMaskImage, asText, black, black, cacheStats, click, click, click, cloneContent, collectLines, collectLinesText, collectWords, collectWordsText, createURL, createURL, delayClick, diffPercentage, exists, exists, existsT, existsText, file, fileName, find, findAll, findAllByColumn, findAllByRow, findAllT, findAllText, findAny, findAnyList, findBest, findBestList, findChanges, findLine, findLines, findLines, findT, findText, findWord, findWords, findWords, getAll, getAutoWaitTimeout, getBufferedImage, getBufferedImage, getCache, getCenter, getContent, getFindFailedHandler, getFindFailedResponse, getH, getImage, getLastMatch, getLastMatches, getMatchLastSeen, getName, getObserveScanRate, getOtherScreen, getPoint, getRect, getRepeatWaitTime, getScreen, getSize, getTarget, getThrowException, getValidImageFilename, getW, getWaitScanRate, getX, getY, has, has, hasT, hasText, hasURL, hover, hover, ignoreLastSeen, initScreen, intersection, isFakeImage, isInside, isMaskImage, isOtherScreen, isText, isValid, isVirtual, match, match, matches, matches, mean, meanColor, mouseDown, mouseMove, mouseMove, mouseMove, mouseUp, mouseUp, plain, plain, reload, reload, reLocate, resetCache, resetFindFailedResponse, resetThrowException, resize, resize, sameSize, save, save, save, set, set, setAutoWaitTimeout, setCenter, setContent, setFindFailedHandler, setFindFailedResponse, setH, setLocation, setMissingAbort, setMissingPrompt, setName, setObserveScanRate, setOtherScreen, setRect, setRect, setRect, setRepeatWaitTime, setScreen, setThrowException, setVirtual, setW, setWaitScanRate, setX, setX, setY, setY, size, size, stdDev, text, textChar, textLine, textLines, textWord, textWords, traceOff, traceOn, union, unionAll, unionAny, unionAnyList, updateContent, url, url, url, virtual, wait, wait, wait, waitVanish, waitVanish, white
-
-
-
-
Constructor Detail
-
Location
public Location(double x, double y)
to allow calculated x and y that might not be integers- Parameters:
x
- columny
- row truncated to the integer part
-
Location
public Location(int x, int y)
a new point at the given coordinates- Parameters:
x
- columny
- row
-
Location
public Location(Offset offset)
-
Location
public Location(Location loc)
duplicates the point- Parameters:
loc
- other Location
-
Location
public Location(java.awt.Point point)
create from AWT point- Parameters:
point
- a Point
-
-
Method Detail
-
getDefaultInstance4py
public static Location getDefaultInstance4py()
-
make4py
public static Location make4py(java.util.ArrayList args)
-
getImage
public Image getImage()
- Overrides:
getImage
in classorg.sikuli.script.Element
-
getColor
public java.awt.Color getColor()
Get the color at the given Point for details: see java.awt.Robot and ...Color- Returns:
- The Color of the Point
-
grow
public Region grow()
create a region with this point as center and size Settings.DefaultPadding- Returns:
- the new region
-
grow
public Region grow(int w, int h)
create a region with this point as center and the given size- Parameters:
w
- the widthh
- the height- Returns:
- the new region
-
grow
public Region grow(int wh)
create a region with this point as center and the given size- Parameters:
wh
- the width and height- Returns:
- the new region
-
grow
public Region grow(int CREATE_X_DIRECTION, int CREATE_Y_DIRECTION, int w, int h)
create a region with a corner at this point
as specified with x y
0 0 top left
0 1 bottom left
1 0 top right
1 1 bottom right- Parameters:
CREATE_X_DIRECTION
- == 0 is left side !=0 is right side, seeRegion.LEFT
,Region.RIGHT
CREATE_Y_DIRECTION
- == 0 is top side !=0 is bottom side, seeRegion.TOP
,Region.BOTTOM
w
- the widthh
- the height- Returns:
- the new region
-
union
public Region union(Location loc)
creates aRegion
with the given points as top-left and bottom-right corners- Parameters:
loc
- the other corner- Returns:
- a new Region
-
moveFor
@Deprecated public Location moveFor(int dx, int dy)
Deprecated.moves the point the given amounts in the x and y direction, might be negative
might move point outside of any screen, not checked- Parameters:
dx
- x offsetdy
- y offset- Returns:
- the location itself modified
-
translate
public Location translate(int dx, int dy)
convenience: like awt point- Parameters:
dx
- x offsetdy
- y offset- Returns:
- the location itself modified
-
moveTo
@Deprecated public Location moveTo(int X, int Y)
Deprecated.usemove(int, int)
changes the locations x and y value to the given values (moves it)
might move point outside of any screen, not checked- Parameters:
X
- new xY
- new y- Returns:
- the location itself modified
-
move
public Location move(int X, int Y)
convenience: like awt point- Parameters:
X
- new xY
- new y- Returns:
- the location itself modified
-
getOffset
public Offset getOffset(Location loc)
the offset of given point to this Location- Parameters:
loc
- the other Location- Returns:
- relative offset
-
copyTo
public Location copyTo(int scrID)
new point with same offset to current screen's top left on given screen- Parameters:
scrID
- number of screen- Returns:
- new location
-
copyTo
public Location copyTo(org.sikuli.script.support.IScreen screen)
New point with same offset to current screen's top left on given screen- Parameters:
screen
- new parent screen- Returns:
- new location
-
offset
public Location offset(int dx, int dy)
creates a point at the given offset, might be negative
might create a point outside of any screen, not checked- Parameters:
dx
- x offsetdy
- y offset- Returns:
- new location
-
offset
public Location offset(java.lang.Object whatever)
creates a point at the given offset, might be negative
might create a point outside of any screen, not checked- Parameters:
whatever
- offset taken from Region, Match, Image, Location or Offset- Returns:
- new location relocated with offset
-
left
public Location left(int dx)
creates a point at the given offset to the left, might be negative
might create a point outside of any screen, not checked- Parameters:
dx
- x offset- Returns:
- new location
-
right
public Location right(int dx)
creates a point at the given offset to the right, might be negative
might create a point outside of any screen, not checked- Parameters:
dx
- x offset- Returns:
- new location
-
above
public Location above(int dy)
creates a point at the given offset above, might be negative
might create a point outside of any screen, not checked- Parameters:
dy
- y offset- Returns:
- new location
-
below
public Location below(int dy)
creates a point at the given offset below, might be negative
might create a point outside of any screen, not checked- Parameters:
dy
- y offset- Returns:
- new location
-
equals
public boolean equals(java.lang.Object oThat)
- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(Location loc)
- Specified by:
compareTo
in interfacejava.lang.Comparable<Location>
- Parameters:
loc
- other Location- Returns:
- -1 if given point is more above and/or left, 1 otherwise (0 is equal)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classorg.sikuli.script.Element
- Returns:
- the description
-
toStringShort
public java.lang.String toStringShort()
- Returns:
- a shorter description
-
toJSON
public java.lang.String toJSON()
-
-