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
c8170647
Commit
c8170647
authored
May 14, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
my first c.
parent
86388db3
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
380 additions
and
133 deletions
+380
-133
WimaGlobalMeasurementPolygonEditor.qml
WimaGlobalMeasurementPolygonEditor.qml
+35
-51
WimaGlobalMeasurementPolygonMapVisual.qml
WimaGlobalMeasurementPolygonMapVisual.qml
+13
-2
issues.txt
issues.txt
+2
-0
qgroundcontrol.pro
qgroundcontrol.pro
+4
-2
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-1
WimaController.cc
src/MissionManager/WimaController.cc
+4
-4
WimaGlobalMeasurementPolygon.SettingsGroup.json
...onManager/WimaGlobalMeasurementPolygon.SettingsGroup.json
+1
-1
WimaGlobalMeasurementPolygon.cc
src/MissionManager/WimaGlobalMeasurementPolygon.cc
+58
-11
WimaGlobalMeasurementPolygon.h
src/MissionManager/WimaGlobalMeasurementPolygon.h
+23
-14
WimaPolygon.cc
src/MissionManager/WimaPolygon.cc
+21
-11
WimaPolygon.h
src/MissionManager/WimaPolygon.h
+15
-13
WimaPolyline.cc
src/MissionManager/WimaPolyline.cc
+97
-0
WimaPolyline.h
src/MissionManager/WimaPolyline.h
+56
-0
QGCApplication.cc
src/QGCApplication.cc
+1
-2
WimaGlobalMeasurementPolygonMapVisual.qml
src/WimaView/WimaGlobalMeasurementPolygonMapVisual.qml
+29
-3
WimaItemEditor.qml
src/WimaView/WimaItemEditor.qml
+14
-13
WimaView.qml
src/WimaView/WimaView.qml
+6
-5
No files found.
WimaGlobalMeasurementPolygonEditor.qml
View file @
c8170647
...
...
@@ -23,10 +23,18 @@ Rectangle {
// The following properties must be available up the hierarchy chain
//property real availableWidth ///< Width for control
//property var
mission
Item ///< Mission Item for editor
//property var
area
Item ///< Mission Item for editor
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_fieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10.5
property
var
polyline
:
areaItem
.
polyline
property
var
operatingPolygon
:
areaItem
.
polygon
property
bool
initNecesarry
:
true
function
editPolyline
(){
polyline
.
setInteractive
(
true
);
}
...
...
@@ -42,7 +50,7 @@ Rectangle {
SectionHeader
{
id
:
scanHeader
text
:
qsTr
(
"
S
can
"
)
text
:
qsTr
(
"
S
ettings
"
)
}
Column
{
...
...
@@ -58,55 +66,48 @@ Rectangle {
rowSpacing
:
_margin
columns
:
2
FactComboBox
{
fact
:
missionItem
.
startFromTop
indexModel
:
true
model
:
[
qsTr
(
"
Start Scan From Bottom
"
),
qsTr
(
"
Start Scan From Top
"
)
]
Layout.columnSpan
:
2
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Structure Height
"
)
text
:
qsTr
(
"
Bottom Layer Altitude
"
)
}
FactTextField
{
fact
:
missionItem
.
structureHeight
fact
:
areaItem
.
bottomLayerAltitude
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Scan Bottom Alt
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Number of Layers
"
)
}
FactTextField
{
fact
:
missionItem
.
scanBottomAlt
fact
:
areaItem
.
numberOfLayers
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Entrance/Exit Alt
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Layer Distance
"
)
}
FactTextField
{
fact
:
missionItem
.
entranceAlt
LayoWimaGlobalMeasurementPolygonEditor.qmlut.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Gimbal Pitch
"
)
visible
:
missionItem
.
cameraCalc
.
isManualCamera
}
FactTextField
{
fact
:
missionItem
.
gimbalPitch
fact
:
areaItem
.
layerDistance
Layout.fillWidth
:
true
visible
:
missionItem
.
cameraCalc
.
isManualCamera
}
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
1
}
QGCButton
{
text
:
qsTr
(
"
Rotate entry point
"
)
onClicked
:
missionItem
.
rotateEntryPoint
()
}
}
// Column - Scan
SectionHeader
{
id
:
polylineHeader
text
:
qsTr
(
"
Gateway Poly Line
"
)
}
QGCButton
{
id
:
polylineEditor
anchors.topMargin
:
_margin
/
2
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
text
:
"
Edit Polyline
"
onClicked
:
editPolyline
()
}
SectionHeader
{
id
:
statsHeader
...
...
@@ -118,26 +119,9 @@ Rectangle {
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
statsHeader
.
checked
QGCLabel
{
text
:
qsTr
(
"
Layers
"
)
}
QGCLabel
{
text
:
missionItem
.
layers
.
valueString
}
QGCLabel
{
text
:
qsTr
(
"
Layer Height
"
)
}
QGCLabel
{
text
:
missionItem
.
cameraCalc
.
adjustedFootprintFrontal
.
valueString
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
}
/*QGCLabel { text: qsTr("Layers") }
QGCLabel { text: areaItem.layers.valueString }*/
QGCLabel
{
text
:
qsTr
(
"
Top Layer Alt
"
)
}
QGCLabel
{
text
:
QGroundControl
.
metersToAppSettingsDistanceUnits
(
missionItem
.
topFlightAlt
).
toFixed
(
1
)
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
}
QGCLabel
{
text
:
qsTr
(
"
Bottom Layer Alt
"
)
}
QGCLabel
{
text
:
QGroundControl
.
metersToAppSettingsDistanceUnits
(
missionItem
.
bottomFlightAlt
).
toFixed
(
1
)
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
}
QGCLabel
{
text
:
qsTr
(
"
Photo Count
"
)
}
QGCLabel
{
text
:
missionItem
.
cameraShots
}
QGCLabel
{
text
:
qsTr
(
"
Photo Interval
"
)
}
QGCLabel
{
text
:
missionItem
.
timeBetweenShots
.
toFixed
(
1
)
+
"
"
+
qsTr
(
"
secs
"
)
}
QGCLabel
{
text
:
qsTr
(
"
Trigger Distance
"
)
}
QGCLabel
{
text
:
missionItem
.
cameraCalc
.
adjustedFootprintSide
.
valueString
+
"
"
+
QGroundControl
.
appSettingsDistanceUnitsString
}
}
}
}
// Column
}
// Rectangle
WimaGlobalMeasurementPolygonMapVisual.qml
View file @
c8170647
...
...
@@ -27,6 +27,7 @@ Item {
property
var
_missionItem
:
object
property
var
_polygon
:
object
.
polygon
property
var
_polyline
:
object
.
polyline
signal
clicked
(
int
sequenceNumber
)
...
...
@@ -77,9 +78,19 @@ Item {
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
green
"
interiorOpacity
:
0.25
interiorOpacity
:
1
}
1
QGCMapPolylineVisuals
{
id
:
mapPolylineVisuals
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolyline
:
_polyline
interactive
:
true
lineWidth
:
3
lineColor
:
"
blue
"
}
...
...
issues.txt
0 → 100644
View file @
c8170647
if polygon vertex clicked: remove circle option
can't switch between polygons on first insert
qgroundcontrol.pro
View file @
c8170647
...
...
@@ -413,7 +413,8 @@ HEADERS += \
src
/
MissionManager
/
WimaVehicleCorridor
.
h
\
src
/
MissionManager
/
WimaVehicleMeasurementPolygon
.
h
\
src
/
MissionManager
/
WimaGlobalMeasurementPolygon
.
h
\
src
/
MissionManager
/
WimaVehicle
.
h
src
/
MissionManager
/
WimaVehicle
.
h
\
src
/
MissionManager
/
WimaPolyline
.
h
SOURCES
+=
\
src
/
api
/
QGCCorePlugin
.
cc
\
...
...
@@ -427,7 +428,8 @@ SOURCES += \
src
/
MissionManager
/
WimaVehicleCorridor
.
cc
\
src
/
MissionManager
/
WimaVehicleMeasurementPolygon
.
cc
\
src
/
MissionManager
/
WimaGlobalMeasurementPolygon
.
cc
\
src
/
MissionManager
/
WimaVehicle
.
cc
src
/
MissionManager
/
WimaVehicle
.
cc
\
src
/
MissionManager
/
WimaPolyline
.
cc
#
#
Unit
Test
specific
configuration
goes
here
(
requires
full
debug
build
with
all
plugins
)
...
...
qgroundcontrol.qrc
View file @
c8170647
...
...
@@ -259,7 +259,7 @@
<file alias="Vehicle/VibrationFact.json">src/Vehicle/VibrationFact.json</file>
<file alias="Vehicle/WindFact.json">src/Vehicle/WindFact.json</file>
<file alias="Video.SettingsGroup.json">src/Settings/Video.SettingsGroup.json</file>
<file>src/MissionManager/WimaGlobalMeasurementPolygon.SettingsGroup.json</file>
<file
alias="WimaGlobalMeasurementPolygon.SettingsGroup.json"
>src/MissionManager/WimaGlobalMeasurementPolygon.SettingsGroup.json</file>
</qresource>
<qresource prefix="/MockLink">
<file alias="APMArduCopterMockLink.params">src/comm/APMArduCopterMockLink.params</file>
...
...
src/MissionManager/WimaController.cc
View file @
c8170647
...
...
@@ -43,7 +43,7 @@ void WimaController::addGlobalMeasurementArea()
void
WimaController
::
removeArea
(
int
index
)
{
if
(
index
>
0
&&
index
<
_visualItems
->
count
()){
if
(
index
>
=
0
&&
index
<
_visualItems
->
count
()){
_visualItems
->
removeAt
(
index
);
emit
visualItemsChanged
();
...
...
@@ -63,7 +63,7 @@ void WimaController::addServiceArea()
{
resetAllIsCurrentPolygon
();
WimaServicePolygon
*
newPoly
=
new
WimaServicePolygon
(
this
);
newPoly
->
setI
sCurrentPolygon
(
true
);
newPoly
->
setI
nteractive
(
true
);
_visualItems
->
append
(
newPoly
);
emit
visualItemsChanged
();
...
...
@@ -118,7 +118,7 @@ void WimaController::recalcPolygonInteractivity(int index)
{
resetAllIsCurrentPolygon
();
WimaPolygon
*
interactivePoly
=
qobject_cast
<
WimaPolygon
*>
(
_visualItems
->
get
(
index
));
interactivePoly
->
setI
sCurrentPolygon
(
true
);
interactivePoly
->
setI
nteractive
(
true
);
}
void
WimaController
::
resetAllIsCurrentPolygon
()
...
...
@@ -126,7 +126,7 @@ void WimaController::resetAllIsCurrentPolygon()
int
itemCount
=
_visualItems
->
count
();
for
(
int
i
=
0
;
i
<
itemCount
;
i
++
)
{
WimaPolygon
*
iteratorPoly
=
qobject_cast
<
WimaPolygon
*>
(
_visualItems
->
get
(
i
));
iteratorPoly
->
setI
sCurrentPolygon
(
false
);
iteratorPoly
->
setI
nteractive
(
false
);
}
}
...
...
src/MissionManager/WimaGlobalMeasurementPolygon.SettingsGroup.json
View file @
c8170647
...
...
@@ -11,7 +11,7 @@
{
"name"
:
"NumberOfLayers"
,
"shortDescription"
:
"The number of layers"
,
"type"
:
"u
n
int32"
,
"type"
:
"uint32"
,
"min"
:
1
,
"defaultValue"
:
1
},
...
...
src/MissionManager/WimaGlobalMeasurementPolygon.cc
View file @
c8170647
#include "WimaGlobalMeasurementPolygon.h"
const
char
*
WimaGlobalMeasurementPolygon
::
settingsGroup
=
"OperatingArea"
;
const
char
*
WimaGlobalMeasurementPolygon
::
settingsGroup
=
"OperatingArea"
;
const
char
*
WimaGlobalMeasurementPolygon
::
bottomLayerAltitudeName
=
"BottomLayerAltitude"
;
const
char
*
WimaGlobalMeasurementPolygon
::
numberOfLayersName
=
"NumberOfLayers"
;
const
char
*
WimaGlobalMeasurementPolygon
::
layerDistanceName
=
"LayerDistance"
;
...
...
@@ -12,14 +12,24 @@ WimaGlobalMeasurementPolygon::WimaGlobalMeasurementPolygon(QObject *parent)
,
_bottomLayerAltitude
(
settingsGroup
,
_metaDataMap
[
bottomLayerAltitudeName
])
,
_numberOfLayers
(
settingsGroup
,
_metaDataMap
[
numberOfLayersName
])
,
_layerDistance
(
settingsGroup
,
_metaDataMap
[
layerDistanceName
])
,
_vehicleList
(
new
QmlObjectListModel
(
this
))
,
_vehiclePolygons
(
new
QmlObjectListModel
(
this
))
{
this
->
setObjectName
(
"Operating Area"
);
_polyline
.
bindPolygon
(
this
->
polygon
());
}
WimaGlobalMeasurementPolygon
::
WimaGlobalMeasurementPolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
)
:
WimaPolygon
(
other
,
parent
)
WimaGlobalMeasurementPolygon
::
WimaGlobalMeasurementPolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
)
:
WimaPolygon
(
other
,
parent
)
,
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/WimaGlobalMeasurementPolygon.SettingsGroup.json"
),
this
/* QObject parent */
))
,
_bottomLayerAltitude
(
settingsGroup
,
_metaDataMap
[
bottomLayerAltitudeName
])
,
_numberOfLayers
(
settingsGroup
,
_metaDataMap
[
numberOfLayersName
])
,
_layerDistance
(
settingsGroup
,
_metaDataMap
[
layerDistanceName
])
,
_vehicleList
(
new
QmlObjectListModel
(
this
))
,
_vehiclePolygons
(
new
QmlObjectListModel
(
this
))
{
this
->
setObjectName
(
"Operating Area"
);
_polyline
.
bindPolygon
(
this
->
polygon
());
}
void
WimaGlobalMeasurementPolygon
::
addVehicle
(
Vehicle
*
vehicle
)
...
...
@@ -44,23 +54,60 @@ void WimaGlobalMeasurementPolygon::recalculatesubPolygons()
QScopedPointer
<
QList
<
QGCMapPolygon
*>>
listQGCPoly
(
this
->
splitPolygonArea
(
vehicleCount
));
int
polyCount
=
listQGCPoly
->
size
();
_
sub
Polygons
->
clear
();
_
vehicle
Polygons
->
clear
();
for
(
int
i
=
0
;
i
<
polyCount
;
i
++
){
WimaVehicleMeasurementPolygon
*
subPoly
=
new
WimaVehicleMeasurementPolygon
(
listQGCPoly
->
takeAt
(
i
),
this
);
_
sub
Polygons
->
append
(
subPoly
);
_
vehicle
Polygons
->
append
(
subPoly
);
}
}
void
WimaGlobalMeasurementPolygon
::
removeAllVehicles
()
{
int
count
er
=
_vehicleList
->
count
()
-
1
;
int
count
=
_vehicleList
->
count
()
;
while
(
counter
>=
0
){
_vehicleList
->
removeAt
(
0
);
counter
--
;
if
(
count
>
0
){
do
{
_vehicleList
->
removeAt
(
0
);
count
--
;
}
while
(
count
>
0
);
emit
vehicleListChanged
();
}
emit
vehicleListChanged
();
}
void
WimaGlobalMeasurementPolygon
::
addVehiclePolygon
()
{
_vehiclePolygons
->
append
(
new
WimaVehicleMeasurementPolygon
(
this
));
emit
vehiclePolygonsChanged
();
}
void
WimaGlobalMeasurementPolygon
::
removeVehiclePolygon
(
int
polygonIndex
)
{
if
(
polygonIndex
>=
0
&&
polygonIndex
<
_vehiclePolygons
->
count
()){
_vehiclePolygons
->
removeAt
(
polygonIndex
);
emit
vehiclePolygonsChanged
();
}
else
{
qWarning
(
"Index out of bounds!"
);
}
}
void
WimaGlobalMeasurementPolygon
::
removeVehiclePolygon
(
WimaVehicleMeasurementPolygon
*
wimaPolygon
)
{
if
(
wimaPolygon
!=
nullptr
){
QObject
*
removedPolygon
=
_vehiclePolygons
->
removeOne
(
wimaPolygon
);
if
(
removedPolygon
){
emit
vehiclePolygonsChanged
();
}
else
{
qWarning
(
"Polygon not inside polygon list."
);
}
}
else
{
qWarning
(
"Not a valid Polygon."
);
}
}
src/MissionManager/WimaGlobalMeasurementPolygon.h
View file @
c8170647
#pragma once
#
pragma
once
#include <QObject>
#include "WimaPolygon.h"
...
...
@@ -20,12 +20,17 @@ public:
Q_PROPERTY
(
Fact
*
numberOfLayers
READ
numberOfLayers
CONSTANT
)
Q_PROPERTY
(
Fact
*
layerDistance
READ
layerDistance
CONSTANT
)
Q_PROPERTY
(
QmlObjectListModel
*
vehicleList
READ
vehicleList
NOTIFY
vehicleListChanged
)
Q_PROPERTY
(
QGCMapPolyline
*
entryPolyline
READ
entryPolyline
NOTIFY
entryPolylineChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
vehiclePolygons
READ
vehiclePolygons
NOTIFY
vehiclePolygonsChanged
)
Q_PROPERTY
(
WimaPolyline
*
polyline
READ
polyline
NOTIFY
polylineChanged
)
Q_INVOKABLE
void
addVehicle
(
Vehicle
*
vehicle
);
Q_INVOKABLE
void
removeVehicle
(
int
vehicleIndex
);
Q_INVOKABLE
void
recalculatesubPolygons
();
Q_INVOKABLE
void
removeAllVehicles
();
Q_INVOKABLE
void
addVehicle
(
Vehicle
*
vehicle
);
Q_INVOKABLE
void
removeVehicle
(
int
vehicleIndex
);
Q_INVOKABLE
void
recalculatesubPolygons
();
Q_INVOKABLE
void
removeAllVehicles
();
Q_INVOKABLE
void
addVehiclePolygon
();
Q_INVOKABLE
void
removeVehiclePolygon
(
int
polygonIndex
);
Q_INVOKABLE
void
removeVehiclePolygon
(
WimaVehicleMeasurementPolygon
*
wimaPolygon
);
// Overrides from WimaPolygon
...
...
@@ -33,11 +38,12 @@ public:
QString
editorQML
(
void
)
const
{
return
"WimaGlobalMeasurementPolygonEditor.qml"
;}
// Property accessors
Fact
*
bottomLayerAltitude
(
void
)
{
return
&
_bottomLayerAltitude
;}
Fact
*
numberOfLayers
(
void
)
{
return
&
_numberOfLayers
;}
Fact
*
layerDistance
(
void
)
{
return
&
_layerDistance
;}
QmlObjectListModel
*
vehicleList
(
void
)
const
{
return
_vehicleList
;}
QGCMapPolyline
*
entryPolyline
(
void
)
const
{
return
_entryPolyline
;}
Fact
*
bottomLayerAltitude
(
void
)
{
return
&
_bottomLayerAltitude
;}
Fact
*
numberOfLayers
(
void
)
{
return
&
_numberOfLayers
;}
Fact
*
layerDistance
(
void
)
{
return
&
_layerDistance
;}
QmlObjectListModel
*
vehicleList
(
void
)
const
{
return
_vehicleList
;}
QmlObjectListModel
*
vehiclePolygons
(
void
)
const
{
return
_vehiclePolygons
;}
WimaPolyline
*
polyline
(
void
)
{
return
&
_polyline
;}
static
const
char
*
settingsGroup
;
...
...
@@ -51,8 +57,8 @@ signals:
void
numberOfLayersChanged
(
void
);
void
layerDistanceChanged
(
void
);
void
vehicleListChanged
(
void
);
void
entryPolylineChanged
(
void
);
void
subPolygonsChanged
(
void
);
void
gatewayPolylinesChanged
(
void
);
void
vehiclePolygonsChanged
(
void
);
private:
...
...
@@ -64,8 +70,11 @@ private:
QmlObjectListModel
*
_vehicleList
;
QGCMapPolyline
*
_entryPolyline
;
QmlObjectListModel
*
_vehiclePolygons
;
WimaPolyline
_polyline
;
};
src/MissionManager/WimaPolygon.cc
View file @
c8170647
...
...
@@ -5,15 +5,22 @@ WimaPolygon::WimaPolygon(QObject *parent) :
,
_maxAltitude
(
30
)
,
_vehicle
(
parent
)
,
_polygon
(
new
QGCMapPolygon
(
this
))
,
_subPolygons
(
new
QmlObjectListModel
(
this
))
,
_subPolylines
(
new
QmlObjectListModel
(
this
))
{
connect
(
_polygon
,
&
QGCMapPolygon
::
interactiveChanged
,
this
,
&
WimaPolygon
::
interactiveChanged
);
connect
(
_polygon
,
&
QGCMapPolygon
::
countChanged
,
this
,
&
WimaPolygon
::
countChanged
);
}
WimaPolygon
::
WimaPolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
)
:
WimaPolygon
(
parent
)
{
*
_polygon
=
*
other
;
connect
(
_polygon
,
&
QGCMapPolygon
::
interactiveChanged
,
this
,
&
WimaPolygon
::
interactiveChanged
);
connect
(
_polygon
,
&
QGCMapPolygon
::
countChanged
,
this
,
&
WimaPolygon
::
countChanged
);
}
WimaPolygon
::~
WimaPolygon
()
{
}
...
...
@@ -34,19 +41,16 @@ void WimaPolygon::setVehicle(Vehicle *vehicle)
}
}
void
WimaPolygon
::
setIsCurrentPolygon
(
bool
isCurrentPolygon
)
{
if
(
_isCurrentPolygon
!=
isCurrentPolygon
){
_isCurrentPolygon
=
isCurrentPolygon
;
emit
isCurrentPolygonChanged
();
}
void
WimaPolygon
::
setInteractive
(
bool
interactive
)
{
_polygon
->
setInteractive
(
interactive
);
}
QList
<
QGCMapPolygon
*>*
WimaPolygon
::
splitPolygonArea
(
int
numberOfFractions
)
QList
<
QGCMapPolygon
*>
*
WimaPolygon
::
splitPolygonArea
(
QGCMapPolygon
*
polygonToSplitt
,
int
numberOfFractions
)
{
if
(
numberOfFractions
>
0
){
QGCMapPolygon
*
poly
=
new
QGCMapPolygon
(
this
->
polygon
()
,
this
);
if
(
numberOfFractions
>
0
&&
polygonToSplitt
!=
nullptr
){
QGCMapPolygon
*
poly
=
new
QGCMapPolygon
(
polygonToSplitt
,
this
);
QList
<
QGCMapPolygon
*>*
list
=
new
QList
<
QGCMapPolygon
*>
();
list
->
append
(
poly
);
return
list
;
...
...
@@ -55,3 +59,9 @@ QList<QGCMapPolygon*>* WimaPolygon::splitPolygonArea(int numberOfFractions)
}
QList
<
QGCMapPolygon
*>*
WimaPolygon
::
splitPolygonArea
(
int
numberOfFractions
)
{
return
splitPolygonArea
(
_polygon
,
numberOfFractions
);
}
src/MissionManager/WimaPolygon.h
View file @
c8170647
...
...
@@ -6,6 +6,7 @@
#include "Vehicle.h"
#include "qobject.h"
#include "WimaVehicle.h"
#include "WimaPolyline.h"
...
...
@@ -17,6 +18,7 @@ class WimaPolygon : public QObject //abstract base class for all WimaPolygons
public:
WimaPolygon
(
QObject
*
parent
=
nullptr
);
WimaPolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
=
nullptr
);
~
WimaPolygon
();
...
...
@@ -25,46 +27,46 @@ public:
Q_PROPERTY
(
QString
editorQML
READ
editorQML
CONSTANT
)
Q_PROPERTY
(
Vehicle
*
vehicle
READ
vehicle
WRITE
setVehicle
NOTIFY
vehicleChanged
)
Q_PROPERTY
(
QGCMapPolygon
*
polygon
READ
polygon
NOTIFY
polygonChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
subPolygons
READ
subPolygons
NOTIFY
subPolygonsChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
subPolylines
READ
subPolylines
NOTIFY
subPolylinesChanged
)
Q_PROPERTY
(
bool
isCurrentPolygon
READ
isCurrentPolygon
WRITE
setIsCurrentPolygon
NOTIFY
isCurrentPolygonChanged
)
Q_PROPERTY
(
bool
interactive
READ
interactive
WRITE
setInteractive
NOTIFY
interactiveChanged
)
Q_PROPERTY
(
int
count
READ
count
NOTIFY
countChanged
)
//Property accessors
double
maxAltitude
(
void
)
const
{
return
_maxAltitude
;}
Vehicle
*
vehicle
(
void
)
const
{
return
_vehicle
.
vehicle
();}
QGCMapPolygon
*
polygon
(
void
)
const
{
return
_polygon
;}
QmlObjectListModel
*
subPolygons
(
void
)
const
{
return
_subPolygons
;}
QmlObjectListModel
*
subPolylines
(
void
)
const
{
return
_subPolylines
;}
bool
isCurrentPolygon
(
void
)
const
{
return
_isCurrentPolygon
;}
bool
interactive
(
void
)
const
{
return
_polygon
->
interactive
();}
int
count
(
void
)
const
{
return
_polygon
->
count
();}
virtual
QString
mapVisualQML
(
void
)
const
=
0
;
virtual
QString
editorQML
(
void
)
const
=
0
;
//Property setters
void
setMaxAltitude
(
double
alt
);
void
setVehicle
(
Vehicle
*
vehicle
);
void
setI
sCurrentPolygon
(
bool
isCurrentPolygon
);
void
setI
nteractive
(
bool
interactive
);
// Member Methodes
QList
<
QGCMapPolygon
*>*
splitPolygonArea
(
QGCMapPolygon
*
polygonToSplitt
,
int
numberOfFractions
);
// use QScopedPointer to store return value
QList
<
QGCMapPolygon
*>*
splitPolygonArea
(
int
numberOfFractions
);
// use QScopedPointer to store return value
signals:
void
maxAltitudeChanged
(
void
);
void
vehicleChanged
(
void
);
void
polygonChanged
(
void
);
void
subPolygons
Changed
(
void
);
void
subPolylinesChanged
(
void
);
void
isCurrentPolygonChanged
(
void
);
void
interactive
Changed
(
void
);
void
polylineChanged
(
void
);
void
countChanged
(
void
);
protected:
double
_maxAltitude
;
WimaVehicle
_vehicle
;
QGCMapPolygon
*
_polygon
;
QmlObjectListModel
*
_subPolygons
;
QmlObjectListModel
*
_subPolylines
;
bool
_isCurrentPolygon
;
};
src/MissionManager/WimaPolyline.cc
0 → 100644
View file @
c8170647
#include "WimaPolyline.h"
WimaPolyline
::
WimaPolyline
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_boundPolygon
(
nullptr
)
,
_startVertexIndex
(
0
)
,
_endVertexIndex
(
1
)
{
connect
(
&
_polyline
,
&
QGCMapPolyline
::
interactiveChanged
,
this
,
&
WimaPolyline
::
interactiveChanged
);
}
WimaPolyline
::
WimaPolyline
(
QGCMapPolyline
*
polyline
,
QObject
*
parent
)
:
WimaPolyline
(
parent
)
{
_polyline
=
*
polyline
;
}
void
WimaPolyline
::
bindPolygon
(
QGCMapPolygon
*
polygon
)
{
if
(
polygon
!=
nullptr
){
_boundPolygon
=
polygon
;
connect
(
polygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
WimaPolyline
::
recalcPolyline
);
}
else
{
qWarning
(
"Invalid Object!"
);
}
}
void
WimaPolyline
::
unbindPolygon
()
{
if
(
_boundPolygon
!=
nullptr
){
disconnect
(
_boundPolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
WimaPolyline
::
recalcPolyline
);
_boundPolygon
=
nullptr
;
}
else
{
qWarning
(
"No Object bound!"
);
}
}
void
WimaPolyline
::
swapLimits
()
{
int
storage
=
_startVertexIndex
;
_startVertexIndex
=
_endVertexIndex
;
_endVertexIndex
=
storage
;
}
void
WimaPolyline
::
setInteractive
(
bool
interactive
)
{
_polyline
.
setInteractive
(
interactive
);
}
void
WimaPolyline
::
setStartVertexIndex
(
int
PolygonVertexIndex
)
{
if
(
PolygonVertexIndex
>=
0
&&
PolygonVertexIndex
<
_boundPolygon
->
count
()){
_startVertexIndex
=
PolygonVertexIndex
;
recalcPolyline
();
}
else
{
qWarning
(
"Index out of bounds!"
);
}
}
void
WimaPolyline
::
setEndVertexIndex
(
int
PolygonVertexIndex
)
{
if
(
PolygonVertexIndex
>=
0
&&
PolygonVertexIndex
<
_boundPolygon
->
count
()){
_endVertexIndex
=
PolygonVertexIndex
;
recalcPolyline
();
}
else
{
qWarning
(
"Index out of bounds!"
);
}
}
void
WimaPolyline
::
recalcPolyline
()
{
if
(
_boundPolygon
!=
nullptr
&&
_boundPolygon
->
count
()
>
0
){
if
(
_startVertexIndex
>=
_boundPolygon
->
count
()){
_startVertexIndex
=
0
;
}
if
(
_endVertexIndex
>=
_boundPolygon
->
count
()){
_startVertexIndex
=
_boundPolygon
->
count
()
-
1
;
}
_polyline
.
clear
();
int
i
=
_startVertexIndex
;
while
(
1
){
_polyline
.
appendVertex
(
_boundPolygon
->
vertexCoordinate
(
i
));
if
(
i
==
_boundPolygon
->
count
()
-
1
){
i
=
0
;
}
else
if
(
i
==
_endVertexIndex
)
{
break
;
}
i
++
;
}
emit
polylineChanged
();
}
else
{
qWarning
(
"No object bound!"
);
}
}
src/MissionManager/WimaPolyline.h
0 → 100644
View file @
c8170647
#ifndef WIMAPOLYLINE_H
#define WIMAPOLYLINE_H
#include <QObject>
#include "QGCMapPolyline.h"
#include "QGCMapPolygon.h"
class
WimaPolyline
:
public
QObject
{
Q_OBJECT
public:
WimaPolyline
(
QObject
*
parent
=
nullptr
);
WimaPolyline
(
QGCMapPolyline
*
polyline
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
QGCMapPolyline
const
*
polyline
READ
polyline
NOTIFY
polylineChanged
)
Q_PROPERTY
(
int
startVertexIndex
READ
startVertexIndex
WRITE
setStartVertexIndex
NOTIFY
startVertexIndexChanged
)
Q_PROPERTY
(
int
endVertexIndex
READ
endVertexIndex
WRITE
setEndVertexIndex
NOTIFY
endVertexIndexChanged
)
Q_PROPERTY
(
bool
interactive
READ
interactive
WRITE
setInteractive
NOTIFY
interactiveChanged
)
// Property accessors
QGCMapPolyline
const
*
polyline
(
void
)
const
{
return
&
_polyline
;}
int
startVertexIndex
(
void
)
const
{
return
_startVertexIndex
;}
int
endVertexIndex
(
void
)
const
{
return
_endVertexIndex
;}
bool
interactive
(
void
)
const
{
return
_polyline
.
interactive
();}
//Property setters
Q_INVOKABLE
void
bindPolygon
(
QGCMapPolygon
*
polygon
);
Q_INVOKABLE
void
unbindPolygon
();
Q_INVOKABLE
void
swapLimits
();
Q_INVOKABLE
void
setInteractive
(
bool
interactive
);
void
setStartVertexIndex
(
int
PolygonVertexIndex
);
void
setEndVertexIndex
(
int
PolygonVertexIndex
);
signals:
void
polylineChanged
(
void
);
void
startVertexIndexChanged
(
void
);
void
endVertexIndexChanged
(
void
);
void
interactiveChanged
(
void
);
public
slots
:
void
recalcPolyline
(
void
);
private:
QGCMapPolyline
_polyline
;
QGCMapPolygon
*
_boundPolygon
;
int
_startVertexIndex
;
int
_endVertexIndex
;
};
#endif // WIMAPOLYLINE_H
src/QGCApplication.cc
View file @
c8170647
...
...
@@ -327,7 +327,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
QGCLoggingCategoryRegister
::
instance
()
->
setFilterRulesFromSettings
(
loggingOptions
);
// Initialize Bluetooth
#ifdef QGC_ENABLE_BLUETOOTH
#ifdef QGC_ENABLE_BLUETOOTH
subPolylines
QBluetoothLocalDevice
localDevice
;
if
(
localDevice
.
isValid
())
{
...
...
@@ -446,7 +446,6 @@ void QGCApplication::_initCommon(void)
qmlRegisterType
<
ESP8266ComponentController
>
(
kQGCControllers
,
1
,
0
,
"ESP8266ComponentController"
);
qmlRegisterType
<
ScreenToolsController
>
(
kQGCControllers
,
1
,
0
,
"ScreenToolsController"
);
qmlRegisterType
<
PlanMasterController
>
(
kQGCControllers
,
1
,
0
,
"PlanMasterController"
);
qmlRegisterType
<
WimaController
>
(
kQGCControllers
,
1
,
0
,
"WimaController"
);
//custom
qmlRegisterType
<
ValuesWidgetController
>
(
kQGCControllers
,
1
,
0
,
"ValuesWidgetController"
);
qmlRegisterType
<
QGCFileDialogController
>
(
kQGCControllers
,
1
,
0
,
"QGCFileDialogController"
);
qmlRegisterType
<
RCChannelMonitorController
>
(
kQGCControllers
,
1
,
0
,
"RCChannelMonitorController"
);
...
...
src/WimaView/WimaGlobalMeasurementPolygonMapVisual.qml
View file @
c8170647
...
...
@@ -25,8 +25,10 @@ Item {
property
var
map
///< Map control to place item in
property
var
qgcView
///< QGCView to use for popping dialogs
property
var
_missionItem
:
object
property
var
_polygon
:
object
.
polygon
property
var
areaItem
:
object
property
var
_polygon
:
areaItem
.
polygon
property
var
subPolylines
:
areaItem
.
subPolylines
property
var
subPolygons
:
areaItem
.
subPolygons
signal
clicked
(
int
sequenceNumber
)
...
...
@@ -62,8 +64,19 @@ Item {
}
}
function
_addInitialPolyline
()
{
if
(
subPolylines
.
count
<
1
)
{
areaItem
.
addSubPolyline
()
console
.
log
(
"
SubPolylines count:
"
,
subPolylines
.
count
)
var
newPolyline
=
subPolylines
.
get
(
0
)
newPolyline
.
appendVertex
(
_polygon
.
vertexCoordinate
(
0
))
newPolyline
.
appendVertex
(
_polygon
.
vertexCoordinate
(
1
))
}
}
Component.onCompleted
:
{
_addInitialPolygon
()
_addInitialPolyline
()
// always call _addInitialPolyline() after _addInitialPolygon()
}
Component.onDestruction
:
{
...
...
@@ -73,13 +86,26 @@ Item {
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolygon
:
_polygon
interactive
:
_missionItem
.
isCurrentPolygon
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
green
"
interiorOpacity
:
0.25
}
Repeater
{
model
:
subPolylines
delegate
:
QGCMapPolylineVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolyline
:
object
lineWidth
:
4
lineColor
:
interactive
?
"
yellow
"
:
"
white
"
}
}
...
...
src/WimaView/WimaItemEditor.qml
View file @
c8170647
...
...
@@ -12,11 +12,11 @@ import QGroundControl.FactControls 1.0
import
QGroundControl
.
Palette
1.0
///
Fly Are
a Item edit control
///
Wim
a Item edit control
Rectangle
{
id
:
_root
height
:
editorLoader
.
visible
?
(
editorLoader
.
y
+
editorLoader
.
height
+
(
_margin
*
2
))
:
(
commandPicker
.
y
+
commandPicker
.
height
+
_margin
/
2
)
color
:
_currentItem
?
qgcPal
.
missionItemEditor
:
qgcPal
.
windowShade
color
:
interactive
?
qgcPal
.
missionItemEditor
:
qgcPal
.
windowShade
radius
:
_radius
property
var
map
///< Map control
...
...
@@ -25,15 +25,16 @@ Rectangle {
property
bool
readOnly
///< true: read only view, false: full editing view
property
var
rootQgcView
property
int
_index
property
var
areaItem
signal
clicked
signal
remove
property
var
_masterController
:
masterController
property
var
_missionController
:
_masterController
.
missionController
property
var
_polygon
:
object
.
polygon
property
bool
_currentItem
:
object
.
isCurrentPolygon
property
color
_outerTextColor
:
_currentItem
?
qgcPal
.
primaryButtonText
:
qgcPal
.
text
property
var
_polygon
:
areaItem
.
polygon
property
bool
interactive
:
areaItem
.
interactive
property
color
_outerTextColor
:
interactive
?
qgcPal
.
primaryButtonText
:
qgcPal
.
text
property
real
_sectionSpacer
:
ScreenTools
.
defaultFontPixelWidth
/
2
// spacing between section headings
readonly
property
real
_editFieldWidth
:
Math
.
min
(
width
-
_margin
*
2
,
ScreenTools
.
defaultFontPixelWidth
*
12
)
...
...
@@ -78,7 +79,7 @@ Rectangle {
height
:
_hamburgerSize
sourceSize.height
:
_hamburgerSize
source
:
"
qrc:/qmlimages/Hamburger.svg
"
visible
:
_currentItem
visible
:
interactive
color
:
qgcPal
.
text
}
...
...
@@ -124,14 +125,14 @@ Rectangle {
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.left
:
label
.
right
anchors.top
:
parent
.
top
visible
:
_currentItem
text
:
object
.
objectName
;
visible
:
interactive
text
:
areaItem
.
objectName
;
Component
{
id
:
commandDialog
MissionCommandDialog
{
missionItem
:
object
missionItem
:
areaItem
}
}
...
...
@@ -141,9 +142,9 @@ Rectangle {
QGCLabel
{
id
:
commandLabel
anchors.fill
:
commandPicker
visible
:
!
_currentItem
visible
:
!
interactive
verticalAlignment
:
Text
.
AlignVCenter
text
:
object
.
objectName
;
text
:
areaItem
.
objectName
;
color
:
_outerTextColor
}
...
...
@@ -153,8 +154,8 @@ Rectangle {
anchors.topMargin
:
_margin
anchors.left
:
parent
.
left
anchors.top
:
commandPicker
.
bottom
source
:
object
.
editorQml
visible
:
_currentItem
source
:
areaItem
.
editorQML
visible
:
interactive
property
var
masterController
:
_masterController
property
real
availableWidth
:
_root
.
width
-
(
_margin
*
2
)
///< How wide the editor should be
...
...
src/WimaView/WimaView.qml
View file @
c8170647
...
...
@@ -413,7 +413,7 @@ QGCView {
planView
:
true
qgcView
:
_qgcView
// This is the center rectangle of the map which is not
_layerWimaPlan
obscured by tools
// This is the center rectangle of the map which is not obscured by tools
property
rect
centerViewport
:
Qt
.
rect
(
_leftToolWidth
,
_toolbarHeight
,
editorMap
.
width
-
_leftToolWidth
-
_rightPanelWidth
,
editorMap
.
height
-
_statusHeight
-
_toolbarHeight
)
property
real
_leftToolWidth
:
toolStrip
.
x
+
toolStrip
.
width
...
...
@@ -495,7 +495,7 @@ QGCView {
}
onItemAdded
:
{
console
.
log
(
"
Item added
"
)
//
console.log("Item added")
}
}
...
...
@@ -810,6 +810,7 @@ QGCView {
masterController
:
_planMasterController
wimaController
:
_wimaController
_index
:
index
areaItem
:
object
width
:
parent
.
width
readOnly
:
false
rootQgcView
:
_qgcView
...
...
@@ -966,7 +967,7 @@ QGCView {
id
:
clearVehicleMissionDialog
QGCViewMessage
{
message
:
qsTr
(
"
Are you sure you want to remove all mission items and clear the mission from the vehicle?
"
)
function
accept
()
{
_layerWimaPlan
function
accept
()
{
masterController
.
removeAllFromVehicle
()
hideDialog
()
}
...
...
@@ -1061,7 +1062,7 @@ QGCView {
}
QGCButton
{
text
:
qsTr
(
"
Save Mission Waypoints As K
_layerWimaPlan
ML...
"
)
text
:
qsTr
(
"
Save Mission Waypoints As KML...
"
)
Layout.columnSpan
:
2
enabled
:
!
masterController
.
syncInProgress
&&
_visualItems
.
count
>
1
onClicked
:
{
...
...
@@ -1153,7 +1154,7 @@ QGCView {
color
:
"
lightsteelblue
"
radius
:
1
Text
{
text
:
object
.
isCurrentPolygon
text
:
"
Hello World!
"
}
}
}
...
...
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