@Test public void testCombine() throws Exception { Envelope e1 = new Envelope(10, 40, 10, 30); GetLocationResult glr1 = new GetLocationResult(); glr1.setEnvelope(e1); Envelope e2 = new Envelope(20, 35, 25, 50); GetLocationResult glr2 = new GetLocationResult(); glr2.setEnvelope(e2); List<GetLocationResult> list = new ArrayList<GetLocationResult>(); list.add(glr1); list.add(glr2); CombineResultService cis = new CombineIntersectionService(); Envelope res = cis.combine(list); Assert.assertEquals(20.0, res.getMinX(), DELTA); Assert.assertEquals(25.0, res.getMinY(), DELTA); Assert.assertEquals(35.0, res.getMaxX(), DELTA); Assert.assertEquals(30.0, res.getMaxY(), DELTA); }
public Envelope combine(List<GetLocationResult> results) { Envelope result = null; for (GetLocationResult add : results) { Envelope envelope = add.getEnvelope(); if (null == result) { result = envelope; } else { result = result.intersection(envelope); } } return result; }
CombineIntersectionService implements CombineResultService { public Envelope combine(List<GetLocationResult> results) { Envelope result = null; for (GetLocationResult add : results) { Envelope envelope = add.getEnvelope(); if (null == result) { result = envelope; } else { result = result.intersection(envelope); } } return result; } }
CombineIntersectionService implements CombineResultService { public Envelope combine(List<GetLocationResult> results) { Envelope result = null; for (GetLocationResult add : results) { Envelope envelope = add.getEnvelope(); if (null == result) { result = envelope; } else { result = result.intersection(envelope); } } return result; }  }
CombineIntersectionService implements CombineResultService { public Envelope combine(List<GetLocationResult> results) { Envelope result = null; for (GetLocationResult add : results) { Envelope envelope = add.getEnvelope(); if (null == result) { result = envelope; } else { result = result.intersection(envelope); } } return result; }  Envelope combine(List<GetLocationResult> results); }
CombineIntersectionService implements CombineResultService { public Envelope combine(List<GetLocationResult> results) { Envelope result = null; for (GetLocationResult add : results) { Envelope envelope = add.getEnvelope(); if (null == result) { result = envelope; } else { result = result.intersection(envelope); } } return result; }  Envelope combine(List<GetLocationResult> results);  }