Skip to content
This repository has been archived by the owner on May 12, 2022. It is now read-only.

Commit

Permalink
Method $map->setCenter() can now take "lat,long" string, Google_Maps_…
Browse files Browse the repository at this point in the history
…Point

or Google_Maps_Coordinat as parameter.
  • Loading branch information
tuupola committed Oct 12, 2008
1 parent 6ee5286 commit 1d1d44b
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
36 changes: 36 additions & 0 deletions Google/Maps/Location.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

/*
* Google_Maps_Location
*
* Copyright (c) 2008 Mika Tuupola
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Project home:
* http://www.appelsiini.net/projects/google_maps
*
* Revision: $Id$
*
*/

require_once 'Google/Maps/Overload.php';

abstract class Google_Maps_Location extends Google_Maps_Overload {

/**
* Return point as coordinate.
*
* @return object Google_Maps_Coordinate
*/
abstract public function toCoordinate();

/**
* Return coordinate as point.
*
* @return object Google_Maps_Point
*/
abstract public function toPoint();

}
45 changes: 45 additions & 0 deletions tests/11_maps_setcenter.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
--TEST--
Google_Maps::create()
--SKIPIF--
<?php
include 'skipif.php';
?>
--FILE--
<?php
include 'skipif.php';

$point = new Google_Maps_Point(355500011, 230704001);
$coord = new Google_Maps_Coordinate(24.5165921956, 58.3813335747);


$map_1 = Google_Maps::create('static');
$map_2 = Google_Maps::create('static');
$map_3 = Google_Maps::create('static');

$map_1->setCenter($coord);
$map_2->setCenter($point);
$map_3->setCenter("24.5165921956, 58.3813335747");

print_r($map_1->getCenter());
print_r($map_2->getCenter());
print_r($map_3->getCenter());

?>
--GET--
--POST--
--EXPECT--
Google_Maps_Coordinate Object
(
[lat:protected] => 24.5165921956
[lon:protected] => 58.3813335747
)
Google_Maps_Coordinate Object
(
[lat:protected] => 24.5165921956
[lon:protected] => 58.3813335747
)
Google_Maps_Coordinate Object
(
[lat:protected] => 24.5165921956
[lon:protected] => 58.3813335747
)

0 comments on commit 1d1d44b

Please sign in to comment.