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
a9fe38d2
Unverified
Commit
a9fe38d2
authored
Dec 05, 2018
by
Don Gagne
Committed by
GitHub
Dec 05, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7064 from DonLakeFlyer/Orbit
Orbit supports display/changing rotation direction
parents
145575ae
7963132f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
42 deletions
+146
-42
ChangeLog.md
ChangeLog.md
+1
-0
FlightDisplayViewMap.qml
src/FlightDisplay/FlightDisplayViewMap.qml
+8
-5
GuidedActionsController.qml
src/FlightDisplay/GuidedActionsController.qml
+1
-1
QGCFenceCircle.cc
src/MissionManager/QGCFenceCircle.cc
+1
-1
QGCMapCircle.cc
src/MissionManager/QGCMapCircle.cc
+39
-14
QGCMapCircle.h
src/MissionManager/QGCMapCircle.h
+25
-14
QGCMapCircleVisuals.qml
src/MissionManager/QGCMapCircleVisuals.qml
+71
-7
No files found.
ChangeLog.md
View file @
a9fe38d2
...
@@ -16,6 +16,7 @@ Note: This file only contains high level features or important fixes.
...
@@ -16,6 +16,7 @@ Note: This file only contains high level features or important fixes.
*
Survey Planning: add mode that supports concave polygons
*
Survey Planning: add mode that supports concave polygons
*
Support loading polygons from SHP files
*
Support loading polygons from SHP files
*
Bumped settings version (now 8). This will cause all settings to be reset to defaults.
*
Bumped settings version (now 8). This will cause all settings to be reset to defaults.
*
Orbit visuals support changing rotation direction
## 3.4
## 3.4
...
...
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
a9fe38d2
...
@@ -325,6 +325,7 @@ FlightMap {
...
@@ -325,6 +325,7 @@ FlightMap {
visible
:
false
visible
:
false
property
alias
center
:
_mapCircle
.
center
property
alias
center
:
_mapCircle
.
center
property
alias
clockwiseRotation
:
_mapCircle
.
clockwiseRotation
readonly
property
real
defaultRadius
:
30
readonly
property
real
defaultRadius
:
30
...
@@ -348,6 +349,8 @@ FlightMap {
...
@@ -348,6 +349,8 @@ FlightMap {
id
:
_mapCircle
id
:
_mapCircle
interactive
:
true
interactive
:
true
radius.rawValue
:
30
radius.rawValue
:
30
showRotation
:
true
clockwiseRotation
:
true
}
}
}
}
...
...
src/FlightDisplay/GuidedActionsController.qml
View file @
a9fe38d2
...
@@ -384,7 +384,7 @@ Item {
...
@@ -384,7 +384,7 @@ Item {
_activeVehicle
.
setCurrentMissionSequence
(
actionData
)
_activeVehicle
.
setCurrentMissionSequence
(
actionData
)
break
break
case
actionOrbit
:
case
actionOrbit
:
_activeVehicle
.
guidedModeOrbit
(
orbitMapCircle
.
center
,
orbitMapCircle
.
radius
(),
_activeVehicle
.
altitudeAMSL
.
rawValue
+
actionAltitudeChange
)
_activeVehicle
.
guidedModeOrbit
(
orbitMapCircle
.
center
,
orbitMapCircle
.
radius
()
*
(
orbitMapCircle
.
clockWiseRotation
?
1
:
-
1
)
,
_activeVehicle
.
altitudeAMSL
.
rawValue
+
actionAltitudeChange
)
orbitMapCircle
.
hide
()
orbitMapCircle
.
hide
()
break
break
case
actionLandAbort
:
case
actionLandAbort
:
...
...
src/MissionManager/QGCFenceCircle.cc
View file @
a9fe38d2
...
@@ -20,7 +20,7 @@ QGCFenceCircle::QGCFenceCircle(QObject* parent)
...
@@ -20,7 +20,7 @@ QGCFenceCircle::QGCFenceCircle(QObject* parent)
}
}
QGCFenceCircle
::
QGCFenceCircle
(
const
QGeoCoordinate
&
center
,
double
radius
,
bool
inclusion
,
QObject
*
parent
)
QGCFenceCircle
::
QGCFenceCircle
(
const
QGeoCoordinate
&
center
,
double
radius
,
bool
inclusion
,
QObject
*
parent
)
:
QGCMapCircle
(
center
,
radius
,
parent
)
:
QGCMapCircle
(
center
,
radius
,
false
/* showRotation */
,
true
/* clockwiseRotation */
,
parent
)
,
_inclusion
(
inclusion
)
,
_inclusion
(
inclusion
)
{
{
_init
();
_init
();
...
...
src/MissionManager/QGCMapCircle.cc
View file @
a9fe38d2
...
@@ -25,16 +25,20 @@ QGCMapCircle::QGCMapCircle(QObject* parent)
...
@@ -25,16 +25,20 @@ QGCMapCircle::QGCMapCircle(QObject* parent)
:
QObject
(
parent
)
:
QObject
(
parent
)
,
_dirty
(
false
)
,
_dirty
(
false
)
,
_interactive
(
false
)
,
_interactive
(
false
)
,
_showRotation
(
false
)
,
_clockwiseRotation
(
true
)
{
{
_init
();
_init
();
}
}
QGCMapCircle
::
QGCMapCircle
(
const
QGeoCoordinate
&
center
,
double
radius
,
QObject
*
parent
)
QGCMapCircle
::
QGCMapCircle
(
const
QGeoCoordinate
&
center
,
double
radius
,
bool
showRotation
,
bool
clockwiseRotation
,
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
)
,
_dirty
(
false
)
,
_dirty
(
false
)
,
_center
(
center
)
,
_center
(
center
)
,
_radius
(
FactSystem
::
defaultComponentId
,
_radiusFactName
,
FactMetaData
::
valueTypeDouble
)
,
_radius
(
FactSystem
::
defaultComponentId
,
_radiusFactName
,
FactMetaData
::
valueTypeDouble
)
,
_interactive
(
false
)
,
_interactive
(
false
)
,
_showRotation
(
showRotation
)
,
_clockwiseRotation
(
clockwiseRotation
)
{
{
_radius
.
setRawValue
(
radius
);
_radius
.
setRawValue
(
radius
);
_init
();
_init
();
...
@@ -46,6 +50,8 @@ QGCMapCircle::QGCMapCircle(const QGCMapCircle& other, QObject* parent)
...
@@ -46,6 +50,8 @@ QGCMapCircle::QGCMapCircle(const QGCMapCircle& other, QObject* parent)
,
_center
(
other
.
_center
)
,
_center
(
other
.
_center
)
,
_radius
(
FactSystem
::
defaultComponentId
,
_radiusFactName
,
FactMetaData
::
valueTypeDouble
)
,
_radius
(
FactSystem
::
defaultComponentId
,
_radiusFactName
,
FactMetaData
::
valueTypeDouble
)
,
_interactive
(
false
)
,
_interactive
(
false
)
,
_showRotation
(
other
.
_showRotation
)
,
_clockwiseRotation
(
other
.
_clockwiseRotation
)
{
{
_radius
.
setRawValue
(
other
.
_radius
.
rawValue
());
_radius
.
setRawValue
(
other
.
_radius
.
rawValue
());
_init
();
_init
();
...
@@ -117,6 +123,10 @@ bool QGCMapCircle::loadFromJson(const QJsonObject& json, QString& errorString)
...
@@ -117,6 +123,10 @@ bool QGCMapCircle::loadFromJson(const QJsonObject& json, QString& errorString)
setCenter
(
center
);
setCenter
(
center
);
_radius
.
setRawValue
(
circleObject
[
_jsonRadiusKey
].
toDouble
());
_radius
.
setRawValue
(
circleObject
[
_jsonRadiusKey
].
toDouble
());
_interactive
=
false
;
_showRotation
=
false
;
_clockwiseRotation
=
true
;
return
true
;
return
true
;
}
}
...
@@ -142,3 +152,18 @@ void QGCMapCircle::setInteractive(bool interactive)
...
@@ -142,3 +152,18 @@ void QGCMapCircle::setInteractive(bool interactive)
}
}
}
}
void
QGCMapCircle
::
setShowRotation
(
bool
showRotation
)
{
if
(
showRotation
!=
_showRotation
)
{
_showRotation
=
showRotation
;
emit
showRotationChanged
(
showRotation
);
}
}
void
QGCMapCircle
::
setClockwiseRotation
(
bool
clockwiseRotation
)
{
if
(
clockwiseRotation
!=
_clockwiseRotation
)
{
_clockwiseRotation
=
clockwiseRotation
;
emit
clockwiseRotationChanged
(
clockwiseRotation
);
}
}
src/MissionManager/QGCMapCircle.h
View file @
a9fe38d2
...
@@ -25,6 +25,7 @@ class QGCMapCircle : public QObject
...
@@ -25,6 +25,7 @@ class QGCMapCircle : public QObject
public:
public:
QGCMapCircle
(
QObject
*
parent
=
nullptr
);
QGCMapCircle
(
QObject
*
parent
=
nullptr
);
QGCMapCircle
(
const
QGeoCoordinate
&
center
,
double
radius
,
QObject
*
parent
=
nullptr
);
QGCMapCircle
(
const
QGeoCoordinate
&
center
,
double
radius
,
QObject
*
parent
=
nullptr
);
QGCMapCircle
(
const
QGeoCoordinate
&
center
,
double
radius
,
bool
showRotation
,
bool
clockwiseRotation
,
QObject
*
parent
=
nullptr
);
QGCMapCircle
(
const
QGCMapCircle
&
other
,
QObject
*
parent
=
nullptr
);
QGCMapCircle
(
const
QGCMapCircle
&
other
,
QObject
*
parent
=
nullptr
);
const
QGCMapCircle
&
operator
=
(
const
QGCMapCircle
&
other
);
const
QGCMapCircle
&
operator
=
(
const
QGCMapCircle
&
other
);
...
@@ -33,6 +34,8 @@ public:
...
@@ -33,6 +34,8 @@ public:
Q_PROPERTY
(
QGeoCoordinate
center
READ
center
WRITE
setCenter
NOTIFY
centerChanged
)
Q_PROPERTY
(
QGeoCoordinate
center
READ
center
WRITE
setCenter
NOTIFY
centerChanged
)
Q_PROPERTY
(
Fact
*
radius
READ
radius
CONSTANT
)
Q_PROPERTY
(
Fact
*
radius
READ
radius
CONSTANT
)
Q_PROPERTY
(
bool
interactive
READ
interactive
WRITE
setInteractive
NOTIFY
interactiveChanged
)
Q_PROPERTY
(
bool
interactive
READ
interactive
WRITE
setInteractive
NOTIFY
interactiveChanged
)
Q_PROPERTY
(
bool
showRotation
READ
showRotation
WRITE
setShowRotation
NOTIFY
showRotationChanged
)
Q_PROPERTY
(
bool
clockwiseRotation
READ
clockwiseRotation
WRITE
setClockwiseRotation
NOTIFY
clockwiseRotationChanged
)
/// Saves the polygon to the json object.
/// Saves the polygon to the json object.
/// @param json Json object to save to
/// @param json Json object to save to
...
@@ -50,10 +53,14 @@ public:
...
@@ -50,10 +53,14 @@ public:
QGeoCoordinate
center
(
void
)
const
{
return
_center
;
}
QGeoCoordinate
center
(
void
)
const
{
return
_center
;
}
Fact
*
radius
(
void
)
{
return
&
_radius
;
}
Fact
*
radius
(
void
)
{
return
&
_radius
;
}
bool
interactive
(
void
)
const
{
return
_interactive
;
}
bool
interactive
(
void
)
const
{
return
_interactive
;
}
bool
showRotation
(
void
)
const
{
return
_showRotation
;
}
bool
clockwiseRotation
(
void
)
const
{
return
_clockwiseRotation
;
}
void
setDirty
(
bool
dirty
);
void
setDirty
(
bool
dirty
);
void
setCenter
(
QGeoCoordinate
newCenter
);
void
setCenter
(
QGeoCoordinate
newCenter
);
void
setInteractive
(
bool
interactive
);
void
setInteractive
(
bool
interactive
);
void
setShowRotation
(
bool
showRotation
);
void
setClockwiseRotation
(
bool
clockwiseRotation
);
static
const
char
*
jsonCircleKey
;
static
const
char
*
jsonCircleKey
;
...
@@ -61,6 +68,8 @@ signals:
...
@@ -61,6 +68,8 @@ signals:
void
dirtyChanged
(
bool
dirty
);
void
dirtyChanged
(
bool
dirty
);
void
centerChanged
(
QGeoCoordinate
center
);
void
centerChanged
(
QGeoCoordinate
center
);
void
interactiveChanged
(
bool
interactive
);
void
interactiveChanged
(
bool
interactive
);
void
showRotationChanged
(
bool
showRotation
);
void
clockwiseRotationChanged
(
bool
clockwiseRotation
);
private
slots
:
private
slots
:
void
_setDirty
(
void
);
void
_setDirty
(
void
);
...
@@ -72,6 +81,8 @@ private:
...
@@ -72,6 +81,8 @@ private:
QGeoCoordinate
_center
;
QGeoCoordinate
_center
;
Fact
_radius
;
Fact
_radius
;
bool
_interactive
;
bool
_interactive
;
bool
_showRotation
;
bool
_clockwiseRotation
;
QMap
<
QString
,
FactMetaData
*>
_nameToMetaDataMap
;
QMap
<
QString
,
FactMetaData
*>
_nameToMetaDataMap
;
...
...
src/MissionManager/QGCMapCircleVisuals.qml
View file @
a9fe38d2
...
@@ -31,13 +31,22 @@ Item {
...
@@ -31,13 +31,22 @@ Item {
property
color
borderColor
:
"
orange
"
property
color
borderColor
:
"
orange
"
property
var
_circleComponent
property
var
_circleComponent
property
var
_topRotationIndicatorComponent
property
var
_bottomRotationIndicatorComponent
property
var
_dragHandlesComponent
property
var
_dragHandlesComponent
property
real
_radius
:
mapCircle
.
radius
.
rawValue
function
addVisuals
()
{
function
addVisuals
()
{
if
(
!
_circleComponent
)
{
if
(
!
_circleComponent
)
{
_circleComponent
=
circleComponent
.
createObject
(
mapControl
)
_circleComponent
=
circleComponent
.
createObject
(
mapControl
)
mapControl
.
addMapItem
(
_circleComponent
)
mapControl
.
addMapItem
(
_circleComponent
)
}
}
if
(
!
_topRotationIndicatorComponent
)
{
_topRotationIndicatorComponent
=
rotationIndicatorComponent
.
createObject
(
mapControl
,
{
"
topIndicator
"
:
true
})
_bottomRotationIndicatorComponent
=
rotationIndicatorComponent
.
createObject
(
mapControl
,
{
"
topIndicator
"
:
false
})
mapControl
.
addMapItem
(
_topRotationIndicatorComponent
)
mapControl
.
addMapItem
(
_bottomRotationIndicatorComponent
)
}
}
}
function
removeVisuals
()
{
function
removeVisuals
()
{
...
@@ -45,6 +54,12 @@ Item {
...
@@ -45,6 +54,12 @@ Item {
_circleComponent
.
destroy
()
_circleComponent
.
destroy
()
_circleComponent
=
undefined
_circleComponent
=
undefined
}
}
if
(
_topRotationIndicatorComponent
)
{
_topRotationIndicatorComponent
.
destroy
()
_bottomRotationIndicatorComponent
.
destroy
()
_topRotationIndicatorComponent
=
undefined
_bottomRotationIndicatorComponent
=
undefined
}
}
}
function
addDragHandles
()
{
function
addDragHandles
()
{
...
@@ -74,15 +89,64 @@ Item {
...
@@ -74,15 +89,64 @@ Item {
}
}
}
}
Component.onCompleted
:
updateInternalComponents
()
Component.onCompleted
:
{
onInteractiveChanged
:
updateInternalComponents
()
updateInternalComponents
()
onVisibleChanged
:
updateInternalComponents
()
}
Component.onDestruction
:
{
Component.onDestruction
:
{
removeVisuals
()
removeVisuals
()
removeDragHandles
()
removeDragHandles
()
}
}
onInteractiveChanged
:
updateInternalComponents
()
onVisibleChanged
:
updateInternalComponents
()
Component
{
id
:
rotationIndicatorComponent
MapQuickItem
{
z
:
QGroundControl
.
zOrderMapItems
+
2
visible
:
mapCircle
.
showRotation
property
bool
topIndicator
:
true
property
real
_rotationRadius
:
_radius
function
updateCoordinate
()
{
coordinate
=
mapCircle
.
center
.
atDistanceAndAzimuth
(
_radius
,
topIndicator
?
0
:
180
)
}
Component.onCompleted
:
updateCoordinate
()
on_RotationRadiusChanged
:
updateCoordinate
()
Connections
{
target
:
mapCircle
onCenterChanged
:
updateCoordinate
()
}
sourceItem
:
QGCColoredImage
{
anchors.centerIn
:
parent
width
:
ScreenTools
.
defaultFontPixelHeight
*
0.66
height
:
ScreenTools
.
defaultFontPixelHeight
source
:
"
/qmlimages/arrow-down.png
"
color
:
borderColor
transform
:
Rotation
{
origin.x
:
width
/
2
origin.y
:
height
/
2
angle
:
(
mapCircle
.
clockwiseRotation
?
1
:
-
1
)
*
(
topIndicator
?
-
90
:
90
)
}
QGCMouseArea
{
fillItem
:
parent
onClicked
:
mapCircle
.
clockwiseRotation
=
!
mapCircle
.
clockwiseRotation
visible
:
mapCircle
.
interactive
}
}
}
}
Component
{
Component
{
id
:
circleComponent
id
:
circleComponent
...
@@ -92,7 +156,7 @@ Item {
...
@@ -92,7 +156,7 @@ Item {
border.color
:
borderColor
border.color
:
borderColor
border.width
:
borderWidth
border.width
:
borderWidth
center
:
mapCircle
.
center
center
:
mapCircle
.
center
radius
:
mapCircle
.
radius
.
rawValue
radius
:
_radius
}
}
}
}
...
@@ -146,7 +210,7 @@ Item {
...
@@ -146,7 +210,7 @@ Item {
property
var
radiusDragArea
property
var
radiusDragArea
property
var
radiusDragCoord
:
QtPositioning
.
coordinate
()
property
var
radiusDragCoord
:
QtPositioning
.
coordinate
()
property
var
circleCenterCoord
:
mapCircle
.
center
property
var
circleCenterCoord
:
mapCircle
.
center
property
real
circleRadius
:
mapCircle
.
radius
.
rawValue
property
real
circleRadius
:
_radius
function
calcRadiusDragCoord
()
{
function
calcRadiusDragCoord
()
{
radiusDragCoord
=
mapCircle
.
center
.
atDistanceAndAzimuth
(
circleRadius
,
90
)
radiusDragCoord
=
mapCircle
.
center
.
atDistanceAndAzimuth
(
circleRadius
,
90
)
...
...
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