You are here

function getlocations_do_minmaxes in Get Locations 7

Same name and namespace in other branches
  1. 6.2 getlocations.module \getlocations_do_minmaxes()
  2. 6 getlocations.module \getlocations_do_minmaxes()
  3. 7.2 getlocations.module \getlocations_do_minmaxes()

Parameters

int $ct $location $minmaxes:

Return value

Returns $minmaxes

18 calls to getlocations_do_minmaxes()
getlocations_commentmap in ./getlocations.module
Page callback: Displays a map.
getlocations_leaflet_entity_type_map in modules/getlocations_leaflet/getlocations_leaflet.module
Function
getlocations_leaflet_field_formatter_view in modules/getlocations_leaflet/getlocations_leaflet.module
Implements hook_field_formatter_view(). Build a renderable array for a field value.
getlocations_lids in ./getlocations.module
Page callback: Displays a map.
getlocations_mapquest_entity_type_map in modules/getlocations_mapquest/getlocations_mapquest.module
Function

... See full list

File

./getlocations.module, line 2308
getlocations.module @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

function getlocations_do_minmaxes($ct, $location, $minmaxes) {
  if ($minmaxes == '') {
    $minmaxes = array(
      'minlat' => 0,
      'minlon' => 0,
      'maxlat' => 0,
      'maxlon' => 0,
    );
  }
  if ($ct) {

    // latitudes
    if ($location['latitude'] > $minmaxes['maxlat']) {
      $minmaxes['maxlat'] = $location['latitude'];
    }
    if ($location['latitude'] < $minmaxes['minlat']) {
      $minmaxes['minlat'] = $location['latitude'];
    }

    // longitudes
    if ($location['longitude'] > $minmaxes['maxlon']) {
      $minmaxes['maxlon'] = $location['longitude'];
    }
    if ($location['longitude'] < $minmaxes['minlon']) {
      $minmaxes['minlon'] = $location['longitude'];
    }
  }
  else {
    $minmaxes['minlat'] = $location['latitude'];
    $minmaxes['minlon'] = $location['longitude'];
    $minmaxes['maxlat'] = $location['latitude'];
    $minmaxes['maxlon'] = $location['longitude'];
  }
  return $minmaxes;
}