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
7303aafc
Commit
7303aafc
authored
Sep 12, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add relative altitude support
Also much other cleanup/change
parent
cd2d960a
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
225 additions
and
180 deletions
+225
-180
MissionItem.cc
src/MissionItem.cc
+132
-69
MissionItem.h
src/MissionItem.h
+18
-14
MissionItemEditor.qml
src/QmlControls/MissionItemEditor.qml
+63
-92
QmlObjectListModel.cc
src/QmlControls/QmlObjectListModel.cc
+0
-1
QmlObjectListModel.h
src/QmlControls/QmlObjectListModel.h
+7
-3
Vehicle.cc
src/Vehicle/Vehicle.cc
+5
-1
No files found.
src/MissionItem.cc
View file @
7303aafc
This diff is collapsed.
Click to expand it.
src/MissionItem.h
View file @
7303aafc
...
...
@@ -60,7 +60,7 @@ public:
Q_PROPERTY
(
int
sequenceNumber
READ
sequenceNumber
WRITE
setSequenceNumber
NOTIFY
sequenceNumberChanged
)
Q_PROPERTY
(
bool
isCurrentItem
READ
isCurrentItem
WRITE
setIsCurrentItem
NOTIFY
isCurrentItemChanged
)
Q_PROPERTY
(
bool
specifiesCoordinate
READ
specifiesCoordinate
NOTIFY
specifiesCoordinate
Changed
)
Q_PROPERTY
(
bool
specifiesCoordinate
READ
specifiesCoordinate
NOTIFY
command
Changed
)
Q_PROPERTY
(
QGeoCoordinate
coordinate
READ
coordinate
WRITE
setCoordinate
NOTIFY
coordinateChanged
)
Q_PROPERTY
(
double
yaw
READ
yawDegrees
WRITE
setYawDegrees
NOTIFY
yawChanged
)
Q_PROPERTY
(
QStringList
commandNames
READ
commandNames
CONSTANT
)
...
...
@@ -68,8 +68,8 @@ public:
Q_PROPERTY
(
QStringList
valueLabels
READ
valueLabels
NOTIFY
commandChanged
)
Q_PROPERTY
(
QStringList
valueStrings
READ
valueStrings
NOTIFY
valueStringsChanged
)
Q_PROPERTY
(
int
commandByIndex
READ
commandByIndex
WRITE
setCommandByIndex
NOTIFY
commandChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
facts
READ
facts
NOTIFY
commandChanged
)
Q_PROPERTY
(
int
factCount
READ
factCount
NOTIFY
commandChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
textFieldFacts
READ
textFieldFacts
NOTIFY
commandChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
checkboxFacts
READ
checkboxFacts
NOTIFY
commandChanged
)
Q_PROPERTY
(
MavlinkQmlSingleton
::
Qml_MAV_CMD
command
READ
command
WRITE
setCommand
NOTIFY
commandChanged
)
// Property accesors
...
...
@@ -82,7 +82,7 @@ public:
bool
specifiesCoordinate
(
void
)
const
;
QGeoCoordinate
coordinate
(
void
)
const
{
return
_coordinate
;
}
QGeoCoordinate
coordinate
(
void
)
const
;
void
setCoordinate
(
const
QGeoCoordinate
&
coordinate
);
QStringList
commandNames
(
void
);
...
...
@@ -97,17 +97,17 @@ public:
QStringList
valueLabels
(
void
);
QStringList
valueStrings
(
void
);
QmlObjectListModel
*
f
acts
(
void
);
int
factCount
(
void
);
QmlObjectListModel
*
textFieldF
acts
(
void
);
QmlObjectListModel
*
checkboxFacts
(
void
);
double
yawDegrees
(
void
)
const
;
void
setYawDegrees
(
double
yaw
);
// C++ only methods
double
latitude
(
void
)
const
{
return
_
coordinate
.
latitud
e
();
}
double
longitude
(
void
)
const
{
return
_
coordinate
.
longitud
e
();
}
double
altitude
(
void
)
const
{
return
_
coordinate
.
altitud
e
();
}
double
latitude
(
void
)
const
{
return
_
latitudeFact
->
value
().
toDoubl
e
();
}
double
longitude
(
void
)
const
{
return
_
longitudeFact
->
value
().
toDoubl
e
();
}
double
altitude
(
void
)
const
{
return
_
altitudeFact
->
value
().
toDoubl
e
();
}
void
setLatitude
(
double
latitude
);
void
setLongitude
(
double
longitude
);
...
...
@@ -158,9 +158,8 @@ public:
return
altitude
();
}
// MAV_FRAME
int
frame
()
const
{
return
_frame
;
}
int
frame
()
const
;
// MAV_CMD
int
command
()
const
{
return
_command
;
...
...
@@ -176,7 +175,6 @@ public:
signals:
void
sequenceNumberChanged
(
int
sequenceNumber
);
void
specifiesCoordinateChanged
(
bool
specifiesCoordinate
);
void
isCurrentItemChanged
(
bool
isCurrentItem
);
void
coordinateChanged
(
const
QGeoCoordinate
&
coordinate
);
void
yawChanged
(
double
yaw
);
...
...
@@ -226,17 +224,20 @@ private:
}
MavCmd2Name_t
;
int
_sequenceNumber
;
QGeoCoordinate
_coordinate
;
int
_frame
;
MavlinkQmlSingleton
::
Qml_MAV_CMD
_command
;
bool
_autocontinue
;
bool
_isCurrentItem
;
quint64
_reachedTime
;
Fact
*
_latitudeFact
;
Fact
*
_longitudeFact
;
Fact
*
_altitudeFact
;
Fact
*
_yawRadiansFact
;
Fact
*
_loiterOrbitRadiusFact
;
Fact
*
_param1Fact
;
Fact
*
_param2Fact
;
Fact
*
_altitudeRelativeToHomeFact
;
FactMetaData
*
_pitchMetaData
;
FactMetaData
*
_acceptanceRadiusMetaData
;
...
...
@@ -251,4 +252,7 @@ private:
static
const
MavCmd2Name_t
_rgMavCmd2Name
[
_cMavCmd2Name
];
};
QDebug
operator
<<
(
QDebug
dbg
,
const
MissionItem
&
missionItem
);
QDebug
operator
<<
(
QDebug
dbg
,
const
MissionItem
*
missionItem
);
#endif
src/QmlControls/MissionItemEditor.qml
View file @
7303aafc
...
...
@@ -20,13 +20,14 @@ Rectangle {
signal
moveUp
signal
moveDown
// FIXME: THis doesn't work right for RTL
height
:
missionItem
.
isCurrentItem
?
((
missionItem
.
factCount
+
(
missionItem
.
specifiesCoordinate
?
3
:
0
))
*
(
latitudeField
.
height
+
_margin
))
+
commandPicker
.
height
+
deleteButton
.
height
+
(
_margin
*
6
)
:
(
missionItem
.
textFieldFacts
.
count
*
(
measureTextField
.
height
+
_margin
))
+
(
missionItem
.
checkboxFacts
.
count
*
(
measureCheckbox
.
height
+
_margin
))
+
commandPicker
.
height
+
deleteButton
.
height
+
(
_margin
*
9
)
:
commandPicker
.
height
+
(
_margin
*
2
)
color
:
missionItem
.
isCurrentItem
?
qgcPal
.
buttonHighlight
:
qgcPal
.
windowShade
readonly
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
1
3
readonly
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
1
6
readonly
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
3
QGCPalette
{
...
...
@@ -34,6 +35,16 @@ Rectangle {
colorGroupEnabled
:
enabled
}
QGCTextField
{
id
:
measureTextField
visible
:
false
}
QGCCheckBox
{
id
:
measureCheckbox
visible
:
false
}
Item
{
anchors.margins
:
_margin
anchors.fill
:
parent
...
...
@@ -65,7 +76,7 @@ Rectangle {
}
Rectangle
{
anchors.
margins
:
_margin
anchors.
topMargin
:
_margin
anchors.top
:
commandPicker
.
bottom
anchors.bottom
:
parent
.
bottom
anchors.left
:
parent
.
left
...
...
@@ -77,76 +88,18 @@ Rectangle {
anchors.margins
:
_margin
anchors.fill
:
parent
QGCTextField
{
id
:
latitudeField
anchors.right
:
parent
.
right
width
:
_editFieldWidth
text
:
missionItem
.
coordinate
.
latitude
visible
:
missionItem
.
specifiesCoordinate
onAccepted
:
missionItem
.
coordinate
.
latitude
=
text
}
QGCTextField
{
id
:
longitudeField
anchors.topMargin
:
_margin
anchors.top
:
latitudeField
.
bottom
anchors.right
:
parent
.
right
width
:
_editFieldWidth
text
:
missionItem
.
coordinate
.
longitude
visible
:
missionItem
.
specifiesCoordinate
onAccepted
:
missionItem
.
coordinate
.
longtitude
=
text
}
QGCTextField
{
id
:
altitudeField
anchors.topMargin
:
_margin
anchors.top
:
longitudeField
.
bottom
anchors.right
:
parent
.
right
width
:
_editFieldWidth
text
:
missionItem
.
coordinate
.
altitude
visible
:
missionItem
.
specifiesCoordinate
showUnits
:
true
unitsLabel
:
"
meters
"
onAccepted
:
missionItem
.
coordinate
.
altitude
=
text
}
QGCLabel
{
anchors.left
:
parent
.
left
anchors.baseline
:
latitudeField
.
baseline
text
:
"
Lat:
"
visible
:
missionItem
.
specifiesCoordinate
}
QGCLabel
{
anchors.left
:
parent
.
left
anchors.baseline
:
longitudeField
.
baseline
text
:
"
Long:
"
visible
:
missionItem
.
specifiesCoordinate
}
QGCLabel
{
anchors.left
:
parent
.
left
anchors.baseline
:
altitudeField
.
baseline
text
:
"
Alt:
"
visible
:
missionItem
.
specifiesCoordinate
}
Column
{
id
:
valueColumn
anchors.topMargin
:
_margin
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
missionItem
.
specifiesCoordinate
?
altitudeField
.
bottom
:
parent
.
top
spacing
:
_margin
id
:
valuesColumn
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
spacing
:
_margin
Repeater
{
model
:
missionItem
.
f
acts
model
:
missionItem
.
textFieldF
acts
Item
{
width
:
valueColumn
.
width
width
:
value
s
Column
.
width
height
:
textField
.
height
QGCLabel
{
...
...
@@ -163,39 +116,57 @@ Rectangle {
}
}
}
}
// Column - Values column
Row
{
anchors.topMargin
:
_margin
anchors.top
:
valueColumn
.
bottom
width
:
parent
.
width
spacing
:
_margin
Item
{
width
:
10
height
:
missionItem
.
textFieldFacts
.
count
?
_margin
:
0
}
readonly
property
real
buttonWidth
:
(
width
-
(
_margin
*
2
))
/
3
Repeater
{
model
:
missionItem
.
checkboxFacts
QGCButton
{
id
:
deleteButton
width
:
parent
.
buttonWidth
text
:
"
Delete
"
FactCheckBox
{
id
:
textField
text
:
object
.
name
fact
:
object
}
}
onClicked
:
_root
.
remove
()
Item
{
width
:
10
height
:
missionItem
.
checkboxFacts
.
count
?
_margin
:
0
}
QGCButton
{
width
:
parent
.
buttonW
idth
text
:
"
Up
"
Row
{
width
:
parent
.
w
idth
spacing
:
_margin
onClicked
:
_root
.
moveUp
()
}
readonly
property
real
buttonWidth
:
(
width
-
(
_margin
*
2
))
/
3
QGCButton
{
id
:
deleteButton
width
:
parent
.
buttonWidth
text
:
"
Delete
"
onClicked
:
_root
.
remove
()
}
QGCButton
{
width
:
parent
.
buttonWidth
text
:
"
Down
"
QGCButton
{
width
:
parent
.
buttonWidth
text
:
"
Up
"
onClicked
:
_root
.
moveDown
()
onClicked
:
_root
.
moveUp
()
}
QGCButton
{
width
:
parent
.
buttonWidth
text
:
"
Down
"
onClicked
:
_root
.
moveDown
()
}
}
}
}
// Column
}
// Item
}
// Rectangle
}
// Item
...
...
src/QmlControls/QmlObjectListModel.cc
View file @
7303aafc
...
...
@@ -117,7 +117,6 @@ bool QmlObjectListModel::removeRows(int position, int rows, const QModelIndex& p
//_objectList[position]->deleteLater();
_objectList
.
removeAt
(
position
);
}
qDebug
()
<<
_objectList
;
endRemoveRows
();
emit
countChanged
(
count
());
...
...
src/QmlControls/QmlObjectListModel.h
View file @
7303aafc
...
...
@@ -46,6 +46,13 @@ public:
QObject
*
operator
[](
int
i
);
const
QObject
*
operator
[](
int
i
)
const
;
template
<
class
T
>
const
QList
<
T
*>&
list
(
void
)
{
return
*
((
QList
<
T
*>*
)((
void
*
)(
&
_objectList
)));
}
signals:
void
countChanged
(
int
count
);
private:
// Overrides from QAbstractListModel
virtual
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
;
virtual
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
;
...
...
@@ -53,9 +60,6 @@ public:
virtual
bool
insertRows
(
int
position
,
int
rows
,
const
QModelIndex
&
index
=
QModelIndex
());
virtual
bool
removeRows
(
int
position
,
int
rows
,
const
QModelIndex
&
index
=
QModelIndex
());
virtual
bool
setData
(
const
QModelIndex
&
index
,
const
QVariant
&
value
,
int
role
=
Qt
::
EditRole
);
signals:
void
countChanged
(
int
count
);
private:
QList
<
QObject
*>
_objectList
;
...
...
src/Vehicle/Vehicle.cc
View file @
7303aafc
...
...
@@ -936,5 +936,9 @@ void Vehicle::setActive(bool active)
QmlObjectListModel
*
Vehicle
::
missionItemsModel
(
void
)
{
return
&
_missionItems
;
if
(
qgcApp
()
->
useNewMissionEditor
())
{
return
missionManager
()
->
missionItems
();
}
else
{
return
&
_missionItems
;
}
}
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