Пример #1
0
 /**
  * Sets bounds after initialization of the [[LatLng]] objects that compound the polyline.
  */
 protected function setBounds()
 {
     foreach ($this->getLatLngs() as $latLng) {
         if (empty($this->_bounds)) {
             $this->_bounds = new LatLngBounds(['southWest' => $latLng, 'northEast' => $latLng]);
         } else {
             $this->_bounds->getSouthWest()->lat = min($latLng->lat, $this->_bounds->getSouthWest()->lat);
             $this->_bounds->getSouthWest()->lng = min($latLng->lng, $this->_bounds->getSouthWest()->lng);
             $this->_bounds->getNorthEast()->lat = min($latLng->lat, $this->_bounds->getNorthEast()->lat);
             $this->_bounds->getNorthEast()->lng = min($latLng->lng, $this->_bounds->getNorthEast()->lng);
         }
     }
 }
Пример #2
0
 /**
  * Sets bounds after initialization of the [[LatLng]] objects that compound the polyline.
  */
 protected function setBounds()
 {
     $this->_bounds = LatLngBounds::getBoundsOfLatLngs($this->getLatLngs());
 }