• Модуль: fileman
  • Путь к файлу: ~/bitrix/modules/fileman/lib/userfield/geo.php
  • Класс: BitrixFilemanUserFieldGeo
  • Вызов: Geo::getCenter
static function getCenter($arUserField, $pointList)
{
	$center = array(0, 0);
	$pointCount = 0;

	if(count($pointList) > 0)
	{
		foreach($pointList as $point)
		{
			if(is_array($point))
			{
				$center[0] += $point[0];
				$center[1] += $point[1];

				$pointCount++;
			}
		}
	}

	if($pointCount <= 0)
	{
		$center = array($arUserField['SETTINGS']['INIT_MAP_LAT'], $arUserField['SETTINGS']['INIT_MAP_LON']);
	}
	else
	{
		$center[0] = $center[0] / $pointCount;
		$center[1] = $center[1] / $pointCount;
	}

	return $center;
}