mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-18 03:52:11 +01:00
Added 'map modes' to the opmap plug-in. "Nomral map mode" and "Magic waypoint map mode". Not yet complete!
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1911 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
69d2e8828f
commit
1741825ee2
Binary file not shown.
Before Width: | Height: | Size: 1006 B After Width: | Height: | Size: 1006 B |
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
ground/src/plugins/opmap/images/waypoint_marker3.png
Normal file
BIN
ground/src/plugins/opmap/images/waypoint_marker3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
@ -3,8 +3,6 @@
|
|||||||
<file>images/ok.png</file>
|
<file>images/ok.png</file>
|
||||||
<file>images/uav.png</file>
|
<file>images/uav.png</file>
|
||||||
<file>images/gcs.png</file>
|
<file>images/gcs.png</file>
|
||||||
<file>images/plus.png</file>
|
|
||||||
<file>images/minus.png</file>
|
|
||||||
<file>images/waypoint.png</file>
|
<file>images/waypoint.png</file>
|
||||||
<file>images/right_but.png</file>
|
<file>images/right_but.png</file>
|
||||||
<file>images/left_but.png</file>
|
<file>images/left_but.png</file>
|
||||||
@ -21,5 +19,8 @@
|
|||||||
<file>images/uav_heading.png</file>
|
<file>images/uav_heading.png</file>
|
||||||
<file>images/uav_trail.png</file>
|
<file>images/uav_trail.png</file>
|
||||||
<file>images/uav_trail_clear.png</file>
|
<file>images/uav_trail_clear.png</file>
|
||||||
|
<file>images/minus.png</file>
|
||||||
|
<file>images/plus.png</file>
|
||||||
|
<file>images/waypoint_marker3.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>548</width>
|
<width>514</width>
|
||||||
<height>565</height>
|
<height>412</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -30,8 +30,253 @@
|
|||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frameTopBar">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::NoContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">QFrame{
|
||||||
|
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(110, 110, 110, 255), stop:1 rgba(71, 71, 71, 255));
|
||||||
|
color: rgba(0, 0, 0, 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
QLabel {
|
||||||
|
background-color: transparent;
|
||||||
|
/* background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(0, 0, 0, 80), stop:1 rgba(0, 0, 0, 80)); */
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
/*border: 1px solid black;*/
|
||||||
|
border: none;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton { /* all types of tool button */
|
||||||
|
background-color: transparent;
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
/*border-style: none;*/
|
||||||
|
/* border: 1px solid rgba(0, 0, 0, 64); */
|
||||||
|
/* border: 0px; */
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
QToolButton:hover {
|
||||||
|
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(255, 255, 255, 200), stop:1 rgba(180, 180, 180, 200));
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
border: 0px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
QToolButton:pressed {
|
||||||
|
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
border: 0px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolButton:checked {
|
||||||
|
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
|
||||||
|
color: rgb(255, 255, 255);
|
||||||
|
border: 0px;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QComboBox {
|
||||||
|
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
|
||||||
|
color: rgba(255, 255, 255, 255);
|
||||||
|
border: 1px solid rgba(0, 0, 0, 128);
|
||||||
|
border-radius: 0px;
|
||||||
|
}
|
||||||
|
QComboBox::down-arrow:on {
|
||||||
|
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(48, 48, 48, 255), stop:1 rgba(120, 120, 120, 255));
|
||||||
|
top: 1px; left: 1px; /* move the arrow when the popup is open */
|
||||||
|
}
|
||||||
|
QComboBox::down-arrow {
|
||||||
|
image: url(:/opmap/images/combobox_down_arrow.png);
|
||||||
|
}
|
||||||
|
QComboBox:drop-down {
|
||||||
|
background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(110, 110, 110, 255), stop:1 rgba(71, 71, 71, 255));
|
||||||
|
border-left: 1px solid rgba(0, 0, 0, 128);
|
||||||
|
/* subcontrol-origin: padding;
|
||||||
|
subcontrol-position: top right;
|
||||||
|
border-top-right-radius: 1px;
|
||||||
|
border-bottom-right-radius: 1px; */
|
||||||
|
}
|
||||||
|
QComboBox QAbstractItemView { /* the drop down list */
|
||||||
|
background-color: rgb(255, 255, 255);
|
||||||
|
color: rgb(0, 0, 0);
|
||||||
|
border: 1px solid rgba(0, 0, 0, 128);
|
||||||
|
selection-background-color: rgb(160, 160, 255);
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
</string>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="layoutWidgetStatusBar_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>8</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonMapModeLeft">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../coreplugin/core.qrc">
|
||||||
|
<normaloff>:/core/images/prev.png</normaloff>:/core/images/prev.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelMapMode">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>200</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>MS Sans Serif</family>
|
||||||
|
<pointsize>12</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<italic>false</italic>
|
||||||
|
<bold>true</bold>
|
||||||
|
<kerning>true</kerning>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Mouse position</string>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::NoFrame</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>labelMapMode</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>5</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="toolButtonMapModeRight">
|
||||||
|
<property name="text">
|
||||||
|
<string>...</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../coreplugin/core.qrc">
|
||||||
|
<normaloff>:/core/images/next.png</normaloff>:/core/images/next.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter">
|
<widget class="QSplitter" name="splitter">
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
@ -149,14 +394,14 @@ border-radius: 2px;
|
|||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboBoxFindPlace">
|
<widget class="QComboBox" name="comboBoxFindPlace">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>20</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -623,7 +868,7 @@ QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-ch
|
|||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="acceptDrops">
|
<property name="acceptDrops">
|
||||||
<bool>true</bool>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">
|
<string notr="true">
|
||||||
@ -819,24 +1064,21 @@ border-radius: 3px;
|
|||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>2</number>
|
||||||
|
</property>
|
||||||
|
<property name="midLineWidth">
|
||||||
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>3</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="margin">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="topMargin">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>1</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_3">
|
<spacer name="verticalSpacer_3">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -899,7 +1141,7 @@ border-radius: 3px;
|
|||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>80</height>
|
<height>50</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
@ -1119,38 +1361,6 @@ border-radius: 3px;
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QToolButton" name="toolButtonClearUAVtrail">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Clear the UAV trail</string>
|
|
||||||
</property>
|
|
||||||
<property name="styleSheet">
|
|
||||||
<string notr="true"/>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="opmap.qrc">
|
|
||||||
<normaloff>:/opmap/images/uav_trail_clear.png</normaloff>:/opmap/images/uav_trail_clear.png</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>28</width>
|
|
||||||
<height>28</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="autoRepeat">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="autoRaise">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -1225,6 +1435,9 @@ color: rgb(255, 255, 255);
|
|||||||
<property name="frameShape">
|
<property name="frameShape">
|
||||||
<enum>QFrame::NoFrame</enum>
|
<enum>QFrame::NoFrame</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>1</number>
|
<number>1</number>
|
||||||
|
@ -66,6 +66,17 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
|||||||
|
|
||||||
min_zoom = max_zoom = 0;
|
min_zoom = max_zoom = 0;
|
||||||
|
|
||||||
|
m_map_mode = Normal_MapMode;
|
||||||
|
|
||||||
|
// default magic waypoint params
|
||||||
|
magic_waypoint.map_wp_item = NULL;
|
||||||
|
magic_waypoint.coord = internals::PointLatLng(0.0, 0.0);
|
||||||
|
magic_waypoint.altitude = 0.0;
|
||||||
|
magic_waypoint.description = "Magic waypoint";
|
||||||
|
magic_waypoint.locked = false;
|
||||||
|
magic_waypoint.time_seconds = 0;
|
||||||
|
magic_waypoint.hold_time_seconds = 0;
|
||||||
|
|
||||||
// **************
|
// **************
|
||||||
// fetch required UAVObjects
|
// fetch required UAVObjects
|
||||||
|
|
||||||
@ -147,6 +158,21 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
|||||||
// **************
|
// **************
|
||||||
// set the user control options
|
// set the user control options
|
||||||
|
|
||||||
|
switch (m_map_mode)
|
||||||
|
{
|
||||||
|
case Normal_MapMode:
|
||||||
|
m_widget->labelMapMode->setText("Normal mode");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MagicWaypoint_MapMode:
|
||||||
|
m_widget->labelMapMode->setText("Magic Waypoint mode");
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
m_widget->labelMapMode->setText("Unknown mode");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
m_widget->labelUAVPos->setText("---");
|
m_widget->labelUAVPos->setText("---");
|
||||||
m_widget->labelMapPos->setText("---");
|
m_widget->labelMapPos->setText("---");
|
||||||
m_widget->labelMousePos->setText("---");
|
m_widget->labelMousePos->setText("---");
|
||||||
@ -329,7 +355,19 @@ OPMapGadgetWidget::~OPMapGadgetWidget()
|
|||||||
// #else
|
// #else
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
onClearWayPointsAct_triggered();
|
m_waypoint_list_mutex.lock();
|
||||||
|
foreach (t_waypoint *wp, m_waypoint_list)
|
||||||
|
{
|
||||||
|
if (!wp) continue;
|
||||||
|
|
||||||
|
|
||||||
|
// todo:
|
||||||
|
|
||||||
|
|
||||||
|
delete wp->map_wp_item;
|
||||||
|
}
|
||||||
|
m_waypoint_list_mutex.unlock();
|
||||||
|
m_waypoint_list.clear();
|
||||||
|
|
||||||
if (m_zoom_slider_widget) delete m_zoom_slider_widget;
|
if (m_zoom_slider_widget) delete m_zoom_slider_widget;
|
||||||
if (m_statusbar_widget) delete m_statusbar_widget;
|
if (m_statusbar_widget) delete m_statusbar_widget;
|
||||||
@ -372,6 +410,8 @@ void OPMapGadgetWidget::mouseMoveEvent(QMouseEvent *event)
|
|||||||
|
|
||||||
void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
|
QString s;
|
||||||
|
|
||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -409,6 +449,26 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
||||||
|
switch (m_map_mode)
|
||||||
|
{
|
||||||
|
case Normal_MapMode: s = tr(" (Normal)"); break;
|
||||||
|
case MagicWaypoint_MapMode: s = tr(" (Magic Waypoint)"); break;
|
||||||
|
default: s = tr(" (Unknown)"); break;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < mapModeAct.count(); i++)
|
||||||
|
{ // set the menu to checked (or not)
|
||||||
|
QAction *act = mapModeAct.at(i);
|
||||||
|
if (!act) continue;
|
||||||
|
if (act->data().toInt() == (int)m_map_mode)
|
||||||
|
act->setChecked(true);
|
||||||
|
}
|
||||||
|
QMenu mapModeSubMenu(tr("Map mode") + s, this);
|
||||||
|
for (int i = 0; i < mapModeAct.count(); i++)
|
||||||
|
mapModeSubMenu.addAction(mapModeAct.at(i));
|
||||||
|
menu.addMenu(&mapModeSubMenu);
|
||||||
|
|
||||||
|
menu.addSeparator();
|
||||||
|
|
||||||
QMenu copySubMenu(tr("Copy"), this);
|
QMenu copySubMenu(tr("Copy"), this);
|
||||||
copySubMenu.addAction(copyMouseLatLonToClipAct);
|
copySubMenu.addAction(copyMouseLatLonToClipAct);
|
||||||
copySubMenu.addAction(copyMouseLatToClipAct);
|
copySubMenu.addAction(copyMouseLatToClipAct);
|
||||||
@ -430,7 +490,7 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
|
|
||||||
QMenu zoomSubMenu(tr("&Zoom ") + "(" + QString::number(m_map->ZoomReal()) + ")", this);
|
QMenu zoomSubMenu(tr("&Zoom ") + "(" + QString::number(m_map->ZoomReal()) + ")", this);
|
||||||
for (int i = 0; i < zoomAct.count(); i++)
|
for (int i = 0; i < zoomAct.count(); i++)
|
||||||
zoomSubMenu.addAction(zoomAct.at(i));
|
zoomSubMenu.addAction(zoomAct.at(i));
|
||||||
menu.addMenu(&zoomSubMenu);
|
menu.addMenu(&zoomSubMenu);
|
||||||
|
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
@ -450,26 +510,36 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
menu.addAction(followUAVheadingAct);
|
menu.addAction(followUAVheadingAct);
|
||||||
menu.addAction(goUAVAct);
|
menu.addAction(goUAVAct);
|
||||||
|
|
||||||
menu.addSeparator()->setText(tr("Waypoints"));
|
menu.addAction(clearUAVtrailAct);
|
||||||
|
|
||||||
menu.addAction(wayPointEditorAct);
|
// *********
|
||||||
menu.addAction(addWayPointAct);
|
|
||||||
|
|
||||||
if (m_mouse_waypoint)
|
if (m_map_mode == Normal_MapMode)
|
||||||
{ // we have a waypoint under the mouse
|
{ // only show the waypoint stuff if not in 'magic waypoint' mode
|
||||||
menu.addAction(editWayPointAct);
|
|
||||||
|
|
||||||
lockWayPointAct->setChecked(waypoint_locked);
|
menu.addSeparator()->setText(tr("Waypoints"));
|
||||||
menu.addAction(lockWayPointAct);
|
|
||||||
|
|
||||||
if (!waypoint_locked)
|
menu.addAction(wayPointEditorAct);
|
||||||
menu.addAction(deleteWayPointAct);
|
menu.addAction(addWayPointAct);
|
||||||
|
|
||||||
|
if (m_mouse_waypoint)
|
||||||
|
{ // we have a waypoint under the mouse
|
||||||
|
menu.addAction(editWayPointAct);
|
||||||
|
|
||||||
|
lockWayPointAct->setChecked(waypoint_locked);
|
||||||
|
menu.addAction(lockWayPointAct);
|
||||||
|
|
||||||
|
if (!waypoint_locked)
|
||||||
|
menu.addAction(deleteWayPointAct);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_waypoint_list_mutex.lock();
|
||||||
|
if (m_waypoint_list.count() > 0)
|
||||||
|
menu.addAction(clearWayPointsAct); // we have waypoints
|
||||||
|
m_waypoint_list_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_waypoint_list_mutex.lock();
|
// *********
|
||||||
if (m_waypoint_list.count() > 0)
|
|
||||||
menu.addAction(clearWayPointsAct); // we have waypoints
|
|
||||||
m_waypoint_list_mutex.unlock();
|
|
||||||
|
|
||||||
// menu.addSeparator();
|
// menu.addSeparator();
|
||||||
|
|
||||||
@ -529,6 +599,8 @@ void OPMapGadgetWidget::updatePosition()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
QPointF pos = getLatLon();
|
QPointF pos = getLatLon();
|
||||||
|
|
||||||
internals::PointLatLng uav_pos = internals::PointLatLng(pos.x(), pos.y()); // current UAV position
|
internals::PointLatLng uav_pos = internals::PointLatLng(pos.x(), pos.y()); // current UAV position
|
||||||
@ -553,6 +625,8 @@ void OPMapGadgetWidget::updateMousePos()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
internals::PointLatLng lat_lon = m_map->currentMousePosition(); // fetch the current lat/lon mouse position
|
internals::PointLatLng lat_lon = m_map->currentMousePosition(); // fetch the current lat/lon mouse position
|
||||||
|
|
||||||
if (mouse_lat_lon == lat_lon)
|
if (mouse_lat_lon == lat_lon)
|
||||||
@ -666,8 +740,37 @@ void OPMapGadgetWidget::WPNumberChanged(int const &oldnumber, int const &newnumb
|
|||||||
|
|
||||||
void OPMapGadgetWidget::WPValuesChanged(WayPointItem *waypoint)
|
void OPMapGadgetWidget::WPValuesChanged(WayPointItem *waypoint)
|
||||||
{
|
{
|
||||||
Q_UNUSED(waypoint);
|
qDebug("WPValuesChanged");
|
||||||
// to do
|
|
||||||
|
switch (m_map_mode)
|
||||||
|
{
|
||||||
|
case Normal_MapMode:
|
||||||
|
m_waypoint_list_mutex.lock();
|
||||||
|
foreach (t_waypoint *wp, m_waypoint_list)
|
||||||
|
{ // search for the waypoint in our own waypoint list and update it
|
||||||
|
if (!wp) continue;
|
||||||
|
if (!wp->map_wp_item) continue;
|
||||||
|
if (wp->map_wp_item != waypoint) continue;
|
||||||
|
// found the waypoint in our list
|
||||||
|
wp->coord = waypoint->Coord();
|
||||||
|
wp->altitude = waypoint->Altitude();
|
||||||
|
wp->description = waypoint->Description();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_waypoint_list_mutex.unlock();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MagicWaypoint_MapMode:
|
||||||
|
// update our copy of the magic waypoint
|
||||||
|
if (magic_waypoint.map_wp_item && magic_waypoint.map_wp_item == waypoint)
|
||||||
|
{
|
||||||
|
magic_waypoint.coord = waypoint->Coord();
|
||||||
|
magic_waypoint.altitude = waypoint->Altitude();
|
||||||
|
magic_waypoint.description = waypoint->Description();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::WPInserted(int const &number, WayPointItem *waypoint)
|
void OPMapGadgetWidget::WPInserted(int const &number, WayPointItem *waypoint)
|
||||||
@ -732,16 +835,19 @@ void OPMapGadgetWidget::on_toolButtonFindPlace_clicked()
|
|||||||
|
|
||||||
void OPMapGadgetWidget::on_toolButtonZoomP_clicked()
|
void OPMapGadgetWidget::on_toolButtonZoomP_clicked()
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&m_map_mutex);
|
||||||
zoomIn();
|
zoomIn();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::on_toolButtonZoomM_clicked()
|
void OPMapGadgetWidget::on_toolButtonZoomM_clicked()
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&m_map_mutex);
|
||||||
zoomOut();
|
zoomOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::on_toolButtonMapHome_clicked()
|
void OPMapGadgetWidget::on_toolButtonMapHome_clicked()
|
||||||
{
|
{
|
||||||
|
QMutexLocker locker(&m_map_mutex);
|
||||||
goHome();
|
goHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -750,6 +856,8 @@ void OPMapGadgetWidget::on_toolButtonMapUAV_clicked()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
followUAVpositionAct->toggle();
|
followUAVpositionAct->toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -758,6 +866,8 @@ void OPMapGadgetWidget::on_toolButtonMapUAVheading_clicked()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
followUAVheadingAct->toggle();
|
followUAVheadingAct->toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,22 +876,18 @@ void OPMapGadgetWidget::on_toolButtonShowUAVtrail_clicked()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
showUAVtrailAct->toggle();
|
showUAVtrailAct->toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::on_toolButtonClearUAVtrail_clicked()
|
|
||||||
{
|
|
||||||
if (!m_widget || !m_map)
|
|
||||||
return;
|
|
||||||
|
|
||||||
clearUAVtrailAct->trigger();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OPMapGadgetWidget::on_horizontalSliderZoom_sliderMoved(int position)
|
void OPMapGadgetWidget::on_horizontalSliderZoom_sliderMoved(int position)
|
||||||
{
|
{
|
||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
setZoom(position);
|
setZoom(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -790,6 +896,8 @@ void OPMapGadgetWidget::on_toolButtonHome_clicked()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
// to do
|
// to do
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -799,6 +907,8 @@ void OPMapGadgetWidget::on_toolButtonPrevWaypoint_clicked()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
// to do
|
// to do
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -807,6 +917,8 @@ void OPMapGadgetWidget::on_toolButtonNextWaypoint_clicked()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
// to do
|
// to do
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -815,6 +927,8 @@ void OPMapGadgetWidget::on_toolButtonHoldPosition_clicked()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
// to do
|
// to do
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -823,6 +937,8 @@ void OPMapGadgetWidget::on_toolButtonGo_clicked()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
// to do
|
// to do
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -831,18 +947,38 @@ void OPMapGadgetWidget::on_toolButtonAddWaypoint_clicked()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_waypoint_list_mutex.lock();
|
if (m_map_mode != Normal_MapMode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QMutexLocker locker(&m_waypoint_list_mutex);
|
||||||
|
// m_waypoint_list_mutex.lock();
|
||||||
|
|
||||||
// create a waypoint at the center of the map
|
// create a waypoint at the center of the map
|
||||||
t_waypoint waypoint;
|
t_waypoint *wp = new t_waypoint;
|
||||||
waypoint.item = m_map->WPCreate(m_map->CurrentPosition(), 0);
|
wp->map_wp_item = NULL;
|
||||||
waypoint.time_seconds = 0;
|
wp->coord = m_map->CurrentPosition();
|
||||||
waypoint.hold_time_seconds = 0;
|
wp->altitude = 0;
|
||||||
|
wp->description = "";
|
||||||
|
wp->locked = false;
|
||||||
|
wp->time_seconds = 0;
|
||||||
|
wp->hold_time_seconds = 0;
|
||||||
|
wp->map_wp_item = m_map->WPCreate(wp->coord, wp->altitude, wp->description);
|
||||||
|
|
||||||
|
wp->map_wp_item->setFlag(QGraphicsItem::ItemIsMovable, !wp->locked);
|
||||||
|
|
||||||
|
if (wp->map_wp_item)
|
||||||
|
{
|
||||||
|
if (!wp->locked)
|
||||||
|
wp->map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
|
||||||
|
else
|
||||||
|
wp->map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker2.png"));
|
||||||
|
wp->map_wp_item->update();
|
||||||
|
}
|
||||||
|
|
||||||
// and remember it in our own local waypoint list
|
// and remember it in our own local waypoint list
|
||||||
m_waypoint_list.append(waypoint);
|
m_waypoint_list.append(wp);
|
||||||
|
|
||||||
m_waypoint_list_mutex.unlock();
|
// m_waypoint_list_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::on_treeViewWaypoints_clicked(QModelIndex index)
|
void OPMapGadgetWidget::on_treeViewWaypoints_clicked(QModelIndex index)
|
||||||
@ -850,12 +986,50 @@ void OPMapGadgetWidget::on_treeViewWaypoints_clicked(QModelIndex index)
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// QMutexLocker locker(&m_map_mutex);
|
||||||
|
|
||||||
QStandardItem *item = wayPoint_treeView_model.itemFromIndex(index);
|
QStandardItem *item = wayPoint_treeView_model.itemFromIndex(index);
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
|
|
||||||
// to do
|
// to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::on_toolButtonMapModeLeft_clicked()
|
||||||
|
{
|
||||||
|
switch (m_map_mode)
|
||||||
|
{
|
||||||
|
case Normal_MapMode:
|
||||||
|
setMapMode(MagicWaypoint_MapMode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MagicWaypoint_MapMode:
|
||||||
|
setMapMode(Normal_MapMode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
setMapMode(Normal_MapMode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::on_toolButtonMapModeRight_clicked()
|
||||||
|
{
|
||||||
|
switch (m_map_mode)
|
||||||
|
{
|
||||||
|
case Normal_MapMode:
|
||||||
|
setMapMode(MagicWaypoint_MapMode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MagicWaypoint_MapMode:
|
||||||
|
setMapMode(Normal_MapMode);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
setMapMode(Normal_MapMode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// *************************************************************************************
|
// *************************************************************************************
|
||||||
// public functions
|
// public functions
|
||||||
|
|
||||||
@ -991,6 +1165,81 @@ void OPMapGadgetWidget::setCacheLocation(QString cacheLocation)
|
|||||||
m_map->configuration->SetCacheLocation(cacheLocation);
|
m_map->configuration->SetCacheLocation(cacheLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::setMapMode(opMapModeType mode)
|
||||||
|
{
|
||||||
|
if (!m_widget || !m_map)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (mode != Normal_MapMode && mode != MagicWaypoint_MapMode)
|
||||||
|
mode = Normal_MapMode; // fix error
|
||||||
|
|
||||||
|
if (m_map_mode == mode)
|
||||||
|
return; // no change in map mode
|
||||||
|
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case Normal_MapMode:
|
||||||
|
m_map_mode = Normal_MapMode;
|
||||||
|
|
||||||
|
m_widget->labelMapMode->setText("Normal mode");
|
||||||
|
|
||||||
|
// delete the magic waypoint from the map
|
||||||
|
if (magic_waypoint.map_wp_item)
|
||||||
|
{
|
||||||
|
magic_waypoint.coord = magic_waypoint.map_wp_item->Coord();
|
||||||
|
magic_waypoint.altitude = magic_waypoint.map_wp_item->Altitude();
|
||||||
|
magic_waypoint.description = magic_waypoint.map_wp_item->Description();
|
||||||
|
magic_waypoint.map_wp_item = NULL;
|
||||||
|
}
|
||||||
|
m_map->WPDeleteAll();
|
||||||
|
|
||||||
|
// restore the normal waypoints on the map
|
||||||
|
m_waypoint_list_mutex.lock();
|
||||||
|
foreach (t_waypoint *wp, m_waypoint_list)
|
||||||
|
{
|
||||||
|
if (!wp) continue;
|
||||||
|
wp->map_wp_item = m_map->WPCreate(wp->coord, wp->altitude, wp->description);
|
||||||
|
if (!wp->map_wp_item) continue;
|
||||||
|
wp->map_wp_item->setFlag(QGraphicsItem::ItemIsMovable, !wp->locked);
|
||||||
|
if (!wp->locked)
|
||||||
|
wp->map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
|
||||||
|
else
|
||||||
|
wp->map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker2.png"));
|
||||||
|
wp->map_wp_item->update();
|
||||||
|
}
|
||||||
|
m_waypoint_list_mutex.unlock();
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MagicWaypoint_MapMode:
|
||||||
|
m_map_mode = MagicWaypoint_MapMode;
|
||||||
|
|
||||||
|
m_widget->labelMapMode->setText("Magic Waypoint mode");
|
||||||
|
|
||||||
|
// delete the normal waypoints from the map
|
||||||
|
m_waypoint_list_mutex.lock();
|
||||||
|
foreach (t_waypoint *wp, m_waypoint_list)
|
||||||
|
{
|
||||||
|
if (!wp) continue;
|
||||||
|
if (!wp->map_wp_item) continue;
|
||||||
|
wp->coord = wp->map_wp_item->Coord();
|
||||||
|
wp->altitude = wp->map_wp_item->Altitude();
|
||||||
|
wp->description = wp->map_wp_item->Description();
|
||||||
|
wp->locked = (wp->map_wp_item->flags() & QGraphicsItem::ItemIsMovable) == 0;
|
||||||
|
wp->map_wp_item = NULL;
|
||||||
|
}
|
||||||
|
m_map->WPDeleteAll();
|
||||||
|
m_waypoint_list_mutex.unlock();
|
||||||
|
|
||||||
|
// restore the magic waypoint on the map
|
||||||
|
magic_waypoint.map_wp_item = m_map->WPCreate(magic_waypoint.coord, magic_waypoint.altitude, magic_waypoint.description);
|
||||||
|
magic_waypoint.map_wp_item->SetShowNumber(false);
|
||||||
|
magic_waypoint.map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker3.png"));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// *************************************************************************************
|
// *************************************************************************************
|
||||||
// Context menu stuff
|
// Context menu stuff
|
||||||
|
|
||||||
@ -1126,6 +1375,25 @@ void OPMapGadgetWidget::createActions()
|
|||||||
clearWayPointsAct->setStatusTip(tr("Clear waypoints"));
|
clearWayPointsAct->setStatusTip(tr("Clear waypoints"));
|
||||||
connect(clearWayPointsAct, SIGNAL(triggered()), this, SLOT(onClearWayPointsAct_triggered()));
|
connect(clearWayPointsAct, SIGNAL(triggered()), this, SLOT(onClearWayPointsAct_triggered()));
|
||||||
|
|
||||||
|
mapModeActGroup = new QActionGroup(this);
|
||||||
|
connect(mapModeActGroup, SIGNAL(triggered(QAction *)), this, SLOT(onMapModeActGroup_triggered(QAction *)));
|
||||||
|
mapModeAct.clear();
|
||||||
|
{
|
||||||
|
QAction *map_mode_act;
|
||||||
|
|
||||||
|
map_mode_act = new QAction(tr("Normal"), mapModeActGroup);
|
||||||
|
map_mode_act->setCheckable(true);
|
||||||
|
map_mode_act->setChecked(m_map_mode == Normal_MapMode);
|
||||||
|
map_mode_act->setData((int)Normal_MapMode);
|
||||||
|
mapModeAct.append(map_mode_act);
|
||||||
|
|
||||||
|
map_mode_act = new QAction(tr("Magic Waypoint"), mapModeActGroup);
|
||||||
|
map_mode_act->setCheckable(true);
|
||||||
|
map_mode_act->setChecked(m_map_mode == MagicWaypoint_MapMode);
|
||||||
|
map_mode_act->setData((int)MagicWaypoint_MapMode);
|
||||||
|
mapModeAct.append(map_mode_act);
|
||||||
|
}
|
||||||
|
|
||||||
zoomActGroup = new QActionGroup(this);
|
zoomActGroup = new QActionGroup(this);
|
||||||
connect(zoomActGroup, SIGNAL(triggered(QAction *)), this, SLOT(onZoomActGroup_triggered(QAction *)));
|
connect(zoomActGroup, SIGNAL(triggered(QAction *)), this, SLOT(onZoomActGroup_triggered(QAction *)));
|
||||||
zoomAct.clear();
|
zoomAct.clear();
|
||||||
@ -1209,7 +1477,6 @@ void OPMapGadgetWidget::onShowHomeAct_toggled(bool show)
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// m_map->SetShowHome(show); // this can cause a rather big crash
|
|
||||||
m_map->Home->setVisible(show);
|
m_map->Home->setVisible(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1218,10 +1485,19 @@ void OPMapGadgetWidget::onShowUAVAct_toggled(bool show)
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// m_map->SetShowUAV(show); // this can cause a rather big crash
|
|
||||||
m_map->UAV->setVisible(show);
|
m_map->UAV->setVisible(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPMapGadgetWidget::onMapModeActGroup_triggered(QAction *action)
|
||||||
|
{
|
||||||
|
if (!m_widget || !m_map || !action)
|
||||||
|
return;
|
||||||
|
|
||||||
|
opMapModeType mode = (opMapModeType)action->data().toInt();
|
||||||
|
|
||||||
|
setMapMode(mode);
|
||||||
|
}
|
||||||
|
|
||||||
void OPMapGadgetWidget::onGoZoomInAct_triggered()
|
void OPMapGadgetWidget::onGoZoomInAct_triggered()
|
||||||
{
|
{
|
||||||
zoomIn();
|
zoomIn();
|
||||||
@ -1322,16 +1598,35 @@ void OPMapGadgetWidget::onAddWayPointAct_triggered()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (m_map_mode != Normal_MapMode)
|
||||||
|
return;
|
||||||
|
|
||||||
m_waypoint_list_mutex.lock();
|
m_waypoint_list_mutex.lock();
|
||||||
|
|
||||||
// create a waypoint on the map at the last known mouse position
|
// create a waypoint on the map at the last known mouse position
|
||||||
t_waypoint waypoint;
|
t_waypoint *wp = new t_waypoint;
|
||||||
waypoint.item = m_map->WPCreate(mouse_lat_lon, 0);
|
wp->map_wp_item = NULL;
|
||||||
waypoint.time_seconds = 0;
|
wp->coord = mouse_lat_lon;
|
||||||
waypoint.hold_time_seconds = 0;
|
wp->altitude = 0;
|
||||||
|
wp->description = "";
|
||||||
|
wp->locked = false;
|
||||||
|
wp->time_seconds = 0;
|
||||||
|
wp->hold_time_seconds = 0;
|
||||||
|
wp->map_wp_item = m_map->WPCreate(wp->coord, wp->altitude, wp->description);
|
||||||
|
|
||||||
// and remember it in our own local waypoint list
|
wp->map_wp_item->setFlag(QGraphicsItem::ItemIsMovable, !wp->locked);
|
||||||
m_waypoint_list.append(waypoint);
|
|
||||||
|
if (wp->map_wp_item)
|
||||||
|
{
|
||||||
|
if (!wp->locked)
|
||||||
|
wp->map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
|
||||||
|
else
|
||||||
|
wp->map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker2.png"));
|
||||||
|
wp->map_wp_item->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
// and remember it in our own local waypoint list
|
||||||
|
m_waypoint_list.append(wp);
|
||||||
|
|
||||||
m_waypoint_list_mutex.unlock();
|
m_waypoint_list_mutex.unlock();
|
||||||
}
|
}
|
||||||
@ -1341,7 +1636,11 @@ void OPMapGadgetWidget::onEditWayPointAct_triggered()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_mouse_waypoint) return;
|
if (m_map_mode != Normal_MapMode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_mouse_waypoint)
|
||||||
|
return;
|
||||||
|
|
||||||
waypoint_edit_dialog.editWaypoint(m_mouse_waypoint);
|
waypoint_edit_dialog.editWaypoint(m_mouse_waypoint);
|
||||||
|
|
||||||
@ -1350,14 +1649,21 @@ void OPMapGadgetWidget::onEditWayPointAct_triggered()
|
|||||||
|
|
||||||
void OPMapGadgetWidget::onLockWayPointAct_triggered()
|
void OPMapGadgetWidget::onLockWayPointAct_triggered()
|
||||||
{
|
{
|
||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map || !m_mouse_waypoint)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_mouse_waypoint) return;
|
if (m_map_mode != Normal_MapMode)
|
||||||
|
return;
|
||||||
|
|
||||||
bool locked = (m_mouse_waypoint->flags() & QGraphicsItem::ItemIsMovable) == 0;
|
bool locked = (m_mouse_waypoint->flags() & QGraphicsItem::ItemIsMovable) == 0;
|
||||||
m_mouse_waypoint->setFlag(QGraphicsItem::ItemIsMovable, locked);
|
m_mouse_waypoint->setFlag(QGraphicsItem::ItemIsMovable, locked);
|
||||||
|
|
||||||
|
if (!locked)
|
||||||
|
m_mouse_waypoint->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker2.png"));
|
||||||
|
else
|
||||||
|
m_mouse_waypoint->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
|
||||||
|
m_mouse_waypoint->update();
|
||||||
|
|
||||||
m_mouse_waypoint = NULL;
|
m_mouse_waypoint = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1366,30 +1672,51 @@ void OPMapGadgetWidget::onDeleteWayPointAct_triggered()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_mouse_waypoint) return;
|
if (m_map_mode != Normal_MapMode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!m_mouse_waypoint)
|
||||||
|
return;
|
||||||
|
|
||||||
bool locked = (m_mouse_waypoint->flags() & QGraphicsItem::ItemIsMovable) == 0;
|
bool locked = (m_mouse_waypoint->flags() & QGraphicsItem::ItemIsMovable) == 0;
|
||||||
|
|
||||||
if (locked) return; // waypoint is locked
|
if (locked) return; // waypoint is locked
|
||||||
|
|
||||||
m_waypoint_list_mutex.lock();
|
QMutexLocker locker(&m_waypoint_list_mutex);
|
||||||
|
|
||||||
for (int i = 0; i < m_waypoint_list.count(); i++)
|
for (int i = 0; i < m_waypoint_list.count(); i++)
|
||||||
{
|
{
|
||||||
t_waypoint waypoint = m_waypoint_list.at(i);
|
t_waypoint *wp = m_waypoint_list.at(i);
|
||||||
if (waypoint.item != m_mouse_waypoint) continue;
|
if (!wp) continue;
|
||||||
|
if (!wp->map_wp_item || wp->map_wp_item != m_mouse_waypoint) continue;
|
||||||
|
|
||||||
|
// delete the waypoint from the map
|
||||||
|
m_map->WPDelete(wp->map_wp_item);
|
||||||
|
|
||||||
|
// delete the waypoint from our local waypoint list
|
||||||
|
m_waypoint_list.removeAt(i);
|
||||||
|
|
||||||
|
delete wp;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
foreach (t_waypoint *wp, m_waypoint_list)
|
||||||
|
{
|
||||||
|
if (!wp) continue;
|
||||||
|
if (!wp->map_wp_item || wp->map_wp_item != m_mouse_waypoint) continue;
|
||||||
|
|
||||||
// delete the waypoint from the map
|
// delete the waypoint from the map
|
||||||
m_map->WPDelete(waypoint.item);
|
m_map->WPDelete(wp->map_wp_item);
|
||||||
|
|
||||||
// delete the waypoint from our local waypoint list
|
// delete the waypoint from our local waypoint list
|
||||||
m_waypoint_list.removeAt(i);
|
m_waypoint_list.removeOne(wp);
|
||||||
|
|
||||||
|
delete wp;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
m_waypoint_list_mutex.unlock();
|
|
||||||
|
|
||||||
m_mouse_waypoint = NULL;
|
m_mouse_waypoint = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1398,10 +1725,23 @@ void OPMapGadgetWidget::onClearWayPointsAct_triggered()
|
|||||||
if (!m_widget || !m_map)
|
if (!m_widget || !m_map)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_waypoint_list_mutex.lock();
|
if (m_map_mode != Normal_MapMode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QMutexLocker locker(&m_waypoint_list_mutex);
|
||||||
|
|
||||||
m_map->WPDeleteAll();
|
m_map->WPDeleteAll();
|
||||||
m_waypoint_list.clear();
|
|
||||||
m_waypoint_list_mutex.unlock();
|
foreach (t_waypoint *wp, m_waypoint_list)
|
||||||
|
{
|
||||||
|
if (wp)
|
||||||
|
{
|
||||||
|
delete wp;
|
||||||
|
wp = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_waypoint_list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// *************************************************************************************
|
// *************************************************************************************
|
||||||
|
@ -28,12 +28,15 @@
|
|||||||
#ifndef OPMAP_GADGETWIDGET_H_
|
#ifndef OPMAP_GADGETWIDGET_H_
|
||||||
#define OPMAP_GADGETWIDGET_H_
|
#define OPMAP_GADGETWIDGET_H_
|
||||||
|
|
||||||
|
// ******************************************************
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
#include <QtGui/QWidget>
|
||||||
#include <QtGui/QMenu>
|
#include <QtGui/QMenu>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
#include <QMutexLocker>
|
||||||
#include <QPointF>
|
#include <QPointF>
|
||||||
|
|
||||||
#include "opmapcontrol/opmapcontrol.h"
|
#include "opmapcontrol/opmapcontrol.h"
|
||||||
@ -51,6 +54,8 @@
|
|||||||
|
|
||||||
#include "utils/coordinateconversions.h"
|
#include "utils/coordinateconversions.h"
|
||||||
|
|
||||||
|
// ******************************************************
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
class OPMap_Widget;
|
class OPMap_Widget;
|
||||||
@ -63,13 +68,22 @@ using namespace mapcontrol;
|
|||||||
// local waypoint list item structure
|
// local waypoint list item structure
|
||||||
typedef struct t_waypoint
|
typedef struct t_waypoint
|
||||||
{
|
{
|
||||||
mapcontrol::WayPointItem *item;
|
mapcontrol::WayPointItem *map_wp_item;
|
||||||
|
internals::PointLatLng coord;
|
||||||
|
double altitude;
|
||||||
|
QString description;
|
||||||
|
bool locked;
|
||||||
int time_seconds;
|
int time_seconds;
|
||||||
int hold_time_seconds;
|
int hold_time_seconds;
|
||||||
} t_waypoint;
|
} t_waypoint;
|
||||||
|
|
||||||
// ******************************************************
|
// ******************************************************
|
||||||
|
|
||||||
|
enum opMapModeType { Normal_MapMode = 0,
|
||||||
|
MagicWaypoint_MapMode = 1};
|
||||||
|
|
||||||
|
// ******************************************************
|
||||||
|
|
||||||
class OPMapGadgetWidget : public QWidget
|
class OPMapGadgetWidget : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -92,6 +106,7 @@ public:
|
|||||||
void setAccessMode(QString accessMode);
|
void setAccessMode(QString accessMode);
|
||||||
void setUseMemoryCache(bool useMemoryCache);
|
void setUseMemoryCache(bool useMemoryCache);
|
||||||
void setCacheLocation(QString cacheLocation);
|
void setCacheLocation(QString cacheLocation);
|
||||||
|
void setMapMode(opMapModeType mode);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
@ -122,7 +137,6 @@ private slots:
|
|||||||
void on_toolButtonMapUAV_clicked();
|
void on_toolButtonMapUAV_clicked();
|
||||||
void on_toolButtonMapUAVheading_clicked();
|
void on_toolButtonMapUAVheading_clicked();
|
||||||
void on_toolButtonShowUAVtrail_clicked();
|
void on_toolButtonShowUAVtrail_clicked();
|
||||||
void on_toolButtonClearUAVtrail_clicked();
|
|
||||||
void on_horizontalSliderZoom_sliderMoved(int position);
|
void on_horizontalSliderZoom_sliderMoved(int position);
|
||||||
void on_toolButtonAddWaypoint_clicked();
|
void on_toolButtonAddWaypoint_clicked();
|
||||||
void on_treeViewWaypoints_clicked(QModelIndex index);
|
void on_treeViewWaypoints_clicked(QModelIndex index);
|
||||||
@ -131,6 +145,8 @@ private slots:
|
|||||||
void on_toolButtonPrevWaypoint_clicked();
|
void on_toolButtonPrevWaypoint_clicked();
|
||||||
void on_toolButtonHoldPosition_clicked();
|
void on_toolButtonHoldPosition_clicked();
|
||||||
void on_toolButtonGo_clicked();
|
void on_toolButtonGo_clicked();
|
||||||
|
void on_toolButtonMapModeLeft_clicked();
|
||||||
|
void on_toolButtonMapModeRight_clicked();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief signals received from the map object
|
* @brief signals received from the map object
|
||||||
@ -179,6 +195,7 @@ private slots:
|
|||||||
void onLockWayPointAct_triggered();
|
void onLockWayPointAct_triggered();
|
||||||
void onDeleteWayPointAct_triggered();
|
void onDeleteWayPointAct_triggered();
|
||||||
void onClearWayPointsAct_triggered();
|
void onClearWayPointsAct_triggered();
|
||||||
|
void onMapModeActGroup_triggered(QAction *action);
|
||||||
void onZoomActGroup_triggered(QAction *action);
|
void onZoomActGroup_triggered(QAction *action);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -191,6 +208,8 @@ private:
|
|||||||
|
|
||||||
int prev_tile_number;
|
int prev_tile_number;
|
||||||
|
|
||||||
|
opMapModeType m_map_mode;
|
||||||
|
|
||||||
QStringList findPlaceWordList;
|
QStringList findPlaceWordList;
|
||||||
QCompleter *findPlaceCompleter;
|
QCompleter *findPlaceCompleter;
|
||||||
|
|
||||||
@ -219,9 +238,13 @@ private:
|
|||||||
|
|
||||||
mapcontrol::WayPointItem *m_mouse_waypoint;
|
mapcontrol::WayPointItem *m_mouse_waypoint;
|
||||||
|
|
||||||
QList<t_waypoint> m_waypoint_list;
|
QList<t_waypoint *> m_waypoint_list;
|
||||||
QMutex m_waypoint_list_mutex;
|
QMutex m_waypoint_list_mutex;
|
||||||
|
|
||||||
|
t_waypoint magic_waypoint;
|
||||||
|
|
||||||
|
QMutex m_map_mutex;
|
||||||
|
|
||||||
void createActions();
|
void createActions();
|
||||||
|
|
||||||
QAction *closeAct;
|
QAction *closeAct;
|
||||||
@ -249,6 +272,9 @@ private:
|
|||||||
QAction *deleteWayPointAct;
|
QAction *deleteWayPointAct;
|
||||||
QAction *clearWayPointsAct;
|
QAction *clearWayPointsAct;
|
||||||
|
|
||||||
|
QActionGroup *mapModeActGroup;
|
||||||
|
QList<QAction *> mapModeAct;
|
||||||
|
|
||||||
QActionGroup *zoomActGroup;
|
QActionGroup *zoomActGroup;
|
||||||
QList<QAction *> zoomAct;
|
QList<QAction *> zoomAct;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user