Brief description of class still missing. More...
#include <CoordinateFile.h>
Public Member Functions | |
bool | contains (const QString &name) const |
CoordinateFile (QWidget *parent=0) | |
const QList< NamedPoint > & | points () const |
bool | read (QString fileName=QString::null, const QString &format=QString::null) |
~CoordinateFile () | |
Static Public Member Functions | |
static bool | write (const QList< NamedPoint > &points, QString fileName=QString::null) |
Brief description of class still missing.
Full description of class still missing
QGpGuiTools::CoordinateFile::CoordinateFile | ( | QWidget * | parent = 0 | ) |
Description of constructor still missing
References QGpGuiTools::Dialog::getRect(), QGpGuiTools::Settings::getWidget(), QGpCoreTools::tr(), and TRACE.
: Dialog(parent) { TRACE; setupUi(this); if(_types.isEmpty()) { // Order here is quite important, see parse() in case of modification // 2 to 5: cartesian, 7 to 14: geographical _types << tr("Station name") // 1 << tr("X (m)") // 2 << tr("X (km)") // 3 << tr("Y (m)") // 4 << tr("Y (km)") // 5 << tr("Z (m)") // 6 << tr("Longitude (D)") // 7 << tr("Longitude (M)") // 8 << tr("Longitude (S)") // 9 << tr("Longitude (DEG)") // 10 << tr("Latitude (D)") // 11 << tr("Latitude (M)") // 12 << tr("Latitude (S)") // 13 << tr("Latitude (DEG)"); // 14 } connect(filterWidget, SIGNAL(typeChanged()), this, SLOT(switchConversion())); connect(filterWidget->parser(), SIGNAL(dataAvailable()), this, SLOT(setUtmZone())); filterWidget->setStandardTypes(_types); connect(convertWidget, SIGNAL(copyReference()), this, SLOT(copyPointToReference())); connect(buttonBox, SIGNAL(accepted()), this, SLOT(beforeLeaving())); setWindowTitle(tr("Load coordinates")); Settings::getRect(this, "coordinateReader"); Settings::getWidget(filterWidget, "coordinateReader"); Settings::getWidget(convertWidget, "coordinateReader"); }
bool QGpGuiTools::CoordinateFile::contains | ( | const QString & | name | ) | const |
const QList<NamedPoint>& QGpGuiTools::CoordinateFile::points | ( | ) | const [inline] |
Referenced by main(), and WaranGpsWidget::setCoordinates().
{return _points;}
bool QGpGuiTools::CoordinateFile::read | ( | QString | fileName = QString::null , |
const QString & | format = QString::null |
||
) |
References QGpGuiTools::Dialog::setRect(), QGpGuiTools::Settings::setWidget(), QGpCoreTools::tr(), and TRACE.
Referenced by main(), and WaranGpsWidget::setCoordinates().
{ TRACE; if(fileName.isEmpty()) { fileName=Message::getOpenFileName(tr("Load coordinates"), _fileFilter); if(fileName.isEmpty()) { return false; } } setFile(fileName, format); if(exec()==QDialog::Accepted) { convertWidget->saveReference(); filterWidget->saveParserSettings("coordinateReader"); Settings::setWidget(filterWidget, "coordinateReader"); Settings::setWidget(convertWidget, "coordinateReader"); Settings::setRect(this, "coordinateReader"); return true; } else { return false; } }
bool QGpGuiTools::CoordinateFile::write | ( | const QList< NamedPoint > & | points, |
QString | fileName = QString::null |
||
) | [static] |
References QGpCoreTools::GoogleEarthKML::Folder::addPlacemark(), QGpGuiTools::Dialog::Dialog(), QGpCoreTools::GoogleEarthKML::document(), QGpGuiTools::Dialog::getRect(), QGpGuiTools::Settings::getWidget(), QGpCoreTools::GoogleEarthKML::Document::mainFolder(), MSG_ID, QGpCoreTools::Point2D::rectangularToGeographical(), QGpGuiTools::GeographicalReference::reference(), QGpGuiTools::GeographicalReference::save(), QGpCoreTools::GoogleEarthKML::save(), QGpCoreTools::GoogleEarthKML::Placemark::setCoordinates(), QGpGuiTools::Dialog::setMainWidget(), QGpCoreTools::GoogleEarthKML::Placemark::setName(), QGpCoreTools::GoogleEarthKML::Folder::setName(), QGpCoreTools::GoogleEarthKML::Document::setName(), QGpGuiTools::Dialog::setRect(), QGpGuiTools::Settings::setWidget(), QGpCoreTools::tr(), and TRACE.
{ TRACE; if(fileName.isEmpty()) { fileName=Message::getSaveFileName(tr("Save coordinates"), CoordinateFile::_fileFilter); if(fileName.isEmpty()) { return false; } } if(fileName.endsWith(".kml")) { Dialog * d=new Dialog; GeographicalReference * dg=new GeographicalReference; d->setMainWidget(dg); d->setWindowTitle("Google Earth KML export"); Settings::getWidget(dg, "CoordinateWriteKML"); Settings::getRect(d, "CoordinateWriteKML"); NamedPoint reference; if(d->exec()==QDialog::Accepted) { Settings::setWidget(dg, "CoordinateWriteKML"); Settings::setRect(d, "CoordinateWriteKML"); dg->save(); reference=dg->reference(); delete d; } else { delete d; return false; } GoogleEarthKML kml; GoogleEarthKML::Document& doc=kml.document(); QFileInfo fi(fileName); doc.setName(fi.baseName()); GoogleEarthKML::Folder * f=doc.mainFolder(); f->setName(fi.baseName()); Point point; for(QList<NamedPoint>::const_iterator it=points.begin(); it!=points.end(); it++) { GoogleEarthKML::Placemark * p=new GoogleEarthKML::Placemark; p->setName(it->name()); point=*it; point.rectangularToGeographical(reference); p->setCoordinates(point); f->addPlacemark(p); } return kml.save(fileName); } else { QFile f(fileName); if(!f.open(QIODevice::WriteOnly)) { Message::warning(MSG_ID, tr("Saving coordinates ..."), tr("Error while writing to file %1").arg(fileName), Message::cancel()); return false; } QTextStream s(&f); for(QList<NamedPoint>::const_iterator it=points.begin(); it!=points.end(); it++) { s << it->toString(20) << "\n"; } } return true; }