# Google Maps Route Optimization V1 Client - Class Visit (0.6.2)

0.6.2 (latest) 0.6.1 0.5.1 0.4.1 0.3.3 0.2.0 0.1.0 Reference documentation and code samples for the Google Maps Route Optimization V1 Client class Visit.

A visit performed during a route. This visit corresponds to a pickup or a
delivery of a `Shipment`.

Generated from protobuf message `google.maps.routeoptimization.v1.ShipmentRoute.Visit`

## Namespace

Google \\ Maps \\ RouteOptimization \\ V1 \\ ShipmentRoute

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ shipment_index` | `int` Index of the `shipments` field in the source [ShipmentModel](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentModel). |
| `↳ is_pickup` | `bool` If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it corresponds to a delivery. |
| `↳ visit_request_index` | `int` Index of `VisitRequest` in either the pickup or delivery field of the `Shipment` (see `is_pickup`). |
| `↳ start_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Time at which the visit starts. Note that the vehicle may arrive earlier than this at the visit location. Times are consistent with the `ShipmentModel`. |
| `↳ load_demands` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Total visit load demand as the sum of the shipment and the visit request `load_demands`. The values are negative if the visit is a delivery. Demands are reported for the same types as the [Transition.loads](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute.Transition) (see this field). |
| `↳ detour` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` Extra detour time due to the shipments visited on the route before the visit and to the potential waiting time induced by time windows. If the visit is a delivery, the detour is computed from the corresponding pickup visit and is equal to: `start_time(delivery) - start_time(pickup) - (duration(pickup) + travel duration from the pickup location to the delivery location).` Otherwise, it is computed from the vehicle `start_location` and is equal to: ``start_time - vehicle_start_time - travel duration from the vehicle's `start_location` to the visit.`` |
| `↳ shipment_label` | `string` Copy of the corresponding `Shipment.label`, if specified in the `Shipment`. |
| `↳ visit_label` | `string` Copy of the corresponding [VisitRequest.label](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.Shipment.VisitRequest#_Google_Maps_RouteOptimization_V1_Shipment_VisitRequest__getLabel__), if specified in the `VisitRequest`. |
| `↳ injected_solution_location_token` | `int` An opaque token representing information about a visit location. This field may be populated in the result routes' visits when [VisitRequest.avoid_u_turns](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.Shipment.VisitRequest#_Google_Maps_RouteOptimization_V1_Shipment_VisitRequest__getAvoidUTurns__) was set to true for this visit or if ShipmentModel.avoid_u_turns was set to true in the request [OptimizeToursRequest](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.OptimizeToursRequest). Experimental: See <https://developers.google.com/maps/tt/route-optimization/experimental/u-turn-avoidance/make-request> for more details. |

### getShipmentIndex

Index of the `shipments` field in the source
[ShipmentModel](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentModel).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setShipmentIndex

Index of the `shipments` field in the source
[ShipmentModel](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentModel).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getIsPickup

If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it
corresponds to a delivery.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### setIsPickup

If true the visit corresponds to a pickup of a `Shipment`. Otherwise, it
corresponds to a delivery.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `bool` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getVisitRequestIndex

Index of `VisitRequest` in either the pickup or delivery field of the
`Shipment` (see `is_pickup`).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### setVisitRequestIndex

Index of `VisitRequest` in either the pickup or delivery field of the
`Shipment` (see `is_pickup`).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getStartTime

Time at which the visit starts. Note that the vehicle may arrive earlier
than this at the visit location. Times are consistent with the
`ShipmentModel`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasStartTime

### clearStartTime

### setStartTime

Time at which the visit starts. Note that the vehicle may arrive earlier
than this at the visit location. Times are consistent with the
`ShipmentModel`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLoadDemands

Total visit load demand as the sum of the shipment and the visit request
`load_demands`. The values are negative if the visit is a delivery.

Demands are reported for the same types as the
[Transition.loads](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute.Transition)
(see this field).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |   |

### setLoadDemands

Total visit load demand as the sum of the shipment and the visit request
`load_demands`. The values are negative if the visit is a delivery.

Demands are reported for the same types as the
[Transition.loads](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.ShipmentRoute.Transition)
(see this field).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDetour

Extra detour time due to the shipments visited on the route before the
visit and to the potential waiting time induced by time windows.

If the visit is a delivery, the detour is computed from the corresponding
pickup visit and is equal to:

    start_time(delivery) - start_time(pickup)
    - (duration(pickup) + travel duration from the pickup location
    to the delivery location).

Otherwise, it is computed from the vehicle `start_location` and is equal
to:

    start_time - vehicle_start_time - travel duration from
    the vehicle's `start_location` to the visit.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration|null` |   |

### hasDetour

### clearDetour

### setDetour

Extra detour time due to the shipments visited on the route before the
visit and to the potential waiting time induced by time windows.

If the visit is a delivery, the detour is computed from the corresponding
pickup visit and is equal to:

    start_time(delivery) - start_time(pickup)
    - (duration(pickup) + travel duration from the pickup location
    to the delivery location).

Otherwise, it is computed from the vehicle `start_location` and is equal
to:

    start_time - vehicle_start_time - travel duration from
    the vehicle's `start_location` to the visit.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getShipmentLabel

Copy of the corresponding `Shipment.label`, if specified in the
`Shipment`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setShipmentLabel

Copy of the corresponding `Shipment.label`, if specified in the
`Shipment`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getVisitLabel

Copy of the corresponding
[VisitRequest.label](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.Shipment.VisitRequest#_Google_Maps_RouteOptimization_V1_Shipment_VisitRequest__getLabel__),
if specified in the `VisitRequest`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setVisitLabel

Copy of the corresponding
[VisitRequest.label](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.Shipment.VisitRequest#_Google_Maps_RouteOptimization_V1_Shipment_VisitRequest__getLabel__),
if specified in the `VisitRequest`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getInjectedSolutionLocationToken

An opaque token representing information about a visit location.

This field may be populated in the result routes' visits when
[VisitRequest.avoid_u_turns](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.Shipment.VisitRequest#_Google_Maps_RouteOptimization_V1_Shipment_VisitRequest__getAvoidUTurns__)
was set to true for this visit or if
ShipmentModel.avoid_u_turns
was set to true in the request
[OptimizeToursRequest](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.OptimizeToursRequest).
Experimental: See
<https://developers.google.com/maps/tt/route-optimization/experimental/u-turn-avoidance/make-request>
for more details.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasInjectedSolutionLocationToken

### clearInjectedSolutionLocationToken

### setInjectedSolutionLocationToken

An opaque token representing information about a visit location.

This field may be populated in the result routes' visits when
[VisitRequest.avoid_u_turns](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.Shipment.VisitRequest#_Google_Maps_RouteOptimization_V1_Shipment_VisitRequest__getAvoidUTurns__)
was set to true for this visit or if
ShipmentModel.avoid_u_turns
was set to true in the request
[OptimizeToursRequest](https://docs.cloud.google.com/php/docs/reference/maps-routeoptimization/latest/V1.OptimizeToursRequest).
Experimental: See
<https://developers.google.com/maps/tt/route-optimization/experimental/u-turn-avoidance/make-request>
for more details.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |