public static Response editFeature( int fid, String spatialcontext, String viewpoint, InputXML input, String img, int width, int height) { try (Database db = new Database()) { Point[] points = anglesToFeature(spatialcontext, viewpoint, input.getAngles(), db); GeoFeature feature = Util.pointsToFeature(points, input.getAngles(), input.getType(), false, 0); db.setFeature(fid, spatialcontext, feature.toWkt(), "wkt", 0); db.addMeasurement(fid, spatialcontext, viewpoint, input); /*HashMap<String, Double> visibility = checkVisibility(spatialcontext, feature, db); for (String vp : visibility.keySet()) { db.setVisibility(spatialcontext, fid, vp, visibility.get(vp) > VISIBILITY_TOLERANCE); }*/ db.setVisibility(spatialcontext, fid, viewpoint, true); db.close(); // insertImage(img, fid, width, height); return FeatureXML.getFeature(spatialcontext, fid); } catch (ClientException e) { return Config.getResult(e); } catch (Exception e) { return Config.getResult(e); } }
public static Response getFeature(String spatialcontext, InputXML input) { try (Database db = new Database()) { Point[] points = anglesToFeature(spatialcontext, input.getViewpoint(), input.getAngles(), db); GeoFeature feature = Util.pointsToFeature(points, input.getAngles(), input.getType(), false, 0); String message = Config.xml + "<feature>"; message += "<geom>" + feature.toWkt() + "</geom>"; return Config.getResult(message + "</feature>"); } catch (ClientException e) { return Config.getResult(e); } catch (Exception e) { return Config.getResult(e); } }