1515import org .apache .logging .log4j .Logger ;
1616
1717/**
18- * The {@code PointSelector} class provides utility methods for selecting random
19- * points within
20- * graphical zones. These methods are designed to reduce code duplication and
21- * streamline common
22- * actions when automating interactions with graphical objects like colours or
23- * images.
18+ * The {@code PointSelector} class provides utility methods for selecting random points within
19+ * graphical zones. These methods are designed to reduce code duplication and streamline common
20+ * actions when automating interactions with graphical objects like colours or images.
2421 *
25- * <p>
26- * <b>Features:</b>
22+ * <p><b>Features:</b>
2723 *
2824 * <ul>
29- * <li>Finds a random point within the bounding box of a detected image
30- * template.
31- * <li>Finds a random point inside the contour of the first detected object of a
32- * specified color.
25+ * <li>Finds a random point within the bounding box of a detected image template.
26+ * <li>Finds a random point inside the contour of the first detected object of a specified colour.
3327 * </ul>
3428 *
35- * <p>
36- * These utilities are commonly reused across scripts written for the
37- * ChromaScape automation
38- * framework. The class does not perform any input actions (such as clicking),
39- * but provides the
29+ * <p>These utilities are commonly reused across scripts written for the ChromaScape automation
30+ * framework. The class does not perform any input actions (such as clicking), but provides the
4031 * coordinates needed for such actions.
4132 *
42- * <p>
43- * <b>Typical Usage:</b>
33+ * <p><b>Typical Usage:</b>
4434 *
4535 * <pre>
4636 * Point pointInImage = PointSelector.getRandomPointInImage(templatePath, gameView, threshold);
4737 * Point pointInColour = PointSelector.getRandomPointInColour(gameView, "Purple", maxAttempts);
4838 * </pre>
4939 *
50- * <p>
51- * All methods are static and thread-safe.
40+ * <p>All methods are static and thread-safe.
5241 */
5342public class PointSelector {
5443
5544 private static final Logger logger = LogManager .getLogger (PointSelector .class );
5645
5746 /**
58- * Searches for the provided image template within the current game view, then
59- * returns a random
60- * point within the detected bounding box if the match exceeds the defined
61- * threshold.
47+ * Searches for the provided image template within the current game view, then returns a random
48+ * point within the detected bounding box if the match exceeds the defined threshold.
6249 *
63- * @param templatePath the BufferedImage template to locate and click within the
64- * larger image view
65- * @param image the larger image, what you're searching in
66- * @param threshold the openCV threshold to decide if a match exists
50+ * @param templatePath the BufferedImage template to locate and click within the larger image view
51+ * @param image the larger image, what you're searching in
52+ * @param threshold the openCV threshold to decide if a match exists
6753 * @return The point to click
6854 */
6955 public static Point getRandomPointInImage (
@@ -86,22 +72,19 @@ public static Point getRandomPointInImage(
8672 }
8773
8874 /**
89- * Attempts to find a random point inside the contour of the first object of the
90- * specified color.
75+ * Attempts to find a random point inside the contour of the first object of the specified colour.
9176 *
92- * @param image the image to search in (e.g. game view from controller)
93- * @param colourName the name of the color (must match ColourInstances key,
94- * e.g. "Purple")
95- * @param maxAttempts maximum number of attempts to find a point inside the
96- * contour
77+ * @param image the image to search in (e.g. game view from controller)
78+ * @param colourName the name of the colour (must match ColourInstances key, e.g. "Purple")
79+ * @param maxAttempts maximum number of attempts to find a point inside the contour
9780 * @return a random Point inside the contour, or null if not found/error
9881 */
9982 public static Point getRandomPointInColour (
10083 BufferedImage image , String colourName , int maxAttempts ) {
101- return getRandomPointByColor (image , ColourInstances .getByName (colourName ), maxAttempts );
84+ return getRandomPointByColour (image , ColourInstances .getByName (colourName ), maxAttempts );
10285 }
10386
104- public static Point getRandomPointByColor (
87+ public static Point getRandomPointByColour (
10588 BufferedImage image , ColourObj colourName , int maxAttempts ) {
10689 List <ChromaObj > objs ;
10790 try {
0 commit comments