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
b3dac085
Commit
b3dac085
authored
Mar 02, 2017
by
Don Gagne
Committed by
GitHub
Mar 02, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4678 from DonLakeFlyer/MapVisuals
Change to use new dynamic map visual system
parents
6bdd7e5b
c68f3790
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
183 additions
and
29 deletions
+183
-29
qgroundcontrol.qrc
qgroundcontrol.qrc
+3
-2
FWLandingPatternMapVisual.qml
src/MissionEditor/FWLandingPatternMapVisual.qml
+7
-7
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+3
-9
MissionItemMapVisual.qml
src/MissionEditor/MissionItemMapVisual.qml
+4
-4
SimpleItemMapVisual.qml
src/MissionEditor/SimpleItemMapVisual.qml
+157
-0
SurveyMapVisual.qml
src/MissionEditor/SurveyMapVisual.qml
+0
-0
ComplexMissionItem.h
src/MissionManager/ComplexMissionItem.h
+0
-4
SimpleMissionItem.h
src/MissionManager/SimpleMissionItem.h
+1
-0
SurveyMissionItem.h
src/MissionManager/SurveyMissionItem.h
+1
-1
VisualMissionItem.h
src/MissionManager/VisualMissionItem.h
+4
-0
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+3
-2
No files found.
qgroundcontrol.qrc
View file @
b3dac085
...
...
@@ -50,7 +50,6 @@
<file alias="PX4FlowSensor.qml">src/VehicleSetup/PX4FlowSensor.qml</file>
<file alias="QGroundControl/Controls/AnalyzePage.qml">src/AnalyzeView/AnalyzePage.qml</file>
<file alias="QGroundControl/Controls/AppMessages.qml">src/QmlControls/AppMessages.qml</file>
<file alias="QGroundControl/Controls/ComplexMissionItem.qml">src/MissionEditor/ComplexMissionItem.qml</file>
<file alias="QGroundControl/Controls/ClickableColor.qml">src/QmlControls/ClickableColor.qml</file>
<file alias="QGroundControl/Controls/DropButton.qml">src/QmlControls/DropButton.qml</file>
<file alias="QGroundControl/Controls/ExclusiveGroupItem.qml">src/QmlControls/ExclusiveGroupItem.qml</file>
...
...
@@ -66,6 +65,7 @@
<file alias="QGroundControl/Controls/MissionCommandDialog.qml">src/QmlControls/MissionCommandDialog.qml</file>
<file alias="QGroundControl/Controls/MissionItemEditor.qml">src/MissionEditor/MissionItemEditor.qml</file>
<file alias="QGroundControl/Controls/MissionItemIndexLabel.qml">src/QmlControls/MissionItemIndexLabel.qml</file>
<file alias="QGroundControl/Controls/MissionItemMapVisual.qml">src/MissionEditor/MissionItemMapVisual.qml</file>
<file alias="QGroundControl/Controls/MissionItemStatus.qml">src/MissionEditor/MissionItemStatus.qml</file>
<file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file>
<file alias="QGroundControl/Controls/MultiRotorMotorDisplay.qml">src/QmlControls/MultiRotorMotorDisplay.qml</file>
...
...
@@ -102,9 +102,10 @@
<file alias="QGroundControl/Controls/RoundButton.qml">src/QmlControls/RoundButton.qml</file>
<file alias="QGroundControl/Controls/SetupPage.qml">src/AutoPilotPlugins/Common/SetupPage.qml</file>
<file alias="QGroundControl/Controls/SignalStrength.qml">src/ui/toolbar/SignalStrength.qml</file>
<file alias="QGroundControl/Controls/SimpleItemMapVisual.qml">src/MissionEditor/SimpleItemMapVisual.qml</file>
<file alias="QGroundControl/Controls/SliderSwitch.qml">src/QmlControls/SliderSwitch.qml</file>
<file alias="QGroundControl/Controls/SubMenuButton.qml">src/QmlControls/SubMenuButton.qml</file>
<file alias="QGroundControl/Controls/Survey
ComplexItem.qml">src/MissionEditor/SurveyComplexItem
.qml</file>
<file alias="QGroundControl/Controls/Survey
MapVisual.qml">src/MissionEditor/SurveyMapVisual
.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
<file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file>
<file alias="QGroundControl/Controls/ToolStrip.qml">src/QmlControls/ToolStrip.qml</file>
...
...
src/MissionEditor/FWLandingPatternMapVisual.qml
View file @
b3dac085
...
...
@@ -151,10 +151,10 @@ Item {
Rectangle
{
id
:
itemDragger
x
:
mapQuickItem
?
(
mapQuickItem
.
x
+
mapQuickItem
.
anchorPoint
.
x
-
(
itemDragger
.
width
/
2
))
:
100
y
:
mapQuickItem
?
(
mapQuickItem
.
y
+
mapQuickItem
.
anchorPoint
.
y
-
(
itemDragger
.
height
/
2
))
:
100
width
:
ScreenTools
.
defaultFontPixelHeight
*
2
height
:
ScreenTools
.
defaultFontPixelHeight
*
2
x
:
mapQuickItem
.
x
y
:
mapQuickItem
.
y
width
:
mapQuickItem
.
width
height
:
mapQuickItem
.
height
color
:
"
transparent
"
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
...
...
@@ -167,7 +167,7 @@ Item {
function
liveDrag
()
{
if
(
!
itemDragger
.
_preventCoordinateBindingLoop
&&
Drag
.
active
)
{
var
point
=
Qt
.
point
(
itemDragger
.
x
+
(
itemDragger
.
width
/
2
),
itemDragger
.
y
+
(
itemDragger
.
height
/
2
)
)
var
point
=
Qt
.
point
(
itemDragger
.
x
+
mapQuickItem
.
anchorPoint
.
x
,
itemDragger
.
y
+
mapQuickItem
.
anchorPoint
.
y
)
var
coordinate
=
map
.
toCoordinate
(
point
)
itemDragger
.
_preventCoordinateBindingLoop
=
true
if
(
dragLoiter
)
{
...
...
@@ -182,8 +182,8 @@ Item {
}
Drag.active
:
itemDrag
.
drag
.
active
Drag.hotSpot.x
:
width
/
2
Drag.hotSpot.y
:
height
/
2
Drag.hotSpot.x
:
mapQuickItem
.
anchorPoint
.
x
Drag.hotSpot.y
:
mapQuickItem
.
anchorPoint
.
y
MouseArea
{
id
:
itemDrag
...
...
src/MissionEditor/MissionEditor.qml
View file @
b3dac085
...
...
@@ -448,21 +448,15 @@ QGCView {
}
}
// Add the
complex mission item
to the map
// Add the
mission item visuals
to the map
Repeater
{
model
:
missionController
.
complexV
isualItems
model
:
missionController
.
v
isualItems
delegate
:
ComplexMissionItem
{
delegate
:
MissionItemMapVisual
{
map
:
editorMap
}
}
// Add the simple mission items to the map
MapItemView
{
model
:
missionController
.
visualItems
delegate
:
missionItemComponent
}
Component
{
id
:
missionItemComponent
...
...
src/MissionEditor/
ComplexMissionItem
.qml
→
src/MissionEditor/
MissionItemMapVisual
.qml
View file @
b3dac085
...
...
@@ -23,7 +23,7 @@ Item {
property
var
map
///< Map control to place item in
property
var
_
complex
Item
property
var
_
visual
Item
Component.onCompleted
:
{
if
(
object
.
mapVisualQML
)
{
...
...
@@ -31,13 +31,13 @@ Item {
if
(
component
.
status
===
Component
.
Error
)
{
console
.
log
(
"
Error loading Qml:
"
,
object
.
mapVisualQML
,
component
.
errorString
())
}
_
complex
Item
=
component
.
createObject
(
map
,
{
"
map
"
:
_root
.
map
})
_
visual
Item
=
component
.
createObject
(
map
,
{
"
map
"
:
_root
.
map
})
}
}
Component
.
onDestruction
:
{
if
(
_
complex
Item
)
{
_
complex
Item
.
destroy
()
if
(
_
visual
Item
)
{
_
visual
Item
.
destroy
()
}
}
}
src/MissionEditor/SimpleItemMapVisual.qml
0 → 100644
View file @
b3dac085
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.2
import
QtQuick
.
Controls
1.2
import
QtLocation
5.3
import
QtPositioning
5.2
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightMap
1.0
/// Simple Mission Item visuals
Item
{
property
var
map
///< Map control to place item in
property
var
_missionItem
:
object
property
var
_itemVisual
property
var
_dragArea
function
hideItemVisuals
()
{
_itemVisual
.
destroy
()
_itemVisual
=
undefined
}
function
showItemVisuals
()
{
if
(
!
_itemVisual
)
{
_itemVisual
=
indicatorComponent
.
createObject
(
map
)
map
.
addMapItem
(
_itemVisual
)
}
}
function
hideDragArea
()
{
if
(
_dragArea
)
{
_dragArea
.
destroy
()
_dragArea
=
undefined
}
}
function
showDragArea
()
{
if
(
!
_dragArea
)
{
_dragArea
=
dragAreaComponent
.
createObject
(
map
)
}
}
Component.onCompleted
:
{
showItemVisuals
()
if
(
_missionItem
.
isCurrentItem
)
{
showDragArea
()
}
}
Component
.
onDestruction
:
{
hideDragArea
()
hideItemVisuals
()
}
Connections
{
target
:
_missionItem
onIsCurrentItemChanged
:
{
if
(
_missionItem
.
isCurrentItem
)
{
showDragArea
()
}
else
{
hideDragArea
()
}
}
}
// Control which is used to drag items
Component
{
id
:
dragAreaComponent
Rectangle
{
id
:
itemDragger
x
:
_itemVisual
.
x
y
:
_itemVisual
.
y
width
:
_itemVisual
.
width
height
:
_itemVisual
.
height
color
:
"
transparent
"
z
:
QGroundControl
.
zOrderMapItems
+
1
// Above item icons
property
bool
dragLoiter
property
bool
_preventCoordinateBindingLoop
:
false
onXChanged
:
liveDrag
()
onYChanged
:
liveDrag
()
function
liveDrag
()
{
if
(
!
itemDragger
.
_preventCoordinateBindingLoop
&&
Drag
.
active
)
{
var
point
=
Qt
.
point
(
itemDragger
.
x
+
_itemVisual
.
anchorPoint
.
x
,
itemDragger
.
y
+
_itemVisual
.
anchorPoint
.
y
)
var
coordinate
=
map
.
toCoordinate
(
point
)
itemDragger
.
_preventCoordinateBindingLoop
=
true
coordinate
.
altitude
=
_missionItem
.
coordinate
.
altitude
_missionItem
.
coordinate
=
coordinate
itemDragger
.
_preventCoordinateBindingLoop
=
false
}
}
Drag.active
:
itemDrag
.
drag
.
active
Drag.hotSpot.x
:
_itemVisual
.
anchorPoint
.
x
Drag.hotSpot.y
:
_itemVisual
.
anchorPoint
.
y
MouseArea
{
id
:
itemDrag
anchors.fill
:
parent
drag.target
:
parent
drag.minimumX
:
0
drag.minimumY
:
0
drag.maximumX
:
itemDragger
.
parent
.
width
-
parent
.
width
drag.maximumY
:
itemDragger
.
parent
.
height
-
parent
.
height
}
}
}
Component
{
id
:
indicatorComponent
MissionItemIndicator
{
coordinate
:
_missionItem
.
coordinate
visible
:
_missionItem
.
specifiesCoordinate
z
:
QGroundControl
.
zOrderMapItems
missionItem
:
_missionItem
sequenceNumber
:
_missionItem
.
sequenceNumber
onClicked
:
setCurrentItem
(
_missionItem
.
sequenceNumber
)
// These are the non-coordinate child mission items attached to this item
Row
{
anchors.top
:
parent
.
top
anchors.left
:
parent
.
right
Repeater
{
model
:
_missionItem
.
childItems
delegate
:
MissionItemIndexLabel
{
label
:
object
.
abbreviation
checked
:
object
.
isCurrentItem
z
:
2
specifiesCoordinate
:
false
onClicked
:
setCurrentItem
(
object
.
sequenceNumber
)
}
}
}
}
}
}
src/MissionEditor/Survey
ComplexItem
.qml
→
src/MissionEditor/Survey
MapVisual
.qml
View file @
b3dac085
File moved
src/MissionManager/ComplexMissionItem.h
View file @
b3dac085
...
...
@@ -21,7 +21,6 @@ public:
const
ComplexMissionItem
&
operator
=
(
const
ComplexMissionItem
&
other
);
Q_PROPERTY
(
QString
mapVisualQML
READ
mapVisualQML
CONSTANT
)
Q_PROPERTY
(
int
lastSequenceNumber
READ
lastSequenceNumber
NOTIFY
lastSequenceNumberChanged
)
Q_PROPERTY
(
double
complexDistance
READ
complexDistance
NOTIFY
complexDistanceChanged
)
...
...
@@ -53,9 +52,6 @@ public:
/// This mission item attribute specifies the type of the complex item.
static
const
char
*
jsonComplexItemTypeKey
;
/// @return The QML resource file which contains the control which visualizes the item on the map.
virtual
QString
mapVisualQML
(
void
)
const
=
0
;
signals:
void
lastSequenceNumberChanged
(
int
lastSequenceNumber
);
void
complexDistanceChanged
(
double
complexDistance
);
...
...
src/MissionManager/SimpleMissionItem.h
View file @
b3dac085
...
...
@@ -90,6 +90,7 @@ public:
QGeoCoordinate
exitCoordinate
(
void
)
const
final
{
return
coordinate
();
}
int
sequenceNumber
(
void
)
const
final
{
return
_missionItem
.
sequenceNumber
();
}
double
flightSpeed
(
void
)
final
;
QString
mapVisualQML
(
void
)
const
final
{
return
QStringLiteral
(
"SimpleItemMapVisual.qml"
);
}
bool
coordinateHasRelativeAltitude
(
void
)
const
final
{
return
_missionItem
.
relativeAltitude
();
}
bool
exitCoordinateHasRelativeAltitude
(
void
)
const
final
{
return
coordinateHasRelativeAltitude
();
}
...
...
src/MissionManager/SurveyMissionItem.h
View file @
b3dac085
...
...
@@ -83,7 +83,7 @@ public:
bool
load
(
const
QJsonObject
&
complexObject
,
int
sequenceNumber
,
QString
&
errorString
)
final
;
double
greatestDistanceTo
(
const
QGeoCoordinate
&
other
)
const
final
;
void
setCruiseSpeed
(
double
cruiseSpeed
)
final
;
QString
mapVisualQML
(
void
)
const
final
{
return
QStringLiteral
(
"Survey
ComplexItem
.qml"
);
}
QString
mapVisualQML
(
void
)
const
final
{
return
QStringLiteral
(
"Survey
MapVisual
.qml"
);
}
// Overrides from VisualMissionItem
...
...
src/MissionManager/VisualMissionItem.h
View file @
b3dac085
...
...
@@ -79,6 +79,7 @@ public:
Q_PROPERTY
(
bool
isStandaloneCoordinate
READ
isStandaloneCoordinate
NOTIFY
isStandaloneCoordinateChanged
)
///< Waypoint line does not go through item
Q_PROPERTY
(
bool
isSimpleItem
READ
isSimpleItem
NOTIFY
isSimpleItemChanged
)
///< Simple or Complex MissionItem
Q_PROPERTY
(
QString
editorQml
MEMBER
_editorQml
CONSTANT
)
///< Qml code for editing this item
Q_PROPERTY
(
QString
mapVisualQML
READ
mapVisualQML
CONSTANT
)
///< QMl code for map visuals
/// List of child mission items. Child mission item are subsequent mision items which do not specify a coordinate. They
/// are shown next to the exitCoordinate indidcator in the ui.
...
...
@@ -128,6 +129,9 @@ public:
/// @param saveObject Save the item to this json object
virtual
void
save
(
QJsonObject
&
saveObject
)
const
=
0
;
/// @return The QML resource file which contains the control which visualizes the item on the map.
virtual
QString
mapVisualQML
(
void
)
const
=
0
;
static
const
char
*
jsonTypeKey
;
///< Json file attribute which specifies the item type
static
const
char
*
jsonTypeSimpleItemValue
;
///< Item type is MISSION_ITEM
static
const
char
*
jsonTypeComplexItemValue
;
///< Item type is Complex Item
...
...
src/QmlControls/QGroundControl.Controls.qmldir
View file @
b3dac085
...
...
@@ -3,7 +3,6 @@ Module QGroundControl.Controls
AnalyzePage 1.0 AnalyzePage.qml
AppMessages 1.0 AppMessages.qml
ClickableColor 1.0 ClickableColor.qml
ComplexMissionItem 1.0 ComplexMissionItem.qml
DropButton 1.0 DropButton.qml
DropPanel 1.0 DropPanel.qml
ExclusiveGroupItem 1.0 ExclusiveGroupItem.qml
...
...
@@ -18,6 +17,7 @@ MainToolBarIndicators 1.0 MainToolBarIndicators.qml
MissionCommandDialog 1.0 MissionCommandDialog.qml
MissionItemEditor 1.0 MissionItemEditor.qml
MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
MissionItemMapVisual 1.0 MissionItemMapVisual.qml
MissionItemStatus 1.0 MissionItemStatus.qml
ModeSwitchDisplay 1.0 ModeSwitchDisplay.qml
MultiRotorMotorDisplay 1.0 MultiRotorMotorDisplay.qml
...
...
@@ -50,9 +50,10 @@ QGCViewPanel 1.0 QGCViewPanel.qml
RoundButton 1.0 RoundButton.qml
SetupPage 1.0 SetupPage.qml
SignalStrength 1.0 SignalStrength.qml
SimpleItemMapVisuals 1.0 SimpleItemMapVisuals.qml
SliderSwitch 1.0 SliderSwitch.qml
SubMenuButton 1.0 SubMenuButton.qml
Survey
ComplexItem 1.0 SurveyComplexItem
.qml
Survey
MapVisuals 1.0 SurveyMapVisuals
.qml
ToolStrip 1.0 ToolStrip.qml
VehicleRotationCal 1.0 VehicleRotationCal.qml
VehicleSummaryRow 1.0 VehicleSummaryRow.qml
...
...
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