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


PHP Location::getLongitude方法代码示例

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


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

示例1: getDistanceInMetersTo

 public function getDistanceInMetersTo(Location $other)
 {
     $radiusOfEarth = 6371000;
     // Earth's radius in meters.
     $diffLatitude = $other->getLatitude() - $this->latitude;
     $diffLongitude = $other->getLongitude() - $this->longitude;
     $a = sin($diffLatitude / 2) * sin($diffLatitude / 2) + cos($this->latitude) * cos($other->getLatitude()) * sin($diffLongitude / 2) * sin($diffLongitude / 2);
     $c = 2 * asin(sqrt($a));
     $distance = $radiusOfEarth * $c;
     return $distance;
 }
开发者ID:RyanMolina,项目名称:MICRO,代码行数:11,代码来源:closestpoint.php

示例2: LocationQuery

$location->setCity($_POST["city"]);
$_POST["city"] = $location->getCity();
$location->setState($_POST["state"]);
$_POST["state"] = $location->getState();
$location->setStaffid($_POST["staffid"]);
$_POST["staffid"] = $location->getStaffid();
$location->setPincode($_POST["pincode"]);
$_POST["pincode"] = $location->getPincode();
$location->setDays($_POST["days"]);
$_POST["days"] = $location->getDays();
$location->setTime($_POST["time"]);
$_POST["time"] = $location->getTime();
$location->setLatitude($_POST["latitude"]);
$_POST["latitude"] = $location->getLatitude();
$location->setLongitude($_POST["longitude"]);
$_POST["longitude"] = $location->getLongitude();
$locQ = new LocationQuery();
$locQ->connect();
#**************************************************************************
#*  Insert new library member
#**************************************************************************
$locationid = $locQ->insert($location);
$locQ->close();
#**************************************************************************
#*  Destroy form values and errors
#**************************************************************************
unset($_SESSION["postVars"]);
unset($_SESSION["pageErrors"]);
$msg = $loc->getText("locNewSuccess");
header("Location: ../circ/loc_view.php?locationid=" . U($locationid) . "&reset=Y&msg=" . U($msg));
exit;
开发者ID:vishnu35,项目名称:opencitylibrary,代码行数:31,代码来源:loc_new.php

示例3: distance

 /**
  * Get the distance between the Location and a given Location.
  *
  * @param Location $otherLocation
  *
  * @return float
  */
 public function distance(Location $otherLocation)
 {
     $theta = $this->longitude - $otherLocation->getLongitude();
     $distance = sin(deg2rad($this->latitude)) * sin(deg2rad($otherLocation->getLatitude())) + cos(deg2rad($this->latitude)) * cos(deg2rad($otherLocation->getLatitude())) * cos(deg2rad($theta));
     $distance = acos($distance);
     $distance = rad2deg($distance);
     return (double) $distance * 60 * 1.1515;
 }
开发者ID:wazoomie,项目名称:support,代码行数:15,代码来源:Location.php

