Class 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)
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.sikuli.script.Element

        org.sikuli.script.Element.Interpolation
    • Field Summary

      • Fields inherited from class org.sikuli.script.Element

        h, w, x, y
    • Constructor Summary

      Constructors 
      Constructor Description
      Location​(double x, double y)
      to allow calculated x and y that might not be integers
      Location​(int x, int y)
      a new point at the given coordinates
      Location​(java.awt.Point point)
      create from AWT point
      Location​(Location loc)
      duplicates the point
      Location​(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 checked
      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
      int compareTo​(Location loc)
      Location copyTo​(int scrID)
      new point with same offset to current screen's top left on given screen
      Location copyTo​(org.sikuli.script.support.IScreen screen)
      New point with same offset to current screen's top left on given screen
      boolean equals​(java.lang.Object oThat)  
      java.awt.Color getColor()
      Get the color at the given Point for details: see java.awt.Robot and ...Color
      static Location getDefaultInstance4py()  
      Image getImage()  
      Offset getOffset​(Location loc)
      the offset of given point to this Location
      Region grow()
      create a region with this point as center and size Settings.DefaultPadding
      Region grow​(int wh)
      create a region with this point as center and the given size
      Region grow​(int w, int h)
      create a region with this point as center and the given size
      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
      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
      static Location make4py​(java.util.ArrayList args)  
      Location move​(int X, int Y)
      convenience: like awt point
      Location moveFor​(int dx, int dy)
      Deprecated.
      Location moveTo​(int X, int Y)
      Deprecated.
      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
      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
      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
      java.lang.String toJSON()  
      java.lang.String toString()
      java.lang.String toStringShort()  
      Location translate​(int dx, int dy)
      convenience: like awt point
      Region union​(Location loc)
      creates a Region 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
      • Methods inherited from class java.lang.Object

        getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Location

        public Location​(double x,
                        double y)
        to allow calculated x and y that might not be integers
        Parameters:
        x - column
        y - row truncated to the integer part
      • Location

        public Location​(int x,
                        int y)
        a new point at the given coordinates
        Parameters:
        x - column
        y - 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 class org.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 width
        h - 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, see Region.LEFT, Region.RIGHT
        CREATE_Y_DIRECTION - == 0 is top side !=0 is bottom side, see Region.TOP, Region.BOTTOM
        w - the width
        h - the height
        Returns:
        the new region
      • union

        public Region union​(Location loc)
        creates a Region 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 offset
        dy - y offset
        Returns:
        the location itself modified
      • translate

        public Location translate​(int dx,
                                  int dy)
        convenience: like awt point
        Parameters:
        dx - x offset
        dy - y offset
        Returns:
        the location itself modified
      • moveTo

        @Deprecated
        public Location moveTo​(int X,
                               int Y)
        Deprecated.
        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 x
        Y - new y
        Returns:
        the location itself modified
      • move

        public Location move​(int X,
                             int Y)
        convenience: like awt point
        Parameters:
        X - new x
        Y - 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 offset
        dy - 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 class java.lang.Object
      • compareTo

        public int compareTo​(Location loc)
        Specified by:
        compareTo in interface java.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 class org.sikuli.script.Element
        Returns:
        the description
      • toStringShort

        public java.lang.String toStringShort()
        Returns:
        a shorter description
      • toJSON

        public java.lang.String toJSON()