/** * Calculates the center of an array of coordiantes * * @param EGMapCoord[] $coords * @return EGMapCoord * @author fabriceb * @since 2009-05-02 */ public static function getCenterCoord($coords) { $bounds = EGMapBounds::getBoundsContainingCoords($coords); return $bounds->getCenterCoord(); }
/** * * @param GMapPolygon[] $polygons array of Polygons * @param float $margin margin factor for the bounds * @return EGMapBounds * @author Matt Kay * @since 2011-03-10 * Added this function based on getBoundsContainingMarkers * * */ public static function getBoundsContainingPolygons($polygons, $margin = 0) { $coords = array(); foreach ($polygons as $polygon) { // merge LatLng arrays array_merge($coords, $polygon->getCoords()); } return EGMapBounds::getBoundsContainingCoords($polygon->getCoords(), $margin); }
/** * * @param GMapMarker[] $markers array of Markers * @param float $margin margin factor for the bounds * @return EGMapBounds * @author fabriceb * @since 2009-05-02 * @since 2011-01-25 modified by Antonio Ramirez * **/ public static function getBoundsContainingMarkers($markers, $margin = 0) { $coords = array(); foreach ($markers as $marker) { array_push($coords, $marker->position); } return EGMapBounds::getBoundsContainingCoords($coords, $margin); }