示例4:

}
$LocationCount = 0;
if (isset($_GET['Longitude'])) {
    $LocationCount++;
    $Location->setLongitude($_GET['Longitude']);
}
if (isset($_GET['Latitude'])) {
    $LocationCount++;
    $Location->setLatitude($_GET['Latitude']);
}
if (isset($_GET['GPS'])) {
    $LocationCount++;
    $Location->setGPS($_GET['GPS']);
}
$locationError = false;
if (!$Location->getGPS() && !$Location->getLatitude() && !$Location->getLongitude()) {
    $LocationError = true;
}
if (isset($_GET['Note'])) {
    $LocationCount++;
    $Location->setLocationNote($_GET['Note']);
    $LocationError = false;
}
if ($LocationError) {
    $php_errormsg = $php_errormsg . "Please enter either a note describing the location, GPS Coordinates or Langitude and Latitude.<br>";
}
if (isset($_GET['SoilType']) && $_GET['SoilType'] > 0) {
    $Soil->setSoilType($_GET['SoilType']);
    $Plant->setPlantSoilType($_GET['SoilType']);
} else {
    $php_errormsg = $php_errormsg . "Please select a Soil Type.<br>";
开发者ID:uwillmore,项目名称:phpsite,代码行数:31,代码来源:SaveFlower.php

示例5: processEncryptedNode

 protected function processEncryptedNode(ProtocolNode $node)
 {
     if ($this->parent->getAxolotlStore() == null) {
         return;
     }
     //is a chat encrypted message
     $from = $node->getAttribute('from');
     if (strpos($from, Constants::WHATSAPP_SERVER) !== false) {
         $author = ExtractNumber($node->getAttribute('from'));
         $version = $node->getChild(0)->getAttribute('v');
         $encType = $node->getChild(0)->getAttribute('type');
         $encMsg = $node->getChild('enc')->getData();
         if (!$this->parent->getAxolotlStore()->containsSession($author, 1)) {
             //we don't have the session to decrypt, save it in pending and process it later
             $this->parent->addPendingNode($node);
             $this->parent->logFile('info', 'Requesting cipher keys from {from}', ['from' => $author]);
             $this->parent->sendGetCipherKeysFromUser($author);
         } else {
             //decrypt the message with the session
             if ($node->getChild('enc')->getAttribute('count') == '') {
                 $this->parent->setRetryCounter($node->getAttribute('id'), 1);
             }
             if ($version == '2') {
                 if (!in_array($author, $this->parent->getv2Jids())) {
                     $this->parent->setv2Jids($author);
                 }
             }
             $plaintext = $this->decryptMessage($from, $encMsg, $encType, $node->getAttribute('id'), $node->getAttribute('t'));
             //$plaintext ="A";
             if ($plaintext === false) {
                 $this->parent->sendRetry($this->node, $from, $node->getAttribute('id'), $node->getAttribute('t'));
                 $this->parent->logFile('info', 'Couldn\'t decrypt message with {id} id from {from}. Retrying...', ['id' => $node->getAttribute('id'), 'from' => ExtractNumber($from)]);
                 return $node;
                 // could not decrypt
             }
             if (isset($this->parent->retryNodes[$node->getAttribute('id')])) {
                 unset($this->parent->retryNodes[$node->getAttribute('id')]);
             }
             if (isset($this->parent->retryCounters[$node->getAttribute('id')])) {
                 unset($this->parent->retryCounters[$node->getAttribute('id')]);
             }
             switch ($node->getAttribute('type')) {
                 case 'text':
                     $node->addChild(new ProtocolNode('body', null, null, $plaintext));
                     break;
                 case 'media':
                     switch ($node->getChild('enc')->getAttribute('mediatype')) {
                         case 'image':
                             $image = new ImageMessage();
                             $image->parseFromString($plaintext);
                             $keys = (new HKDFv3())->deriveSecrets($image->getRefKey(), hex2bin('576861747341707020496d616765204b657973'), 112);
                             $iv = substr($keys, 0, 16);
                             $keys = substr($keys, 16);
                             $parts = str_split($keys, 32);
                             $key = $parts[0];
                             $macKey = $parts[1];
                             $refKey = $parts[2];
                             //should be changed to nice curl, no extra headers :D
                             $file_enc = file_get_contents($image->getUrl());
                             //requires mac check , last 10 chars
                             $mac = substr($file_enc, -10);
                             $cipherImage = substr($file_enc, 0, strlen($file_enc) - 10);
                             $decrypted_image = pkcs5_unpad(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $cipherImage, MCRYPT_MODE_CBC, $iv));
                             //$save_file = tempnam(sys_get_temp_dir(),"WAIMG_");
                             //file_put_contents($save_file,$decrypted_image);
                             $child = new ProtocolNode('media', ['size' => $image->getLength(), 'caption' => $image->getCaption(), 'url' => $image->getUrl(), 'mimetype' => $image->getMimeType(), 'filehash' => bin2hex($image->getSha256()), 'width' => 0, 'height' => 0, 'file' => $decrypted_image ?: $file_enc, 'type' => 'image'], null, $image->getThumbnail());
                             $node->addChild($child);
                             break;
                         case 'location':
                             $location = new Location();
                             $data = $node->getChild('enc')->getData();
                             $location->parseFromString($plaintext);
                             $child = new ProtocolNode('media', ['type' => 'location', 'encoding' => 'raw', 'latitude' => $location->getLatitude(), 'longitude' => $location->getLongitude(), 'name' => $location->getName(), 'url' => $location->getUrl()], null, $location->getThumbnail());
                             $node->addChild($child);
                             break;
                     }
                     break;
             }
             $this->parent->logFile('info', 'Decrypted message with {id} from {from}', ['id' => $node->getAttribute('id'), 'from' => ExtractNumber($from)]);
             return $node;
         }
     } else {
         $author = ExtractNumber($node->getAttribute('participant'));
         $group_number = ExtractNumber($node->getAttribute('from'));
         $childs = $node->getChildren();
         foreach ($childs as $child) {
             if ($child->getAttribute('type') == 'pkmsg' || $child->getAttribute('type') == 'msg') {
                 if (!$this->parent->getAxolotlStore()->containsSession($author, 1)) {
                     $this->parent->addPendingNode($node);
                     $this->parent->sendGetCipherKeysFromUser($author);
                     break;
                 } else {
                     //decrypt senderKey and save it
                     $encType = $child->getAttribute('type');
                     $encMsg = $child->getData();
                     $from = $node->getAttribute('participant');
                     $version = $child->getAttribute('v');
                     if ($node->getChild('enc')->getAttribute('count') == '') {
                         $this->parent->setRetryCounter($node->getAttribute('id'), 1);
                     }
//.........这里部分代码省略.........
开发者ID:rflsouza,项目名称:Chat-API,代码行数:101,代码来源:MessageHandler.php

示例6: update

 public function update(Location $loc)
 {
     $query = "UPDATE `location` SET `location_name`='" . $loc->getLocationName() . "',`location_city`='" . $loc->getLocationCity() . "',`longitude`='" . $loc->getLongitude() . "',`latitude`='" . $loc->getLatitude() . "',`altitude`='" . $loc->getAltitude() . "' WHERE `idlocation`='" . $loc->getLocationId() . "'";
     $this->con->openConnection();
     $this->con->executeRawQuery($query);
     $this->con->closeConnection();
 }
开发者ID:roshanmadhushanka,项目名称:Environment-Monitoring-System,代码行数:7,代码来源:LocationController.php

示例7:

      </div>

      <div class="form-group">
        <label for="plant-notes">Plant Notes:</label>
        <input class="form-control" id="plant-notes" type="text" name="PlantNotes" value="<?php 
echo $Plant->getPlantNote();
?>
">
      </div>

      <h3 class="text-center">Plant Location:</h3>

      <div class="form-group">
        <label for="longitude">Longitude:</label>
        <input class="form-control" id="longitude" type="text" name="Longitude" value="<?php 
echo $Location->getLongitude();
?>
">
      </div>

      <div class="form-group">
        <label for="latitude">Latitude:</label>
        <input class="form-control" id="latitude" type="text" name="Latitude" value="<?php 
echo $Location->getLatitude();
?>
">
      </div>

      <div class="form-group">
        <label for="gps">GPS:</label>
        <input class="form-control" id="gps" type="text" name="GPS" value="<?php 
开发者ID:uwillmore,项目名称:phpsite,代码行数:31,代码来源:flower_add.php


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