class GeometryConvexHullCommand implements CommandHasRequest<GeometryConvexHullRequest, GeometryConvexHullResponse> {

	@Override
	public void execute(GeometryConvexHullRequest request, GeometryConvexHullResponse response) throws Exception {
		List<org.geomajas.geometry.Geometry> clientGeometries = request.getGeometries();
		if (clientGeometries == null || clientGeometries.size() == 0) {
			throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "request");
		}
		
		// Convert to internal, apply ConvexHull and convert back to DTO
		List<org.geomajas.geometry.Geometry> result = new ArrayList<org.geomajas.geometry.Geometry>();
		for (Geometry clientGeometry : clientGeometries) {
			result.add(converter.toDto(new ConvexHull(converter.toInternal(clientGeometry)).getConvexHull()));
		}
		response.setGeometries(result);
	}

}