MapLayer { public List<BoundingBox> getAllBoundingBoxList(){ if(boundingBoxMap != null){ Collection<BoundingBox> values = boundingBoxMap.values(); if(values != null && !values.isEmpty()){ return new ArrayList<BoundingBox>(values); } } return parent == null ? new ArrayList<BoundingBox>() : parent.getAllBoundingBoxList(); } MapLayer(String name, String title, Collection<String> srsList,
          Collection<MapLayer> subLayers, BoundingBox latLon);  MapLayer( String name, String title, Collection<String> srsList, Collection<MapLayer> subLayers,
  		BoundingBox bbox, Map<String,BoundingBox> boundingBoxMap); List<BoundingBox> getAllBoundingBoxList(); int numSubLayers(); MapLayer getSubLayer( int n ); ArrayList<MapLayer> getSubLayerList(); ArrayList getLayerList(); String getTitle(); String getName(); MapLayer getParent(); BoundingBox getBoundingBox(); BoundingBox getBoundingBox(String srs); static Envelope getBoundingBox(String srs, MapLayer lyr, Envelope env); BoundingBox getLatLonBoundingBox(); Map<String,BoundingBox> getBoundingBoxMap(); ArrayList getSRSList(); Collection getFullSRSList(); @Override String toString();  }
@Test public void testGetAllBoundingBox(){ List<BoundingBox> bbs = c1.getAllBoundingBoxList(); assertTrue(bbs.size()==2); Envelope exp1 = new Envelope(40,50,40,50); Envelope exp2 = new Envelope(1,5,4,6); Envelope real0 = bbs.get(0).getEnvelope(); Envelope real1 = bbs.get(1).getEnvelope(); assertTrue(exp1.equals(real0) || exp2.equals(real0)); assertTrue(exp1.equals(real1) || exp2.equals(real1)); assertFalse(real1.equals(real0)); }
@Test public void testGetAllBoundingBoxFromParent(){ String s = "EPSG:2154"; String wgs = "EPSG:4326"; Collection<String> srs = new ArrayList<String>(); srs.add(s); srs.add(wgs); HashMap<String, BoundingBox> hm = new HashMap<String,BoundingBox>(); MapLayer ml = new MapLayer("c1", "c1", srs, new ArrayList<MapLayer>(), null, hm); List<MapLayer> children = new ArrayList<MapLayer>(2); children.add(ml); BoundingBox bb = new BoundingBox(s, new Envelope(10,20,10,20)); BoundingBox bw = new BoundingBox(wgs, new Envelope(2,6,5,7)); hm = new HashMap<String,BoundingBox>(); hm.put(s,bb); hm.put(wgs,bw); MapLayer par = new MapLayer("parent","parent",srs,children,bw, hm); List<BoundingBox> bbs = ml.getAllBoundingBoxList(); Envelope exp1 = new Envelope(10,20,10,20); Envelope exp2 = new Envelope(2,6,5,7); Envelope real0 = bbs.get(0).getEnvelope(); Envelope real1 = bbs.get(1).getEnvelope(); assertTrue(exp1.equals(real0) || exp2.equals(real0)); assertTrue(exp1.equals(real1) || exp2.equals(real1)); assertFalse(real1.equals(real0)); }