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 b756bf2..2efc968 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 @@ -40,6 +40,7 @@ // @PathParam Integer pid ページのID // @PathParam Integer layerNo レイヤーの番号 // @FormParam Integer uid ページのID + // @FormParam Integer StrokeNo ストロークのID uid+数字 // @FormParam Integer uidToken トークン // @FormParam Integer pen ペン情報 // @FormParam Integer color 色情報 @@ -47,8 +48,8 @@ @Path("/{aid}/pageMap/{pid}/layers/{layerNo}/strokes") @POST @Produces(MediaType.APPLICATION_JSON) - public Integer addStrokes(@PathParam("aid") Integer aid, @PathParam("pid") Integer pid, @PathParam("layerNo") Integer layerNo, - @FormParam("uid") Integer uid, @FormParam("uidToken") String uidToken, @FormParam("pen") Integer pen, + 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) { var pages = gallery.getAnimationByAid(aid).getPageMap(); var strokes = pages.get(pid).getLayers().get(layerNo).getStrokes(); @@ -56,14 +57,14 @@ Stroke stroke = new Stroke(); stroke.addStrokes(pen, color, thick); // 線の情報を追加 strokes.add(stroke); - stroke.setStrokeNo(strokes.size()-1); // strokeNoに現在のstrokesのsizeを入れる + stroke.setStrokeNo(strokeNo); // strokeNoに現在のstrokesのsizeを入れる // if(animation != null) { // this.Test.setStrokes(pen, color, thick); // }else{ // throw new WebApplicationException(401); // } - return stroke.getStrokeNo(); + return "OK!"; } // 画像URLを返す @@ -164,7 +165,7 @@ @Path("/{aid}/pageMap/{pid}/layers/{layerNo}/strokes/{strokeNo}/positions") @POST @Produces(MediaType.APPLICATION_JSON) - public Integer addPosition(@FormParam("positionNo") Integer positionNo, @PathParam("aid") Integer aid, @PathParam("pid") Integer pid, @PathParam("strokeNo") Integer strokeNo, + 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) { var pages = gallery.getAnimationByAid(aid).getPageMap(); var strokes = pages.get(pid).getLayers().get(layerNo).getStrokes(); @@ -172,14 +173,22 @@ Position position = new Position(); position.setXY(positionNo, x, y); - strokes.get(strokeNo).addPosition(position); // 呼び出したstrokesに座標を追加する + + for(int i = 0; i < strokes.size(); i++){ + if(strokes.get(i).getStrokeNo()==strokeNo) + { + strokes.get(i).addPosition(position); + } + } + + // strokes.get(strokeNo).addPosition(position); // 呼び出したstrokesに座標を追加する // if(animation != null) { -//// this.Position.setXY(x, y); -//// this.positions.add(this.Position); -//// }else{ -//// throw new WebApplicationException(401); -//// } - return strokes.get(strokeNo).getPositions().size(); +////// this.Position.setXY(x, y); +////// this.positions.add(this.Position); +////// }else{ +////// throw new WebApplicationException(401); +////// } + return "OK"; } }