Rectangle2D.Float box = annotation.getUserSpaceRectangle(); Map<String, Double> bounds = new HashMap<String, Double>(); bounds.put("height", box.getHeight()); bounds.put("width", box.getWidth()); bounds.put("x", box.getX()); bounds.put("y", box.getY());
if (bounds != null && bounds.getHeight() < 0) { isfourthQuadrant = true;
if (diff != 0 && diff > word.getTextExtractionBounds().getHeight() / 2) { LineText lineText = new LineText(); lineText.addAll(words.subList(start, end));
segmentRect.setRect(xOffset, yOffset, destScalingInsets.left, destScalingInsets.top); segmentRect.intersect(clipRect, segmentRect, segmentRect); if (segmentRect.getWidth() > 0 && segmentRect.getHeight() > 0 && srcScalingInsets.left != 0 && srcScalingInsets.top != 0) if (segmentRect.getWidth() > 0 && segmentRect.getHeight() > 0 && srcScalingInsets.right != 0 && srcScalingInsets.top != 0) if (segmentRect.getWidth() > 0 && segmentRect.getHeight() > 0 && srcScalingInsets.left != 0 && srcScalingInsets.bottom != 0) destScalingInsets.right, destScalingInsets.bottom); segmentRect.intersect(clipRect, segmentRect, segmentRect); if (segmentRect.getWidth() > 0 && segmentRect.getHeight() > 0 && srcScalingInsets.right != 0 && srcScalingInsets.bottom != 0) if (segmentRect.getWidth() > 0 && segmentRect.getHeight() > 0 && srcScalingInsets.left != 0 && centervscale != 0) destScalingInsets.right, fullTargetHeight - destScalingInsets.bottom - destScalingInsets.top); segmentRect.intersect(clipRect, segmentRect, segmentRect); if (segmentRect.getWidth() > 0 && segmentRect.getHeight() > 0 && srcScalingInsets.right != 0 && centervscale != 0) if (segmentRect.getWidth() > 0 && segmentRect.getHeight() > 0 && srcScalingInsets.top != 0 && centerhscale != 0) fullTargetWidth - destScalingInsets.left - destScalingInsets.right, destScalingInsets.bottom); segmentRect.intersect(clipRect, segmentRect, segmentRect); if (segmentRect.getWidth() > 0 && segmentRect.getHeight() > 0 && srcScalingInsets.bottom != 0 && centerhscale != 0) fullTargetWidth - destScalingInsets.left - destScalingInsets.right, fullTargetHeight - destScalingInsets.bottom - destScalingInsets.top); segmentRect.intersect(clipRect, segmentRect, segmentRect); if (segmentRect.getWidth() > 0 && segmentRect.getHeight() > 0 && centerhscale != 0 && centervscale != 0)
Rectangle2D.Float jrect = deriveBorderDrawingRectangle(width); RoundRectangle2D.Double roundRect = new RoundRectangle2D.Double( jrect.getX(), jrect.getY(), jrect.getWidth(), jrect.getHeight(), horizRadius, vertRadius); BasicStroke stroke = new BasicStroke(
AffineTransform rotationTransform = AffineTransform.getRotateInstance(radians); Point2D.Double origTopLeftCorner = new Point2D.Double(0.0, Math.abs(rect.getHeight())); Point2D rotatedTopLeftCorner = rotationTransform.transform(origTopLeftCorner, null); at.translate(origTopLeftCorner.getX() - rotatedTopLeftCorner.getX(), if (scaleY != 1.0) { double scaleX = Math.abs(at.getScaleX()); double rectHeight = Math.abs(rect.getHeight()); double resizedY = rectHeight * ((scaleY - 1.0) / scaleY); at.translate(0.0, resizedY);
strokeWidth, (int) userSpaceRectangle.getWidth() - strokeWidth * 2, (int) userSpaceRectangle.getHeight() - strokeWidth * 2);
(int)(smallTextBounds.getY() + 4), // FIXME (int)(smallTextBounds.getWidth()), (int)(smallTextBounds.getHeight() - 6)); // FIXME
} else { g.setPaint(getPaint()); float h = (float)(smallTextBounds.getHeight() * scale); float w = (float)(smallTextBounds.getWidth() * scale); if (h >= minimumScreenHeight && w > minimumScreenWidth) { } else { float h2 = Math.max((float)smallTextBounds.getHeight(), minimumScreenHeight / scale); float w2 = Math.max((float)smallTextBounds.getWidth(), minimumScreenWidth / scale); g.fillRect(
private boolean isSimilar(BBlock b1, BBlock b2) { // rough text lengh comparison String txt1 = b1.getText(), txt2 = b2.getText(); if (abs(txt1.length() - txt2.length()) > TEXT_LENGTH_THRESHOLD) { // System.out.println("TEXT_LENGTH_THRESHOLD"); return false; } // position comparison java.awt.geom.Rectangle2D.Float r1 = b1.getRegion(), r2 = b2 .getRegion(); double diff = abs(r1.getX() - r2.getX()) + // abs(r1.getY() - r2.getY()) + // abs(r1.getWidth() - r2.getWidth()) + // abs(r1.getHeight() - r2.getHeight()); if (diff > POSITION_THRESHOLD) { // System.out.println("POSITION_THRESHOLD"); return false; } // text comparison (Levenshtein) if (getLevenshteinDistance(txt1, txt2, EDIT_DISTANCE_THRESHOLD) == -1) { // System.out.println("EDIT_DISTANCE_THRESHOLD"); return false; } return true; }