private void paint(Graphics2D g, Collection features, Layer layer, Style style) throws Exception {
   try {
     if (!layer.isVisible()) {
       return;
     }
     if (!style.isEnabled()) {
       return;
     }
     style.initialize(layer);
     // new ArrayList to avoid ConcurrentModificationException. [Jon Aquino]
     for (Iterator i = new ArrayList(features).iterator(); i.hasNext(); ) {
       final Feature feature = (Feature) i.next();
       if (cancelled) {
         return;
       }
       if (feature.getGeometry().isEmpty()) {
         continue;
       }
       style.paint(feature, g, panel.getViewport());
     }
   } catch (NullPointerException e) {
     // System.out.println("Registro con geometría nula");
   }
 }