Commit 69229517 authored by lm's avatar lm

Map caching works now, uav following as well. Waypoint lines and some...

Map caching works now, uav following as well. Waypoint lines and some graphical tweaks needed, but its very close to an alpha release now
parent 59bbbfbe
...@@ -60,7 +60,8 @@ HEADERS += opmapcontrol.h \ ...@@ -60,7 +60,8 @@ HEADERS += opmapcontrol.h \
src/internals/projections/mercatorprojection.h \ src/internals/projections/mercatorprojection.h \
src/internals/projections/mercatorprojectionyandex.h \ src/internals/projections/mercatorprojectionyandex.h \
src/internals/projections/platecarreeprojection.h \ src/internals/projections/platecarreeprojection.h \
src/internals/projections/platecarreeprojectionpergo.h src/internals/projections/platecarreeprojectionpergo.h \
src/libs/opmapcontrol/src/mapwidget/waypointlineitem.h
FORMS += src/mapwidget/mapripform.ui FORMS += src/mapwidget/mapripform.ui
SOURCES += src/core/alllayersoftype.cpp \ SOURCES += src/core/alllayersoftype.cpp \
src/core/cache.cpp \ src/core/cache.cpp \
...@@ -104,5 +105,6 @@ SOURCES += src/core/alllayersoftype.cpp \ ...@@ -104,5 +105,6 @@ SOURCES += src/core/alllayersoftype.cpp \
src/internals/projections/mercatorprojection.cpp \ src/internals/projections/mercatorprojection.cpp \
src/internals/projections/mercatorprojectionyandex.cpp \ src/internals/projections/mercatorprojectionyandex.cpp \
src/internals/projections/platecarreeprojection.cpp \ src/internals/projections/platecarreeprojection.cpp \
src/internals/projections/platecarreeprojectionpergo.cpp src/internals/projections/platecarreeprojectionpergo.cpp \
src/libs/opmapcontrol/src/mapwidget/waypointlineitem.cpp
RESOURCES += src/mapwidget/mapresources.qrc RESOURCES += src/mapwidget/mapresources.qrc
...@@ -109,6 +109,13 @@ namespace mapcontrol ...@@ -109,6 +109,13 @@ namespace mapcontrol
double ZoomDigi(); double ZoomDigi();
double ZoomTotal(); double ZoomTotal();
/**
* @brief The area currently selected by the user
*
* @return The rectangle in lat/lon coordinates currently selected
*/
internals::RectLatLng SelectedArea()const{return selectedArea;}
protected: protected:
void mouseMoveEvent ( QGraphicsSceneMouseEvent * event ); void mouseMoveEvent ( QGraphicsSceneMouseEvent * event );
void mousePressEvent ( QGraphicsSceneMouseEvent * event ); void mousePressEvent ( QGraphicsSceneMouseEvent * event );
...@@ -190,7 +197,6 @@ namespace mapcontrol ...@@ -190,7 +197,6 @@ namespace mapcontrol
int MinZoom()const{return minZoom;} int MinZoom()const{return minZoom;}
internals::MouseWheelZoomType::Types GetMouseWheelZoomType(){return core->GetMouseWheelZoomType();} internals::MouseWheelZoomType::Types GetMouseWheelZoomType(){return core->GetMouseWheelZoomType();}
void SetSelectedArea(internals::RectLatLng const& value){selectedArea = value;this->update();} void SetSelectedArea(internals::RectLatLng const& value){selectedArea = value;this->update();}
internals::RectLatLng SelectedArea()const{return selectedArea;}
internals::RectLatLng BoundsOfMap; internals::RectLatLng BoundsOfMap;
void Offset(int const& x, int const& y); void Offset(int const& x, int const& y);
bool CanDragMap()const{return core->CanDragMap;} bool CanDragMap()const{return core->CanDragMap;}
......
...@@ -94,12 +94,18 @@ namespace mapcontrol ...@@ -94,12 +94,18 @@ namespace mapcontrol
UAVItem* newUAV = new UAVItem(map,this); UAVItem* newUAV = new UAVItem(map,this);
newUAV->setParentItem(map); newUAV->setParentItem(map);
UAVS.insert(id, newUAV); UAVS.insert(id, newUAV);
QGraphicsItemGroup* waypointLine = new QGraphicsItemGroup();
waypointLine->setParentItem(map);
waypointLines.insert(id, waypointLine);
return newUAV; return newUAV;
} }
void OPMapWidget::AddUAV(int id, UAVItem* uav) void OPMapWidget::AddUAV(int id, UAVItem* uav)
{ {
uav->setParentItem(map); uav->setParentItem(map);
QGraphicsItemGroup* waypointLine = new QGraphicsItemGroup();
waypointLine->setParentItem(map);
waypointLines.insert(id, waypointLine);
UAVS.insert(id, uav); UAVS.insert(id, uav);
} }
......
#include "waypointlineitem.h"
WaypointLineItem::WaypointLineItem()
{
}
#ifndef WAYPOINTLINEITEM_H
#define WAYPOINTLINEITEM_H
#include <QGraphicsLineItem>
class WaypointLineItem : public QGraphicsLineItem
{
public:
WaypointLineItem();
};
#endif // WAYPOINTLINEITEM_H
...@@ -18,6 +18,42 @@ void QGCMapToolBar::setMap(QGCMapWidget* map) ...@@ -18,6 +18,42 @@ void QGCMapToolBar::setMap(QGCMapWidget* map)
{ {
connect(ui->goToButton, SIGNAL(clicked()), map, SLOT(showGoToDialog())); connect(ui->goToButton, SIGNAL(clicked()), map, SLOT(showGoToDialog()));
connect(ui->goHomeButton, SIGNAL(clicked()), map, SLOT(goHome())); connect(ui->goHomeButton, SIGNAL(clicked()), map, SLOT(goHome()));
connect(map, SIGNAL(OnTileLoadStart()), this, SLOT(tileLoadStart()));
connect(map, SIGNAL(OnTileLoadComplete()), this, SLOT(tileLoadEnd()));
connect(map, SIGNAL(OnTilesStillToLoad(int)), this, SLOT(tileLoadProgress(int)));
connect(ui->ripMapButton, SIGNAL(clicked()), map, SLOT(cacheVisibleRegion()));
ui->followCheckBox->setChecked(map->getFollowUAVEnabled());
connect(ui->followCheckBox, SIGNAL(clicked(bool)), map, SLOT(setFollowUAVEnabled(bool)));
// Edit mode handling
ui->editButton->hide();
}
}
void QGCMapToolBar::tileLoadStart()
{
ui->posLabel->setText(QString("Starting to load tiles.."));
}
void QGCMapToolBar::tileLoadEnd()
{
ui->posLabel->setText(QString("Finished"));
}
void QGCMapToolBar::tileLoadProgress(int progress)
{
if (progress == 1)
{
ui->posLabel->setText(QString("1 tile to load.."));
}
else if (progress > 0)
{
ui->posLabel->setText(QString("%1 tiles to load..").arg(progress));
}
else
{
tileLoadEnd();
} }
} }
......
...@@ -19,6 +19,11 @@ public: ...@@ -19,6 +19,11 @@ public:
void setMap(QGCMapWidget* map); void setMap(QGCMapWidget* map);
public slots:
void tileLoadStart();
void tileLoadEnd();
void tileLoadProgress(int progress);
protected: protected:
QGCMapWidget* map; QGCMapWidget* map;
......
...@@ -20,13 +20,6 @@ ...@@ -20,13 +20,6 @@
<property name="margin"> <property name="margin">
<number>4</number> <number>4</number>
</property> </property>
<item>
<widget class="QLabel" name="posLabel">
<property name="text">
<string>00.00 00.00</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QPushButton" name="goToButton"> <widget class="QPushButton" name="goToButton">
<property name="text"> <property name="text">
...@@ -48,6 +41,13 @@ ...@@ -48,6 +41,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="ripMapButton">
<property name="text">
<string>Cache</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="followCheckBox"> <widget class="QCheckBox" name="followCheckBox">
<property name="text"> <property name="text">
...@@ -55,6 +55,13 @@ ...@@ -55,6 +55,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QLabel" name="posLabel">
<property name="text">
<string>00.00 00.00</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
......
This diff is collapsed.
...@@ -24,6 +24,9 @@ public: ...@@ -24,6 +24,9 @@ public:
// double headingP1P2(internals::PointLatLng p1, internals::PointLatLng p2); // double headingP1P2(internals::PointLatLng p1, internals::PointLatLng p2);
// internals::PointLatLng targetLatLon(internals::PointLatLng source, double heading, double dist); // internals::PointLatLng targetLatLon(internals::PointLatLng source, double heading, double dist);
/** @brief Map centered on current active system */
bool getFollowUAVEnabled() { return followUAVEnabled; }
signals: signals:
void homePositionChanged(double latitude, double longitude, double altitude); void homePositionChanged(double latitude, double longitude, double altitude);
/** @brief Signal for newly created map waypoints */ /** @brief Signal for newly created map waypoints */
...@@ -53,6 +56,10 @@ public slots: ...@@ -53,6 +56,10 @@ public slots:
void updateHomePosition(double latitude, double longitude, double altitude); void updateHomePosition(double latitude, double longitude, double altitude);
/** @brief Set update rate limit */ /** @brief Set update rate limit */
void setUpdateRateLimit(float seconds); void setUpdateRateLimit(float seconds);
/** @brief Cache visible region to harddisk */
void cacheVisibleRegion();
/** @brief Set follow mode */
void setFollowUAVEnabled(bool enabled) { followUAVEnabled = enabled; }
void loadSettings(); void loadSettings();
void storeSettings(); void storeSettings();
...@@ -85,6 +92,8 @@ protected: ...@@ -85,6 +92,8 @@ protected:
EDIT_MODE_CACHING EDIT_MODE_CACHING
}; };
editMode currEditMode; ///< The current edit mode on the map editMode currEditMode; ///< The current edit mode on the map
bool followUAVEnabled; ///< Does the map follow the UAV?
int followUAVID; ///< Which UAV should be tracked?
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment