当前位置: 首页>>代码示例>>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;未经允许,请勿转载。