本文整理汇总了PHP中Point::isValid方法的典型用法代码示例。如果您正苦于以下问题:PHP Point::isValid方法的具体用法?PHP Point::isValid怎么用?PHP Point::isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Point
的用法示例。
在下文中一共展示了Point::isValid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getCoordinatesUseMapquestNominatim
public static function getCoordinatesUseMapquestNominatim($address, $params)
{
$return = false;
$param_polygon = isset($params['polygon']) && $params['polygon'] === true ? true : false;
$urlArgs = array('format' => 'json', 'addressdetails' => '0', 'limit' => 1, 'q' => $address);
if ($param_polygon) {
$urlArgs['polygon'] = '1';
}
$response = self::performRequest('http://open.mapquestapi.com/nominatim/v1/search.php?', $urlArgs);
if ($response !== false) {
$data = \FormatJson::decode($response);
if (isset($data[0])) {
$data = $data[0];
$lat = $data->lat;
$lon = $data->lon;
if (!is_null($lat) && !is_null($lon)) {
$return = array('lat' => $lat, 'lon' => $lon);
$bounds = $data->boundingbox;
if (!is_null($bounds)) {
$bounds_ne = new Point($bounds[1], $bounds[3]);
$bounds_sw = new Point($bounds[0], $bounds[2]);
if ($bounds_ne->isValid() && $bounds_sw->isValid()) {
$b = new Bounds(array($bounds_ne, $bounds_sw));
$return['bounds'] = $b;
}
}
if ($param_polygon) {
$polygonpoints = $data->polygonpoints;
if (count($polygonpoints) > 1) {
$points = array();
foreach ($polygonpoints as $value) {
$p = new Point($value[1], $value[0]);
if ($p->isValid()) {
$points[] = $p;
}
}
if (count($points) > 1) {
$return['polygon'] = $points;
}
}
}
}
}
}
return $return;
}