當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ParseQuery::withinGeoBox方法代碼示例

本文整理匯總了PHP中Parse\ParseQuery::withinGeoBox方法的典型用法代碼示例。如果您正苦於以下問題:PHP ParseQuery::withinGeoBox方法的具體用法?PHP ParseQuery::withinGeoBox怎麽用?PHP ParseQuery::withinGeoBox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Parse\ParseQuery的用法示例。


在下文中一共展示了ParseQuery::withinGeoBox方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: withinBox

 /**
  * @param $column
  * @param $swLatitude
  * @param $swLongitude
  * @param $neLatitude
  * @param $neLongitude
  * @param array $keyToInclude
  *
  * @return Collection|ParseObject[]
  */
 public function withinBox($column, $swLatitude, $swLongitude, $neLatitude, $neLongitude, $keyToInclude = [])
 {
     $southWest = new ParseGeoPoint((double) $swLatitude, (double) $swLongitude);
     $northEast = new ParseGeoPoint((double) $neLatitude, (double) $neLongitude);
     $this->query->withinGeoBox($column, $southWest, $northEast);
     for ($i = 0; $i < count($keyToInclude); $i++) {
         $this->query->includeKey($keyToInclude[$i]);
     }
     return Collection::make($this->query->find($this->useMasterKey));
 }
開發者ID:khangaikh,項目名稱:golocal,代碼行數:20,代碼來源:AbstractParseRepository.php

示例2: testGeoBoxTooLarge

 public function testGeoBoxTooLarge()
 {
     $centerPoint = new ParseGeoPoint(0, 0);
     $center = ParseObject::create('TestObject');
     $center->set('location', $centerPoint);
     $center->save();
     $southwest = new ParseGeoPoint(-89, -179);
     $northeast = new ParseGeoPoint(89, 179);
     // This is an interesting test case because mongo can actually handle this
     // kind of query, but
     // if one actually happens, it's probably that the developer switches the
     // two points.
     $query = new ParseQuery('TestObject');
     $query->withinGeoBox('location', $southwest, $northeast);
     try {
         $query->find();
         $this->assertTrue(false, 'Query should fail for being too large.');
     } catch (ParseException $e) {
     }
 }
開發者ID:rvdavid,項目名稱:parse-php-sdk,代碼行數:20,代碼來源:ParseGeoBoxTest.php


注:本文中的Parse\ParseQuery::withinGeoBox方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。