Indicates if this area contains the specified point. @param x the x coordinate of the point @param y the y coordinate of the point @return true if the point is contained in this area
(final int x, final int y)
| 218 | * @return {@code true} if the point is contained in this area |
| 219 | */ |
| 220 | boolean containsPoint(final int x, final int y) { |
| 221 | final String shape = StringUtils.defaultIfEmptyOrNull(getShapeAttribute(), SHAPE_RECT); |
| 222 | |
| 223 | if ("default".equalsIgnoreCase(shape) && getCoordsAttribute() != null) { |
| 224 | return true; |
| 225 | } |
| 226 | |
| 227 | if (SHAPE_RECT.equalsIgnoreCase(shape) && getCoordsAttribute() != null) { |
| 228 | final Shape2D rectangle = parseRect(); |
| 229 | return rectangle.contains(x, y); |
| 230 | } |
| 231 | |
| 232 | if (SHAPE_CIRCLE.equalsIgnoreCase(shape) && getCoordsAttribute() != null) { |
| 233 | final Shape2D circle = parseCircle(); |
| 234 | return circle.contains(x, y); |
| 235 | } |
| 236 | |
| 237 | if (SHAPE_POLY.equalsIgnoreCase(shape) && getCoordsAttribute() != null) { |
| 238 | final Shape2D path = parsePoly(); |
| 239 | return path.contains(x, y); |
| 240 | } |
| 241 | |
| 242 | return false; |
| 243 | } |
| 244 | |
| 245 | /** |
| 246 | * {@inheritDoc} |
no test coverage detected