()
| 266 | } |
| 267 | |
| 268 | private Rectangle2D parseRect() { |
| 269 | // browsers seem to support comma and blank |
| 270 | final String[] coords = StringUtils.splitAtCommaOrBlank(getCoordsAttribute()); |
| 271 | |
| 272 | double leftX = 0; |
| 273 | double topY = 0; |
| 274 | double rightX = 0; |
| 275 | double bottomY = 0; |
| 276 | |
| 277 | try { |
| 278 | if (coords.length > 0) { |
| 279 | leftX = Double.parseDouble(coords[0].trim()); |
| 280 | } |
| 281 | if (coords.length > 1) { |
| 282 | topY = Double.parseDouble(coords[1].trim()); |
| 283 | } |
| 284 | if (coords.length > 2) { |
| 285 | rightX = Double.parseDouble(coords[2].trim()); |
| 286 | } |
| 287 | if (coords.length > 3) { |
| 288 | bottomY = Double.parseDouble(coords[3].trim()); |
| 289 | } |
| 290 | } |
| 291 | catch (final NumberFormatException e) { |
| 292 | if (LOG.isWarnEnabled()) { |
| 293 | LOG.warn("Invalid rect coords '" + Arrays.toString(coords) + "'", e); |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | return new Rectangle2D(leftX, topY, rightX, bottomY); |
| 298 | } |
| 299 | |
| 300 | private Circle2D parseCircle() { |
| 301 | // browsers seem to support comma and blank |
no test coverage detected