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