private static Point[] anglesToFeature( String spatialcontext, String viewpoint, Angle[] angles, Database db) throws ClientException, SQLException, Exception { ResultSet result = db.getViewpoint(spatialcontext, viewpoint); if (!result.next()) { throw new ClientException( "viewpoint " + viewpoint + " in spatialcontext " + spatialcontext + " does not exist", 404); } String filename = Config.getProperty("pointcloudpath") + result.getString("filename"); Transformation ptrans = new Transformation(result.getString("pointcloud_trans")); Transformation vtrans = new Transformation(result.getString("viewpoint_trans")); if (result.next()) { Config.warn( "more than one viewpoint in spatialcontext " + spatialcontext + " with name " + viewpoint + " in the database"); } Point[] points = null; try (Pointcloud pc = new Pointcloud(filename, ptrans)) { points = pc.getPoints(angles); pc.close(); } catch (Exception e) { throw e; } for (Point point : points) { point.transform(vtrans); } return points; }
private static double getPrismPoint( String spatialcontext, String viewpoint, Database db, InputXML input, Point[] points) throws SQLException, ClientException, Exception { double prismPoint; if (input.getType().equals("PRISM")) { ResultSet result = db.getViewpoint(spatialcontext, viewpoint); if (!result.next()) { throw new ClientException( "viewpoint " + viewpoint + " in spatialcontext " + spatialcontext + " does not exist", 404); } String filename = Config.getProperty("pointcloudpath") + result.getString("filename"); Transformation trans = new Transformation(result.getString("pointcloud_trans")); trans.transform(new Transformation(result.getString("viewpoint_trans"))); Transformation inv = trans.inverse(); if (result.next()) { Config.warn( "more than one viewpoint in spatialcontext " + spatialcontext + " with name " + viewpoint + " in the database"); } PlanarPolygon tmp = new PlanarPolygon(input.getAngles(), points); tmp.transform(inv); prismPoint = PTGInteraction.getPrismaPoint(tmp, filename); tmp.transform(trans); } else { prismPoint = 0; } return prismPoint; }