/**
  * @param string $hrmFile
  * @param string $gpxFile
  * @return \ImporterHRMandGPX
  */
 protected function loadFiles($hrmFile, $gpxFile)
 {
     $HRMimporter = new ImporterFiletypeHRM();
     $HRMimporter->parseFile($hrmFile);
     $GPXimporter = new ImporterFiletypeGPX();
     $GPXimporter->parseFile($gpxFile);
     return new ImporterHRMandGPX($HRMimporter, $GPXimporter);
 }
Ejemplo n.º 2
0
 /**
  * Test: standard route
  * Filename: "Route-only.gpx" 
  */
 public function testStandardGPXroute()
 {
     $this->object->parseFile('../tests/testfiles/gpx/Route-only.gpx');
     $this->assertFalse($this->object->hasMultipleTrainings());
     $this->assertFalse($this->object->failed());
     $this->assertEquals(0.4, $this->object->object()->getDistance(), '', 0.05);
     $this->assertTrue($this->object->object()->hasArrayAltitude());
     $this->assertTrue($this->object->object()->hasArrayDistance());
     $this->assertTrue($this->object->object()->hasArrayLatitude());
     $this->assertTrue($this->object->object()->hasArrayLongitude());
 }
Ejemplo n.º 3
0
 /**
  * Fill splits from gpx
  */
 protected function fillSplitsFromGPX()
 {
     if ($this->GPXImporter->object()->hasArrayTime() && $this->GPXImporter->object()->hasArrayDistance()) {
         $this->TrainingObject->Splits()->fillDistancesFromArray($this->GPXImporter->object()->getArrayTime(), $this->GPXImporter->object()->getArrayDistance());
     }
 }
Ejemplo n.º 4
0
 /**
  * Import hrm and gpx
  * @param string $filename relative path
  */
 private function importHRMandGPX($filename)
 {
     $HRMImporter = new ImporterFiletypeHRM();
     $HRMImporter->parseFile($filename . '.hrm');
     $GPXImporter = new ImporterFiletypeGPX();
     $GPXImporter->parseFile($filename . '.gpx');
     $Importer = new ImporterHRMandGPX($HRMImporter, $GPXImporter);
     $this->TrainingObjects[] = $Importer->object();
     $this->addErrors($HRMImporter->getErrors());
     $this->addErrors($GPXImporter->getErrors());
     unlink(FRONTEND_PATH . $filename . '.hrm');
     unlink(FRONTEND_PATH . $filename . '.gpx');
 }