public function addDirections($from, $to, array $options = []) {
		$id = 'd' . static::$markerCount++;
		$defaults = $this->_runtimeConfig['directions'];
		$options += $defaults;
		$travelMode = $this->travelModes[$options['travelMode']];

		$directions = "
			var {$id}Service = new google.maps.DirectionsService();
			var {$id}Display;
			{$id}Display = new google.maps.DirectionsRenderer();
			{$id}Display. setMap(" . $this->name() . ");
			";

		if (!empty($options['directionsDiv'])) {
			$directions .= "{$id}Display. setPanel(document.getElementById('" . $options['directionsDiv'] . "'));";
		}

		if (is_array($from)) {
			$from = 'new google.maps.LatLng(' . (float)$from['lat'] . ', ' . (float)$from['lng'] . ')';
		} else {
			$from = '"' . h($from) . '"';
		}
		if (is_array($to)) {
			$to = 'new google.maps.LatLng(' . (float)$to['lat'] . ', ' . (float)$to['lng'] . ')';
		} else {
			$to = '"' . h($to) . '"';
		}

		$directions .= "
			var request = {
				origin: $from,
				destination: $to,
				unitSystem: google.maps.UnitSystem." . $options['unitSystem'] . ",
				travelMode: google.maps.TravelMode. $travelMode
			};
			{$id}Service.route(request, function(result, status) {
				if (status == google.maps.DirectionsStatus.OK) {
					{$id}Display. setDirections(result);
				}
			});
		";
		$this->map .= $directions;
	}
public function addDirections($from, $to, array $options = []) {
		$id = 'd' . static::$markerCount++;
		$defaults = $this->_runtimeConfig['directions'];
		$options += $defaults;
		$travelMode = $this->travelModes[$options['travelMode']];

		$directions = "
			var {$id}Service = new google.maps.DirectionsService();
			var {$id}Display;
			{$id}Display = new google.maps.DirectionsRenderer();
			{$id}Display. setMap(" . $this->name() . ");
			";

		if (!empty($options['directionsDiv'])) {
			$directions .= "{$id}Display. setPanel(document.getElementById('" . $options['directionsDiv'] . "'));";
		}

		if (is_array($from)) {
			$from = 'new google.maps.LatLng(' . (float)$from['lat'] . ', ' . (float)$from['lng'] . ')';
		} else {
			$from = '"' . h($from) . '"';
		}
		if (is_array($to)) {
			$to = 'new google.maps.LatLng(' . (float)$to['lat'] . ', ' . (float)$to['lng'] . ')';
		} else {
			$to = '"' . h($to) . '"';
		}

		$directions .= "
			var request = {
				origin: $from,
				destination: $to,
				unitSystem: google.maps.UnitSystem." . $options['unitSystem'] . ",
				travelMode: google.maps.TravelMode. $travelMode
			};
			{$id}Service.route(request, function(result, status) {
				if (status == google.maps.DirectionsStatus.OK) {
					{$id}Display. setDirections(result);
				}
			});
		";
		$this->map .= $directions;
	}
public function addDirections ( $ from , $ to , array $ options = [ ] ) { $ id = 'd' . static :: $ markerCount ++ ; $ defaults = $ this -> _runtimeConfig [ 'directions' ] ; $ options += $ defaults ; $ travelMode = $ this -> travelModes [ $ options [ 'travelMode' ] ] ; $ directions = "
			var {$id}Service = new google.maps.DirectionsService();
			var {$id}Display;
			{$id}Display = new google.maps.DirectionsRenderer();
			{$id}Display. setMap(" . $ this -> name ( ) . ");
			" ; if ( ! empty ( $ options [ 'directionsDiv' ] ) ) { $ directions .= "{$id}Display. setPanel(document.getElementById('" . $ options [ 'directionsDiv' ] . "'));" ; } if ( is_array ( $ from ) ) { $ from = 'new google.maps.LatLng(' . ( float ) $ from [ 'lat' ] . ', ' . ( float ) $ from [ 'lng' ] . ')' ; } else { $ from = '"' . h ( $ from ) . '"' ; } if ( is_array ( $ to ) ) { $ to = 'new google.maps.LatLng(' . ( float ) $ to [ 'lat' ] . ', ' . ( float ) $ to [ 'lng' ] . ')' ; } else { $ to = '"' . h ( $ to ) . '"' ; } $ directions .= "
			var request = {
				origin: $from,
				destination: $to,
				unitSystem: google.maps.UnitSystem." . $ options [ 'unitSystem' ] . ",
				travelMode: google.maps.TravelMode. $travelMode
			};
			{$id}Service.route(request, function(result, status) {
				if (status == google.maps.DirectionsStatus.OK) {
					{$id}Display. setDirections(result);
				}
			});
		" ; $ this -> map .= $ directions ; }
Add directions to the map.

@param array|string $from Location as array(fixed lat/lng pair) or string (to be geocoded at runtime)
@param array|string $to Location as array(fixed lat/lng pair) or string (to be geocoded at runtime)
@param array $options
- directionsDiv: Div to place directions in text form
- travelMode: TravelMode,
- transitOptions: TransitOptions,
- unitSystem: UnitSystem (IMPERIAL, METRIC, AUTO),
- waypoints[]: DirectionsWaypoint,
- optimizeWaypoints: Boolean,
- provideRouteAlternatives: Boolean,
- avoidHighways: Boolean,
- avoidTolls: Boolean
- region: String
@see https://developers.google.com/maps/documentation/javascript/3.exp/reference#DirectionsRequest
@return void
Add directions to the map .