Subversion Repositories Projects

Rev

Rev 395 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 395 Rev 481
Line 15... Line 15...
15
 *   along with this program; if not, write to the                         *
15
 *   along with this program; if not, write to the                         *
16
 *   Free Software Foundation, Inc.,                                       *
16
 *   Free Software Foundation, Inc.,                                       *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
17
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18
 ***************************************************************************/
18
 ***************************************************************************/
19
#include "dlg_Map.h"
19
#include "dlg_Map.h"
-
 
20
#include "dlg_MapPos.h"
-
 
21
 
-
 
22
 
20
#include <QDomDocument>
23
#include <QDomDocument>
21
#include <QFile>
24
#include <QFile>
22
 
25
 
23
dlg_Map::dlg_Map(QWidget *parent) : QDialog(parent)
26
dlg_Map::dlg_Map(QWidget *parent) : QDialog(parent)
24
{
27
{
Line 69... Line 72...
69
    o_Map->addLayer(o_Layer);
72
    o_Map->addLayer(o_Layer);
70
    o_Map->addLayer(o_Click);
73
    o_Map->addLayer(o_Click);
71
    o_Map->addLayer(o_Route);
74
    o_Map->addLayer(o_Route);
72
 
75
 
73
    o_Map->setZoom(17);
76
    o_Map->setZoom(17);
74
    o_Map->setView(QPointF(13.5,52.5));
77
//    o_Map->setView(QPointF(13.5,52.5));
-
 
78
    o_Map->setView(QPointF(o_Settings->Map.LastLongitude,o_Settings->Map.LastLatitude));
75
 
79
 
76
    connect(o_Map, SIGNAL(mouseEventCoordinate(const QMouseEvent*, const QPointF)), this, SLOT(slot_Click(const QMouseEvent*, const QPointF)));
80
    connect(o_Map, SIGNAL(mouseEventCoordinate(const QMouseEvent*, const QPointF)), this, SLOT(slot_Click(const QMouseEvent*, const QPointF)));
77
 
81
 
78
    l_Map->addWidget(o_Map);
82
    l_Map->addWidget(o_Map);
79
 
83
 
Line 289... Line 293...
289
// Position zum Flug-Track hinzufügen
293
// Position zum Flug-Track hinzufügen
290
void dlg_Map::add_Position(double x, double y)
294
void dlg_Map::add_Position(double x, double y)
291
{
295
{
292
    sWayPoint WayPoint;
296
    sWayPoint WayPoint;
293
 
297
 
-
 
298
    o_Settings->Map.LastLongitude = x;
-
 
299
    o_Settings->Map.LastLatitude = y;
-
 
300
 
294
    WayPoint.Longitude = x;
301
    WayPoint.Longitude = x;
295
    WayPoint.Latitude = y;
302
    WayPoint.Latitude = y;
296
//    WayPoint.Time = sb_Time->value();
303
//    WayPoint.Time = sb_Time->value();
297
 
304
 
298
    l_Track.append(WayPoint);
305
    l_Track.append(WayPoint);
Line 433... Line 440...
433
{
440
{
434
    QString Filename = QFileDialog::getOpenFileName(this, "Bild als Karte",  o_Settings->DIR.Logging, "Bilddatei(*.jpg *.png *.gif);;Alle Dateien (*)");
441
    QString Filename = QFileDialog::getOpenFileName(this, "Bild als Karte",  o_Settings->DIR.Logging, "Bilddatei(*.jpg *.png *.gif);;Alle Dateien (*)");
435
 
442
 
436
    if (!Filename.isEmpty())
443
    if (!Filename.isEmpty())
437
    {
444
    {
438
        QFile f_Points(Filename + ".pos");
445
        QFile *f_Points = new QFile(Filename + ".pos");
439
 
446
 
440
        if (f_Points.exists())
447
        if (f_Points->exists())
441
        {
448
        {
442
            f_Points.open(QIODevice::ReadOnly | QIODevice::Text);
449
            f_Points->open(QIODevice::ReadOnly | QIODevice::Text);
443
 
450
 
444
            QString s_Points;
451
            QString s_Points;
445
 
452
 
446
            while (!f_Points.atEnd())
453
            while (!f_Points->atEnd())
447
            {
454
            {
448
                s_Points.append(f_Points.readLine());
455
                s_Points.append(f_Points->readLine());
449
            }
456
            }
450
 
457
 
451
            f_Points.close();
458
            f_Points->close();
452
 
459
 
453
            QStringList s_Pos = s_Points.split(",");
460
            QStringList s_Pos = s_Points.split(",");
454
 
461
 
455
            FixedImageOverlay* fip = new FixedImageOverlay(s_Pos[0].toDouble(), s_Pos[1].toDouble(), s_Pos[2].toDouble(), s_Pos[3].toDouble(), Filename);
462
            FixedImageOverlay* fip = new FixedImageOverlay(s_Pos[0].toDouble(), s_Pos[1].toDouble(), s_Pos[2].toDouble(), s_Pos[3].toDouble(), Filename);
456
 
463
 
457
            o_Layer->addGeometry(fip);
464
            o_Layer->addGeometry(fip);
458
            o_Map->updateRequestNew();
465
            o_Map->updateRequestNew();
459
        }
466
        }
-
 
467
        else
-
 
468
        {
-
 
469
            dlg_MapPos *f_MapPos = new dlg_MapPos(this);
-
 
470
 
-
 
471
            if (f_MapPos->exec()==QDialog::Accepted)
-
 
472
            {
-
 
473
                QString Data = f_MapPos->get_Data();
-
 
474
 
-
 
475
                f_Points->open(QIODevice::ReadWrite | QIODevice::Text);
-
 
476
 
-
 
477
                QTextStream out(f_Points);
-
 
478
 
-
 
479
                out.setRealNumberPrecision(9);
-
 
480
 
-
 
481
                out << Data << "\n";
-
 
482
 
-
 
483
                f_Points->close();
-
 
484
 
-
 
485
                QStringList s_Pos = Data.split(",");
-
 
486
 
-
 
487
                FixedImageOverlay* fip = new FixedImageOverlay(s_Pos[0].toDouble(), s_Pos[1].toDouble(), s_Pos[2].toDouble(), s_Pos[3].toDouble(), Filename);
-
 
488
 
-
 
489
                o_Layer->addGeometry(fip);
-
 
490
                o_Map->updateRequestNew();
-
 
491
            }
-
 
492
 
-
 
493
        }
460
    }
494
    }
461
}
495
}
462
 
496
 
463
// auf Veränderung der Fenstergröße reagieren
497
// auf Veränderung der Fenstergröße reagieren
464
void dlg_Map::resizeEvent ( QResizeEvent * event )
498
void dlg_Map::resizeEvent ( QResizeEvent * event )