Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
c58f1378
Commit
c58f1378
authored
Dec 03, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2349 from DonLakeFlyer/ItemAltitude
Show altitude in mission item
parents
e1deebcf
3a4849b3
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
63 additions
and
324 deletions
+63
-324
FlightDisplayViewMap.qml
src/FlightDisplay/FlightDisplayViewMap.qml
+0
-12
MissionItemIndicator.qml
src/FlightMap/MapItems/MissionItemIndicator.qml
+24
-5
MissionItemView.qml
src/FlightMap/MapItems/MissionItemView.qml
+5
-2
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+5
-278
MissionController.cc
src/MissionManager/MissionController.cc
+7
-1
MissionItem.h
src/MissionManager/MissionItem.h
+1
-0
MissionItemEditor.qml
src/QmlControls/MissionItemEditor.qml
+9
-15
MissionItemIndexLabel.qml
src/QmlControls/MissionItemIndexLabel.qml
+12
-11
No files found.
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
c58f1378
...
...
@@ -59,18 +59,6 @@ FlightMap {
Component.onCompleted
:
start
(
false
/* editMode */
)
}
// Home position
MissionItemIndicator
{
label
:
"
H
"
coordinate
:
(
_activeVehicle
&&
_activeVehicle
.
homePositionAvailable
)
?
_activeVehicle
.
homePosition
:
QtPositioning
.
coordinate
(
0
,
0
)
visible
:
{
if
(
!
_mainIsMap
)
return
false
;
return
_activeVehicle
?
_activeVehicle
.
homePositionAvailable
:
false
}
z
:
QGroundControl
.
zOrderMapItems
}
// Add trajectory points to the map
MapItemView
{
model
:
_mainIsMap
?
multiVehicleManager
.
activeVehicle
?
multiVehicleManager
.
activeVehicle
.
trajectoryPoints
:
0
:
0
...
...
src/FlightMap/MapItems/MissionItemIndicator.qml
View file @
c58f1378
...
...
@@ -32,18 +32,37 @@ import QGroundControl.Vehicle 1.0
MapQuickItem
{
id
:
_item
property
alias
label
:
_label
.
label
property
alias
isCurrentItem
:
_label
.
isCurrentItem
property
var
missionItem
signal
clicked
anchorPoint.x
:
sourceItem
.
width
/
2
anchorPoint.y
:
sourceItem
.
height
/
2
Connections
{
target
:
missionItem
onCoordinateChanged
:
recalcLabel
()
onRelativeAltitudeChanged
:
recalcLabel
()
}
Component.onCompleted
:
recalcLabel
()
function
recalcLabel
()
{
var
label
=
Math
.
round
(
object
.
coordinate
.
altitude
)
if
(
!
object
.
relativeAltitude
)
{
label
=
"
=
"
+
label
}
if
(
object
.
homePosition
)
{
label
=
"
H
"
+
label
}
_label
.
label
=
label
}
sourceItem
:
MissionItemIndexLabel
{
id
:
_label
isCurrentItem
:
missionItem
.
isCurrentItem
onClicked
:
_item
.
clicked
()
}
}
src/FlightMap/MapItems/MissionItemView.qml
View file @
c58f1378
...
...
@@ -39,11 +39,10 @@ MapItemView {
delegate
:
MissionItemIndicator
{
id
:
itemIndicator
label
:
object
.
homePosition
?
"
H
"
:
object
.
sequenceNumber
isCurrentItem
:
object
.
isCurrentItem
coordinate
:
object
.
coordinate
visible
:
object
.
specifiesCoordinate
&&
(
!
object
.
homePosition
||
object
.
homePositionValid
)
z
:
QGroundControl
.
zOrderMapItems
missionItem
:
object
onClicked
:
setCurrentItem
(
object
.
sequenceNumber
)
...
...
@@ -71,6 +70,9 @@ MapItemView {
}
}
/*
Turned off for now
// These are the non-coordinate child mission items attached to this item
Row {
anchors.top: parent.top
...
...
@@ -88,5 +90,6 @@ MapItemView {
}
}
}
*/
}
}
src/MissionEditor/MissionEditor.qml
View file @
c58f1378
...
...
@@ -313,11 +313,10 @@ QGCView {
MissionItemIndicator
{
id
:
itemIndicator
label
:
object
.
homePosition
?
"
H
"
:
object
.
sequenceNumber
isCurrentItem
:
object
.
isCurrentItem
coordinate
:
object
.
coordinate
visible
:
object
.
specifiesCoordinate
&&
(
!
object
.
homePosition
||
object
.
homePositionValid
)
z
:
QGroundControl
.
zOrderMapItems
missionItem
:
object
onClicked
:
setCurrentItem
(
object
.
sequenceNumber
)
...
...
@@ -348,6 +347,9 @@ QGCView {
onCommandChanged
:
updateItemIndicator
()
}
/*
Disabled for now: Not sure if they will come back
// These are the non-coordinate child mission items attached to this item
Row {
anchors.top: parent.top
...
...
@@ -365,6 +367,7 @@ QGCView {
}
}
}
*/
}
}
...
...
@@ -414,282 +417,6 @@ QGCView {
}
// ListView
}
// Item - Mission Item editor
/*
Home Position Manager temporarily disbled till more work is done on it
// Home Position Manager
Rectangle {
id: homePositionManager
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
width: _rightPanelWidth
visible: homePositionManagerButton.checked
color: qgcPal.window
opacity: _rightPanelOpacity
z: QGroundControl.zOrderTopMost
Column {
anchors.margins: _margin
anchors.fill: parent
visible: !liveHomePositionAvailable
QGCLabel {
font.pixelSize: ScreenTools.mediumFontPixelSize
text: "Flying Field Manager"
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: "This is used to save locations associated with your flying field for use while creating missions with no vehicle connection."
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight
}
QGCLabel {
text: "Select field to use:"
}
QGCComboBox {
id: homePosCombo
width: parent.width
textRole: "text"
model: _homePositionManager.homePositions
onCurrentIndexChanged: {
if (currentIndex != -1) {
var homePos = _homePositionManager.homePositions.get(currentIndex)
_homePositionName = homePos.name
offlineHomePosition = homePos.coordinate
editorMap.latitude = offlineHomePosition.latitude
editorMap.longitude = offlineHomePosition.longitude
}
}
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: "To add a new flying field, click on the Map to set the position. " +
"Then give it a new name and click Add/Update. " +
"To change the current field position, click on the Map to set the new position. " +
"Then click Add/Update without changing the name."
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight / 3
}
Item {
width: parent.width
height: nameField.height
QGCLabel {
anchors.baseline: nameField.baseline
text: "Name:"
}
QGCTextField {
id: nameField
anchors.right: parent.right
width: _editFieldWidth
text: _homePositionName
}
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight / 3
}
Item {
width: parent.width
height: offlineLatitudeField.height
QGCLabel {
anchors.baseline: offlineLatitudeField.baseline
text: "Lat:"
}
QGCTextField {
id: offlineLatitudeField
anchors.right: parent.right
width: _editFieldWidth
text: offlineHomePosition.latitude
}
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight / 3
}
Item {
width: parent.width
height: offlineLongitudeField.height
QGCLabel {
anchors.baseline: offlineLongitudeField.baseline
text: "Lon:"
}
QGCTextField {
id: offlineLongitudeField
anchors.right: parent.right
width: _editFieldWidth
text: offlineHomePosition.longitude
}
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight / 3
}
Item {
width: parent.width
height: offlineAltitudeField.height
QGCLabel {
anchors.baseline: offlineAltitudeField.baseline
text: "Alt:"
}
QGCTextField {
id: offlineAltitudeField
anchors.right: parent.right
width: _editFieldWidth
text: offlineHomePosition.altitude
}
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCButton {
text: "Add/Update"
onClicked: {
offlineHomePosition = QtPositioning.coordinate(latitudeField.text, longitudeField.text, altitudeField.text)
_homePositionManager.updateHomePosition(nameField.text, offlineHomePosition)
homePosCombo.currentIndex = homePosCombo.find(nameField.text)
}
}
QGCButton {
text: "Delete"
onClicked: {
homePosCombo.currentIndex = -1
_homePositionManager.deleteHomePosition(nameField.text)
homePosCombo.currentIndex = 0
var homePos = _homePositionManager.homePositions.get(0)
_homePositionName = homePos.name
offlineHomePosition = homePos.coordinate
}
}
}
} // Column - Offline view
Column {
anchors.margins: _margin
anchors.fill: parent
visible: liveHomePositionAvailable
QGCLabel {
font.pixelSize: ScreenTools.mediumFontPixelSize
text: "Vehicle Home Position"
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight
}
Item {
width: parent.width
height: liveLatitudeField.height
QGCLabel {
anchors.baseline: liveLatitudeField.baseline
text: "Lat:"
}
QGCLabel {
id: liveLatitudeField
anchors.right: parent.right
width: _editFieldWidth
text: liveHomePosition.latitude
}
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight / 3
}
Item {
width: parent.width
height: liveLongitudeField.height
QGCLabel {
anchors.baseline: liveLongitudeField.baseline
text: "Lon:"
}
QGCLabel {
id: liveLongitudeField
anchors.right: parent.right
width: _editFieldWidth
text: liveHomePosition.longitude
}
}
Item {
width: 10
height: ScreenTools.defaultFontPixelHeight / 3
}
Item {
width: parent.width
height: liveAltitudeField.height
QGCLabel {
anchors.baseline: liveAltitudeField.baseline
text: "Alt:"
}
QGCLabel {
id: liveAltitudeField
anchors.right: parent.right
width: _editFieldWidth
text: liveHomePosition.altitude
}
}
} // Column - Online view
} // Item - Home Position Manager
*/
//-- Dismiss Drop Down (if any)
MouseArea
{
anchors.fill
:
parent
...
...
src/MissionManager/MissionController.cc
View file @
c58f1378
...
...
@@ -431,6 +431,10 @@ void MissionController::_initAllMissionItems(void)
// Add the home position item to the front
homeItem
=
new
MissionItem
(
this
);
homeItem
->
setHomePositionSpecialCase
(
true
);
if
(
_activeVehicle
)
{
homeItem
->
setCoordinate
(
_activeVehicle
->
homePosition
());
homeItem
->
setHomePositionValid
(
_activeVehicle
->
homePositionAvailable
());
}
homeItem
->
setCommand
(
MavlinkQmlSingleton
::
MAV_CMD_NAV_LAST
);
homeItem
->
setFrame
(
MAV_FRAME_GLOBAL_RELATIVE_ALT
);
homeItem
->
setSequenceNumber
(
0
);
...
...
@@ -548,6 +552,7 @@ void MissionController::_activeVehicleHomePositionAvailableChanged(bool homePosi
_liveHomePositionAvailable
=
homePositionAvailable
;
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
))
->
setHomePositionValid
(
homePositionAvailable
);
emit
liveHomePositionAvailableChanged
(
_liveHomePositionAvailable
);
_recalcWaypointLines
();
}
void
MissionController
::
_activeVehicleHomePositionChanged
(
const
QGeoCoordinate
&
homePosition
)
...
...
@@ -555,6 +560,7 @@ void MissionController::_activeVehicleHomePositionChanged(const QGeoCoordinate&
_liveHomePosition
=
homePosition
;
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
))
->
setCoordinate
(
_liveHomePosition
);
emit
liveHomePositionChanged
(
_liveHomePosition
);
_recalcWaypointLines
();
}
void
MissionController
::
deleteCurrentMissionItem
(
void
)
...
...
src/MissionManager/MissionItem.h
View file @
c58f1378
...
...
@@ -82,6 +82,7 @@ public:
Q_PROPERTY
(
bool
homePositionValid
READ
homePositionValid
WRITE
setHomePositionValid
NOTIFY
homePositionValidChanged
)
///< true: Home position should be shown
Q_PROPERTY
(
bool
isCurrentItem
READ
isCurrentItem
WRITE
setIsCurrentItem
NOTIFY
isCurrentItemChanged
)
Q_PROPERTY
(
bool
rawEdit
READ
rawEdit
WRITE
setRawEdit
NOTIFY
rawEditChanged
)
///< true: raw item editing with all params
Q_PROPERTY
(
bool
relativeAltitude
READ
relativeAltitude
NOTIFY
frameChanged
)
Q_PROPERTY
(
int
sequenceNumber
READ
sequenceNumber
WRITE
setSequenceNumber
NOTIFY
sequenceNumberChanged
)
Q_PROPERTY
(
bool
standaloneCoordinate
READ
standaloneCoordinate
NOTIFY
commandChanged
)
Q_PROPERTY
(
bool
specifiesCoordinate
READ
specifiesCoordinate
NOTIFY
commandChanged
)
...
...
src/QmlControls/MissionItemEditor.qml
View file @
c58f1378
...
...
@@ -49,11 +49,11 @@ Rectangle {
onClicked
:
_root
.
clicked
()
}
MissionItemIndex
Label
{
QGC
Label
{
id
:
label
anchors.verticalCenter
:
commandPicker
.
verticalCenter
isCurrentItem
:
missionItem
.
isCurrentItem
label
:
missionItem
.
sequenceNumber
==
0
?
"
H
"
:
missionItem
.
sequenceNumber
color
:
missionItem
.
isCurrentItem
?
qgcPal
.
buttonHighlightText
:
qgcPal
.
buttonText
text
:
missionItem
.
sequenceNumber
==
0
?
"
H
"
:
missionItem
.
sequenceNumber
}
Image
{
...
...
@@ -92,19 +92,13 @@ Rectangle {
onClicked
:
qgcView
.
showDialog
(
commandDialog
,
"
Select Mission Command
"
,
40
,
StandardButton
.
Cancel
)
}
Rectangle
{
QGCLabel
{
anchors.fill
:
commandPicker
color
:
qgcPal
.
button
visible
:
missionItem
.
sequenceNumber
==
0
||
!
missionItem
.
isCurrentItem
QGCLabel
{
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.fill
:
parent
verticalAlignment
:
Text
.
AlignVCenter
text
:
missionItem
.
sequenceNumber
==
0
?
"
Home
"
:
missionItem
.
commandName
color
:
qgcPal
.
buttonText
}
}
Rectangle
{
id
:
valuesRect
...
...
src/QmlControls/MissionItemIndexLabel.qml
View file @
c58f1378
...
...
@@ -11,27 +11,28 @@ Rectangle {
signal
clicked
readonly
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
4
QGCPalette
{
id
:
qgcPal
}
width
:
ScreenTools
.
mediumFontPixelSize
*
1.5
height
:
width
radius
:
width
/
2
border.width
:
2
width
:
_label
.
width
+
(
_margin
*
2
)
height
:
_label
.
height
+
(
_margin
*
2
)
radius
:
_margin
border.width
:
1
border.color
:
"
white
"
color
:
isCurrentItem
?
"
green
"
:
qgcPal
.
mapButtonHighlight
MouseArea
{
anchors.fill
:
parent
onClicked
:
parent
.
clicked
()
}
QGCLabel
{
id
:
_label
anchors.
fill
:
parent
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
anchors.
margins
:
_margin
anchors.left
:
parent
.
left
anchors.top
:
parent
.
top
color
:
"
white
"
font.pixelSize
:
ScreenTools
.
medium
FontPixelSize
font.pixelSize
:
ScreenTools
.
default
FontPixelSize
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment