@@ -5,19 +5,12 @@ |
*/ |
package m.gis.area; |
|
-import csip.ModelDataService; |
import static csip.ModelDataService.EXEC_OK; |
-import java.util.ArrayList; |
import java.util.ListIterator; |
-import java.util.logging.Logger; |
import javax.ws.rs.Path; |
-import m.gis.Database; |
-import m.gis.DatabaseBuilder; |
-import m.gis.GeoJSON; |
+import m.gis.GISModelDataService; |
import m.gis.Layer; |
import oms3.annotations.*; |
-import org.codehaus.jettison.json.JSONArray; |
-import org.codehaus.jettison.json.JSONObject; |
|
/** |
* |
@@ -26,25 +19,11 @@ |
@Name("area") |
@Description("CSIP Area Service") |
@Path("m/area/1.0") |
-public class V1_0 extends ModelDataService { |
- |
- JSONArray result; |
- GeoJSON layers; |
- |
- private Database db; |
- |
- public V1_0() { |
- super(); |
- } |
+public class V1_0 extends GISModelDataService { |
|
@Override |
protected void preProcess() throws Exception { |
- db = new DatabaseBuilder() |
- .setAll() |
- .create(); |
- result = new JSONArray(); |
- JSONArray geojson = getJSONArrayParam("layer"); |
- layers = new GeoJSON(geojson, db); |
+ super.preProcess(); |
} |
|
@Override |
@@ -54,7 +33,6 @@ |
while (iterator.hasNext()) { |
Layer lyr = db.area(iterator.next()); |
result.put(db.toJSON(lyr)); |
- db.deleteLayer(lyr); |
} |
} |
return EXEC_OK; |
@@ -62,7 +40,7 @@ |
|
@Override |
protected void postProcess() throws Exception { |
- putResult("layer", result); |
+ super.postProcess(); |
} |
|
} |
@@ -5,18 +5,12 @@ |
*/ |
package m.gis.buffer; |
|
-import csip.ModelDataService; |
import static csip.ModelDataService.EXEC_OK; |
-import java.util.ArrayList; |
import java.util.ListIterator; |
-import java.util.logging.Logger; |
import javax.ws.rs.Path; |
-import m.gis.Database; |
-import m.gis.DatabaseBuilder; |
-import m.gis.GeoJSON; |
+import m.gis.GISModelDataService; |
import m.gis.Layer; |
import oms3.annotations.*; |
-import org.codehaus.jettison.json.JSONArray; |
import org.codehaus.jettison.json.JSONObject; |
|
/** |
@@ -27,27 +21,14 @@ |
@Name("buffer") |
@Description("CSIP Buffer Service") |
@Path("m/buffer/1.0") |
-public class V1_0 extends ModelDataService { |
+public class V1_0 extends GISModelDataService { |
|
- JSONArray result; |
- GeoJSON layers; |
JSONObject distance; |
|
- private Database db; |
- |
- public V1_0() { |
- super(); |
- } |
- |
@Override |
protected void preProcess() throws Exception { |
- db = new DatabaseBuilder() |
- .setAll() |
- .create(); |
- result = new JSONArray(); |
- JSONArray geojson = getJSONArrayParam("layer"); |
+ super.preProcess(); |
distance = getJSONParam("distance"); |
- layers = new GeoJSON(geojson, db); |
} |
|
@Override |
@@ -57,7 +38,6 @@ |
while (iterator.hasNext()) { |
Layer lyr = db.buffer(iterator.next(), distance.getInt("value")); |
result.put(db.toJSON(lyr)); |
- db.deleteLayer(lyr); |
} |
} |
return EXEC_OK; |
@@ -65,7 +45,7 @@ |
|
@Override |
protected void postProcess() throws Exception { |
- putResult("layer", result); |
+ super.postProcess(); |
} |
|
} |
@@ -5,19 +5,12 @@ |
*/ |
package m.gis.envelope; |
|
-import csip.ModelDataService; |
import static csip.ModelDataService.EXEC_OK; |
-import java.util.ArrayList; |
import java.util.ListIterator; |
-import java.util.logging.Logger; |
import javax.ws.rs.Path; |
-import m.gis.Database; |
-import m.gis.DatabaseBuilder; |
-import m.gis.GeoJSON; |
+import m.gis.GISModelDataService; |
import m.gis.Layer; |
import oms3.annotations.*; |
-import org.codehaus.jettison.json.JSONArray; |
-import org.codehaus.jettison.json.JSONObject; |
|
/** |
* |
@@ -26,25 +19,11 @@ |
@Name("envelope") |
@Description("CSIP Envelope Service") |
@Path("m/envelope/1.0") |
-public class V1_0 extends ModelDataService { |
- |
- JSONArray result; |
- GeoJSON layers; |
- |
- private Database db; |
- |
- public V1_0() { |
- super(); |
- } |
+public class V1_0 extends GISModelDataService { |
|
@Override |
protected void preProcess() throws Exception { |
- db = new DatabaseBuilder() |
- .setAll() |
- .create(); |
- result = new JSONArray(); |
- JSONArray geojson = getJSONArrayParam("layer"); |
- layers = new GeoJSON(geojson, db); |
+ super.preProcess(); |
} |
|
@Override |
@@ -54,7 +33,6 @@ |
while (iterator.hasNext()) { |
Layer lyr = db.envelope(iterator.next()); |
result.put(db.toJSON(lyr)); |
- db.deleteLayer(lyr); |
} |
} |
return EXEC_OK; |
@@ -62,7 +40,7 @@ |
|
@Override |
protected void postProcess() throws Exception { |
- putResult("layer", result); |
+ super.postProcess(); |
} |
|
} |
@@ -5,19 +5,12 @@ |
*/ |
package m.gis.extent; |
|
-import csip.ModelDataService; |
import static csip.ModelDataService.EXEC_OK; |
-import java.util.ArrayList; |
import java.util.ListIterator; |
-import java.util.logging.Logger; |
import javax.ws.rs.Path; |
-import m.gis.Database; |
-import m.gis.DatabaseBuilder; |
-import m.gis.GeoJSON; |
+import m.gis.GISModelDataService; |
import m.gis.Layer; |
import oms3.annotations.*; |
-import org.codehaus.jettison.json.JSONArray; |
-import org.codehaus.jettison.json.JSONObject; |
|
/** |
* |
@@ -26,25 +19,11 @@ |
@Name("extent") |
@Description("CSIP Extent Service") |
@Path("m/extent/1.0") |
-public class V1_0 extends ModelDataService { |
- |
- JSONArray result; |
- GeoJSON layers; |
- |
- private Database db; |
- |
- public V1_0() { |
- super(); |
- } |
+public class V1_0 extends GISModelDataService { |
|
@Override |
protected void preProcess() throws Exception { |
- db = new DatabaseBuilder() |
- .setAll() |
- .create(); |
- result = new JSONArray(); |
- JSONArray geojson = getJSONArrayParam("layer"); |
- layers = new GeoJSON(geojson, db); |
+ super.preProcess(); |
} |
|
@Override |
@@ -55,8 +34,6 @@ |
Layer lyr = db.extent(iterator.next()); |
Layer lyrArea = db.area(lyr); |
result.put(db.toJSON(lyrArea)); |
- db.deleteLayer(lyr); |
- db.deleteLayer(lyrArea); |
} |
} |
return EXEC_OK; |
@@ -64,7 +41,7 @@ |
|
@Override |
protected void postProcess() throws Exception { |
- putResult("layer", result); |
+ super.postProcess(); |
} |
|
} |
@@ -5,19 +5,11 @@ |
*/ |
package m.gis.intersect; |
|
-import csip.ModelDataService; |
-import java.util.ArrayList; |
import java.util.ListIterator; |
-import java.util.logging.Level; |
-import java.util.logging.Logger; |
import javax.ws.rs.Path; |
-import m.gis.Database; |
-import m.gis.DatabaseBuilder; |
-import m.gis.GeoJSON; |
+import m.gis.GISModelDataService; |
import m.gis.Layer; |
import oms3.annotations.*; |
-import org.codehaus.jettison.json.JSONArray; |
-import org.codehaus.jettison.json.JSONObject; |
|
/** |
* |
@@ -26,39 +18,21 @@ |
@Name("intersect") |
@Description("CSIP Intersection Service") |
@Path("m/intersect/1.0") |
-public class V1_0 extends ModelDataService { |
- |
- JSONArray result; |
- GeoJSON layers; |
- Layer resultLayer; |
- ArrayList<Layer> operationLayers; |
- |
- private Database db; |
- |
- public V1_0() { |
- super(); |
- } |
+public class V1_0 extends GISModelDataService { |
|
@Override |
protected void preProcess() throws Exception { |
- db = new DatabaseBuilder() |
- .setAll() |
- .create(); |
- JSONArray geojson = getJSONArrayParam("layer"); |
- result = new JSONArray(); |
- layers = new GeoJSON(geojson, db); |
- operationLayers = new ArrayList<>(); |
+ super.preProcess(); |
} |
|
@Override |
protected String process() throws Exception { |
- resultLayer = null; |
+ Layer resultLayer = null; |
if (layers.size() > 0) { |
ListIterator<Layer> iterator = layers.listIterator(); |
resultLayer = iterator.next(); |
while (iterator.hasNext()) { |
resultLayer = db.intersect(resultLayer, iterator.next()); |
- operationLayers.add(resultLayer); |
} |
} |
result.put(db.toJSON(resultLayer)); |
@@ -67,13 +41,7 @@ |
|
@Override |
protected void postProcess() throws Exception { |
- putResult("layer", result); |
- for (Layer lyr : layers) { |
- db.deleteLayer(lyr); |
- } |
- for (Layer lyr : operationLayers) { |
- db.deleteLayer(lyr); |
- } |
+ super.postProcess(); |
} |
|
} |
@@ -5,18 +5,13 @@ |
*/ |
package m.gis.minboundingcircle; |
|
-import csip.ModelDataService; |
import static csip.ModelDataService.EXEC_OK; |
import csip.ServiceException; |
import java.util.ListIterator; |
import javax.ws.rs.Path; |
-import m.gis.Database; |
-import m.gis.DatabaseBuilder; |
-import m.gis.GeoJSON; |
+import m.gis.GISModelDataService; |
import m.gis.Layer; |
import oms3.annotations.*; |
-import org.codehaus.jettison.json.JSONArray; |
-import org.codehaus.jettison.json.JSONObject; |
|
/** |
* |
@@ -25,26 +20,13 @@ |
@Name("minboundingcircle") |
@Description("CSIP Minimum Bounding Circle Service") |
@Path("m/minboundingcircle/1.0") |
-public class V1_0 extends ModelDataService { |
+public class V1_0 extends GISModelDataService { |
|
- JSONArray result; |
- GeoJSON layers; |
int numSegsPerQtrCirc; |
|
- private Database db; |
- |
- public V1_0() { |
- super(); |
- } |
- |
@Override |
protected void preProcess() throws Exception { |
- db = new DatabaseBuilder() |
- .setAll() |
- .create(); |
- result = new JSONArray(); |
- JSONArray geojson = getJSONArrayParam("layer"); |
- layers = new GeoJSON(geojson, db); |
+ super.preProcess(); |
try { |
numSegsPerQtrCirc = getIntParam("numSeqsPerQtrCirc"); |
} catch (ServiceException ex) { |
@@ -59,7 +41,6 @@ |
while (iterator.hasNext()) { |
Layer lyr = db.minimumBoundingCircle(iterator.next(), numSegsPerQtrCirc); |
result.put(db.toJSON(lyr)); |
- db.deleteLayer(lyr); |
} |
} |
return EXEC_OK; |
@@ -67,7 +48,7 @@ |
|
@Override |
protected void postProcess() throws Exception { |
- putResult("layer", result); |
+ super.postProcess(); |
} |
|
} |
@@ -5,18 +5,12 @@ |
*/ |
package m.gis.minboundingrectangle; |
|
-import csip.ModelDataService; |
import static csip.ModelDataService.EXEC_OK; |
-import csip.ServiceException; |
import java.util.ListIterator; |
import javax.ws.rs.Path; |
-import m.gis.Database; |
-import m.gis.DatabaseBuilder; |
-import m.gis.GeoJSON; |
+import m.gis.GISModelDataService; |
import m.gis.Layer; |
import oms3.annotations.*; |
-import org.codehaus.jettison.json.JSONArray; |
-import org.codehaus.jettison.json.JSONObject; |
|
/** |
* |
@@ -25,25 +19,11 @@ |
@Name("minboundingrectangle") |
@Description("CSIP Minimum Bounding Rectangle Service") |
@Path("m/minboundingrectangle/1.0") |
-public class V1_0 extends ModelDataService { |
- |
- JSONArray result; |
- GeoJSON layers; |
- |
- private Database db; |
- |
- public V1_0() { |
- super(); |
- } |
+public class V1_0 extends GISModelDataService { |
|
@Override |
protected void preProcess() throws Exception { |
- db = new DatabaseBuilder() |
- .setAll() |
- .create(); |
- result = new JSONArray(); |
- JSONArray geojson = getJSONArrayParam("layer"); |
- layers = new GeoJSON(geojson, db); |
+ super.preProcess(); |
} |
|
@Override |
@@ -54,8 +34,6 @@ |
Layer lyr = db.minimumBoundingRectangle(iterator.next()); |
Layer lyrArea = db.area(lyr); |
result.put(db.toJSON(lyrArea)); |
- db.deleteLayer(lyr); |
- db.deleteLayer(lyrArea); |
} |
} |
return EXEC_OK; |
@@ -63,7 +41,7 @@ |
|
@Override |
protected void postProcess() throws Exception { |
- putResult("layer", result); |
+ super.postProcess(); |
} |
|
} |
@@ -5,19 +5,12 @@ |
*/ |
package m.gis.union; |
|
-import csip.ModelDataService; |
import static csip.ModelDataService.EXEC_OK; |
-import java.util.ArrayList; |
import java.util.ListIterator; |
-import java.util.logging.Logger; |
import javax.ws.rs.Path; |
-import m.gis.Database; |
-import m.gis.DatabaseBuilder; |
-import m.gis.GeoJSON; |
+import m.gis.GISModelDataService; |
import m.gis.Layer; |
import oms3.annotations.*; |
-import org.codehaus.jettison.json.JSONArray; |
-import org.codehaus.jettison.json.JSONObject; |
|
/** |
* |
@@ -26,39 +19,21 @@ |
@Name("union") |
@Description("CSIP Union Service") |
@Path("m/union/1.0") |
-public class V1_0 extends ModelDataService { |
- |
- JSONArray result; |
- GeoJSON layers; |
- Layer resultLayer; |
- ArrayList<Layer> operationLayers; |
- |
- private Database db; |
- |
- public V1_0() { |
- super(); |
- } |
+public class V1_0 extends GISModelDataService { |
|
@Override |
protected void preProcess() throws Exception { |
- db = new DatabaseBuilder() |
- .setAll() |
- .create(); |
- JSONArray geojson = getJSONArrayParam("layer"); |
- result = new JSONArray(); |
- layers = new GeoJSON(geojson, db); |
- operationLayers = new ArrayList<>(); |
+ super.preProcess(); |
} |
|
@Override |
protected String process() throws Exception { |
- resultLayer = null; |
+ Layer resultLayer = null; |
if (layers.size() > 0) { |
ListIterator<Layer> iterator = layers.listIterator(); |
resultLayer = iterator.next(); |
while (iterator.hasNext()) { |
resultLayer = db.union(resultLayer, iterator.next()); |
- operationLayers.add(resultLayer); |
} |
} |
result.put(db.toJSON(resultLayer)); |
@@ -67,13 +42,7 @@ |
|
@Override |
protected void postProcess() throws Exception { |
- putResult("layer", result); |
- for (Layer lyr : layers) { |
- db.deleteLayer(lyr); |
- } |
- for (Layer lyr : operationLayers) { |
- db.deleteLayer(lyr); |
- } |
+ super.postProcess(); |
} |
|
} |