/** * 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; }
/** * Correct elevation data * * This method does directly update the route object. * * @param string $strategyName * @return boolean false if correction did not work */ public function tryToCorrectElevation($strategyName = '') { if (!$this->Route->hasPositionData()) { return false; } if ($strategyName == 'none') { $this->removeElevationCorrection(); return true; } $coordinates = $this->Route->latitudesAndLongitudesFromGeohash(); $Corrector = new Corrector(); $Corrector->correctElevation($coordinates['lat'], $coordinates['lng'], $strategyName); $result = $Corrector->getCorrectedElevation(); if (!empty($result)) { $this->Route->set(Route\Entity::ELEVATIONS_CORRECTED, $result); $this->Route->set(Route\Entity::ELEVATIONS_SOURCE, $Corrector->getNameOfUsedStrategy()); return true; } return false; }