GeoArea extends GeoObject { @Nonnull public static GeoArea fromAreas(@Nonnull final Collection<? extends GeoArea> areas) { assert areas != null; assert !areas.isEmpty(); GeoArea result = null; for (final GeoArea area : areas) { if (result == null) { result = area; } else { result = result.add(area); } } assert result != null; return result; }  @Nonnull @Override GeoPoint getOrigin(); @Override @Nonnull GeoPoint getCenter(); @Nonnull static GeoArea fromAreas(@Nonnull final Collection<? extends GeoArea> areas); @Nonnull final GeoArea add(@Nonnull final GeoArea op); abstract boolean overlaps(@Nonnull final GeoArea area); abstract boolean contains(@Nonnull final GeoArea area); abstract boolean contains(@Nonnull final GeoPoint point); @Nonnull abstract GeoRectangle boundingBox(); @Nonnull abstract Collection<GeoRectangle> pixelate(); @Nonnull @Override abstract GeoArea translate(@Nonnull final GeoVector vector); @Override @Nonnull abstract GeoArea moveTo(final GeoPoint origin); abstract boolean isCompound();  }
@Test public void testFromAreas() { LOG.info("testFromAreas"); final GeoRectangle r1 = new GeoRectangle(new GeoPoint(0.0, 0.0), new GeoPoint(1.0, 1.0)); final GeoRectangle r2 = new GeoRectangle(new GeoPoint(1.0, 0.0), new GeoPoint(2.0, 1.0)); final Collection<GeoArea> list = new ArrayList<>(); list.add(r1); list.add(r2); final GeoArea area = GeoArea.fromAreas(list); Assert.assertTrue(area.contains(r1)); Assert.assertTrue(area.contains(r2)); }