diff --git a/chameleon-server/src/main/java/com/chameleonvision/web/RequestHandler.java b/chameleon-server/src/main/java/com/chameleonvision/web/RequestHandler.java index b0c1dbde8..64c926bcb 100644 --- a/chameleon-server/src/main/java/com/chameleonvision/web/RequestHandler.java +++ b/chameleon-server/src/main/java/com/chameleonvision/web/RequestHandler.java @@ -74,9 +74,9 @@ public class RequestHandler { if (cam.getCamera().getProperties().videoModes.size() < newPipeline.videoModeIndex) { newPipeline.videoModeIndex = cam.getCamera().getProperties().videoModes.size() - 1; } - if (newPipeline.is3D){ + if (newPipeline.is3D) { var calibration = cam.getCamera().getCalibration(cam.getCamera().getProperties().getVideoMode(newPipeline.videoModeIndex)); - if (calibration == null){ + if (calibration == null) { newPipeline.is3D = false; } } @@ -180,31 +180,21 @@ public class RequestHandler { public static void onPnpModel(Context ctx) throws JsonProcessingException { //noinspection unchecked - List> points = kObjectMapper.readValue(ctx.body(), List.class); + List> points = kObjectMapper.readValue(ctx.body(), List.class); // each entry should be an xy pair var pointsList = new ArrayList(); - for(List point: points) { + for (List point : points) { double x, y; - try { - x = (Double) point.get(0); - } catch (ClassCastException e) { - x = (Integer) point.get(0); - } - try { - y = (Double) point.get(1); - } catch (ClassCastException e) { - y = (Integer) point.get(1); - } + x = point.get(0).doubleValue(); + y = point.get(1).doubleValue(); var pointToAdd = new Point3(x, y, 0.0); pointsList.add(pointToAdd); } System.out.println(pointsList.toString()); - - if(VisionManager.getCurrentUIVisionProcess().pipelineManager.getCurrentPipeline().settings instanceof StandardCVPipelineSettings) { + if (VisionManager.getCurrentUIVisionProcess().pipelineManager.getCurrentPipeline().settings instanceof StandardCVPipelineSettings) { var settings = (StandardCVPipelineSettings) VisionManager.getCurrentUIVisionProcess().pipelineManager.getCurrentPipeline().settings; settings.targetCornerMat.fromList(pointsList); - var xxx = 4; } } }