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


PHP Address::getLatitude方法代码示例

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


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

示例1: addAddress

 public function addAddress(Address $address)
 {
     try {
         if ($address != null) {
             $latLong = [];
             if ($address->getLatitude() == null && $address->getLongitude() == null || $address->getLatitude() == 0.0 && $address->getLongitude() == 0.0) {
                 $latLong = $this->googleMapService->getLatLong($address);
                 if (sizeof($latLong) == 2) {
                     $address->setLatitude($latLong[0]);
                     $address->setLongitude($latLong[1]);
                 }
             }
             if (!parent::getBdd()->inTransaction()) {
                 parent::getBdd()->beginTransaction();
             }
             $query = "INSERT INTO ADDRESS VALUES (NULL,:line1, :line2, :zipcode, :city, :lat, :long)";
             $request = parent::getBdd()->prepare($query);
             $request->bindParam(':line1', $address->getLine1());
             $request->bindParam(':line2', $address->getLine2());
             $request->bindParam(':zipcode', $address->getZipCode());
             $request->bindParam(':city', $address->getCity());
             $request->bindParam(':lat', $address->getLatitude());
             $request->bindParam(':long', $address->getLongitude());
             $request->execute();
             $id = parent::getBdd()->lastInsertId();
             $request->closeCursor();
             parent::getBdd()->commit();
             return $id;
         }
     } catch (Exception $e) {
         error_log($e->getMessage());
     }
     return -1;
 }
开发者ID:alex148,项目名称:SmartMastore,代码行数:34,代码来源:AddressService.php

示例2: testAddressLatitudeAndLongitude

 public function testAddressLatitudeAndLongitude()
 {
     $address = new Address();
     $address->latitude = 123.145638;
     $this->assertEquals('123.145638', $address->getLatitude());
     $address->longitude = 121.176129;
     $this->assertEquals('121.176129', $address->getLongitude());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:8,代码来源:AddressTest.php

示例3: testGetLatitude

 /**
  * Tests Address->getLatitude()
  */
 public function testGetLatitude()
 {
     $this->assertEquals('LATITUDE', $this->Address->getLatitude());
 }
开发者ID:ahmedadham88,项目名称:enhanced-social-network,代码行数:7,代码来源:AddressTest.php

示例4: distanceToAddress

 /**
  * @param Address $addressB
  * @return float the distance in km
  */
 public function distanceToAddress(Address $addressB)
 {
     $longitudeA = $this->getLongitude();
     $latitudeA = $this->getLatitude();
     $longitudeB = $addressB->getLongitude();
     $latitudeB = $addressB->getLatitude();
     return $this->calculateDistanceInKm($longitudeA, $latitudeA, $longitudeB, $latitudeB);
 }
开发者ID:niborb,项目名称:postcode-api-nu,代码行数:12,代码来源:Address.php

示例5: testSetLatitude

 /**
  * Tests Address->setLatitude()
  */
 public function testSetLatitude()
 {
     $this->Address->setLatitude('latitude');
     $this->assertEquals('latitude', $this->Address->getLatitude());
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:8,代码来源:AddressTest.php


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