@Deprecated
  private static Bounds cloneBounds(Bounds bounds) {
    double lrx = (bounds.getLowerRight().getX() != null ? bounds.getLowerRight().getX() : 0.0);
    double lry = (bounds.getLowerRight().getY() != null ? bounds.getLowerRight().getY() : 0.0);
    double ulx = (bounds.getUpperLeft().getX() != null ? bounds.getUpperLeft().getX() : 0.0);
    double uly = (bounds.getUpperLeft().getY() != null ? bounds.getUpperLeft().getY() : 0.0);

    return new Bounds(new Point(lrx, lry), new Point(ulx, uly));
  }
 @Deprecated
 private static void setBounds(Bounds bounds, double offsetX, double offsetY) {
   Point ul = bounds.getUpperLeft();
   ul.setX(ul.getX() + offsetX);
   ul.setY(ul.getY() + offsetY);
   Point lr = bounds.getLowerRight();
   lr.setX(lr.getX() + offsetX);
   lr.setY(lr.getY() + offsetY);
 }
  @Deprecated
  public static Bounds getAbsoluteBounds(GenericShape shape) {
    /* Handle invalid diagram and prevent from crashing the transformation */
    if (shape.getBounds() == null) {
      Bounds bounds = new Bounds(new Point(0.0, 0.0), new Point(0.0, 0.0));
      return bounds;
    }
    // clone bounds
    Bounds bounds = cloneBounds(shape.getBounds());

    GenericShape parent = shape.getParent();

    if (parent != null) {
      Bounds parentBounds = getAbsoluteBounds(parent);
      setBounds(
          bounds,
          parentBounds.getUpperLeft().getX().doubleValue(),
          parentBounds.getUpperLeft().getY().doubleValue());
    }

    return bounds;
  }