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
8290009d
Commit
8290009d
authored
Jan 14, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2607 from DonLakeFlyer/InitialMapPosition
Initial map position changes, plus GCS position on map
parents
faea3168
5824ffe7
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
86 additions
and
72 deletions
+86
-72
FlightDisplayView.qml
src/FlightDisplay/FlightDisplayView.qml
+0
-4
FlightDisplayViewMap.qml
src/FlightDisplay/FlightDisplayViewMap.qml
+7
-10
FlightMap.qml
src/FlightMap/FlightMap.qml
+25
-8
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+15
-30
QGCApplication.cc
src/QGCApplication.cc
+15
-0
QGCApplication.h
src/QGCApplication.h
+13
-6
QGroundControlQmlGlobal.cc
src/QmlControls/QGroundControlQmlGlobal.cc
+0
-1
QGroundControlQmlGlobal.h
src/QmlControls/QGroundControlQmlGlobal.h
+4
-1
Vehicle.cc
src/Vehicle/Vehicle.cc
+1
-0
MainWindowInner.qml
src/ui/MainWindowInner.qml
+6
-12
No files found.
src/FlightDisplay/FlightDisplayView.qml
View file @
8290009d
...
...
@@ -50,7 +50,6 @@ Item {
property
var
_activeVehicle
:
multiVehicleManager
.
activeVehicle
readonly
property
var
_defaultVehicleCoordinate
:
mainWindow
.
tabletPosition
readonly
property
real
_defaultRoll
:
0
readonly
property
real
_defaultPitch
:
0
readonly
property
real
_defaultHeading
:
0
...
...
@@ -71,8 +70,6 @@ Item {
property
real
_pitch
:
_activeVehicle
?
(
isNaN
(
_activeVehicle
.
pitch
)
?
_defaultPitch
:
_activeVehicle
.
pitch
)
:
_defaultPitch
property
real
_heading
:
_activeVehicle
?
(
isNaN
(
_activeVehicle
.
heading
)
?
_defaultHeading
:
_activeVehicle
.
heading
)
:
_defaultHeading
property
var
_vehicleCoordinate
:
_activeVehicle
?
(
_activeVehicle
.
coordinateValid
?
_activeVehicle
.
coordinate
:
_defaultVehicleCoordinate
)
:
_defaultVehicleCoordinate
property
real
_altitudeWGS84
:
_activeVehicle
?
_activeVehicle
.
altitudeWGS84
:
_defaultAltitudeWGS84
property
real
_groundSpeed
:
_activeVehicle
?
_activeVehicle
.
groundSpeed
:
_defaultGroundSpeed
property
real
_airSpeed
:
_activeVehicle
?
_activeVehicle
.
airSpeed
:
_defaultAirSpeed
...
...
@@ -120,7 +117,6 @@ Item {
_flightMap
.
zoomLevel
=
_savedZoomLevel
else
_savedZoomLevel
=
_flightMap
.
zoomLevel
_flightMap
.
updateMapPosition
(
true
/* force */
)
}
else
{
_flightVideo
=
item
}
...
...
src/FlightDisplay/FlightDisplayViewMap.qml
View file @
8290009d
...
...
@@ -39,18 +39,15 @@ FlightMap {
id
:
flightMap
anchors.fill
:
parent
mapName
:
_mapName
latitude
:
mainWindow
.
tabletPosition
.
latitude
longitude
:
mainWindow
.
tabletPosition
.
longitude
property
var
rootVehicleCoordinate
:
_vehicleCoordinate
property
bool
_followVehicle
:
true
property
bool
_followVehicle
:
true
property
bool
_activeVehicleCoordinateValid
:
multiVehicleManager
.
activeVehicle
?
multiVehicleManager
.
activeVehicle
.
coordinateValid
:
false
property
var
activeVehicleCoordinate
:
multiVehicleManager
.
activeVehicle
?
multiVehicleManager
.
activeVehicle
.
coordinate
:
QtPositioning
.
coordinate
()
onRootVehicleCoordinateChanged
:
updateMapPosition
(
false
/* force */
)
function
updateMapPosition
(
force
)
{
if
(
_followVehicle
||
force
)
{
flightMap
.
latitude
=
root
.
_vehicleCoordinate
.
latitude
flightMap
.
longitude
=
root
.
_vehicleCoordinate
.
longitude
onActiveVehicleCoordinateChanged
:
{
if
(
_followVehicle
&&
activeVehicleCoordinate
.
isValid
)
{
_initialMapPositionSet
=
true
flightMap
.
center
=
activeVehicleCoordinate
}
}
...
...
src/FlightMap/FlightMap.qml
View file @
8290009d
...
...
@@ -43,22 +43,16 @@ import QGroundControl.Mavlink 1.0
Map
{
id
:
_map
property
real
latitude
:
64.154549
//-- If you find yourself here on startup, something went wrong :)
property
real
longitude
:
-
22.023540
property
real
heading
:
0
property
bool
interactive
:
true
property
string
mapName
:
'
defaultMap
'
property
string
mapType
:
QGroundControl
.
flightMapSettings
.
mapTypeForMapName
(
mapName
)
// property alias mapWidgets: controlWidgets
property
bool
isSatelliteMap
:
mapType
==
"
Satellite Map
"
||
mapType
==
"
Hybrid Map
"
property
real
lon
:
(
longitude
>=
-
180
&&
longitude
<=
180
)
?
longitude
:
0
property
real
lat
:
(
latitude
>=
-
90
&&
latitude
<=
90
)
?
latitude
:
0
readonly
property
real
maxZoomLevel
:
20
zoomLevel
:
18
center
:
Q
tPositioning
.
coordinate
(
lat
,
lon
)
center
:
Q
GroundControl
.
defaultMapPosition
gesture.flickDeceleration
:
3000
gesture.enabled
:
interactive
gesture.activeGestures
:
MapGestureArea
.
ZoomGesture
|
MapGestureArea
.
PanGesture
|
MapGestureArea
.
FlickGesture
...
...
@@ -69,6 +63,18 @@ Map {
Component.onCompleted
:
onMapTypeChanged
property
bool
_initialMapPositionSet
:
false
Connections
{
target
:
mainWindow
onGcsPositionChanged
:
{
if
(
!
_initialMapPositionSet
)
{
_initialMapPositionSet
=
true
flightMap
.
center
=
mainWindow
.
gcsPosition
}
}
}
onMapTypeChanged
:
{
QGroundControl
.
flightMapSettings
.
setMapTypeForMapName
(
mapName
,
mapType
)
var
fullMapName
=
QGroundControl
.
flightMapSettings
.
mapProvider
+
"
"
+
mapType
...
...
@@ -80,7 +86,18 @@ Map {
}
}
/*********************************************
MapQuickItem
{
anchorPoint.x
:
sourceItem
.
width
/
2
anchorPoint.y
:
sourceItem
.
height
/
2
visible
:
mainWindow
.
gcsPosition
.
isValid
coordinate
:
mainWindow
.
gcsPosition
sourceItem
:
MissionItemIndexLabel
{
label
:
"
Q
"
}
}
/*********************************************
/// Map control widgets
Column {
id: controlWidgets
...
...
src/MissionEditor/MissionEditor.qml
View file @
8290009d
...
...
@@ -62,13 +62,8 @@ QGCView {
property
var
_missionItems
:
controller
.
missionItems
property
var
_currentMissionItem
property
bool
gpsLock
:
_activeVehicle
?
_activeVehicle
.
coordinateValid
:
false
property
bool
_firstGpsLock
:
true
//property var _homePositionManager: QGroundControl.homePositionManager
//property string _homePositionName: _homePositionManager.homePositions.get(0).name
//property var offlineHomePosition: _homePositionManager.homePositions.get(0).coordinate
property
bool
_firstVehiclePosition
:
true
property
var
activeVehiclePosition
:
_activeVehicle
?
_activeVehicle
.
coordinate
:
QtPositioning
.
coordinate
()
property
var
liveHomePosition
:
controller
.
liveHomePosition
property
var
liveHomePositionAvailable
:
controller
.
liveHomePositionAvailable
...
...
@@ -76,17 +71,23 @@ QGCView {
property
bool
_syncInProgress
:
_activeVehicle
?
_activeVehicle
.
missionManager
.
inProgress
:
false
onGpsLockChanged
:
updateMapToVehiclePosition
()
Component.onCompleted
:
updateMapToVehiclePosition
()
onActiveVehiclePositionChanged
:
updateMapToVehiclePosition
()
Component.onCompleted
:
{
updateMapToVehiclePosition
()
Connections
{
target
:
multiVehicleManager
onActiveVehicleChanged
:
{
// When the active vehicle changes we need to allow the first vehicle position to move the map again
_firstVehiclePosition
=
true
updateMapToVehiclePosition
()
}
}
function
updateMapToVehiclePosition
()
{
if
(
gpsLock
&&
_firstGpsLock
)
{
_firstGpsLock
=
false
editorMap
.
latitude
=
_activeVehicle
.
latitude
editorMap
.
longitude
=
_activeVehicle
.
longitude
if
(
_activeVehicle
&&
_activeVehicle
.
coordinateValid
&&
_firstVehiclePosition
)
{
_firstVehiclePosition
=
false
editorMap
.
center
=
_activeVehicle
.
coordinate
}
}
...
...
@@ -178,8 +179,6 @@ QGCView {
id
:
editorMap
anchors.fill
:
parent
mapName
:
"
MissionEditor
"
latitude
:
mainWindow
.
tabletPosition
.
latitude
longitude
:
mainWindow
.
tabletPosition
.
longitude
readonly
property
real
animationDuration
:
500
...
...
@@ -190,20 +189,6 @@ QGCView {
}
}
Behavior
on
latitude
{
NumberAnimation
{
duration
:
editorMap
.
animationDuration
easing.type
:
Easing
.
InOutQuad
}
}
Behavior
on
longitude
{
NumberAnimation
{
duration
:
editorMap
.
animationDuration
easing.type
:
Easing
.
InOutQuad
}
}
MouseArea
{
anchors.fill
:
parent
...
...
src/QGCApplication.cc
View file @
8290009d
...
...
@@ -121,6 +121,8 @@ const char* QGCApplication::_settingsVersionKey = "SettingsVersion";
const
char
*
QGCApplication
::
_promptFlightDataSave
=
"PromptFLightDataSave"
;
const
char
*
QGCApplication
::
_promptFlightDataSaveNotArmed
=
"PromptFLightDataSaveNotArmed"
;
const
char
*
QGCApplication
::
_styleKey
=
"StyleIsDark"
;
const
char
*
QGCApplication
::
_defaultMapPositionLatKey
=
"DefaultMapPositionLat"
;
const
char
*
QGCApplication
::
_defaultMapPositionLonKey
=
"DefaultMapPositionLon"
;
const
char
*
QGCApplication
::
_darkStyleFile
=
":/res/styles/style-dark.css"
;
const
char
*
QGCApplication
::
_lightStyleFile
=
":/res/styles/style-light.css"
;
...
...
@@ -176,6 +178,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
#endif
,
_toolbox
(
NULL
)
,
_bluetoothAvailable
(
false
)
,
_defaultMapPosition
(
37.803784
,
-
122.462276
)
{
Q_ASSERT
(
_app
==
NULL
);
_app
=
this
;
...
...
@@ -318,6 +321,9 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
settings
.
setValue
(
_settingsVersionKey
,
QGC_SETTINGS_VERSION
);
}
_defaultMapPosition
.
setLatitude
(
settings
.
value
(
_defaultMapPositionLatKey
,
37.803784
).
toDouble
());
_defaultMapPosition
.
setLongitude
(
settings
.
value
(
_defaultMapPositionLonKey
,
-
122.462276
).
toDouble
());
// Initialize Bluetooth
#ifdef QGC_ENABLE_BLUETOOTH
QBluetoothLocalDevice
localDevice
;
...
...
@@ -711,3 +717,12 @@ void QGCApplication::_showSetupVehicleComponent(VehicleComponent* vehicleCompone
QMetaObject
::
invokeMethod
(
_rootQmlObject
(),
"showSetupVehicleComponent"
,
Q_RETURN_ARG
(
QVariant
,
varReturn
),
Q_ARG
(
QVariant
,
varComponent
));
}
void
QGCApplication
::
setDefaultMapPosition
(
QGeoCoordinate
&
defaultMapPosition
)
{
QSettings
settings
;
settings
.
setValue
(
_defaultMapPositionLatKey
,
defaultMapPosition
.
latitude
());
settings
.
setValue
(
_defaultMapPositionLonKey
,
defaultMapPosition
.
longitude
());
_defaultMapPosition
=
defaultMapPosition
;
}
src/QGCApplication.h
View file @
8290009d
...
...
@@ -121,6 +121,9 @@ public:
/// Do we have Bluetooth Support?
bool
isBluetoothAvailable
()
{
return
_bluetoothAvailable
;
}
QGeoCoordinate
defaultMapPosition
(
void
)
{
return
_defaultMapPosition
;
}
void
setDefaultMapPosition
(
QGeoCoordinate
&
defaultMapPosition
);
public
slots
:
/// You can connect to this slot to show an information message box from a different thread.
void
informationMessageBoxOnMainThread
(
const
QString
&
title
,
const
QString
&
msg
);
...
...
@@ -184,12 +187,6 @@ private:
QQmlApplicationEngine
*
_qmlAppEngine
;
#endif
static
const
char
*
_settingsVersionKey
;
///< Settings key which hold settings version
static
const
char
*
_deleteAllSettingsKey
;
///< If this settings key is set on boot, all settings will be deleted
static
const
char
*
_promptFlightDataSave
;
///< Settings key for promptFlightDataSave
static
const
char
*
_promptFlightDataSaveNotArmed
;
///< Settings key for promptFlightDataSaveNotArmed
static
const
char
*
_styleKey
;
///< Settings key for UI style
bool
_runningUnitTests
;
///< true: running unit tests, false: normal app
static
const
char
*
_darkStyleFile
;
...
...
@@ -210,6 +207,16 @@ private:
bool
_bluetoothAvailable
;
QGeoCoordinate
_defaultMapPosition
;
///< Map position when all other sources fail
static
const
char
*
_settingsVersionKey
;
///< Settings key which hold settings version
static
const
char
*
_deleteAllSettingsKey
;
///< If this settings key is set on boot, all settings will be deleted
static
const
char
*
_promptFlightDataSave
;
///< Settings key for promptFlightDataSave
static
const
char
*
_promptFlightDataSaveNotArmed
;
///< Settings key for promptFlightDataSaveNotArmed
static
const
char
*
_styleKey
;
///< Settings key for UI style
static
const
char
*
_defaultMapPositionLatKey
;
///< Settings key for default map location
static
const
char
*
_defaultMapPositionLonKey
;
///< Settings key for default map location
/// Unit Test have access to creating and destroying singletons
friend
class
UnitTest
;
};
...
...
src/QmlControls/QGroundControlQmlGlobal.cc
View file @
8290009d
...
...
@@ -42,7 +42,6 @@ QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app)
,
_virtualTabletJoystick
(
false
)
,
_offlineEditingFirmwareTypeFact
(
QString
(),
"OfflineEditingFirmwareType"
,
FactMetaData
::
valueTypeUint32
,
(
uint32_t
)
MAV_AUTOPILOT_ARDUPILOTMEGA
)
,
_offlineEditingFirmwareTypeMetaData
(
FactMetaData
::
valueTypeUint32
)
{
QSettings
settings
;
_virtualTabletJoystick
=
settings
.
value
(
_virtualTabletJoystickKey
,
false
).
toBool
();
...
...
src/QmlControls/QGroundControlQmlGlobal.h
View file @
8290009d
...
...
@@ -76,6 +76,8 @@ public:
Q_PROPERTY
(
Fact
*
offlineEditingFirmwareType
READ
offlineEditingFirmwareType
CONSTANT
)
Q_PROPERTY
(
QGeoCoordinate
defaultMapPosition
READ
defaultMapPosition
CONSTANT
)
Q_INVOKABLE
void
saveGlobalSetting
(
const
QString
&
key
,
const
QString
&
value
);
Q_INVOKABLE
QString
loadGlobalSetting
(
const
QString
&
key
,
const
QString
&
defaultValue
);
Q_INVOKABLE
void
saveBoolGlobalSetting
(
const
QString
&
key
,
bool
value
);
...
...
@@ -113,6 +115,8 @@ public:
bool
isVersionCheckEnabled
()
{
return
_toolbox
->
mavlinkProtocol
()
->
versionCheckEnabled
();
}
int
mavlinkSystemID
()
{
return
_toolbox
->
mavlinkProtocol
()
->
getSystemId
();
}
QGeoCoordinate
defaultMapPosition
()
{
return
qgcApp
()
->
defaultMapPosition
();
}
Fact
*
offlineEditingFirmwareType
()
{
return
&
_offlineEditingFirmwareTypeFact
;
}
//-- TODO: Make this into an actual preference.
...
...
@@ -144,7 +148,6 @@ signals:
void
mavlinkSystemIDChanged
(
int
id
);
private:
FlightMapSettings
*
_flightMapSettings
;
HomePositionManager
*
_homePositionManager
;
LinkManager
*
_linkManager
;
...
...
src/Vehicle/Vehicle.cc
View file @
8290009d
...
...
@@ -281,6 +281,7 @@ void Vehicle::_handleHomePosition(mavlink_message_t& message)
if
(
emitHomePositionChanged
)
{
qCDebug
(
VehicleLog
)
<<
"New home position"
<<
newHomePosition
;
qgcApp
()
->
setDefaultMapPosition
(
_homePosition
);
emit
homePositionChanged
(
_homePosition
);
}
if
(
emitHomePositionAvailableChanged
)
{
...
...
src/ui/MainWindowInner.qml
View file @
8290009d
...
...
@@ -33,9 +33,9 @@ import QGroundControl.FlightDisplay 1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
MultiVehicleManager
1.0
/// Inner common QML for
M
ainWindow
/// Inner common QML for
m
ainWindow
Item
{
id
:
mainWindow
id
:
mainWindow
signal
reallyClose
...
...
@@ -50,10 +50,7 @@ Item {
property
real
tbButtonWidth
:
tbCellHeight
*
1.35
property
real
availableHeight
:
height
-
tbHeight
property
real
menuButtonWidth
:
(
tbButtonWidth
*
2
)
+
(
tbSpacing
*
4
)
+
1
property
var
defaultPosition
:
QtPositioning
.
coordinate
(
37.803784
,
-
122.462276
)
property
var
tabletPosition
:
defaultPosition
property
var
gcsPosition
:
QtPositioning
.
coordinate
()
// Starts as invalid coordinate
property
var
currentPopUp
:
null
property
real
currentCenterX
:
0
property
var
activeVehicle
:
multiVehicleManager
.
activeVehicle
...
...
@@ -179,20 +176,20 @@ Item {
PositionSource
{
id
:
positionSource
updateInterval
:
1000
active
:
false
active
:
true
onPositionChanged
:
{
if
(
positionSource
.
valid
)
{
if
(
positionSource
.
position
.
coordinate
.
latitude
)
{
if
(
Math
.
abs
(
positionSource
.
position
.
coordinate
.
latitude
)
>
0.001
)
{
if
(
positionSource
.
position
.
coordinate
.
longitude
)
{
if
(
Math
.
abs
(
positionSource
.
position
.
coordinate
.
longitude
)
>
0.001
)
{
tablet
Position
=
positionSource
.
position
.
coordinate
gcs
Position
=
positionSource
.
position
.
coordinate
}
}
}
}
}
positionSource
.
stop
()
}
}
...
...
@@ -299,9 +296,6 @@ Item {
anchors.fill
:
parent
availableHeight
:
mainWindow
.
availableHeight
visible
:
true
Component.onCompleted
:
{
positionSource
.
start
()
}
}
Loader
{
...
...
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