diff --git a/src/main/java/org/ntlab/acanthus_server/entities/Position.java b/src/main/java/org/ntlab/acanthus_server/entities/Position.java index 92b7e3f..bc95a70 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/Position.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/Position.java @@ -12,10 +12,10 @@ public void putPosition(String coordinate, Integer value) { this.positionMap.put(coordinate, value); + this.positionList.add(this.positionMap); } public ArrayList> getPosition() { - this.positionList.add(this.positionMap); return this.positionList; } diff --git a/src/main/java/org/ntlab/acanthus_server/entities/Stroke.java b/src/main/java/org/ntlab/acanthus_server/entities/Stroke.java index 17dc6c7..b2b4bb4 100644 --- a/src/main/java/org/ntlab/acanthus_server/entities/Stroke.java +++ b/src/main/java/org/ntlab/acanthus_server/entities/Stroke.java @@ -1,5 +1,20 @@ package org.ntlab.acanthus_server.entities; -public class Stroke { +import java.util.ArrayList; +import java.util.HashMap; +public class Stroke { + private HashMap StrokeMap = new HashMap<>(); + private ArrayList> StrokeList = new ArrayList<>(); + + public void putStroke(String type, Integer value) { + this.StrokeMap.put(type, value); + } + + public ArrayList> getStrokeRest() { + this.StrokeList.add(this.StrokeMap); + return this.StrokeList; + } +/**/ } + 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 f54f352..f5f154e 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 @@ -1,10 +1,12 @@ package org.ntlab.acanthus_server.resources.gallery; import org.ntlab.acanthus_server.entities.Position; +import org.ntlab.acanthus_server.entities.Stroke; import org.ntlab.acanthus_server.entities.Work; import org.ntlab.acanthus_server.models.Gallery; import org.springframework.stereotype.Component; +import javax.swing.text.TabExpander; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.ArrayList; @@ -18,6 +20,7 @@ /* * 1ページの1レイヤーに置ける筆跡情報を全て取得します。 + * 成功時のレスポンス:strokeNo{pen, color, thickness, potions{x, y}} * @PathParam Integer aid 作品ID * @PathParam Integer pid ページのID 今回は0 * @PathParam Integer layerNo レイヤーの番号 今回は0 @@ -25,8 +28,13 @@ @Path("/{aid}/pageMap/0/layers/0/strokes") @GET @Produces(MediaType.APPLICATION_JSON) - public ArrayList getLayersRest(@PathParam("aid") Integer aid) { - return null; + public ArrayList> getStrokeRest(@PathParam("aid") Integer aid) { + Stroke Test = new Stroke(); + Test.putStroke("strokeNo", 2); + Test.putStroke("pen", 3); + Test.putStroke("color", 5); + Test.putStroke("thickness", 1); + return Test.getStrokeRest(); } /* @@ -55,9 +63,6 @@ @GET @Produces(MediaType.APPLICATION_JSON) public ArrayList> getPositions(@PathParam("aid") Integer aid, @PathParam("strokeNo") Integer strokeNo) { - Position.putPosition("x", 80); - Position.putPosition("y", 50); - return Position.getPosition(); } @@ -70,8 +75,8 @@ @Path("/{aid}/pageMap/0/layers/0/strokes/{strokeNo}/position") @POST @Produces(MediaType.APPLICATION_JSON) - public String addPositions(@PathParam("aid") Integer aid, @FormParam("x") Integer x, @FormParam("y") Integer y) { - return null; + public void addPositions(@PathParam("aid") Integer aid, @FormParam("x") Integer x, @FormParam("y") Integer y) { + Position.putPosition("x", 80); + Position.putPosition("y", 50); } -} - +} \ No newline at end of file