Example #1
0
 /**
  * Correct elevation data
  * 
  * This method does directly update the route object.
  * 
  * @return boolean false if correction did not work
  */
 public function tryToCorrectElevation()
 {
     if (!$this->Route->hasPositionData()) {
         return false;
     }
     $Corrector = new Corrector();
     $Corrector->correctElevation($this->Route->latitudes(), $this->Route->longitudes());
     $result = $Corrector->getCorrectedElevation();
     if (!empty($result)) {
         $this->Route->set(Route\Object::ELEVATIONS_CORRECTED, $result);
         $this->Route->set(Route\Object::ELEVATIONS_SOURCE, $Corrector->getNameOfUsedStrategy());
         return true;
     }
     return false;
 }
Example #2
0
 public function testSimpleUpdate()
 {
     $Inserter = new Inserter($this->PDO);
     $Inserter->setAccountID(0);
     $Inserter->insert(new Object(array(Object::NAME => 'Route name', Object::DISTANCE => 3.14)));
     $Route = new Object($this->PDO->query('SELECT * FROM `' . PREFIX . 'route` WHERE `id`=' . $Inserter->insertedID())->fetch(PDO::FETCH_ASSOC));
     $Route->set(Object::DISTANCE, 0);
     $Changed = clone $Route;
     $Changed->set(Object::NAME, 'New route name');
     $Updater = new Updater($this->PDO, $Changed, $Route);
     $Updater->setAccountID(0);
     $Updater->update();
     $Result = new Object($this->PDO->query('SELECT * FROM `' . PREFIX . 'route` WHERE `id`=' . $Inserter->insertedID())->fetch(PDO::FETCH_ASSOC));
     $this->assertEquals('New route name', $Result->name());
     $this->assertEquals(3.14, $Result->distance());
 }
Example #3
0
 /**
  * Remove gps path from route
  */
 public function removeGPSpathFromRoute()
 {
     $this->Route->set(Model\Route\Object::LATITUDES, array());
     $this->Route->set(Model\Route\Object::LONGITUDES, array());
 }