本文整理汇总了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());
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}