private void draw(
      Object parentGroup, GeometryIndex parentIndex, Polygon polygon, GraphicsContext graphics) {
    String groupName = baseName;
    if (parentIndex != null) {
      groupName += "." + editingService.getIndexService().format(parentIndex);
    }

    Composite bgGroup = getOrCreateGroup(parentGroup, groupName + ".background");
    Composite geometryGroup = getOrCreateGroup(parentGroup, groupName + ".geometries");

    // Draw the exterior ring:
    GeometryIndex shellIndex =
        editingService
            .getIndexService()
            .addChildren(parentIndex, GeometryIndexType.TYPE_GEOMETRY, 0);
    if (!polygon.isEmpty()) {
      if (styleService.getBackgroundStyle() != null
          && styleService.getBackgroundStyle().getFillOpacity() > 0) {
        graphics.drawPolygon(bgGroup, "background", polygon, findGeometryStyle(shellIndex));
      }
      draw(geometryGroup, shellIndex, polygon.getExteriorRing(), graphics);
    }

    // Draw the interior rings:
    for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
      GeometryIndex holeIndex =
          editingService
              .getIndexService()
              .addChildren(parentIndex, GeometryIndexType.TYPE_GEOMETRY, i + 1);
      draw(geometryGroup, holeIndex, polygon.getInteriorRingN(i), graphics);
    }
  }