diff --git a/src/main/java/org/ntlab/acanthus_server/resources/gallery/StrokesRest.java b/src/main/java/org/ntlab/acanthus_server/resources/gallery/StrokesRest.java index e052208..b3f3c9d 100644 --- a/src/main/java/org/ntlab/acanthus_server/resources/gallery/StrokesRest.java +++ b/src/main/java/org/ntlab/acanthus_server/resources/gallery/StrokesRest.java @@ -20,8 +20,8 @@ @Path("/gallery") public class StrokesRest implements ApplicationContextAware { private final Gallery gallery = Gallery.getInstance(); - private int srstrokeSize=0; - private int srstrokeNo=0; + private int srstrokeSize = 0; + private int srstrokeNo = 0; private ApplicationContext applicationContext; @@ -67,8 +67,8 @@ @POST @Produces(MediaType.APPLICATION_JSON) public String addStrokes(@PathParam("aid") Integer aid, @PathParam("pid") Integer pid, @PathParam("layerNo") Integer layerNo, - @FormParam("uid") Integer uid, @FormParam("strokeNo") Integer strokeNo, @FormParam("uidToken") String uidToken, @FormParam("pen") Integer pen, - @FormParam("color") Integer color, @FormParam("thick") Integer thick) { + @FormParam("uid") Integer uid, @FormParam("strokeNo") Integer strokeNo, @FormParam("uidToken") String uidToken, @FormParam("pen") Integer pen, + @FormParam("color") Integer color, @FormParam("thick") Integer thick) { var pages = gallery.getAnimationByAid(aid).getPages(); var strokes = new ArrayList(); @@ -98,7 +98,7 @@ ArrayList pages = animation.getPages(); HashMap pageUrl = new HashMap<>(); - for (Page p: pages){ + for (Page p : pages) { String url = "http://nitta-lab-www.is.konan-u.ac.jp/gallery/" + aid + "/" + p.getPid() + "/a" + aid + "p" + p.getPid() + ".png"; pageUrl.put(p.getPageNo(), url); } @@ -107,7 +107,6 @@ } - // _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/ // スクショで撮った画像をサーバ内の指定フォルダーにおく // @PathParam Integer aid 作品のID @@ -120,23 +119,26 @@ String vid = "a" + aid.toString() + pid.toString(); +// String url = "http://nitta-lab-www.is.konan-u.ac.jp/nitta-lab-www/webapps/"; + String path1 = ""; try { - path1 = applicationContext.getResource("file:").getFile().getAbsolutePath() + "/apache-tomcat-9.0.10/webapps"; - Base64Decode.saveAsFile(aid, pid, path1, image); +// path1 = applicationContext.getResource("http:").getFile().getAbsolutePath() + "/apache-tomcat-9.0.10/webapps"; + path1 = applicationContext.getResource("http:").getFile().getAbsolutePath() + "/webapps"; + Base64Decode.saveAsFile(aid, pid, path1, image); + } catch (IOException e) { e.printStackTrace(); throw new WebApplicationException(500); } - String url = "http://nitta-lab-www.is.konan-u.ac.jp" + vid; /* ArrayList categories = (ArrayList) category; ScreenImage v = screenimage.createScreenImage(aid, pid, vid, url, categories); return v;*/ - return "OK"; + return path1; } @@ -242,7 +244,7 @@ @POST @Produces(MediaType.APPLICATION_JSON) public String addPosition(@FormParam("positionNo") Integer positionNo, @PathParam("aid") Integer aid, @PathParam("pid") Integer pid, @PathParam("strokeNo") Integer strokeNo, - @PathParam("layerNo") Integer layerNo, @FormParam("x") Float x, @FormParam("y") Float y) { + @PathParam("layerNo") Integer layerNo, @FormParam("x") Float x, @FormParam("y") Float y) { var pages = gallery.getAnimationByAid(aid).getPages(); var strokes = new ArrayList(); @@ -253,19 +255,18 @@ var position = new Position(); position.setXY(positionNo, x, y); - if(srstrokeNo==strokeNo){ + if (srstrokeNo == strokeNo) { strokes.get(srstrokeSize).addPosition(position); - }else { - for(int i = 0; i < strokes.size(); i++){ - if(strokes.get(i).getStrokeNo()==strokeNo) - { - srstrokeNo=strokes.get(i).getStrokeNo(); - srstrokeSize=i; + } else { + for (int i = 0; i < strokes.size(); i++) { + if (strokes.get(i).getStrokeNo() == strokeNo) { + srstrokeNo = strokes.get(i).getStrokeNo(); + srstrokeSize = i; strokes.get(i).addPosition(position); } } } - // strokes.get(strokeNo).addPosition(position); // 呼び出したstrokesに座標を追加する + // strokes.get(strokeNo).addPosition(position); // 呼び出したstrokesに座標を追加する // if(animation != null) { ////// this.Position.setXY(x, y); ////// this.positions.add(this.Position);