forked from digitick/yii-jquery-gmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEGmap3Route.php
69 lines (60 loc) · 1.34 KB
/
EGmap3Route.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* EGmap3 Yii extension
*
* Object oriented PHP interface to GMAP3 Javascript library for
* Google Maps.
*
* @copyright © Digitick <www.digitick.net> 2011
* @license GNU Lesser General Public License v3.0
* @author Ianaré Sévi
*
*/
/**
* A simple direction interface.
*/
class EGmap3Route extends EGmap3ActionBase
{
protected $action = 'getRoute';
/**
* @var EGmap3RouteOptions
*/
protected $options;
public function __construct($options = null)
{
parent::__construct($options);
$this->callback = 'js:function(result){if(!result)return;$(this).gmap3({action:"addDirectionsRenderer",options:{draggable:false,directions:result}});}';
}
public function addCallback($callback)
{
throw new CException('Sorry, callbacks are not supported for routes.');
}
}
class EGmap3RouteOptions extends EGmap3OptionBase
{
/**
* Origin of the route.
* @var string
*/
public $origin;
/**
* Route destination.
* @var string
*/
public $destination;
/**
* Mode of travel.
* @var string One of the modes defined in EGmap3DirectionsTravelMode.
*/
public $travelMode = EGmap3DirectionsTravelMode::DRIVING;
public function getOptionChecks()
{
return array(
'travelMode' => array(
EGmap3DirectionsTravelMode::BICYCLING,
EGmap3DirectionsTravelMode::DRIVING,
EGmap3DirectionsTravelMode::WALKING
),
);
}
}