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
a4d09405
Commit
a4d09405
authored
Jan 31, 2021
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp
parent
670dffae
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
324 additions
and
213 deletions
+324
-213
MeasurementComplexItem.cc
src/MeasurementComplexItem/MeasurementComplexItem.cc
+22
-9
MeasurementComplexItem.h
src/MeasurementComplexItem/MeasurementComplexItem.h
+15
-0
NemoInterface.cpp
src/MeasurementComplexItem/NemoInterface.cpp
+248
-194
NemoInterface.h
src/MeasurementComplexItem/NemoInterface.h
+31
-9
MeasurementComplexItem.SettingsGroup.json
...omplexItem/json/MeasurementComplexItem.SettingsGroup.json
+7
-0
QGCApplication.cc
src/QGCApplication.cc
+1
-1
No files found.
src/MeasurementComplexItem/MeasurementComplexItem.cc
View file @
a4d09405
...
...
@@ -41,6 +41,7 @@ const char *variantNamesKey = "VariantNames";
const
char
*
generatorArrayKey
=
"GeneratorArray"
;
const
char
*
variantArrayKey
=
"VariantArray"
;
const
char
*
generatorIndexKey
=
"GeneratorIndex"
;
const
char
*
connectionsStringKey
=
"ConnectionString"
;
}
// namespace
MeasurementComplexItem
::
MeasurementComplexItem
(
...
...
@@ -55,7 +56,8 @@ MeasurementComplexItem::MeasurementComplexItem(
_variantIndex
(
settingsGroup
,
_metaDataMap
[
variantIndexKey
]),
_pAreaData
(
new
AreaData
(
this
)),
_pEditorData
(
new
AreaData
(
this
)),
_pCurrentData
(
_pAreaData
),
_holdProgress
(
false
),
_pGenerator
(
nullptr
),
_pWorker
(
new
RoutingThread
(
this
))
{
_pWorker
(
new
RoutingThread
(
this
)),
_nemoCString
(
settingsGroup
,
_metaDataMap
[
connectionsStringKey
])
{
// Setup altitude.
_altitude
.
setRawValue
(
qgcApp
()
...
...
@@ -91,17 +93,17 @@ MeasurementComplexItem::MeasurementComplexItem(
&
MeasurementComplexItem
::
_storeRoutingData
);
// Connect coordinate and exitCoordinate.
connect
(
this
,
&
MeasurementComplexItem
::
routeChanged
,
connect
(
this
,
&
MeasurementComplexItem
::
routeChanged
,
this
,
[
this
]
{
emit
this
->
coordinateChanged
(
this
->
coordinate
());
});
connect
(
this
,
&
MeasurementComplexItem
::
routeChanged
,
connect
(
this
,
&
MeasurementComplexItem
::
routeChanged
,
this
,
[
this
]
{
emit
this
->
exitCoordinateChanged
(
this
->
exitCoordinate
());
});
connect
(
this
,
&
MeasurementComplexItem
::
routeChanged
,
[
this
]
{
connect
(
this
,
&
MeasurementComplexItem
::
routeChanged
,
this
,
[
this
]
{
emit
this
->
exitCoordinateSameAsEntryChanged
(
this
->
exitCoordinateSameAsEntry
());
});
// Connect isIncomplete.
connect
(
this
,
&
MeasurementComplexItem
::
idleChanged
,
[
this
]
{
connect
(
this
,
&
MeasurementComplexItem
::
idleChanged
,
this
,
[
this
]
{
if
(
this
->
idle
())
{
if
(
this
->
route
().
size
()
>
0
&&
this
->
_isIncomplete
==
true
)
{
this
->
_isIncomplete
=
false
;
...
...
@@ -124,14 +126,14 @@ MeasurementComplexItem::MeasurementComplexItem(
&
MeasurementComplexItem
::
_updateFlightpathSegments
);
// Connect complexDistance.
connect
(
this
,
&
MeasurementComplexItem
::
routeChanged
,
connect
(
this
,
&
MeasurementComplexItem
::
routeChanged
,
this
,
[
this
]
{
emit
this
->
complexDistanceChanged
();
});
resetGenerators
();
startEditing
();
// connect to nemo interface
connect
(
pNemoInterface
,
&
Nemo
I
nterface
::
progressChanged
,
this
,
connect
(
pNemoInterface
,
&
Nemo
i
nterface
::
progressChanged
,
this
,
&
MeasurementComplexItem
::
_onNewProgress
);
}
...
...
@@ -773,6 +775,17 @@ void MeasurementComplexItem::_onAltitudeChanged() {
}
}
QString
MeasurementComplexItem
::
nemoError
()
const
{
return
_nemoError
;
}
void
MeasurementComplexItem
::
_setNemoError
(
const
QString
&
nemoError
)
{
if
(
_nemoError
!=
nemoError
)
{
_nemoError
=
nemoError
;
emit
nemoErrorChanged
();
}
}
Fact
*
MeasurementComplexItem
::
nemoCString
()
{
return
&
_nemoCString
;
}
bool
MeasurementComplexItem
::
holdProgress
()
const
{
return
_holdProgress
;
}
void
MeasurementComplexItem
::
setHoldProgress
(
bool
holdProgress
)
{
...
...
@@ -781,10 +794,10 @@ void MeasurementComplexItem::setHoldProgress(bool holdProgress) {
emit
holdProgressChanged
();
if
(
_holdProgress
)
{
disconnect
(
pNemoInterface
,
&
Nemo
I
nterface
::
progressChanged
,
this
,
disconnect
(
pNemoInterface
,
&
Nemo
i
nterface
::
progressChanged
,
this
,
&
MeasurementComplexItem
::
_onNewProgress
);
}
else
{
connect
(
pNemoInterface
,
&
Nemo
I
nterface
::
progressChanged
,
this
,
connect
(
pNemoInterface
,
&
Nemo
i
nterface
::
progressChanged
,
this
,
&
MeasurementComplexItem
::
_onNewProgress
);
_onNewProgress
(
pNemoInterface
->
getProgress
());
}
...
...
src/MeasurementComplexItem/MeasurementComplexItem.h
View file @
a4d09405
...
...
@@ -14,6 +14,7 @@
class
RoutingThread
;
class
RoutingResult
;
class
Nemointerface
;
namespace
routing
{
class
GeneratorBase
;
...
...
@@ -51,6 +52,8 @@ public:
Q_PROPERTY
(
int
generatorIndex
READ
generatorIndex
NOTIFY
generatorChanged
)
Q_PROPERTY
(
AreaData
*
areaData
READ
areaData
NOTIFY
areaDataChanged
)
Q_PROPERTY
(
QVariantList
route
READ
route
NOTIFY
routeChanged
)
Q_PROPERTY
(
QString
nemoError
READ
nemoError
NOTIFY
nemoErrorChanged
)
Q_PROPERTY
(
Fact
*
nemoCString
READ
nemoCString
CONSTANT
)
Q_INVOKABLE
void
reverseRoute
(
void
);
...
...
@@ -224,6 +227,10 @@ public:
bool
holdProgress
()
const
;
void
setHoldProgress
(
bool
holdProgress
);
QString
nemoError
()
const
;
Fact
*
nemoCString
();
signals:
void
variantNamesChanged
();
...
...
@@ -238,6 +245,8 @@ signals:
void
routeChanged
();
void
holdProgressChanged
();
void
nemoErrorChanged
();
private
slots
:
// Worker functions.
...
...
@@ -257,6 +266,7 @@ private:
static
bool
_idle
(
STATE
state
);
void
_updateFlightpathSegments
();
void
_onAltitudeChanged
();
void
_setNemoError
(
const
QString
&
nemoError
);
// Hirarcical stuff.
int
_sequenceNumber
;
...
...
@@ -285,4 +295,9 @@ private:
QVector
<
Variant
>
_variantVector
;
Variant
_route
;
PtrWorker
_pWorker
;
// NemoInterface
std
::
shared_ptr
<
Nemointerface
>
_pNemointerface
;
QString
_nemoError
;
SettingsFact
_nemoCString
;
};
src/MeasurementComplexItem/NemoInterface.cpp
View file @
a4d09405
This diff is collapsed.
Click to expand it.
src/MeasurementComplexItem/NemoInterface.h
View file @
a4d09405
...
...
@@ -13,20 +13,20 @@
#include "TilePtrArray.h"
#include "geometry/ProgressArray.h"
// Singelton class used to interface measurement devices implementing the nemo
// interface.
class
Nemo
I
nterface
:
public
QObject
{
class
NemointerfaceFactory
;
class
Nemo
i
nterface
:
public
QObject
{
Q_OBJECT
class
Impl
;
using
PImpl
=
std
::
unique_ptr
<
Impl
>
;
NemoInterface
();
NemoInterface
(
NemoInterface
&
other
)
=
delete
;
static
NemoInterface
*
createInstance
();
Nemointerface
(
const
QString
&
connectionString
);
Nemointerface
(
Nemointerface
&
other
)
=
delete
;
friend
class
NemointerfaceFactory
;
public:
~
NemoInterface
()
override
;
static
NemoInterface
*
instance
();
~
Nemointerface
()
override
;
enum
class
STATUS
{
NOT_CONNECTED
,
...
...
@@ -90,6 +90,7 @@ public:
QString
infoString
()
const
;
QString
warningString
()
const
;
bool
running
()
const
;
QString
connectionString
();
signals:
void
statusChanged
();
...
...
@@ -103,4 +104,25 @@ private:
PImpl
pImpl
;
};
#define pNemoInterface NemoInterface::instance()
// Singelton class used for nemo interface creation.
class
NemointerfaceFactory
{
NemointerfaceFactory
();
NemointerfaceFactory
(
const
NemointerfaceFactory
&
other
)
=
delete
;
static
NemointerfaceFactory
*
createInstance
();
public:
~
NemointerfaceFactory
();
static
NemointerfaceFactory
*
instance
();
// Creates a interface with a connection string connectionString.
// Two different interfaces can't share the same connection string.
std
::
shared_ptr
<
Nemointerface
>
create
(
const
QString
&
connectionString
);
// Returns true if an interface with connection string connectionString can
// be created (i.e. doesn't exist yet), returns false either.
bool
isCreatable
(
const
QString
&
connectionString
);
private:
std
::
map
<
QString
,
std
::
weak_ptr
<
Nemointerface
>>
_map
;
};
#define pNemoInterfaceFactory NemointerfaceFactory::instance()
src/MeasurementComplexItem/json/MeasurementComplexItem.SettingsGroup.json
View file @
a4d09405
...
...
@@ -17,6 +17,13 @@
"min"
:
1
,
"decimalPlaces"
:
1
,
"default"
:
10.0
},
{
"name"
:
"ConnectionString"
,
"shrotDesc"
:
"Nemo Connection String."
,
"longDesc"
:
"Nemo Connection String (e.g. host_ip:port)."
,
"type"
:
"string"
,
"default"
:
"localhost:9090"
}
]
}
src/QGCApplication.cc
View file @
a4d09405
...
...
@@ -672,7 +672,7 @@ void QGCApplication::_initCommon() {
qmlRegisterUncreatableType
<
routing
::
LinearGenerator
>
(
"MeasurementComplexItem"
,
1
,
0
,
"LinearGenerator"
,
kRefOnly
);
qmlRegisterType
<
AreaData
>
(
"MeasurementComplexItem"
,
1
,
0
,
"AreaData"
);
qmlRegisterSingletonType
<
Nemo
I
nterface
>
(
"MeasurementComplexItem"
,
1
,
0
,
qmlRegisterSingletonType
<
Nemo
i
nterface
>
(
"MeasurementComplexItem"
,
1
,
0
,
"NemoInterface"
,
getNemoInterface
);
qmlRegisterInterface
<
routing
::
GeneratorBase
>
(
"GeneratorBase"
);
qmlRegisterUncreatableType
<
routing
::
CircularGenerator
>
(
...
...
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