Changeset 3158 for trunk/modules

Show
Ignore:
Timestamp:
07/19/2008 07:42:10 PM (5 months ago)
Author:
alexsancho
Message:

Initial support to OverviewMapControl?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/modules/gmaps/libraries/Gmap.php

    r3156 r3158  
    136136        protected $center; 
    137137        protected $control; 
     138        protected $overview_control; 
    138139        protected $type_control = FALSE; 
    139140         
     
    201202         
    202203        /** 
     204         * Set the GMap overview map. 
     205         * 
     206         * @chainable 
     207         * @param integer $width width 
     208         * @param integer $height height 
     209         * @return object 
     210         */ 
     211        public function overview($width = '', $height = '') 
     212        { 
     213                $size = (is_int($width) AND is_int($height)) ? 'new GSize('.$width.','.$height.')' : ''; 
     214                $this->overview_control = 'map.addControl(new google.maps.OverviewMapControl('.$size.'));'; 
     215                 
     216                return $this; 
     217        } 
     218         
     219        /** 
    203220         * Set the GMap type controls. 
    204221         * by default renders G_NORMAL_MAP, G_SATELLITE_MAP, and G_HYBRID_MAP 
     
    259276                 
    260277                // Map controls 
    261                 $controls = empty($this->control) ? '' : 'map.addControl(new google.maps.'.$this->control.'MapControl());'; 
     278                $controls[] = empty($this->control) ? '' : 'map.addControl(new google.maps.'.$this->control.'MapControl());'; 
    262279 
    263280                // Map Types 
     
    267284                        { 
    268285                                foreach($this->types as $type => $action) 
    269                                         $controls .= 'map.'.$action.'MapType('.$type.');'; 
     286                                        $controls[] = 'map.'.$action.'MapType('.$type.');'; 
    270287                        } 
    271288                         
    272                         $controls .= 'map.addControl(new google.maps.MapTypeControl());'; 
    273                 } 
     289                        $controls[] = 'map.addControl(new google.maps.MapTypeControl());'; 
     290                } 
     291                 
     292                if ( ! empty($this->overview_control)) 
     293                        $controls[] = $this->overview_control; 
    274294 
    275295                // Map centering 
     
    281301                                'map' => $map, 
    282302                                'options' => $this->options, 
    283                                 'controls' => $controls, 
     303                                'controls' => implode("\n", $controls), 
    284304                                'center' => $center, 
    285305                                'markers' => $this->markers,