@Test public void testTranslateBounds() { Bounds bounds = Bounds.create(1.1d, 2.2d, 3.3d, 4.4d); OptionalBounds lienzoBounds = LienzoShapeUtils.translateBounds(bounds); assertTrue(lienzoBounds.hasMinX()); assertEquals(1.1d, lienzoBounds.getMinX(), 0d); assertTrue(lienzoBounds.hasMinY()); assertEquals(2.2d, lienzoBounds.getMinY(), 0d); assertTrue(lienzoBounds.hasMaxX()); assertEquals(3.3d, lienzoBounds.getMaxX(), 0d); assertTrue(lienzoBounds.hasMaxY()); assertEquals(4.4d, lienzoBounds.getMaxY(), 0d); Bounds minBounds = Bounds.createMinBounds(0d, 0d); OptionalBounds lienzoMinBounds = LienzoShapeUtils.translateBounds(minBounds); assertTrue(lienzoMinBounds.hasMinX()); assertEquals(0d, lienzoMinBounds.getMinX(), 0d); assertTrue(lienzoMinBounds.hasMinY()); assertEquals(0d, lienzoMinBounds.getMinY(), 0d); assertFalse(lienzoMinBounds.hasMaxX()); assertNull(lienzoMinBounds.getMaxX()); assertFalse(lienzoMinBounds.hasMaxY()); assertNull(lienzoMinBounds.getMaxY()); }
public static OptionalBounds translateBounds(final Bounds bounds) { final OptionalBounds result = OptionalBounds.createEmptyBounds(); if (bounds.hasUpperLeft()) { final Bound upperLeft = bounds.getUpperLeft(); if (upperLeft.hasX()) { result.setMinX(upperLeft.getX()); } if (upperLeft.hasY()) { result.setMinY(upperLeft.getY()); } } if (bounds.hasLowerRight()) { final Bound lowerRight = bounds.getLowerRight(); if (lowerRight.hasX()) { result.setMaxX(lowerRight.getX()); } if (lowerRight.hasY()) { result.setMaxY(lowerRight.getY()); } } return result; }
LienzoShapeUtils { public static OptionalBounds translateBounds(final Bounds bounds) { final OptionalBounds result = OptionalBounds.createEmptyBounds(); if (bounds.hasUpperLeft()) { final Bound upperLeft = bounds.getUpperLeft(); if (upperLeft.hasX()) { result.setMinX(upperLeft.getX()); } if (upperLeft.hasY()) { result.setMinY(upperLeft.getY()); } } if (bounds.hasLowerRight()) { final Bound lowerRight = bounds.getLowerRight(); if (lowerRight.hasX()) { result.setMaxX(lowerRight.getX()); } if (lowerRight.hasY()) { result.setMaxY(lowerRight.getY()); } } return result; } }
LienzoShapeUtils { public static OptionalBounds translateBounds(final Bounds bounds) { final OptionalBounds result = OptionalBounds.createEmptyBounds(); if (bounds.hasUpperLeft()) { final Bound upperLeft = bounds.getUpperLeft(); if (upperLeft.hasX()) { result.setMinX(upperLeft.getX()); } if (upperLeft.hasY()) { result.setMinY(upperLeft.getY()); } } if (bounds.hasLowerRight()) { final Bound lowerRight = bounds.getLowerRight(); if (lowerRight.hasX()) { result.setMaxX(lowerRight.getX()); } if (lowerRight.hasY()) { result.setMaxY(lowerRight.getY()); } } return result; }  }
LienzoShapeUtils { public static OptionalBounds translateBounds(final Bounds bounds) { final OptionalBounds result = OptionalBounds.createEmptyBounds(); if (bounds.hasUpperLeft()) { final Bound upperLeft = bounds.getUpperLeft(); if (upperLeft.hasX()) { result.setMinX(upperLeft.getX()); } if (upperLeft.hasY()) { result.setMinY(upperLeft.getY()); } } if (bounds.hasLowerRight()) { final Bound lowerRight = bounds.getLowerRight(); if (lowerRight.hasX()) { result.setMaxX(lowerRight.getX()); } if (lowerRight.hasY()) { result.setMaxY(lowerRight.getY()); } } return result; }  static void scale(final Shape shape,
                             final double width,
                             final double height); static double[] getScaleFactor(final double width,
                                          final double height,
                                          final double targetWidth,
                                          final double targetHeight); static WiresLayoutContainer.Layout getWiresLayout(final HasChildren.Layout layout); static LinearGradient getLinearGradient(final String startColor,
                                                   final String endColor,
                                                   final Double width,
                                                   final Double height); static OptionalBounds translateBounds(final Bounds bounds); }
LienzoShapeUtils { public static OptionalBounds translateBounds(final Bounds bounds) { final OptionalBounds result = OptionalBounds.createEmptyBounds(); if (bounds.hasUpperLeft()) { final Bound upperLeft = bounds.getUpperLeft(); if (upperLeft.hasX()) { result.setMinX(upperLeft.getX()); } if (upperLeft.hasY()) { result.setMinY(upperLeft.getY()); } } if (bounds.hasLowerRight()) { final Bound lowerRight = bounds.getLowerRight(); if (lowerRight.hasX()) { result.setMaxX(lowerRight.getX()); } if (lowerRight.hasY()) { result.setMaxY(lowerRight.getY()); } } return result; }  static void scale(final Shape shape,
                             final double width,
                             final double height); static double[] getScaleFactor(final double width,
                                          final double height,
                                          final double targetWidth,
                                          final double targetHeight); static WiresLayoutContainer.Layout getWiresLayout(final HasChildren.Layout layout); static LinearGradient getLinearGradient(final String startColor,
                                                   final String endColor,
                                                   final Double width,
                                                   final Double height); static OptionalBounds translateBounds(final Bounds bounds);  }