*/
#include "mapviewscreen.h"
+ #include "infotab.h"
#include "../map/mapview.h"
#include "../map/mapengine.h"
+ #include "infotab.h"
MapViewScreen::MapViewScreen(QWidget *parent)
: QWidget(parent)
{
- QHBoxLayout *mapViewLayout = new QHBoxLayout;
- MapView *mapView = new MapView(this);
- mapViewLayout->addWidget(mapView);
- setLayout(mapViewLayout);
- MapEngine *mapEngine = new MapEngine(this);
- mapView->setScene(mapEngine->scene());
- connect(mapEngine, SIGNAL(zoomLevelChanged(int)), mapView, SLOT(setZoomLevel(int)));
- mapEngine->setViewLocation(QPointF(25.5000, 65.0000));
+ MapView *mapView = new MapView(this);
+ mapEngine = new MapEngine(this);
+ mapView->setScene(mapEngine->scene());
+
+ connect(mapView, SIGNAL(viewScrolled(QPoint)), mapEngine, SLOT(setLocation(QPoint)));
+ connect(mapEngine, SIGNAL(locationChanged(QPoint)),
+ mapView, SLOT(centerToSceneCoordinates(QPoint)));
+ connect(mapEngine, SIGNAL(zoomLevelChanged(int)), mapView, SLOT(setZoomLevel(int)));
+ connect(mapView, SIGNAL(viewResized(QSize)), mapEngine, SLOT(viewResized(QSize)));
+
+ QHBoxLayout *mapViewLayout = new QHBoxLayout;
+ //DEBUG
+ QVBoxLayout *mapControlLayout = new QVBoxLayout;
+ QWidget *mapControl = new QWidget(this);
+ mapControl->setLayout(mapControlLayout);
+ search = new QPushButton("Search", this);
+ zoomOut = new QPushButton("-", this);
+ zoomIn = new QPushButton("+", this);
+ mapControlLayout->addWidget(&latLine);
+ mapControlLayout->addWidget(&lonLine);
+ mapControlLayout->addWidget(search);
+ mapControlLayout->addWidget(zoomIn);
+ mapControlLayout->addWidget(zoomOut);
+ mapViewLayout->addWidget(mapControl);
+ connect(search, SIGNAL(clicked()), this, SLOT(searchMap()));
+ connect(zoomIn, SIGNAL(clicked()), mapEngine, SLOT(zoomIn()));
+ connect(zoomOut, SIGNAL(clicked()), mapEngine, SLOT(zoomOut()));
+ //DEBUG
+ mapViewLayout->addWidget(mapView);
+ setLayout(mapViewLayout);
+
+ mapEngine->init();
+}
+
+void MapViewScreen::searchMap()
+{
+ qreal lat = latLine.text().toFloat();
+ qreal lon = lonLine.text().toFloat();
+
+ qDebug() << lat << "," << lon;
+
+ mapEngine->setViewLocation(QPointF(lon, lat));
}