View Javadoc
1   /*
2    * Copyright 2018-2022 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.bremersee.geojson.model;
18  
19  import com.fasterxml.jackson.annotation.JsonCreator;
20  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
21  import com.fasterxml.jackson.annotation.JsonProperty;
22  import io.swagger.v3.oas.annotations.media.Schema;
23  import java.io.Serial;
24  import java.io.Serializable;
25  import java.math.BigDecimal;
26  import lombok.EqualsAndHashCode;
27  import lombok.Getter;
28  import lombok.ToString;
29  
30  /**
31   * The latitude longitude.
32   *
33   * @author Christian Bremer
34   */
35  @Schema(description = "WGS84 position with latitude and longitude.")
36  @JsonIgnoreProperties(ignoreUnknown = true)
37  @Getter
38  @EqualsAndHashCode(callSuper = false)
39  @ToString
40  public class LatitudeLongitude implements LatLonAware, Serializable {
41  
42    @Serial
43    private static final long serialVersionUID = 1L;
44  
45    /**
46     * The latitude.
47     */
48    @Schema(description = "The latitude.")
49    @JsonProperty("latitude")
50    private BigDecimal latitude;
51  
52    /**
53     * The longitude.
54     */
55    @Schema(description = "The longitude.")
56    @JsonProperty("longitude")
57    private BigDecimal longitude;
58  
59    /**
60     * Instantiates a new latitude longitude.
61     *
62     * @param latitude the latitude
63     * @param longitude the longitude
64     */
65    @JsonCreator
66    public LatitudeLongitude(
67        @JsonProperty("latitude") BigDecimal latitude,
68        @JsonProperty("longitude") BigDecimal longitude) {
69      this.latitude = latitude;
70      this.longitude = longitude;
71    }
72  
73    /**
74     * Instantiates a new latitude longitude.
75     *
76     * @param latLonAware the lat lon aware
77     */
78    public LatitudeLongitude(LatLonAware latLonAware) {
79      if (latLonAware != null) {
80        this.latitude = latLonAware.getLatitude();
81        this.longitude = latLonAware.getLongitude();
82      }
83    }
84  
85  }