Example #1
0
TiXmlElement * TcxActivity::getTiXml(bool readTrackData) {
    TiXmlElement * xmlActivity = new TiXmlElement("Activity");

    switch (this->sportType) {
        case TrainingCenterDatabase::Running:
            xmlActivity->SetAttribute("Sport","Running");
            break;
        case TrainingCenterDatabase::Biking:
            xmlActivity->SetAttribute("Sport","Biking");
            break;
        default:
            xmlActivity->SetAttribute("Sport","Other");
            break;
    }

    TiXmlElement * xmlId = new TiXmlElement("Id");
    xmlActivity->LinkEndChild(xmlId);
    xmlId->LinkEndChild(new TiXmlText(this->id));

    vector<TcxLap*>::iterator it;
    TcxLap* previousLap=NULL;
    for ( it=lapList.begin() ; it < lapList.end(); ++it )
    {
        TcxLap* lap = *it;
        lap->correctMissingStartTime(previousLap);
        xmlActivity->LinkEndChild( lap->getTiXml(readTrackData) );
        previousLap = lap;
    }

    if (this->creator != NULL) {
        xmlActivity->LinkEndChild(this->creator->getTiXml());
    }
    return xmlActivity;
}
Example #2
0
TiXmlElement * TcxActivity::getGpxTiXml() {
    TiXmlElement* trk = new TiXmlElement("trk");

    TiXmlElement * gpxname = new TiXmlElement("name");
    trk->LinkEndChild(gpxname);
    gpxname->LinkEndChild(new TiXmlText(this->id));

    vector<TcxLap*>::iterator it;
    TcxLap* previousLap=NULL;
    for ( it=lapList.begin() ; it < lapList.end(); ++it )
    {
        TcxLap* lap = *it;
        lap->correctMissingStartTime(previousLap);
        trk->LinkEndChild( lap->getGpxTiXml() );
        previousLap=lap;
    }
    return trk;
}