SnappingApiRequest.java

  1. package org.heigit.ors.api.requests.snapping;

  2. import com.fasterxml.jackson.annotation.JsonCreator;
  3. import com.fasterxml.jackson.annotation.JsonInclude;
  4. import com.fasterxml.jackson.annotation.JsonProperty;
  5. import io.swagger.v3.oas.annotations.media.Schema;
  6. import org.heigit.ors.api.requests.common.APIRequest;
  7. import org.heigit.ors.api.APIEnums;

  8. import java.util.List;

  9. @Schema(name = "SnappingRequest", description = "Snapping service endpoint.")
  10. @JsonInclude(JsonInclude.Include.NON_DEFAULT)
  11. public class SnappingApiRequest extends APIRequest {
  12.     public static final String PARAM_PROFILE = "profile";
  13.     public static final String PARAM_LOCATIONS = "locations";
  14.     public static final String PARAM_MAXIMUM_SEARCH_RADIUS = "radius";
  15.     public static final String PARAM_FORMAT = "format";

  16.     @Schema(name = PARAM_PROFILE, hidden = true)
  17.     private APIEnums.Profile profile;

  18.     @Schema(name = PARAM_LOCATIONS, description = "The locations to be snapped as array of `longitude/latitude` pairs.",
  19.             example = "[[8.681495,49.41461],[8.686507,49.41943]]",
  20.             requiredMode = Schema.RequiredMode.REQUIRED)
  21.     @JsonProperty(PARAM_LOCATIONS)
  22.     private List<List<Double>> locations; //apparently, this has to be a non-primitive type…

  23.     @Schema(name = PARAM_FORMAT, hidden = true)
  24.     @JsonProperty(PARAM_FORMAT)
  25.     private APIEnums.SnappingResponseType responseType = APIEnums.SnappingResponseType.JSON;

  26.     @Schema(name = PARAM_MAXIMUM_SEARCH_RADIUS, description = "Maximum radius in meters around given coordinates to search for graph edges.",
  27.         example ="300", requiredMode = Schema.RequiredMode.REQUIRED)
  28.     @JsonProperty(PARAM_MAXIMUM_SEARCH_RADIUS)
  29.     private double maximumSearchRadius;

  30.     @JsonCreator
  31.     public SnappingApiRequest(@JsonProperty(value = PARAM_LOCATIONS, required = true) List<List<Double>> locations) {
  32.         this.locations = locations;
  33.     }

  34.     public APIEnums.Profile getProfile() {
  35.         return profile;
  36.     }

  37.     public void setProfile(APIEnums.Profile profile) {
  38.         this.profile = profile;
  39.     }

  40.     public double getMaximumSearchRadius() {
  41.         return maximumSearchRadius;
  42.     }

  43.     public List<List<Double>> getLocations() {
  44.         return locations;
  45.     }

  46.     public void setLocations(List<List<Double>> locations) {
  47.         this.locations = locations;
  48.     }

  49.     public void setResponseType(APIEnums.SnappingResponseType responseType) {
  50.         this.responseType = responseType;
  51.     }
  52. }