当前位置: 首页>>代码示例>>PHP>>正文


PHP Place::setLongitude方法代码示例

本文整理汇总了PHP中Place::setLongitude方法的典型用法代码示例。如果您正苦于以下问题:PHP Place::setLongitude方法的具体用法?PHP Place::setLongitude怎么用?PHP Place::setLongitude使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Place的用法示例。


在下文中一共展示了Place::setLongitude方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Place

 function test_setLongitude()
 {
     //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->setLongitude($longitude);
     $result = $test_place->getLongitude();
     //Assert
     $this->assertEquals("-122.681211", $result);
 }
开发者ID:juliocesardiaz,项目名称:Face2Face,代码行数:15,代码来源:PlaceTest.php

示例2: AplMap

             $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);
                 }
             }
         }
     }
 }
开发者ID:cleitonferreira,项目名称:WorkAndroid,代码行数:31,代码来源:CtrlMap.php

示例3: 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;
    }
开发者ID:cleitonferreira,项目名称:WorkAndroid,代码行数:51,代码来源:DaoMap.php


注:本文中的Place::setLongitude方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。