StrokesRestのstrokesのPOST,GETに内容追加。 entitiesのStrokeにコード追加。 #130

Merged d-matsuura merged 1 commit into nitta-lab-2021:master from nitta-lab-2021:akagi05/25 on 28 May 2021
Showing 2 changed files
View
19
src/main/java/org/ntlab/acanthus_server/entities/Stroke.java
import org.ntlab.acanthus_server.resources.gallery.StrokesRest;
import org.ntlab.acanthus_server.entities.Position;
 
public class Stroke {
private static int i; //strokeNoを数えるためだけ
private int strokeNo;
private int pen;
private int color;
private int thickness;
private ArrayList<Position> positions = new ArrayList<>();
 
public int getStrokeNo() {
return this.strokeNo;
}
public int getPen() {
return this.pen;
}
public int getColor() {
public int getThickness() {
return this.thickness;
}
 
public void setStrokes(int pen, int color, int thickness) {
//書き始めたらstrokeNoを追加する。
public void addStrokeNo(){
this.i++;
this.strokeNo = i;
}
 
public void addStrokes(int pen, int color, int thickness) {
this.pen = pen;
this.color = color;
this.thickness = thickness;
}
View
14
src/main/java/org/ntlab/acanthus_server/resources/gallery/StrokesRest.java
@Path("/gallery")
public class StrokesRest {
private Position Position = new Position();
private ArrayList<Position> positions = new ArrayList<>();
private Stroke Test = new Stroke();
private ArrayList<Stroke> strokes = new ArrayList<>();
private Gallery gallery = Gallery.getInstance();
 
/*
* 1ページの1レイヤーに置ける筆跡情報を全て取得します。
*/
@Path("/{aid}/pageMap/0/layers/0/strokes")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Stroke getStrokeRest(@PathParam("aid") Integer aid) {
public ArrayList<Stroke> getStrokeRest(@PathParam("aid") Integer aid) {
var animation = gallery.getAnimationInformation(aid);
return this.Test;
return this.strokes;
// if(animation != null) {
// return this.Test;
// }else{
// throw new WebApplicationException(401);
@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);
Stroke Test = new Stroke();
Test.addStrokes(pen, color, thick);
Test.addStrokeNo();//strokeNoを+1する
this.strokes.add(Test);
// if(animation != null) {
// this.Test.setStrokes(pen, color, thick);
// }else{
// throw new WebApplicationException(401);