function test_MAX_geoIsPlaceInRegion() { $this->assertTrue(MAX_geoIsPlaceInRegion('10.0000', '10.0000', $this->newRegion('5.0000', '15.0000', '5.0000', '15.0000'))); $this->assertTrue(MAX_geoIsPlaceInRegion('-10.0000', '6.0000', $this->newRegion('-11.0000', '6.0000', '6.0000', '12.0000'))); $this->assertFalse(MAX_geoIsPlaceInRegion('-10.0000', '6.0000', $this->newRegion('-9.0000', '6.0000', '6.0000', '12.0000'))); $this->assertFalse(MAX_geoIsPlaceInRegion('-10.0000', '6.0000', $this->newRegion('-11.0000', '6.0000', '6.0001', '12.0000'))); }
function MAX_geoIsRegionContainedInRegion($region1, $region2) { $lattitudeSouth1 = $region1[0]; $lattitudeNorth1 = $region1[1]; $longitudeEast1 = $region1[2]; $longitudeWest1 = $region1[3]; return MAX_geoIsPlaceInRegion($lattitudeSouth1, $longitudeWest1, $region2) && MAX_geoIsPlaceInRegion($lattitudeSouth1, $longitudeEast1, $region2) && MAX_geoIsPlaceInRegion($lattitudeNorth1, $longitudeWest1, $region2) && MAX_geoIsPlaceInRegion($lattitudeNorth1, $longitudeEast1, $region2); }
/** * Check to see if this impression contains the valid latitude/longitude. * * @param string $limitation The latitude/longitude limitation * @param string $op The operator (either '==' or '!=') * @param array $aParams An array of additional parameters to be checked * @return boolean Whether this impression's latitude/longitude passes this limitation's test. */ function MAX_checkGeo_Latlong($limitation, $op, $aParams = array()) { if (empty($aParams)) { $aParams = $GLOBALS['_MAX']['CLIENT_GEO']; } if ($aParams && isset($aParams['latitude']) && isset($aParams['longitude'])) { $aRegion = MAX_geoReplaceEmptyWithZero(MAX_limitationsGetAFromS($limitation)); $result = MAX_geoIsPlaceInRegion($aParams['latitude'], $aParams['longitude'], $aRegion); if ($op == '==') { return $result; } else { return !$result; } } else { return $op != '=='; } }