/** * * @param EGMapMarker[] $markers array of MArkers * @return EGMapCoord * @author fabriceb * @since 2009-05-02 * @since 2011-01-25 modified by Antonio Ramirez * */ public static function getCenterCoord($markers) { $bounds = EGMapBounds::getBoundsContainingMarkers($markers); return $bounds->getCenterCoord(); }
/** * * calculates the zoom which fits the markers on the map * * @param integer $margin a scaling factor around the smallest bound * @return integer $zoom * @author fabriceb * @since 2009-05-02 * @since 2010-12-22 modified for Yii Antonio Ramirez */ public function getMarkersFittingZoom($margin = 0, $default_zoom = 14) { if (null === $this->resources->itemAt('markers')) { throw new CException(Yii::t('EGMap', 'At least one more marker is necessary for getMarkersFittingZoom to work')); } //todo check for markers existence $bounds = EGMapBounds::getBoundsContainingMarkers($this->resources->itemAt('markers'), $margin); return $bounds->getZoom(min($this->getWidth(), $this->getHeight()), $default_zoom); }