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


PHP Point::parse方法代碼示例

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


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

示例1: testIsValidParse

 /**
  * @covers MultiMaps\Point::isValid
  * @covers \MultiMaps\Point::parse
  */
 public function testIsValidParse()
 {
     $this->assertTrue($this->object->isValid());
     $this->object->parse("123456");
     $this->assertFalse($this->object->isValid());
     $this->object->parse("123,456");
     $this->assertTrue($this->object->isValid());
 }
開發者ID:MapsMD,項目名稱:mediawikiMaps,代碼行數:12,代碼來源:PointTest.php

示例2: parseCoordinates

 /**
  * Filling property 'coordinates'
  * @global string $egMultiMaps_CoordinatesSeparator
  * @param string $coordinates
  * @param string $service Name of map service
  * @return boolean
  */
 protected function parseCoordinates($coordinates, $service = null)
 {
     global $egMultiMaps_CoordinatesSeparator;
     $array = explode($egMultiMaps_CoordinatesSeparator, $coordinates);
     if ($service == 'leaflet' && count($array) == 1) {
         $value = $array[0];
         $coord = Geocoders::getCoordinates($value, $service, array('polygon' => true));
         if ($coord !== false && is_array($coord['polygon'])) {
             $this->coordinates = $coord['polygon'];
         } else {
             $this->errormessages[] = \wfMessage('multimaps-unable-parse-coordinates', $value)->escaped();
             return false;
         }
     } else {
         foreach ($array as $value) {
             $point = new Point();
             if ($point->parse($value, $service)) {
                 $this->coordinates[] = $point;
             } else {
                 $this->errormessages[] = \wfMessage('multimaps-unable-parse-coordinates', $value)->escaped();
                 return false;
             }
         }
     }
     return true;
 }
開發者ID:MapsMD,項目名稱:mediawikiMaps,代碼行數:33,代碼來源:Line.php

示例3: parse

function parse($line)
{
    list($c, $r, $p) = explode(";", $line);
    $center = Point::parse($c);
    $point = Point::parse($p);
    list($radius_name, $radius_value) = explode(":", $r);
    $radius = trim($radius_value);
    return array(new Circle($center, $radius), $point);
}
開發者ID:eandbsoftware,項目名稱:CodeEval-1,代碼行數:9,代碼來源:PointInCircle.php

示例4: parseCoordinates

 /**
  * Parse coordinates for rectangle
  *
  * @assert ('10,10:20,20') === true
  * @assert ('10,10:20,20:30,30') === false
  * @assert ('10,10:20,20:30') === false
  * @assert ('10,10:20') === false
  * @assert ('10,10:') === false
  * @assert ('10,10') === false
  * @assert ('10') === false
  *
  * @global type $egMultiMaps_CoordinatesSeparator
  * @param string $coordinates
  * @param string $service Name of map service
  * @return boolean
  */
 protected function parseCoordinates($coordinates, $service = null)
 {
     global $egMultiMaps_CoordinatesSeparator;
     $array = explode($egMultiMaps_CoordinatesSeparator, $coordinates);
     if (count($array) == 2) {
         $point1 = new Point();
         $point2 = new Point();
         if ($point1->parse($array[0], $service)) {
             if ($point2->parse($array[1], $service)) {
                 $this->coordinates[] = $point1;
                 $this->coordinates[] = $point2;
             } else {
                 $this->errormessages[] = \wfMessage('multimaps-unable-parse-coordinates', $array[1])->escaped();
                 return false;
             }
         } else {
             $this->errormessages[] = \wfMessage('multimaps-unable-parse-coordinates', $array[0])->escaped();
             return false;
         }
     } else {
         if (count($array) == 1) {
             $point = new Point();
             if ($point->parse($array[0], $service)) {
                 $bounds = $point->bounds;
                 if ($bounds) {
                     $this->coordinates[] = $bounds->ne;
                     $this->coordinates[] = $bounds->sw;
                 } else {
                     $this->errormessages[] = \wfMessage('multimaps-square-wrong-number-points', count($array))->escaped();
                     return false;
                 }
             } else {
                 $this->errormessages[] = \wfMessage('multimaps-unable-parse-coordinates', $array[0])->escaped();
                 return false;
             }
         } else {
             $this->errormessages[] = \wfMessage('multimaps-square-wrong-number-points', count($array))->escaped();
             return false;
         }
     }
     return true;
 }
開發者ID:MapsMD,項目名稱:mediawikiMaps,代碼行數:58,代碼來源:Rectangle.php

示例5: parseCoordinates

 /**
  * Filling property 'coordinates'
  * @global string $egMultiMaps_CoordinatesSeparator
  * @param string $coordinates
  * @param string $service Name of map service
  * @return boolean
  */
 protected function parseCoordinates($coordinates, $service = null)
 {
     global $egMultiMaps_CoordinatesSeparator;
     $array = explode($egMultiMaps_CoordinatesSeparator, $coordinates);
     if (count($array) == 2) {
         $point = new Point();
         if ($point->parse($array[0], $service)) {
             if (is_numeric($array[1])) {
                 $this->coordinates[] = $point;
                 $this->radiuses[] = (double) $array[1];
             } else {
                 $this->errormessages[] = \wfMessage('multimaps-unable-parse-radius', $array[1])->escaped();
                 return false;
             }
         } else {
             $this->errormessages[] = \wfMessage('multimaps-unable-parse-coordinates', $array[0])->escaped();
             return false;
         }
     } else {
         if (count($array) == 1) {
             $point = new Point();
             if ($point->parse($array[0], $service)) {
                 $bounds = $point->bounds;
                 if ($bounds) {
                     $this->coordinates[] = $bounds->center;
                     $this->radiuses[] = $bounds->diagonal / 2;
                 } else {
                     $this->errormessages[] = \wfMessage('multimaps-circle-radius-not-defined')->escaped();
                     return false;
                 }
             } else {
                 $this->errormessages[] = \wfMessage('multimaps-unable-parse-coordinates', $array[0])->escaped();
                 return false;
             }
         } else {
             $this->errormessages[] = \wfMessage('multimaps-circle-wrong-number-parameters', count($array))->escaped();
             return false;
         }
     }
     return true;
 }
開發者ID:MapsMD,項目名稱:mediawikiMaps,代碼行數:48,代碼來源:Circle.php

示例6: parseCoordinates

 /**
  * Filling property 'coordinates'
  * @global string $egMultiMaps_CoordinatesSeparator
  * @param string $coordinates
  * @param string $service Name of map service
  * @return boolean
  */
 protected function parseCoordinates($coordinates, $service = null)
 {
     global $egMultiMaps_CoordinatesSeparator;
     $array = explode($egMultiMaps_CoordinatesSeparator, $coordinates);
     foreach ($array as $value) {
         $point = new Point();
         if ($point->parse($value, $service)) {
             $this->coordinates[] = $point;
         } else {
             $this->errormessages[] = \wfMessage('multimaps-unable-parse-coordinates', $value)->escaped();
             return false;
         }
     }
     return true;
 }
開發者ID:MapsMD,項目名稱:mediawikiMaps,代碼行數:22,代碼來源:BaseMapElement.php


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