Browse Source

Support blocking zoom on map

QGC4.4
Lorenz Meier 11 years ago
parent
commit
ba883c7920
  1. 1
      src/ui/map/QGCMapToolBar.cc
  2. 20
      src/ui/map/QGCMapToolBar.ui
  3. 12
      src/ui/map/QGCMapWidget.cc
  4. 7
      src/ui/map/QGCMapWidget.h

1
src/ui/map/QGCMapToolBar.cc

@ -28,6 +28,7 @@ void QGCMapToolBar::setMap(QGCMapWidget* map) @@ -28,6 +28,7 @@ void QGCMapToolBar::setMap(QGCMapWidget* map)
connect(ui->goHomeButton, SIGNAL(clicked()), map, SLOT(goHome()));
connect(ui->lastPosButton, SIGNAL(clicked()), map, SLOT(loadSettings()));
connect(ui->clearTrailsButton, SIGNAL(clicked()), map, SLOT(deleteTrails()));
connect(ui->lockCheckBox, SIGNAL(clicked(bool)), map, SLOT(setZoomBlocked(bool)));
connect(map, SIGNAL(OnTileLoadStart()), this, SLOT(tileLoadStart()));
connect(map, SIGNAL(OnTileLoadComplete()), this, SLOT(tileLoadEnd()));
connect(map, SIGNAL(OnTilesStillToLoad(int)), this, SLOT(tileLoadProgress(int)));

20
src/ui/map/QGCMapToolBar.ui

@ -13,11 +13,20 @@ @@ -13,11 +13,20 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1,1,1,1,1,1,5,1,30,1">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,1,1,1,1,1,0,1,5,1,30,1">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
@ -63,6 +72,13 @@ @@ -63,6 +72,13 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="lockCheckBox">
<property name="text">
<string>Lock</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="followCheckBox">
<property name="text">
<string>Follow</string>

12
src/ui/map/QGCMapWidget.cc

@ -18,6 +18,7 @@ QGCMapWidget::QGCMapWidget(QWidget *parent) : @@ -18,6 +18,7 @@ QGCMapWidget::QGCMapWidget(QWidget *parent) :
mapInitialized(false),
mapPositionInitialized(false),
homeAltitude(0),
zoomBlocked(false),
uas(NULL)
{
currWPManager = UASManager::instance()->getActiveUASWaypointManager();
@ -249,6 +250,13 @@ void QGCMapWidget::hideEvent(QHideEvent* event) @@ -249,6 +250,13 @@ void QGCMapWidget::hideEvent(QHideEvent* event)
OPMapWidget::hideEvent(event);
}
void QGCMapWidget::wheelEvent ( QWheelEvent * event )
{
if (!zoomBlocked) {
OPMapWidget::wheelEvent(event);
}
}
/**
* @param changePosition Load also the last position from settings and update the map position.
*/
@ -328,14 +336,10 @@ void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event) @@ -328,14 +336,10 @@ void QGCMapWidget::mouseDoubleClickEvent(QMouseEvent* event)
// Create new waypoint
internals::PointLatLng pos = map->FromLocalToLatLng(event->pos().x(), event->pos().y());
Waypoint* wp = currWPManager->createWaypoint();
// wp->blockSignals(true);
// wp->setFrame(MAV_FRAME_GLOBAL_RELATIVE_ALT);
wp->setLatitude(pos.Lat());
wp->setLongitude(pos.Lng());
wp->setFrame((MAV_FRAME)currWPManager->getFrameRecommendation());
wp->setAltitude(currWPManager->getAltitudeRecommendation());
// wp->blockSignals(false);
// currWPManager->notifyOfChangeEditable(wp);
}
OPMapWidget::mouseDoubleClickEvent(event);

7
src/ui/map/QGCMapWidget.h

@ -124,6 +124,11 @@ public slots: @@ -124,6 +124,11 @@ public slots:
}
}
void setZoomBlocked(bool blocked)
{
zoomBlocked = blocked;
}
/** @brief Load the settings for this widget from disk */
void loadSettings(bool changePosition=true);
/** @brief Store the settings for this widget to disk */
@ -139,6 +144,7 @@ protected: @@ -139,6 +144,7 @@ protected:
/** @brief Initialize */
void showEvent(QShowEvent* event);
void hideEvent(QHideEvent* event);
void wheelEvent(QWheelEvent* event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent* event);
@ -172,6 +178,7 @@ protected: @@ -172,6 +178,7 @@ protected:
QPoint mousePressPos; ///< Mouse position when the button is released.
QPoint contextMousePressPos; ///< Mouse position when context menu activated.
int defaultGuidedAlt; ///< Default altitude for guided mode
bool zoomBlocked; ///< Wether zooming is blocked
UASInterface *uas; ///< Currently selected UAS.
};

Loading…
Cancel
Save