forked from leonardfischer/Kohana-Google-Maps-Module
-
Notifications
You must be signed in to change notification settings - Fork 0
Google Maps Module V 1.3
solidsnake edited this page Feb 12, 2011
·
1 revision
These are the new features:
- factory method
- add polylines to map
- add polygons to map
The prefered way of creating an instance is through the static "factory" method. This allows you to directly use method-chaining.
public function action_index()
{
// Simply display a blank Google Map, with the options set in your config.
$this->template->bind('map', Gmap::factory());
} // functionDisplaying a polyline is as easy as can be - You may add your own color, stroke weight and stroke opacity, if you wish. If not, this options will be set by the default settings of the config-file.
public function action_index()
{
// Set the options for the polyline.
$options = array(
'strokeColor' => '#f00',
'strokeOpacity' => .5,
'strokeWeight' => 10,
);
$coords = array(
array(50.123, 6.123),
array(51.234, 6.234),
array(52.345, 6.345),
);
$coords2 = array(
array(51.123, 7.123),
array(52.234, 7.234),
array(53.345, 7.345),
);
$gmap = Gmap::factory()
->add_polyline('polyline one', $coords, $options)
->add_polyline('polyline two', $coords2);
$this->template->bind('map', $gmap);
} // functionThis is mainly the same way how you display a polyline - You just have two new options:
- fillColor
- fillOpacity
public function action_index()
{
$options = array(
'strokeColor' => '#f00',
'strokeOpacity' => .5,
'strokeWeight' => 10,
'fillColor' => '#f00',
'fillOpacity' => .5,
);
$coords = array(
array(50.123, 6.123),
array(51.234, 6.234),
array(52.345, 6.345),
);
$coords2 = array(
array(51.123, 7.123),
array(52.234, 7.234),
array(53.345, 7.345),
);
$gmap = Gmap::factory()
->add_polygon('polyline one', $coords, $options)
->add_polygon('polyline two', $coords2);
$this->template->bind('map', $gmap);
} // function