GeoPoint.java 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package com.fdkankan.scene.dto;
  2. import lombok.Data;
  3. import java.util.Objects;
  4. /**
  5. * @author Xiewj
  6. * @date 2021/11/9
  7. */
  8. @Data
  9. public class GeoPoint {
  10. public GeoPoint() {
  11. }
  12. public GeoPoint(Double lon, Double lat) {
  13. this.lon = lon;
  14. this.lat = lat;
  15. }
  16. public GeoPoint(Double[] point) {
  17. if (point != null && point.length != 0) {
  18. if (point.length == 1) {
  19. this.lon = point[0];
  20. } else {
  21. this.lon = point[0];
  22. this.lat = point[1];
  23. }
  24. } else {
  25. this.lon = 0.0D;
  26. this.lat = 0.0D;
  27. }
  28. }
  29. public Double[] getCoordinates() {
  30. if(Objects.isNull(this.lon) || Objects.isNull(this.lat) || Objects.isNull(this.alt)){
  31. return new Double[]{};
  32. }
  33. return new Double[]{this.lon, this.lat, this.alt};
  34. }
  35. public void setCoordinates(Double[] coordinates) {
  36. if (coordinates != null && coordinates.length != 0) {
  37. if (coordinates.length == 1) {
  38. this.lon = coordinates[0];
  39. } else {
  40. this.lon = coordinates[0];
  41. this.lat = coordinates[1];
  42. this.alt = coordinates[2];
  43. }
  44. } else {
  45. this.lon = 0.0D;
  46. this.lat = 0.0D;
  47. this.alt = 0.0D;
  48. }
  49. }
  50. /* 经度 */
  51. private Double lon;
  52. /* 纬度 */
  53. private Double lat;
  54. private Double alt;
  55. private Double[] location;
  56. private Long id;
  57. private Long uuid;
  58. private int statusIndicator;
  59. private boolean pointA;
  60. private boolean pointB;
  61. }