Newer
Older
task-bldg / src / main / java / osm / surveyor / task / util / JsonGeometryPoint.java
@haya4 haya4 on 27 Jul 2022 878 bytes OK: "/tasks/00000"の地図表示
  1. package osm.surveyor.task.util;
  2.  
  3. import com.fasterxml.jackson.databind.JsonNode;
  4.  
  5. import lombok.Getter;
  6. import lombok.Setter;
  7.  
  8. /**
  9. * {
  10. * "coordinates":[141.35625,42.90416666666667],
  11. * "type":"Point"
  12. * }
  13. */
  14. @Getter
  15. @Setter
  16. public class JsonGeometryPoint extends JsonTemple {
  17. private Point coordinates;
  18. private String type = "Point";
  19. public String toString() {
  20. StringBuffer sb = new StringBuffer();
  21. boolean c = false;
  22. sb.append("{");
  23. c = out(c, sb, "coordinates", this.coordinates.toString());
  24. c = outStr(c, sb, "type", this.type);
  25. sb.append("}");
  26. return sb.toString();
  27. }
  28. public void parse(JsonNode node) {
  29. JsonNode node1 = node.get("type");
  30. if (node1 != null) {
  31. this.type = node1.textValue();
  32. }
  33. node1 = node.get("coordinates");
  34. if (node1 != null) {
  35. this.coordinates = new Point();
  36. this.coordinates.parse(node1);
  37. }
  38. }
  39. }