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
b43e55c3
Commit
b43e55c3
authored
Sep 17, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
border poly edited, not working yet
parent
62b3a020
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
13 deletions
+75
-13
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-1
WimaArea.SettingsGroup.json
src/Wima/WimaArea.SettingsGroup.json
+1
-1
WimaArea.cc
src/Wima/WimaArea.cc
+63
-11
WimaArea.h
src/Wima/WimaArea.h
+3
-0
WimaMeasurementAreaEditor.qml
src/WimaView/WimaMeasurementAreaEditor.qml
+7
-0
No files found.
qgroundcontrol.qrc
View file @
b43e55c3
...
...
@@ -272,7 +272,7 @@
<file alias="Video.SettingsGroup.json">src/Settings/Video.SettingsGroup.json</file>
<file alias="WimaMeasurementArea.SettingsGroup.json">src/Wima/WimaMeasurementArea.SettingsGroup.json</file>
<file alias="CircularSurvey.SettingsGroup.json">src/Wima/CircularSurvey.SettingsGroup.json</file>
<file>src/Wima/WimaArea.SettingsGroup.json</file>
<file
alias="WimaArea.SettingsGroup.json"
>src/Wima/WimaArea.SettingsGroup.json</file>
</qresource>
<qresource prefix="/MockLink">
<file alias="APMArduCopterMockLink.params">src/comm/APMArduCopterMockLink.params</file>
...
...
src/Wima/WimaArea.SettingsGroup.json
View file @
b43e55c3
...
...
@@ -9,7 +9,7 @@
"defaultValue"
:
5
},
{
"name"
:
"
s
howBorderPolygon"
,
"name"
:
"
S
howBorderPolygon"
,
"shortDescription"
:
"Border polygon will be displayed if checked."
,
"type"
:
"bool"
,
"defaultValue"
:
true
...
...
src/Wima/WimaArea.cc
View file @
b43e55c3
...
...
@@ -24,20 +24,27 @@ const char* WimaArea::areaTypeName = "AreaType";
const
char
*
WimaArea
::
borderPolygonOffsetName
=
"BorderPolygonOffset"
;
const
char
*
WimaArea
::
settingsGroup
=
"MeasurementArea"
;
const
char
*
WimaArea
::
showBorderPolygonName
=
"ShowBorderPolygon"
;
const
char
*
WimaArea
::
settingsGroup
=
"MeasurementArea"
;
// Constructors
WimaArea
::
WimaArea
(
QObject
*
parent
)
:
QGCMapPolygon
(
parent
)
:
QGCMapPolygon
(
parent
)
,
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/WimaArea.SettingsGroup.json"
),
this
/* QObject parent */
))
,
_borderPolygonOffset
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
borderPolygonOffsetName
],
this
/* QObject parent */
))
,
_showBorderPolygon
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showBorderPolygonName
],
this
/* QObject parent */
))
,
_borderPolygon
(
QGCMapPolygon
(
this
))
{
init
();
_maxAltitude
=
30
;
}
WimaArea
::
WimaArea
(
const
WimaArea
&
other
,
QObject
*
parent
)
:
QGCMapPolygon
(
parent
)
:
QGCMapPolygon
(
parent
)
,
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/WimaArea.SettingsGroup.json"
),
this
/* QObject parent */
))
,
_borderPolygonOffset
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
borderPolygonOffsetName
],
this
/* QObject parent */
))
,
_showBorderPolygon
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showBorderPolygonName
],
this
/* QObject parent */
))
,
_borderPolygon
(
QGCMapPolygon
(
this
))
{
init
();
*
this
=
other
;
...
...
@@ -73,6 +80,11 @@ void WimaArea::setMaxAltitude(double altitude)
}
}
void
WimaArea
::
setShowBorderPolygon
(
bool
showBorderPolygon
)
{
_showBorderPolygon
.
setRawValue
(
showBorderPolygon
);
}
void
WimaArea
::
setBorderPolygonOffset
(
double
offset
)
...
...
@@ -84,12 +96,36 @@ void WimaArea::setBorderPolygonOffset(double offset)
}
}
void
WimaArea
::
recalc
MeasurementPolygon
()
void
WimaArea
::
recalc
Polygons
()
{
this
->
setPath
(
_borderPolygon
.
coordinateList
());
this
->
offset
(
-
_borderPolygonOffset
.
rawValue
().
toDouble
());
if
(
_showBorderPolygon
.
rawValue
().
toBool
()
==
true
)
{
if
(
_borderPolygon
.
count
()
>=
3
)
{
this
->
setPath
(
_borderPolygon
.
coordinateList
());
this
->
offset
(
-
_borderPolygonOffset
.
rawValue
().
toDouble
());
}
}
else
{
if
(
this
->
count
()
>=
3
){
_borderPolygon
.
setPath
(
this
->
coordinateList
());
_borderPolygon
.
offset
(
_borderPolygonOffset
.
rawValue
().
toDouble
());
}
emit
borderPolygonChanged
();
}
emit
borderPolygonChanged
();
}
void
WimaArea
::
updatePolygonConnections
(
QVariant
showBorderPolygon
)
{
if
(
showBorderPolygon
.
toBool
()
==
true
)
{
connect
(
&
_borderPolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
WimaArea
::
recalcPolygons
);
disconnect
(
this
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
WimaArea
::
recalcPolygons
);
}
else
{
disconnect
(
&
_borderPolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
WimaArea
::
recalcPolygons
);
connect
(
this
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
WimaArea
::
recalcPolygons
);
}
}
/*!
...
...
@@ -335,10 +371,11 @@ bool WimaArea::isSimplePolygon()
void
WimaArea
::
saveToJson
(
QJsonObject
&
json
)
{
this
->
QGCMapPolygon
::
saveToJson
(
json
);
json
[
maxAltitudeName
]
=
_maxAltitude
;
json
[
maxAltitudeName
]
=
_maxAltitude
;
json
[
borderPolygonOffsetName
]
=
_borderPolygonOffset
.
rawValue
().
toDouble
();
json
[
areaTypeName
]
=
wimaAreaName
;
// add WimaVehicle if necessary..
json
[
showBorderPolygonName
]
=
_showBorderPolygon
.
rawValue
().
toDouble
()
;
json
[
areaTypeName
]
=
wimaAreaName
;
}
/*!
...
...
@@ -365,6 +402,13 @@ bool WimaArea::loadFromJson(const QJsonObject &json, QString& errorString)
errorString
.
append
(
tr
(
"Could not load border polygon offset value!
\n
"
));
return
false
;
}
if
(
json
.
contains
(
showBorderPolygonName
)
&&
json
[
showBorderPolygonName
].
isDouble
())
{
_showBorderPolygon
.
setRawValue
(
json
[
showBorderPolygonName
].
toBool
());
}
else
{
errorString
.
append
(
tr
(
"Could not load border polygon offset value!
\n
"
));
return
false
;
}
}
else
{
qWarning
()
<<
errorString
;
return
false
;
...
...
@@ -380,8 +424,16 @@ bool WimaArea::loadFromJson(const QJsonObject &json, QString& errorString)
void
WimaArea
::
init
()
{
this
->
setObjectName
(
wimaAreaName
);
connect
(
&
_borderPolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
WimaArea
::
recalcPolygons
);
if
(
_showBorderPolygon
.
rawValue
().
toBool
()
==
true
){
connect
(
&
_borderPolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
WimaArea
::
recalcPolygons
);
}
else
{
connect
(
this
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
WimaArea
::
recalcPolygons
);
}
connect
(
&
_borderPolygonOffset
,
&
SettingsFact
::
rawValueChanged
,
this
,
&
WimaArea
::
recalcPolygons
);
connect
(
&
_showBorderPolygon
,
&
SettingsFact
::
rawValueChanged
,
this
,
&
WimaArea
::
updatePolygonConnections
);
}
/*!
...
...
src/Wima/WimaArea.h
View file @
b43e55c3
...
...
@@ -72,6 +72,7 @@ public:
static
const
char
*
wimaAreaName
;
static
const
char
*
areaTypeName
;
static
const
char
*
borderPolygonOffsetName
;
static
const
char
*
showBorderPolygonName
;
static
const
char
*
settingsGroup
;
signals:
...
...
@@ -86,6 +87,8 @@ public slots:
private
slots
:
void
recalcPolygons
(
void
);
void
updatePolygonConnections
(
QVariant
value
);
private:
void
init
();
...
...
src/WimaView/WimaMeasurementAreaEditor.qml
View file @
b43e55c3
...
...
@@ -96,6 +96,13 @@ Rectangle {
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Border Poly.
"
)
}
FactTextField
{
fact
:
areaItem
.
showBorderPolygon
Layout.fillWidth
:
true
}
}
...
...
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