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; }
private static HashMap<String, Double> checkVisibility( String spatialcontext, GeoFeature feature, Database db, String viewpoint) throws SQLException, ClassNotFoundException, IOException { double tolerance; if (viewpoint == null || viewpoint.isEmpty()) { tolerance = POINTCLOUD_TOLERANCE; } else { ResultSet startViewpoint = db.getViewpoint(spatialcontext, viewpoint); if (startViewpoint.next()) { String filename = Config.getProperty("pointcloudpath") + startViewpoint.getString("filename"); Transformation t = new Transformation(startViewpoint.getString("pointcloud_trans")); t.transform(new Transformation(startViewpoint.getString("viewpoint_trans"))); feature.transform(t.inverse()); tolerance = feature.getPointTol(filename); feature.transform(t); if (tolerance < POINTCLOUD_TOLERANCE) { tolerance = POINTCLOUD_TOLERANCE; } } else { tolerance = POINTCLOUD_TOLERANCE; } } // result.last(); // int size = result.getRow(); // result.beforeFirst(); ResultSet result = db.getViewpoints(spatialcontext); HashMap<String, Double> visibility = new HashMap<>(); while (result.next()) { // user.setStatus(result.getRow() * 90 / size); String filename = Config.getProperty("pointcloudpath") + result.getString("filename"); Transformation t = new Transformation(result.getString("pointcloud_trans")); t.transform(new Transformation(result.getString("viewpoint_trans"))); feature.transform(t.inverse()); visibility.put(result.getString("name"), feature.visible(tolerance, filename)); feature.transform(t); } return visibility; }