V1_0.java [src/java/m/gis/minboundingcircle] Revision: Date:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package m.gis.minboundingcircle;
import static csip.ModelDataService.EXEC_OK;
import csip.ServiceException;
import java.util.ListIterator;
import javax.ws.rs.Path;
import m.gis.GISModelDataService;
import m.utils.Layer;
import oms3.annotations.*;
/**
*
* @author ktraff
*/
@Name("minboundingcircle")
@Description("CSIP Minimum Bounding Circle Service")
@Path("m/minboundingcircle/1.0")
public class V1_0 extends GISModelDataService {
int numSegsPerQtrCirc;
@Override
protected void preProcess() throws Exception {
super.preProcess();
try {
numSegsPerQtrCirc = getIntParam("numSeqsPerQtrCirc");
} catch (ServiceException ex) {
numSegsPerQtrCirc = 48;
}
}
@Override
protected String process() throws Exception {
if (layers.size() > 0) {
ListIterator<Layer> iterator = layers.listIterator();
while (iterator.hasNext()) {
Layer lyr = db.minimumBoundingCircle(iterator.next(), numSegsPerQtrCirc);
result.put(db.toJSON(lyr, outputSRID));
}
}
return EXEC_OK;
}
@Override
protected void postProcess() throws Exception {
super.postProcess();
}
}