// initalizes all the data for CDInterface based on a file name from // CDOpen inline void CDInterface::open(const std::string& str) { // use the FIFactory to make the FileInterface std::string extension; image = FileInterfaceFactory(str, extension); std::string fileroot = str; fileroot.erase(fileroot.rfind(extension)); TrackParser* tp = TrackParserFactory(fileroot); tp->parse(); tp->postProcess(image->getCDLength()); trackList = tp->getTrackList(); delete tp; // if there is more than one track, initalize the CDDA data if (trackList.size() > 2) { cdda = new PlayCDDAData(trackList, tp->hasPregap()); cdda->openFile(str); } else { cdda = new NoCDDAData(); } // build the subchannel data scd = SubchannelDataFactory(fileroot); if (tp->hasPregap()) { image->setPregap(true, trackList[2].trackStart); } }
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); TrackParser parser; Track t=parser.parse("/home/anisart/GPS/doc.kml"); // qDebug()<<t.deletePoint(1); CPoint c; c.setData(); qDebug()<<t.insertPoint(2,c); qDebug()<<t.getListIds(); QList<CPoint> points; int i = 0; while(i<t.getListIds().count()) { points.append(t.getPoint(t.getListIds().at(i))); i++; } bool hasEle=t.hasEle; bool hasTime=t.hasTime; qDebug()<<hasEle<<hasTime; qDebug()<<t.title; if (hasEle && hasTime) foreach (CPoint point, points) qDebug()<<"lat = "<<point.getLat()<<", lon = "<<point.getLon()<<", ele = "<<point.getEle()<<" "<<point.getTime().toString(Qt::DefaultLocaleLongDate); else if (hasEle) foreach (CPoint point, points) qDebug()<<"lat = "<<point.getLat()<<", lon = "<<point.getLon()<<", ele = "<<point.getEle(); else foreach (CPoint point, points) qDebug()<<"lat = "<<point.getLat()<<", lon = "<<point.getLon(); return a.exec(); }