/** * Load trackpoint data from GPX */ public function algorithm($target, \SimpleXMLElement $data) { $target->setTime(new \DateTime((string) $data->time)); if (isset($data["lon"])) { $position = new \position(); $position->setValues($data, "GPX"); $target->setPosition($position); } if (isset($data->ele)) { $target->setAltitude((double) $data->ele); } }
/** * Load trackpoint data from TCX file. */ public function algorithm($target, \SimpleXMLElement $data) { $target->setTime(new \DateTime((string) $data->Time)); if (isset($data->Position)) { $position = new \position(); $position->setValues($data->Position, "TCX"); $target->setPosition($position); } if (isset($data->AltitudeMeters)) { $target->setAltitude((double) $data->AltitudeMeters); } if (isset($data->DistanceMeters)) { $target->setDistance((double) $data->DistanceMeters); } if (isset($data->HeartRateBpm)) { $target->setHeartRate((int) $data->HeartRateBpm->Value); } if (isset($data->Cadence)) { $target->setCadence((int) $data->Cadence); } if (isset($data->SensorState)) { $target->setSensorState((string) $data->SensorState); } }