Example #1
0
 /**
  *
  * Добавляет нас. пункт на карту
  *
  * @param Locality $vertex
  * @return $this
  * @throws \Exception
  */
 public function add(VertexInterface $vertex)
 {
     if (array_key_exists($vertex->getId(), $this->getVertices())) {
         throw new \Exception('Невозможно добавить на карту нас. пункт, который уже был ранее добавлен');
     }
     $this->localities[$vertex->getId()] = $vertex;
     return $this;
 }
Example #2
0
 /**
  * Соединяем транспортный узел с указанием стоимости проезда(растояния)
  * A $distance, to balance the connection, can be specified.
  *
  * @param VertexInterface $vertex
  * @param integer $distance
  */
 public function connect(VertexInterface $vertex, $distance = 1)
 {
     $this->connections[$vertex->getId()] = $distance;
 }