private void updateBoundsAndShapes(int i) {
   ImageryBounds bounds = defaultModel.getRow(i).getBounds();
   if (bounds != null) {
     List<Shape> shapes = bounds.getShapes();
     if (shapes != null && !shapes.isEmpty()) {
       if (defaultTable.getSelectionModel().isSelectedIndex(i)) {
         if (!mapPolygons.containsKey(i)) {
           List<MapPolygon> list = new ArrayList<>();
           mapPolygons.put(i, list);
           // Add new map polygons
           for (Shape shape : shapes) {
             MapPolygon polygon = new MapPolygonImpl(shape.getPoints());
             list.add(polygon);
             defaultMap.addMapPolygon(polygon);
           }
         }
       } else if (mapPolygons.containsKey(i)) {
         // Remove previously drawn map polygons
         for (MapPolygon polygon : mapPolygons.get(i)) {
           defaultMap.removeMapPolygon(polygon);
         }
         mapPolygons.remove(i);
       }
       // Only display bounds when no polygons (shapes) are defined for this provider
     } else {
       if (defaultTable.getSelectionModel().isSelectedIndex(i)) {
         if (!mapRectangles.containsKey(i)) {
           // Add new map rectangle
           Coordinate topLeft = new Coordinate(bounds.getMaxLat(), bounds.getMinLon());
           Coordinate bottomRight = new Coordinate(bounds.getMinLat(), bounds.getMaxLon());
           MapRectangle rectangle = new MapRectangleImpl(topLeft, bottomRight);
           mapRectangles.put(i, rectangle);
           defaultMap.addMapRectangle(rectangle);
         }
       } else if (mapRectangles.containsKey(i)) {
         // Remove previously drawn map rectangle
         defaultMap.removeMapRectangle(mapRectangles.get(i));
         mapRectangles.remove(i);
       }
     }
   }
 }