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
42fe8ce4
Commit
42fe8ce4
authored
Jan 20, 2021
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nemo interface working
parent
47586728
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
253 additions
and
189 deletions
+253
-189
MeasurementComplexItem.cc
src/MeasurementComplexItem/MeasurementComplexItem.cc
+23
-28
MeasurementComplexItem.h
src/MeasurementComplexItem/MeasurementComplexItem.h
+7
-0
NemoInterface.cpp
src/MeasurementComplexItem/NemoInterface.cpp
+208
-90
NemoInterface.h
src/MeasurementComplexItem/NemoInterface.h
+8
-8
MeasurementArea.cc
src/MeasurementComplexItem/geometry/MeasurementArea.cc
+3
-14
MeasurementArea.h
src/MeasurementComplexItem/geometry/MeasurementArea.h
+0
-16
NemoEditor.qml
src/MeasurementComplexItem/qml/NemoEditor.qml
+4
-33
No files found.
src/MeasurementComplexItem/MeasurementComplexItem.cc
View file @
42fe8ce4
...
...
@@ -54,7 +54,7 @@ MeasurementComplexItem::MeasurementComplexItem(
_altitude
(
settingsGroup
,
_metaDataMap
[
altitudeKey
]),
_variantIndex
(
settingsGroup
,
_metaDataMap
[
variantIndexKey
]),
_pAreaData
(
new
AreaData
(
this
)),
_pEditorData
(
new
AreaData
(
this
)),
_pCurrentData
(
_pAreaData
),
_pGenerator
(
nullptr
),
_pCurrentData
(
_pAreaData
),
_
holdProgress
(
false
),
_
pGenerator
(
nullptr
),
_pWorker
(
new
RoutingThread
(
this
))
{
// Setup altitude.
...
...
@@ -772,6 +772,24 @@ void MeasurementComplexItem::_onAltitudeChanged() {
emit
routeChanged
();
}
}
bool
MeasurementComplexItem
::
holdProgress
()
const
{
return
_holdProgress
;
}
void
MeasurementComplexItem
::
setHoldProgress
(
bool
holdProgress
)
{
if
(
_holdProgress
!=
holdProgress
)
{
_holdProgress
=
holdProgress
;
emit
holdProgressChanged
();
if
(
_holdProgress
)
{
disconnect
(
pNemoInterface
,
&
NemoInterface
::
progressChanged
,
this
,
&
MeasurementComplexItem
::
_onNewProgress
);
}
else
{
connect
(
pNemoInterface
,
&
NemoInterface
::
progressChanged
,
this
,
&
MeasurementComplexItem
::
_onNewProgress
);
_onNewProgress
(
pNemoInterface
->
getProgress
());
}
}
}
void
MeasurementComplexItem
::
_setAreaData
(
MeasurementComplexItem
::
PtrAreaData
data
)
{
if
(
_pCurrentData
!=
data
)
{
...
...
@@ -940,30 +958,9 @@ void MeasurementComplexItem::_syncTiles() {
}
if
(
tilePtrArray
.
size
()
>
0
)
{
// create id array
IDArray
idArray
;
for
(
const
auto
*
pTile
:
tilePtrArray
)
{
idArray
.
push_back
(
pTile
->
id
());
}
// sync. necessary?
bool
doSync
=
false
;
auto
contains
=
pNemoInterface
->
containsTiles
(
idArray
);
for
(
auto
&&
logical
:
contains
)
{
if
(
logical
==
false
)
{
doSync
=
true
;
break
;
}
}
if
(
doSync
)
{
if
(
!
pNemoInterface
->
empty
())
{
(
void
)
pNemoInterface
->
clearTiles
();
}
(
void
)
pNemoInterface
->
addTiles
(
tilePtrArray
);
return
;
}
(
void
)
pNemoInterface
->
clearTiles
();
(
void
)
pNemoInterface
->
addTiles
(
tilePtrArray
);
return
;
}
else
{
clear
=
true
;
}
...
...
@@ -972,9 +969,7 @@ void MeasurementComplexItem::_syncTiles() {
}
if
(
clear
)
{
if
(
!
pNemoInterface
->
empty
())
{
(
void
)
pNemoInterface
->
clearTiles
();
}
(
void
)
pNemoInterface
->
clearTiles
();
}
}
...
...
src/MeasurementComplexItem/MeasurementComplexItem.h
View file @
42fe8ce4
...
...
@@ -43,6 +43,8 @@ public:
generatorListChanged
)
Q_PROPERTY
(
bool
calculating
READ
calculating
NOTIFY
calculatingChanged
)
Q_PROPERTY
(
bool
editing
READ
editing
NOTIFY
editingChanged
)
Q_PROPERTY
(
bool
holdProgress
READ
holdProgress
WRITE
setHoldProgress
NOTIFY
holdProgressChanged
)
Q_PROPERTY
(
bool
idle
READ
idle
NOTIFY
idleChanged
)
Q_PROPERTY
(
routing
::
GeneratorBase
*
generator
READ
generator
NOTIFY
generatorChanged
)
...
...
@@ -219,6 +221,9 @@ public:
static
const
char
*
jsonComplexItemTypeValue
;
static
const
QString
name
;
bool
holdProgress
()
const
;
void
setHoldProgress
(
bool
holdProgress
);
signals:
void
variantNamesChanged
();
...
...
@@ -231,6 +236,7 @@ signals:
void
areaDataChanged
();
void
routeChanged
();
void
holdProgressChanged
();
private
slots
:
...
...
@@ -269,6 +275,7 @@ private:
PtrAreaData
_pAreaData
;
PtrAreaData
_pEditorData
;
PtrAreaData
_pCurrentData
;
bool
_holdProgress
;
// Generators
QList
<
PtrGenerator
>
_generatorList
;
...
...
src/MeasurementComplexItem/NemoInterface.cpp
View file @
42fe8ce4
This diff is collapsed.
Click to expand it.
src/MeasurementComplexItem/NemoInterface.h
View file @
42fe8ce4
...
...
@@ -73,22 +73,22 @@ public:
//!
std
::
shared_future
<
QVariant
>
clearTiles
();
TileArray
getTiles
(
const
IDArray
&
idArray
);
TileArray
getAllTiles
();
LogicalArray
containsTiles
(
const
IDArray
&
idArray
);
std
::
size_t
size
();
bool
empty
();
TileArray
getTiles
(
const
IDArray
&
idArray
)
const
;
TileArray
getAllTiles
()
const
;
LogicalArray
containsTiles
(
const
IDArray
&
idArray
)
const
;
std
::
size_t
size
()
const
;
bool
empty
()
const
;
// Progress.
ProgressArray
getProgress
();
ProgressArray
getProgress
(
const
IDArray
&
idArray
);
ProgressArray
getProgress
()
const
;
ProgressArray
getProgress
(
const
IDArray
&
idArray
)
const
;
// Status.
STATUS
status
()
const
;
QString
statusString
()
const
;
QString
infoString
()
const
;
QString
warningString
()
const
;
bool
running
();
bool
running
()
const
;
signals:
void
statusChanged
();
...
...
src/MeasurementComplexItem/geometry/MeasurementArea.cc
View file @
42fe8ce4
...
...
@@ -55,8 +55,7 @@ MeasurementArea::MeasurementArea(QObject *parent)
this
/* QObject parent */
)),
_showTiles
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showTilesKey
],
this
/* QObject parent */
)),
_tiles
(
new
QmlObjectListModel
()),
_holdProgress
(
false
),
_state
(
STATE
::
IDLE
)
{
_tiles
(
new
QmlObjectListModel
()),
_state
(
STATE
::
IDLE
)
{
init
();
}
...
...
@@ -74,8 +73,7 @@ MeasurementArea::MeasurementArea(const MeasurementArea &other, QObject *parent)
this
/* QObject parent */
)),
_showTiles
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showTilesKey
],
this
/* QObject parent */
)),
_tiles
(
new
QmlObjectListModel
()),
_holdProgress
(
false
),
_state
(
STATE
::
IDLE
)
{
_tiles
(
new
QmlObjectListModel
()),
_state
(
STATE
::
IDLE
)
{
init
();
disableUpdate
();
...
...
@@ -323,7 +321,7 @@ bool MeasurementArea::isCorrect() {
}
void
MeasurementArea
::
updateProgress
(
const
ProgressArray
&
array
)
{
if
(
ready
()
&&
!
_holdProgress
&&
array
.
size
()
>
0
)
{
if
(
ready
()
&&
array
.
size
()
>
0
)
{
bool
anyChanges
=
false
;
for
(
const
auto
&
lp
:
array
)
{
auto
it
=
_indexMap
.
find
(
lp
.
id
());
...
...
@@ -589,15 +587,6 @@ void MeasurementArea::setState(MeasurementArea::STATE s) {
}
}
bool
MeasurementArea
::
holdProgress
()
const
{
return
_holdProgress
;
}
void
MeasurementArea
::
setHoldProgress
(
bool
holdProgress
)
{
if
(
_holdProgress
!=
holdProgress
)
{
_holdProgress
=
holdProgress
;
emit
holdProgressChanged
();
}
}
void
MeasurementArea
::
updateIds
(
const
QList
<
TileDiff
>
&
array
)
{
for
(
const
auto
&
diff
:
array
)
{
...
...
src/MeasurementComplexItem/geometry/MeasurementArea.h
View file @
42fe8ce4
...
...
@@ -48,8 +48,6 @@ public:
Q_PROPERTY
(
Fact
*
showTiles
READ
showTiles
CONSTANT
)
Q_PROPERTY
(
QmlObjectListModel
*
tiles
READ
tiles
NOTIFY
tilesChanged
)
Q_PROPERTY
(
int
maxTiles
READ
maxTiles
NOTIFY
maxTilesChanged
)
Q_PROPERTY
(
bool
holdProgress
READ
holdProgress
WRITE
setHoldProgress
NOTIFY
holdProgressChanged
)
// Overrides from GeoArea
QString
mapVisualQML
(
void
)
const
override
;
...
...
@@ -75,23 +73,10 @@ public:
static
const
char
*
settingsGroup
;
static
const
char
*
nameString
;
//!
//! \brief holdProgress
//! \return Returns a copy of the holdProgress variable.
//!
bool
holdProgress
()
const
;
//!
//! \brief setHoldProgress Sets the holdProgress variable to \p holdProgress.
//! \note If holdProgress() == true, than setProgress() will do nothing, but
//! return false and emit the progressNotAccepted() signal.
//!
void
setHoldProgress
(
bool
holdProgress
);
signals:
void
tilesChanged
();
void
maxTilesChanged
();
void
readyChanged
();
void
holdProgressChanged
();
void
progressChanged
();
public
slots
:
...
...
@@ -123,7 +108,6 @@ private:
// Tile stuff.
TilePtr
_tiles
;
std
::
map
<
std
::
int64_t
/*id*/
,
int
>
_indexMap
;
bool
_holdProgress
;
QTimer
_timer
;
STATE
_state
;
QFutureWatcher
<
TilePtr
>
_watcher
;
...
...
src/MeasurementComplexItem/qml/NemoEditor.qml
View file @
42fe8ce4
...
...
@@ -29,13 +29,10 @@ Rectangle {
property
var
_areaData
:
missionItem
.
areaData
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
var
_nemoInterface
:
MCI
.
NemoInterface
property
bool
_holding
Component.onCompleted
:
{
console
.
assert
(
missionItem
!==
undefined
,
"
please set the missionItem property
"
)
_holding
=
false
_stopHolding
()
}
GridLayout
{
...
...
@@ -93,16 +90,14 @@ Rectangle {
visible
:
progressHeader
.
checked
QGCButton
{
text
:
!
_holding
?
qsTr
(
"
Hold
"
)
:
qsTr
(
"
Stop Holding
"
)
text
:
!
missionItem
.
holdProgress
?
qsTr
(
"
Hold
"
)
:
qsTr
(
"
Stop Holding
"
)
Layout.fillWidth
:
true
Layout.columnSpan
:
parent
.
columns
onPressed
:
{
if
(
_holding
)
{
_stopHolding
()
_holding
=
false
if
(
missionItem
.
holdProgress
)
{
missionItem
.
holdProgress
=
false
}
else
{
_holdProgress
()
_holding
=
true
missionItem
.
holdProgress
=
true
}
}
}
...
...
@@ -187,30 +182,6 @@ Use the Random button to simulate measurement progress.")
}
}
// GridLayout
function
_holdProgress
()
{
var
areaArray
=
_areaData
.
measurementAreaList
for
(
var
i
=
0
;
i
<
areaArray
.
count
;
++
i
)
{
var
area
=
areaArray
.
get
(
i
)
if
(
area
)
{
area
.
holdProgress
=
true
}
else
{
console
.
log
(
"
empty area!
"
)
}
}
}
function
_stopHolding
()
{
var
areaArray
=
_areaData
.
measurementAreaList
for
(
var
i
=
0
;
i
<
areaArray
.
count
;
++
i
)
{
var
area
=
areaArray
.
get
(
i
)
if
(
area
)
{
area
.
holdProgress
=
false
}
else
{
console
.
log
(
"
empty area!
"
)
}
}
}
function
_randomProgress
()
{
var
areaArray
=
_areaData
.
measurementAreaList
for
(
var
i
=
0
;
i
<
areaArray
.
count
;
++
i
)
{
...
...
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