Exemplo n.º 1
0
 public function distanceTo(Google_Maps_Location $location, $unit = 'km', Google_Maps_Static $map = null)
 {
     if ('pixel' == $unit) {
         $zoom = $map->getZoom();
         $x1 = $this->toPoint()->getX();
         $x2 = $location->toPoint()->getX();
         $y1 = $this->toPoint()->getY();
         $y2 = $location->toPoint()->getY();
         $distance = sqrt(pow($x1 - $x2, 2) + pow($y1 - $y2, 2));
         if ($map instanceof Google_Maps_Static) {
             $distance = $distance >> 21 - $zoom;
         }
     }
     return $distance;
 }
Exemplo n.º 2
0
 public function toHtml(Google_Maps_Static $map)
 {
     $original = $map->getZoom();
     $map->zoomIn();
     $zoom_in = sprintf('<a rel="nofollow" href="%s"><img src="%s" id="%s" alt="%s" /></a>', $_SERVER['PHP_SELF'] . '?' . $map->toQueryString(), $this->getZoomInImage(), $this->getZoomInId(), $this->getZoomInAlt());
     $map->setZoom($original);
     $map->zoomOut();
     $zoom_out = sprintf('<a rel="nofollow" href="%s"><img src="%s" id="%s" alt="%s" /></a>', $_SERVER['PHP_SELF'] . '?' . $map->toQueryString(), $this->getZoomOutImage(), $this->getZoomOutId(), $this->getZoomOutAlt());
     $map->setZoom($original);
     return $zoom_in . $zoom_out;
 }
Exemplo n.º 3
0
 public function getCloseUrl(Google_Maps_Static $map)
 {
     return preg_replace('/infowindow=.*&/', 'infowindow=&', $map->toUrl('?', false));
 }
Exemplo n.º 4
0
 public function toHtml(Google_Maps_Static $map)
 {
     $map->panNorth(60);
     $pan_north = sprintf('<a rel="nofollow" href="%s"><img src="%s" id="%s" alt="%s" /></a>', $_SERVER['PHP_SELF'] . '?' . $map->toQueryString(), $this->getPanNorthImage(), $this->getPanNorthId(), $this->getPanNorthAlt());
     $map->panSouth(60);
     $map->panWest(100);
     $pan_west = sprintf('<a rel="nofollow" href="%s"><img src="%s" id="%s" alt="%s" /></a>', $_SERVER['PHP_SELF'] . '?' . $map->toQueryString(), $this->getPanWestImage(), $this->getPanWestId(), $this->getPanWestAlt());
     $map->panEast(100);
     $map->panEast(100);
     $pan_east = sprintf('<a rel="nofollow" href="%s"><img src="%s" id="%s" alt="%s" /></a>', $_SERVER['PHP_SELF'] . '?' . $map->toQueryString(), $this->getPanEastImage(), $this->getPanEastId(), $this->getPanEastAlt());
     $map->panWest(100);
     $map->panSouth(60);
     $pan_south = sprintf('<a rel="nofollow" href="%s"><img src="%s" id="%s" alt="%s" /></a>', $_SERVER['PHP_SELF'] . '?' . $map->toQueryString(), $this->getPanSouthImage(), $this->getPanSouthId(), $this->getPanSouthAlt());
     $map->panNorth(60);
     return $pan_north . $pan_west . $pan_east . $pan_south;
 }