StrokesRestにif文を追加 #120

Merged g-akagi merged 1 commit into nitta-lab-2021:master from nitta-lab-2021:matsu on 26 May 2021
Showing 1 changed file
View
26
src/main/java/org/ntlab/acanthus_server/resources/gallery/StrokesRest.java
public class StrokesRest {
private Position Position = new Position();
private ArrayList<Position> positions = new ArrayList<>();
private Stroke Test = new Stroke();
private Gallery gallery = Gallery.getInstance();
 
/*
* 1ページの1レイヤーに置ける筆跡情報を全て取得します。
* 成功時のレスポンス:strokeNo{pen, color, thickness, potions{x, y}}
@Path("/{aid}/pageMap/0/layers/0/strokes")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Stroke getStrokeRest(@PathParam("aid") Integer aid) {
var animation = gallery.getAnimationInformation(aid);
return this.Test;
// if(animation != null) {
// return this.Test;
// }else{
// throw new WebApplicationException(401);
// }
}
 
/*
* 何かを書き始めた時strokeNoを取得しペン情報、色情報、太さ情報、座標情報を追加する
@POST
@Produces(MediaType.APPLICATION_JSON)
public void addStrokes(@PathParam("aid") Integer aid, @FormParam("uid") Integer uid, @FormParam("uidToken") Integer uidToken,
@FormParam("pen") Integer pen, @FormParam("color") Integer color, @FormParam("thick") Integer thick) {
var animation = gallery.getAnimationInformation(aid);
this.Test.setStrokes(pen, color, thick);
// if(animation != null) {
// this.Test.setStrokes(pen, color, thick);
// }else{
// throw new WebApplicationException(401);
// }
}
 
/*
* 全座標値を取得する
@Path("/{aid}/pageMap/0/layers/0/strokes/{strokeNo}/position")
@GET
@Produces(MediaType.APPLICATION_JSON)
public ArrayList<Position> getPositions(@PathParam("aid") Integer aid, @PathParam("strokeNo") Integer strokeNo) {
var animation = gallery.getAnimationInformation(aid);
return this.positions;
// if(animation != null) {
// return this.positions;
// }else{
// throw new WebApplicationException(401);
// }
}
 
/*
* 座標情報の追加
@Path("/{aid}/pageMap/0/layers/0/strokes/{strokeNo}/position")
@POST
@Produces(MediaType.APPLICATION_JSON)
public void addPositions(@PathParam("aid") Integer aid, @FormParam("x") Float x, @FormParam("y") Float y) {
var animation = gallery.getAnimationInformation(aid);
this.Position.setXY(x, y);
this.positions.add(this.Position);
// if(animation != null) {
// this.Position.setXY(x, y);
// this.positions.add(this.Position);
// }else{
// throw new WebApplicationException(401);
// }
}
}