MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / parsePoly

Method parsePoly

src/main/java/org/htmlunit/html/HtmlArea.java:329–350  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

327 }
328
329 private Shape2D parsePoly() {
330 // browsers seem to support comma and blank
331 final String[] coords = StringUtils.splitAtCommaOrBlank(getCoordsAttribute());
332
333 try {
334 if (coords.length > 1) {
335 final Polygon2D path = new Polygon2D(Double.parseDouble(coords[0]), Double.parseDouble(coords[1]));
336
337 for (int i = 2; i + 1 < coords.length; i += 2) {
338 path.lineTo(Double.parseDouble(coords[i]), Double.parseDouble(coords[i + 1]));
339 }
340 return path;
341 }
342 }
343 catch (final NumberFormatException e) {
344 if (LOG.isWarnEnabled()) {
345 LOG.warn("Invalid poly coords '" + Arrays.toString(coords) + "'", e);
346 }
347 }
348
349 return new Rectangle2D(0, 0, 0, 0);
350 }
351
352 /**
353 * {@inheritDoc}

Callers 2

containsPointMethod · 0.95
isEmptyMethod · 0.95

Calls 6

splitAtCommaOrBlankMethod · 0.95
getCoordsAttributeMethod · 0.95
lineToMethod · 0.95
isWarnEnabledMethod · 0.65
warnMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected