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 static org.bremersee.geojson.GeoJsonConstants.COORDINATES;
20  
21  import com.fasterxml.jackson.annotation.JsonIgnore;
22  import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
23  import com.fasterxml.jackson.annotation.JsonProperty;
24  import io.swagger.v3.oas.annotations.media.Schema;
25  import java.io.Serial;
26  import java.io.Serializable;
27  import lombok.Builder;
28  import lombok.EqualsAndHashCode;
29  import lombok.Getter;
30  import lombok.Setter;
31  import lombok.ToString;
32  
33  /**
34   * GeoJSON Point.
35   *
36   * @author Christian Bremer
37   */
38  @Schema(description = "GeoJSON Point.")
39  @JsonIgnoreProperties(ignoreUnknown = true)
40  @Getter
41  @Setter
42  @EqualsAndHashCode(callSuper = true)
43  @ToString(callSuper = true)
44  public class Point extends Geometry implements Serializable {
45  
46    @Serial
47    private static final long serialVersionUID = 1L;
48  
49    /**
50     * The coordinates.
51     */
52    @Schema(description = "The coordinates.")
53    @JsonProperty(COORDINATES)
54    private Position coordinates = null;
55  
56    /**
57     * Instantiates a new point.
58     */
59    public Point() {
60      setType(TypeEnum.POINT);
61    }
62  
63    /**
64     * Instantiates a new point.
65     *
66     * @param bbox the bbox
67     * @param coordinates the coordinates
68     */
69    @Builder(toBuilder = true)
70    public Point(BoundingBox bbox, Position coordinates) {
71      super(bbox);
72      setType(TypeEnum.POINT);
73      this.coordinates = coordinates;
74    }
75  
76    @Schema(hidden = true)
77    @JsonIgnore
78    @Override
79    Object getGeometryJsonValue() {
80      return getCoordinates();
81    }
82  
83  }
84