public void run(WebGenRequest wgreq) {
   FeatureCollection fc = wgreq.getFeatureCollection("geom");
   double tolerance = wgreq.getParameterDouble("tolerance");
   GenAreaAggregation gaa = new GenAreaAggregation();
   gaa.init(tolerance);
   Feature f;
   Polygon p;
   for (Iterator iter = fc.iterator(); iter.hasNext(); ) {
     try {
       f = (Feature) iter.next();
       p = (Polygon) f.getGeometry();
       gaa.addDataPolygon(p, f, 0.0);
     } catch (ClassCastException e) {
       this.addError("only polygons can be aggregated");
       return;
     }
   }
   if (gaa.execute()) {
     ConstrainedFeatureCollection fcr = new ConstrainedFeatureCollection(fc.getFeatureSchema());
     for (int i = 0; i < gaa.getDataCount(); i++) {
       f = (Feature) gaa.getDataLinkedObject(i);
       f.setGeometry(gaa.getDataPolygon(i));
       fcr.add(f);
     }
     wgreq.addResult("result", fcr);
   }
 }
 public void run() {
   WebGenRequest twgreq = WebGenRequestExecuter.callService(parameters, webgenserver, operation);
   ConstrainedFeatureCollection fcNew =
       (ConstrainedFeatureCollection) twgreq.getParameter("result");
   if (fcNew == null) fcNew = (ConstrainedFeatureCollection) twgreq.getResult("result");
   if (fcNew != null) {
     // LOGGER.info("Evaluation for - " + operationName);
     WebGenRequest ewgreq = new WebGenRequest();
     ewgreq.addParameters(parameters);
     ewgreq.addFeatureCollection("geom", fcNew);
     Double[] costVec = evalPartitions(ewgreq);
     double costAllCurrent = getCostFromCostVector(costVec);
     ConstrainedFeatureCollectionSorted sortedFeatureCollection =
         new ConstrainedFeatureCollectionSorted(costAllCurrent, fcNew, operationName);
     sortedFeatureCollectionVector.add(sortedFeatureCollection);
   }
 }
 private Double[] evalPartitions(WebGenRequest wgreq) {
   (new Eval_GMFeat_All()).run(wgreq);
   Double[] partitionCost = (Double[]) wgreq.getResult("severities");
   for (int i = 4; i < 8; i++) partitionCost[i] *= 0.25;
   return partitionCost;
 }