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
512301be
Commit
512301be
authored
Jul 11, 2018
by
Jonas Vautherin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove boost dependency from airmap public interface
parent
a15b46b8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
140 additions
and
48 deletions
+140
-48
QGCExternalLibs.pri
QGCExternalLibs.pri
+15
-20
date_time.h
libs/airmapd/include/airmap/date_time.h
+115
-19
AirMapAdvisoryManager.cc
src/Airmap/AirMapAdvisoryManager.cc
+2
-1
AirMapFlightPlanManager.cc
src/Airmap/AirMapFlightPlanManager.cc
+8
-8
No files found.
QGCExternalLibs.pri
View file @
512301be
...
...
@@ -153,28 +153,23 @@ contains (DEFINES, DISABLE_AIRMAP) {
message("Skipping support for AirMap (manual override from user_config.pri)")
} else {
AIRMAPD_PATH = $$PWD/libs/airmapd
# Temporary until we get rid of boost
exists($${AIRMAPD_PATH}/include/boost) {
MacBuild|iOSBuild {
exists($${AIRMAPD_PATH}/macOS/Qt.5.9) {
message("Including support for AirMap for macOS")
LIBS += -L$${AIRMAPD_PATH}/macOS/Qt.5.9 -lairmap-qt
DEFINES += QGC_AIRMAP_ENABLED
}
} else:LinuxBuild {
exists($${AIRMAPD_PATH}/linux/Qt.5.9) {
message("Including support for AirMap for Linux")
LIBS += -L$${AIRMAPD_PATH}/linux/Qt.5.9 -lairmap-qt
DEFINES += QGC_AIRMAP_ENABLED
}
} else {
message("Skipping support for Airmap (unsupported platform)")
MacBuild|iOSBuild {
exists($${AIRMAPD_PATH}/macOS/Qt.5.9) {
message("Including support for AirMap for macOS")
LIBS += -L$${AIRMAPD_PATH}/macOS/Qt.5.9 -lairmap-qt
DEFINES += QGC_AIRMAP_ENABLED
}
contains (DEFINES, QGC_AIRMAP_ENABLED) {
INCLUDEPATH += \
$${AIRMAPD_PATH}/include
} else:LinuxBuild {
exists($${AIRMAPD_PATH}/linux/Qt.5.9) {
message("Including support for AirMap for Linux")
LIBS += -L$${AIRMAPD_PATH}/linux/Qt.5.9 -lairmap-qt
DEFINES += QGC_AIRMAP_ENABLED
}
} else {
message("Missing boost for AirMap. Excluding AirMap support")
message("Skipping support for Airmap (unsupported platform)")
}
contains (DEFINES, QGC_AIRMAP_ENABLED) {
INCLUDEPATH += \
$${AIRMAPD_PATH}/include
}
}
libs/airmapd/include/airmap/date_time.h
View file @
512301be
#ifndef AIRMAP_DATE_TIME_H_
#define AIRMAP_DATE_TIME_H_
#include <boost/date_time.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <cstdint>
#include <memory>
#include <string>
namespace
airmap
{
class
DateTime
;
template
<
typename
Tag
>
class
Duration
;
namespace
detail
{
class
Duration
;
}
// namespace detail
namespace
tag
{
struct
Hours
{};
struct
Minutes
{};
struct
Seconds
{};
struct
Milliseconds
{};
struct
Microseconds
{};
}
// namespace tag
using
Hours
=
Duration
<
tag
::
Hours
>
;
using
Minutes
=
Duration
<
tag
::
Minutes
>
;
using
Seconds
=
Duration
<
tag
::
Seconds
>
;
using
Milliseconds
=
Duration
<
tag
::
Milliseconds
>
;
using
Microseconds
=
Duration
<
tag
::
Microseconds
>
;
/// Clock marks the reference for time measurements.
using
Clock
=
boost
::
posix_time
::
microsec_clock
;
class
Clock
{
public:
static
DateTime
universal_time
();
static
DateTime
local_time
();
};
namespace
boost_iso
{
DateTime
datetime
(
const
std
::
string
&
iso_time
);
std
::
string
to_iso_string
(
const
DateTime
&
);
}
// namespace boost_iso
/// DateTime marks a specific point in time, in reference to Clock.
using
DateTime
=
boost
::
posix_time
::
ptime
;
using
Hours
=
boost
::
posix_time
::
hours
;
using
Minutes
=
boost
::
posix_time
::
minutes
;
using
Seconds
=
boost
::
posix_time
::
seconds
;
using
Milliseconds
=
boost
::
posix_time
::
milliseconds
;
using
Microseconds
=
boost
::
posix_time
::
microseconds
;
class
DateTime
{
public:
DateTime
();
~
DateTime
();
DateTime
(
DateTime
const
&
);
DateTime
(
DateTime
&&
);
DateTime
&
operator
=
(
const
DateTime
&
);
DateTime
&
operator
=
(
DateTime
&&
);
DateTime
operator
+
(
const
detail
::
Duration
&
)
const
;
Microseconds
operator
-
(
const
DateTime
&
)
const
;
bool
operator
==
(
const
DateTime
&
)
const
;
bool
operator
!=
(
const
DateTime
&
)
const
;
friend
std
::
istream
&
operator
>>
(
std
::
istream
&
,
DateTime
&
);
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
,
const
DateTime
&
);
DateTime
date
()
const
;
Microseconds
time_of_day
()
const
;
private:
struct
Impl
;
std
::
unique_ptr
<
Impl
>
impl
;
explicit
DateTime
(
std
::
unique_ptr
<
Impl
>
&&
);
friend
DateTime
Clock
::
universal_time
();
friend
DateTime
Clock
::
local_time
();
friend
DateTime
boost_iso
::
datetime
(
const
std
::
string
&
iso_time
);
friend
std
::
string
boost_iso
::
to_iso_string
(
const
DateTime
&
datetime
);
};
Hours
hours
(
int64_t
raw
);
Minutes
minutes
(
int64_t
raw
);
Seconds
seconds
(
int64_t
raw
);
Milliseconds
milliseconds
(
int64_t
raw
);
Microseconds
microseconds
(
int64_t
raw
);
namespace
detail
{
class
Duration
{
public:
Duration
();
~
Duration
();
Duration
(
Duration
const
&
old
);
Duration
&
operator
=
(
const
Duration
&
);
uint64_t
total_seconds
()
const
;
uint64_t
total_milliseconds
()
const
;
uint64_t
total_microseconds
()
const
;
uint64_t
hours
()
const
;
private:
struct
Impl
;
std
::
unique_ptr
<
Impl
>
impl
;
friend
DateTime
DateTime
::
operator
+
(
const
detail
::
Duration
&
)
const
;
friend
Microseconds
DateTime
::
operator
-
(
const
DateTime
&
)
const
;
friend
Microseconds
DateTime
::
time_of_day
()
const
;
friend
Hours
airmap
::
hours
(
int64_t
raw
);
friend
Minutes
airmap
::
minutes
(
int64_t
raw
);
friend
Seconds
airmap
::
seconds
(
int64_t
raw
);
friend
Milliseconds
airmap
::
milliseconds
(
int64_t
raw
);
friend
Microseconds
airmap
::
microseconds
(
int64_t
raw
);
};
}
// namespace detail
template
<
typename
Tag
>
class
Duration
:
public
detail
::
Duration
{};
/// milliseconds_since_epoch returns the milliseconds that elapsed since the UNIX epoch.
std
::
uint64_t
milliseconds_since_epoch
(
const
DateTime
&
dt
);
uint64_t
milliseconds_since_epoch
(
const
DateTime
&
dt
);
/// microseconds_since_epoch returns the microseconds that elapsed since the UNIX epoch.
std
::
uint64_t
microseconds_since_epoch
(
const
DateTime
&
dt
);
uint64_t
microseconds_since_epoch
(
const
DateTime
&
dt
);
/// from_seconds_since_epoch returns a DateTime.
DateTime
from_seconds_since_epoch
(
const
Seconds
&
s
);
DateTime
from_seconds_since_epoch
(
const
Seconds
&
s
);
/// from_milliseconds_since_epoch returns a DateTime.
DateTime
from_milliseconds_since_epoch
(
const
Milliseconds
&
ms
);
DateTime
from_milliseconds_since_epoch
(
const
Milliseconds
&
ms
);
/// from_microseconds_since_epoch returns a DateTime.
DateTime
from_microseconds_since_epoch
(
const
Microseconds
&
us
);
DateTime
from_microseconds_since_epoch
(
const
Microseconds
&
us
);
// moves the datetime forward to the specified hour
DateTime
move_to_hour
(
const
DateTime
&
dt
,
in
t
hour
);
DateTime
move_to_hour
(
const
DateTime
&
dt
,
uint64_
t
hour
);
namespace
iso8601
{
/// parse parses a DateTime instance from the string s in iso8601 format.
DateTime
parse
(
const
std
::
string
&
s
);
DateTime
parse
(
const
std
::
string
&
s
);
/// generate returns a string in iso8601 corresponding to 'dt'.
std
::
string
generate
(
const
DateTime
&
dt
);
std
::
string
generate
(
const
DateTime
&
dt
);
}
// namespace iso8601
...
...
src/Airmap/AirMapAdvisoryManager.cc
View file @
512301be
...
...
@@ -11,6 +11,7 @@
#include "AirspaceRestriction.h"
#include "AirMapManager.h"
#include <cmath>
#include <QTimer>
#include "airmap/airspaces.h"
...
...
@@ -73,7 +74,7 @@ AirMapAdvisoryManager::_requestAdvisories()
params
.
types
=
Airspace
::
Type
::
all
;
params
.
weather
=
false
;
double
diagonal
=
_lastROI
.
pointNW
.
distanceTo
(
_lastROI
.
pointSE
);
params
.
buffer
=
fmax
(
fmin
(
diagonal
,
10000.0
),
500.0
);
params
.
buffer
=
std
::
fmax
(
std
::
fmin
(
diagonal
,
10000.0
),
500.0
);
params
.
flight_date_time
=
Clock
::
universal_time
();
std
::
weak_ptr
<
LifetimeChecker
>
isAlive
(
_instance
);
_shared
.
client
()
->
status
().
get_status_by_point
(
params
,
[
this
,
isAlive
](
const
Status
::
GetStatus
::
Result
&
result
)
{
...
...
src/Airmap/AirMapFlightPlanManager.cc
View file @
512301be
...
...
@@ -137,13 +137,13 @@ void
AirMapFlightPlanManager
::
setFlightStartTime
(
QDateTime
start
)
{
quint64
startt
=
start
.
toUTC
().
toMSecsSinceEpoch
();
if
(
_flightPlan
.
start_time
!=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
startt
}
))
{
if
(
_flightPlan
.
start_time
!=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
milliseconds
((
long
long
)
startt
)
))
{
//-- Can't start in the past
if
(
start
<
QDateTime
::
currentDateTime
())
{
start
=
QDateTime
::
currentDateTime
().
addSecs
(
5
*
60
);
startt
=
start
.
toUTC
().
toMSecsSinceEpoch
();
}
_flightPlan
.
start_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
startt
}
);
_flightPlan
.
start_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
milliseconds
((
long
long
)
startt
)
);
emit
flightStartTimeChanged
();
}
}
...
...
@@ -153,13 +153,13 @@ void
AirMapFlightPlanManager
::
setFlightEndTime
(
QDateTime
end
)
{
quint64
endt
=
end
.
toUTC
().
toMSecsSinceEpoch
();
if
(
_flightPlan
.
end_time
!=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
endt
}
))
{
if
(
_flightPlan
.
end_time
!=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
milliseconds
((
long
long
)
endt
)
))
{
//-- End has to be after start
if
(
end
<
flightStartTime
())
{
end
=
flightStartTime
().
addSecs
(
30
*
60
);
endt
=
end
.
toUTC
().
toMSecsSinceEpoch
();
}
_flightPlan
.
end_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
endt
}
);
_flightPlan
.
end_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
milliseconds
((
long
long
)
endt
)
);
emit
flightEndTimeChanged
();
}
}
...
...
@@ -488,8 +488,8 @@ AirMapFlightPlanManager::_uploadFlightPlan()
params
.
pilot
.
id
=
_pilotID
.
toStdString
();
quint64
start
=
QDateTime
::
currentDateTimeUtc
().
toMSecsSinceEpoch
();
quint64
end
=
start
+
60
*
30
*
1000
;
params
.
start_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
start
}
);
params
.
end_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
end
}
);
params
.
start_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
milliseconds
((
long
long
)
start
)
);
params
.
end_time
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
milliseconds
((
long
long
)
end
)
);
//-- Rules & Features
_updateRulesAndFeatures
(
params
.
rulesets
,
params
.
features
);
//-- Geometry: polygon
...
...
@@ -856,8 +856,8 @@ AirMapFlightPlanManager::_loadFlightList()
params
.
authorization
=
login_token
.
toStdString
();
quint64
start
=
_rangeStart
.
toUTC
().
toMSecsSinceEpoch
();
quint64
end
=
_rangeEnd
.
toUTC
().
toMSecsSinceEpoch
();
params
.
start_after
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
start
}
);
params
.
start_before
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
Milliseconds
{(
long
long
)
end
}
);
params
.
start_after
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
milliseconds
((
long
long
)
start
)
);
params
.
start_before
=
airmap
::
from_milliseconds_since_epoch
(
airmap
::
milliseconds
((
long
long
)
end
)
);
params
.
limit
=
250
;
params
.
pilot_id
=
_pilotID
.
toStdString
();
_shared
.
client
()
->
flights
().
search
(
params
,
[
this
,
isAlive
](
const
Flights
::
Search
::
Result
&
result
)
{
...
...
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