RouteRequestOptions.java

  1. /*
  2.  * This file is part of Openrouteservice.
  3.  *
  4.  * Openrouteservice is free software; you can redistribute it and/or modify it under the terms of the
  5.  * GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1
  6.  * of the License, or (at your option) any later version.
  7.  *
  8.  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  9.  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10.  * See the GNU Lesser General Public License for more details.
  11.  *
  12.  * You should have received a copy of the GNU Lesser General Public License along with this library;
  13.  * if not, see <https://www.gnu.org/licenses/>.
  14.  */

  15. package org.heigit.ors.api.requests.routing;

  16. import com.fasterxml.jackson.annotation.JsonIgnore;
  17. import com.fasterxml.jackson.annotation.JsonInclude;
  18. import com.fasterxml.jackson.annotation.JsonProperty;
  19. import io.swagger.v3.oas.annotations.media.Schema;
  20. import org.heigit.ors.api.requests.common.RequestOptions;

  21. @Schema(title = "Route Options", name = "routeOptions", description = "Advanced options for routing", subTypes = {RouteRequestAlternativeRoutes.class, RequestProfileParams.class, RouteRequestRoundTripOptions.class})
  22. @JsonInclude(JsonInclude.Include.NON_DEFAULT)
  23. public class RouteRequestOptions extends RequestOptions {
  24.     public static final String PARAM_ROUND_TRIP_OPTIONS = "round_trip";

  25.     @Schema(name = PARAM_ROUND_TRIP_OPTIONS, description = "Options to be applied on round trip routes.",
  26.             example = "{\"length\":10000,\"points\":5}")
  27.     @JsonProperty(PARAM_ROUND_TRIP_OPTIONS)
  28.     private RouteRequestRoundTripOptions roundTripOptions;
  29.     @JsonIgnore
  30.     private boolean hasRoundTripOptions = false;

  31.     public RouteRequestRoundTripOptions getRoundTripOptions() {
  32.         return roundTripOptions;
  33.     }

  34.     public void setRoundTripOptions(RouteRequestRoundTripOptions roundTripOptions) {
  35.         this.roundTripOptions = roundTripOptions;
  36.         hasRoundTripOptions = true;
  37.     }

  38.     public boolean hasRoundTripOptions() {
  39.         return hasRoundTripOptions;
  40.     }
  41. }