private ShapeStyle findGeometryStyle(GeometryIndex index) {
   if (!editingService.getIndexStateService().isEnabled(index)) {
     return styleService.getBackgroundDisabledStyle();
   } else if (editingService.getIndexStateService().isMarkedForDeletion(index)) {
     return styleService.getBackgroundMarkedForDeletionStyle();
   }
   return styleService.getBackgroundStyle();
 }
  private ShapeStyle findEdgeStyle(GeometryIndex index) {
    if (editingService.getIndexStateService().isMarkedForDeletion(index)) {
      return styleService.getEdgeMarkForDeletionStyle();
    } else if (!editingService.getIndexStateService().isEnabled(index)) {
      return styleService.getEdgeDisabledStyle();
    }

    boolean selected = editingService.getIndexStateService().isSelected(index);
    boolean highlighted = editingService.getIndexStateService().isHightlighted(index);
    if (selected && highlighted) {
      return styleService.getEdgeSelectHoverStyle();
    } else if (selected) {
      return styleService.getEdgeSelectStyle();
    } else if (highlighted) {
      return styleService.getEdgeHoverStyle();
    }
    return styleService.getEdgeStyle();
  }
  // TODO make use of the findGeometryStyle method.
  private void updateGeometry(Geometry geometry, GeometryIndex index, boolean bringToFront)
      throws GeometryIndexNotFoundException {
    // Some initialization:
    String identifier = baseName + "." + editingService.getIndexService().format(index);
    boolean marked = editingService.getIndexStateService().isMarkedForDeletion(index);

    // Find current and previous parent groups:
    Composite parentGroup =
        groups.get(identifier.substring(0, identifier.lastIndexOf('.')) + ".geometries");

    // Find the correct style:
    ShapeStyle style = new ShapeStyle();
    if (marked) {
      style = styleService.getBackgroundMarkedForDeletionStyle();
    }

    // Draw the inner ring:
    org.geomajas.gwt.client.spatial.geometry.Geometry transformed =
        mapWidget
            .getMapModel()
            .getMapView()
            .getWorldViewTransformer()
            .worldToPan(
                GeometryConverter.toGwt(
                    editingService.getIndexService().getGeometry(geometry, index)));
    if (transformed instanceof LinearRing) {
      Polygon polygon =
          mapWidget
              .getMapModel()
              .getGeometryFactory()
              .createPolygon((LinearRing) transformed, null);
      mapWidget
          .getVectorContext()
          .drawPolygon(parentGroup, identifier + ".background", polygon, style);
    }
  }