You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

41 lines
808 B

<?php
namespace OSM\Element\Member;
use OSM\Point;
class Way extends Member
{
public array $points = [];
public function completeFromArray(array $array): static
{
$hasGeometry = isset($array['geometry']);
if ($hasGeometry) {
$items = $array['geometry'];
foreach ($items as $item) {
$point = Point::createFromArray($item);
$this->points[] = $point;
}
}
return $this;
}
public function getFirstPoint(): Point
{
return reset($this->points);
}
public function getLastPoint(): Point
{
return end($this->points);
}
public function reversePoints(): static
{
$this->points = array_reverse($this->points);
return $this;
}
}