本文整理汇总了PHP中Place::setLatitude方法的典型用法代码示例。如果您正苦于以下问题:PHP Place::setLatitude方法的具体用法?PHP Place::setLatitude怎么用?PHP Place::setLatitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::setLatitude方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPlacesClosest
public function getPlacesClosest($place)
{
$data = array();
$data[] = $this->conn->cleanData($place->getLatitude());
$data[] = $this->conn->cleanData($place->getLongitude());
$data[] = $this->conn->cleanData($place->getDistance());
$query = <<<SQL
\t\t\t\t\tSELECT
\t\t\t\t\t\tid,
\t\t\t\t\t\tname,
\t\t\t\t\t\tcategory,
\t\t\t\t\t\tdescription,
\t\t\t\t\t\tlatitude,
\t\t\t\t\t\tlongitude
\t\t\t\t\t\tFROM
\t\t\t\t\t\t\tlaa_place
\t\t\t\t\t\tWHERE
\t\t\t\t\t\t\tstatus = 1
\t\t\t\t\t\t\tAND
\t\t\t\t\t\t\t6371 * ACOS(
\t\t\t\t\t\t\t\t\t\tCOS( RADIANS( {$data['0']} ) )
\t\t\t\t\t\t\t\t\t\t*
\t\t\t\t\t\t\t\t\t\tCOS( RADIANS(latitude) )
\t\t\t\t\t\t\t\t\t\t*
\t\t\t\t\t\t\t\t\t\tCOS(
\t\t\t\t\t\t\t\t\t\t\tRADIANS( {$data['1']} )
\t\t\t\t\t\t\t\t\t\t\t-
\t\t\t\t\t\t\t\t\t\t\tRADIANS(longitude)
\t\t\t\t\t\t\t\t\t\t)
\t\t\t\t\t\t\t\t\t\t+
\t\t\t\t\t\t\t\t\t\tSIN( RADIANS( {$data['0']} ) )
\t\t\t\t\t\t\t\t\t\t*
\t\t\t\t\t\t\t\t\t\tSIN( RADIANS(latitude) )
\t\t\t\t\t\t\t\t\t) <= {$data['2']}
SQL;
//exit($query);
$query = $this->conn->removeBreakLine($query);
$result = $this->conn->getConn()->query($query);
$arrayPlaces = array();
while ($data = $result->fetch_object()) {
$place = new Place($data->id);
$place->setName($data->name);
$place->setCategory(new Category($data->category));
$place->setDescription($data->description);
$place->setLatitude($data->latitude);
$place->setLongitude($data->longitude);
$arrayPlaces[] = $place;
}
$result->free();
return $arrayPlaces;
}
示例2: Place
$place = new Place($_POST['id-place']);
$place->post($_POST);
$return = $apl->updatePlace($place);
echo json_encode(array('feedback' => $return));
} else {
if (preg_match('/^(get-place-data){1}$/', $_POST['method'])) {
$apl = new AplMap();
$place = new Place($_POST['id-place']);
$place->post($_POST);
$place = $apl->getPlace($place);
echo json_encode(array('place' => $place->getDataJSON()));
} else {
if (preg_match('/^(get-places-closest){1}$/', $_POST['method'])) {
$apl = new AplMap();
$place = new Place();
$place->setLatitude($_POST['latitude']);
$place->setLongitude($_POST['longitude']);
$place->setDistance($_POST['distance']);
$arrayPlaces = $apl->getPlacesClosest($place);
// SEND TO CLIENT
$tam = count($arrayPlaces);
$arrayJson = array();
for ($i = 0; $i < $tam; $i++) {
$arrayJson[] = $arrayPlaces[$i]->getDataJSON();
}
$arrayJson = array('places' => $arrayJson);
echo json_encode($arrayJson);
}
}
}
}
示例3: Place
function test_setLatitude()
{
//Arrange
$place_name = "Director Park";
$address = "SW Park Ave";
$latitude = 45.518672;
$longitude = -122.681211;
$id = 1;
$test_place = new Place($place_name, $address, $latitude, $longitude, $id);
//Act
$test_place->setLatitude($latitude);
$result = $test_place->getLatitude();
//Assert
$this->assertEquals("45.518672", $result);
}