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
07975ff6
Commit
07975ff6
authored
May 20, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto vehicle corridor implemented
parent
6c9cee43
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
545 additions
and
58 deletions
+545
-58
qgroundcontrol.qrc
qgroundcontrol.qrc
+2
-0
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+3
-0
WimaController.cc
src/Wima/WimaController.cc
+97
-15
WimaController.h
src/Wima/WimaController.h
+8
-0
WimaGOperationArea.cc
src/Wima/WimaGOperationArea.cc
+15
-0
WimaGOperationArea.h
src/Wima/WimaGOperationArea.h
+11
-6
WimaServiceArea.cc
src/Wima/WimaServiceArea.cc
+16
-0
WimaServiceArea.h
src/Wima/WimaServiceArea.h
+12
-2
WimaTrackerPolyline.cc
src/Wima/WimaTrackerPolyline.cc
+5
-4
WimaTrackerPolyline.h
src/Wima/WimaTrackerPolyline.h
+1
-2
WimaVCorridor.cc
src/Wima/WimaVCorridor.cc
+33
-1
WimaVCorridor.h
src/Wima/WimaVCorridor.h
+17
-0
WimaGOperationAreaEditor.qml
src/WimaView/WimaGOperationAreaEditor.qml
+33
-5
WimaGOperationAreaMapVisual.qml
src/WimaView/WimaGOperationAreaMapVisual.qml
+5
-17
WimaMapPolylineVisuals.qml
src/WimaView/WimaMapPolylineVisuals.qml
+7
-1
WimaServiceAreaEditor.qml
src/WimaView/WimaServiceAreaEditor.qml
+155
-0
WimaServiceAreaMapVisual.qml
src/WimaView/WimaServiceAreaMapVisual.qml
+21
-4
WimaVCorridorMapVisual.qml
src/WimaView/WimaVCorridorMapVisual.qml
+102
-0
WimaView.qml
src/WimaView/WimaView.qml
+2
-1
No files found.
qgroundcontrol.qrc
View file @
07975ff6
...
...
@@ -218,6 +218,8 @@
<file alias="QGroundControl/Controls/WimaGOperationAreaMapVisual.qml">src/WimaView/WimaGOperationAreaMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaServiceAreaMapVisual.qml">src/WimaView/WimaServiceAreaMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaGOperationAreaEditor.qml">src/WimaView/WimaGOperationAreaEditor.qml</file>
<file alias="QGroundControl/Controls/WimaServiceAreaEditor.qml">src/WimaView/WimaServiceAreaEditor.qml</file>
<file alias="QGroundControl/Controls/WimaVCorridorMapVisual.qml">src/WimaView/WimaVCorridorMapVisual.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
...
...
src/QmlControls/QGroundControl.Controls.qmldir
View file @
07975ff6
...
...
@@ -89,6 +89,9 @@ WimaMapVisual 1.0 WimaMapVisual.qml
WimaGOperationAreaMapVisual 1.0 WimaGOperationAreaMapVisual.qml
WimaGOperationAreaEditor 1.0 WimaGOperationAreaEditor.qml
WimaServiceAreaMapVisual 1.0 WimaServiceAreaMapVisual.qml
WimaServiceAreaEditor 1.0 WimaServiceAreaEditor.qml
WimaVCorridorMapVisual 1.0 WimaVCorridorMapVisual.qml
WimaItemEditor 1.0 WimaItemEditor.qml
WimaMapPolygonVisuals 1.0 WimaMapPolygonVisuals.qml
WimaMapPolylineVisuals 1.0 WimaMapPolylineVisuals.qml
src/Wima/WimaController.cc
View file @
07975ff6
#include "WimaController.h"
#include "MissionController.h"
WimaController
::
WimaController
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_planView
(
true
)
,
_visualItems
(
new
QmlObjectListModel
(
parent
))
,
_currentPolygonIndex
(
-
1
)
{
connect
(
this
,
&
WimaController
::
currentPolygonIndexChanged
,
this
,
&
WimaController
::
recalcPolygonInteractivity
);
}
...
...
@@ -30,17 +30,6 @@ void WimaController::setCurrentPolygonIndex(int index)
}
}
void
WimaController
::
addGOperationArea
()
{
WimaGOperationArea
*
newPoly
=
new
WimaGOperationArea
(
this
);
_visualItems
->
append
(
newPoly
);
int
newIndex
=
_visualItems
->
count
()
-
1
;
_currentPolygonIndex
=
newIndex
;
emit
currentPolygonIndexChanged
(
newIndex
);
emit
visualItemsChanged
();
}
void
WimaController
::
removeArea
(
int
index
)
{
if
(
index
>=
0
&&
index
<
_visualItems
->
count
()){
...
...
@@ -48,6 +37,13 @@ void WimaController::removeArea(int index)
emit
visualItemsChanged
();
if
(
_visualItems
->
count
()
==
0
)
{
// this branch is reached if all items are removed
// to guarentee proper behavior, _currentPolygonIndex must be set to a invalid value, as on constructor init.
_currentPolygonIndex
=
-
1
;
return
;
}
if
(
_currentPolygonIndex
>=
_visualItems
->
count
()){
setCurrentPolygonIndex
(
_visualItems
->
count
()
-
1
);
}
else
{
...
...
@@ -59,16 +55,75 @@ void WimaController::removeArea(int index)
}
void
WimaController
::
addGOperationArea
()
{
WimaGOperationArea
*
newPoly
=
new
WimaGOperationArea
(
this
);
_visualItems
->
append
(
newPoly
);
int
newIndex
=
_visualItems
->
count
()
-
1
;
setCurrentPolygonIndex
(
newIndex
);
emit
visualItemsChanged
();
}
void
WimaController
::
addServiceArea
()
{
resetAllIsCurrentPolygon
();
WimaServiceArea
*
newPoly
=
new
WimaServiceArea
(
this
);
newPoly
->
setInteractive
(
true
);
_visualItems
->
append
(
newPoly
);
int
newIndex
=
_visualItems
->
count
()
-
1
;
setCurrentPolygonIndex
(
newIndex
);
emit
visualItemsChanged
();
}
bool
WimaController
::
addVehicleCorridor
(
WimaGOperationArea
*
opArea
,
WimaServiceArea
*
serviceArea
)
{
WimaVCorridor
*
corridor
=
nullptr
;
if
(
opArea
!=
nullptr
&&
serviceArea
!=
nullptr
){
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
corridor
=
qobject_cast
<
WimaVCorridor
*>
(
_visualItems
->
get
(
i
));
if
(
corridor
!=
nullptr
){
if
(
corridor
->
serviceArea
()
==
serviceArea
&&
corridor
->
opArea
()
==
opArea
){
break
;
}
else
{
corridor
=
nullptr
;
}
}
}
bool
newCorridorCreated
=
false
;
if
(
corridor
==
nullptr
){
corridor
=
new
WimaVCorridor
(
this
);
newCorridorCreated
=
true
;
}
else
{
corridor
->
clear
();
}
QList
<
QGeoCoordinate
>
opAreaPolyline
=
opArea
->
polyline
()
->
coordinateList
();
QList
<
QGeoCoordinate
>
serAreaPolyline
=
serviceArea
->
polyline
()
->
coordinateList
();
if
(
opAreaPolyline
.
size
()
>
1
&&
serAreaPolyline
.
size
()
>
1
){
corridor
->
appendVertices
(
opAreaPolyline
);
corridor
->
appendVertices
(
serAreaPolyline
);
if
(
newCorridorCreated
){
corridor
->
setServiceArea
(
serviceArea
);
corridor
->
setOpArea
(
opArea
);
serviceArea
->
setVehicleCorridor
(
corridor
);
opArea
->
setVehicleCorridor
(
corridor
);
_visualItems
->
append
(
corridor
);
emit
visualItemsChanged
();
}
return
true
;
}
else
{
qWarning
(
"WimaController::addVehicleCorridor(): OpArea or serviceArea polyline size <= 1!"
);
if
(
newCorridorCreated
){
corridor
->
deleteLater
();
}
return
false
;
}
}
else
{
return
false
;
}
}
void
WimaController
::
startMission
()
{
...
...
@@ -89,6 +144,33 @@ void WimaController::resumeMission()
}
bool
WimaController
::
updateMission
()
{
WimaGOperationArea
*
opArea
=
nullptr
;
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
WimaGOperationArea
*
currentArea
=
qobject_cast
<
WimaGOperationArea
*>
(
_visualItems
->
get
(
i
));
if
(
currentArea
!=
nullptr
){
opArea
=
currentArea
;
break
;
}
}
WimaServiceArea
*
serArea
=
nullptr
;
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
WimaServiceArea
*
currentArea
=
qobject_cast
<
WimaServiceArea
*>
(
_visualItems
->
get
(
i
));
if
(
currentArea
!=
nullptr
){
serArea
=
currentArea
;
break
;
}
}
if
(
opArea
!=
nullptr
&&
serArea
!=
nullptr
){
return
addVehicleCorridor
(
opArea
,
serArea
);
}
else
{
return
false
;
}
}
void
WimaController
::
saveMission
()
{
...
...
src/Wima/WimaController.h
View file @
07975ff6
...
...
@@ -7,6 +7,7 @@
#include "WimaArea.h"
#include "WimaGOperationArea.h"
#include "WimaServiceArea.h"
#include "WimaVCorridor.h"
#include "PlanMasterController.h"
#include "MissionController.h"
...
...
@@ -37,16 +38,23 @@ public:
// Property setters
void
setMasterController
(
PlanMasterController
*
masterController
);
void
setMissionController
(
MissionController
*
missionController
);
/// Sets the integer index pointing to the current polygon. Current polygon is set interactive.
void
setCurrentPolygonIndex
(
int
index
);
Q_INVOKABLE
void
addGOperationArea
();
/// Removes an area from _visualItems
/// @param index Index of the area to be removed
Q_INVOKABLE
void
removeArea
(
int
index
);
Q_INVOKABLE
void
addServiceArea
();
/// @return true if a vehicle corridor was added sucessfully and false otherwise.
bool
addVehicleCorridor
(
WimaGOperationArea
*
opArea
,
WimaServiceArea
*
serviceArea
);
Q_INVOKABLE
void
startMission
();
Q_INVOKABLE
void
abortMission
();
Q_INVOKABLE
void
pauseMission
();
Q_INVOKABLE
void
resumeMission
();
/// Recalculates vehicle corridor, flight path, etc.
Q_INVOKABLE
bool
updateMission
();
Q_INVOKABLE
void
saveMission
();
Q_INVOKABLE
void
loadMission
();
...
...
src/Wima/WimaGOperationArea.cc
View file @
07975ff6
...
...
@@ -42,6 +42,21 @@ void WimaGOperationArea::removeVehicle(int vehicleIndex)
}
}
void
WimaGOperationArea
::
setVehicleCorridor
(
WimaVCorridor
*
corridor
)
{
if
(
corridor
!=
nullptr
){
if
(
corridor
!=
_vehicleCorridor
){
_vehicleCorridor
=
corridor
;
emit
vehicleCorridorChanged
(
_vehicleCorridor
);
}
else
{
qWarning
(
"WimaGOperationArea::setVehicleCorridor(): new corridor equals old _vehicleCorridor!"
);
}
}
else
{
qWarning
(
"WimaGOperationArea::setVehicleCorridor(): corridor == nullptr!"
);
}
}
/*void WimaGOperationArea::recalculatesubPolygons()
{
int vehicleCount = _vehicleList->count();
...
...
src/Wima/WimaGOperationArea.h
View file @
07975ff6
...
...
@@ -4,6 +4,7 @@
#include "WimaArea.h"
#include "SettingsFact.h"
#include "WimaTrackerPolyline.h"
#include "WimaGOperationArea.h"
#include "QScopedPointer"
...
...
@@ -14,16 +15,17 @@ public:
WimaGOperationArea
(
QObject
*
parent
=
nullptr
);
WimaGOperationArea
(
WimaArea
*
other
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
Fact
*
bottomLayerAltitude
READ
bottomLayerAltitude
CONSTANT
)
Q_PROPERTY
(
Fact
*
numberOfLayers
READ
numberOfLayers
CONSTANT
)
Q_PROPERTY
(
Fact
*
layerDistance
READ
layerDistance
CONSTANT
)
Q_PROPERTY
(
Fact
*
bottomLayerAltitude
READ
bottomLayerAltitude
CONSTANT
)
Q_PROPERTY
(
Fact
*
numberOfLayers
READ
numberOfLayers
CONSTANT
)
Q_PROPERTY
(
Fact
*
layerDistance
READ
layerDistance
CONSTANT
)
/*Q_PROPERTY(QmlObjectListModel* vehicleList READ vehicleList NOTIFY vehicleListChanged)
Q_PROPERTY(QmlObjectListModel* vehiclePolygons READ vehiclePolygons NOTIFY vehiclePolygonsChanged)*/
Q_PROPERTY
(
WimaTrackerPolyline
*
polyline
READ
polyline
CONSTANT
)
Q_PROPERTY
(
WimaTrackerPolyline
*
polyline
READ
polyline
CONSTANT
)
Q_INVOKABLE
void
addVehicle
(
WimaVehicle
*
vehicle
);
Q_INVOKABLE
void
removeVehicle
(
int
vehicleIndex
);
void
setVehicleCorridor
(
WimaVCorridor
*
corridor
);
/*Q_INVOKABLE void recalculatesubPolygons ();
Q_INVOKABLE void removeAllVehicles ();
Q_INVOKABLE void addVehiclePolygon ();
...
...
@@ -42,6 +44,7 @@ public:
/*QmlObjectListModel* vehicleList (void) const { return _vehicleList;}
QmlObjectListModel* vehiclePolygons (void) const { return _vehiclePolygons;}*/
WimaTrackerPolyline
*
polyline
(
void
)
{
return
&
_polyline
;}
WimaVCorridor
*
vehicleCorridor
(
void
)
{
return
_vehicleCorridor
;}
static
const
char
*
settingsGroup
;
...
...
@@ -57,7 +60,7 @@ signals:
//void vehicleListChanged (void);
void
polylineChanged
(
void
);
//void vehiclePolygonsChanged (void);
void
vehicleCorridorChanged
(
WimaVCorridor
*
corridor
);
private:
QMap
<
QString
,
FactMetaData
*>
_metaDataMap
;
...
...
@@ -69,7 +72,9 @@ private:
/*QmlObjectListModel* _vehicleList;
QmlObjectListModel* _vehiclePolygons;*/
WimaTrackerPolyline
_polyline
;
WimaTrackerPolyline
_polyline
;
WimaVCorridor
*
_vehicleCorridor
;
...
...
src/Wima/WimaServiceArea.cc
View file @
07975ff6
...
...
@@ -9,6 +9,7 @@ WimaServiceArea::WimaServiceArea(QObject *parent):
WimaServiceArea
::
WimaServiceArea
(
WimaArea
*
other
,
QObject
*
parent
)
:
WimaArea
(
other
,
parent
)
{
_polyline
.
bindPolygon
(
this
);
this
->
setObjectName
(
"Service Area"
);
}
...
...
@@ -28,3 +29,18 @@ void WimaServiceArea::setLandPosition(QGeoCoordinate* coordinate)
}
}
void
WimaServiceArea
::
setVehicleCorridor
(
WimaVCorridor
*
corridor
)
{
if
(
corridor
!=
nullptr
){
if
(
corridor
!=
_vehicleCorridor
){
_vehicleCorridor
=
corridor
;
emit
vehicleCorridorChanged
(
_vehicleCorridor
);
}
else
{
qWarning
(
"WimaServiceArea::setVehicleCorridor(): new corridor equals old _vehicleCorridor!"
);
}
}
else
{
qWarning
(
"WimaServiceArea::setVehicleCorridor(): corridor == nullptr!"
);
}
}
src/Wima/WimaServiceArea.h
View file @
07975ff6
...
...
@@ -2,6 +2,7 @@
#include <QObject>
#include "WimaArea.h"
#include "WimaTrackerPolyline.h"
class
WimaServiceArea
:
public
WimaArea
{
...
...
@@ -10,8 +11,10 @@ public:
WimaServiceArea
(
QObject
*
parent
=
nullptr
);
WimaServiceArea
(
WimaArea
*
other
=
nullptr
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
QGeoCoordinate
*
takeOffPosition
READ
takeOffPosition
WRITE
setTakeOffPosition
NOTIFY
takeOffPositionChanged
)
Q_PROPERTY
(
QGeoCoordinate
*
landPosition
READ
landPosition
WRITE
setLandPosition
NOTIFY
landPositionChanged
)
Q_PROPERTY
(
QGeoCoordinate
*
takeOffPosition
READ
takeOffPosition
WRITE
setTakeOffPosition
NOTIFY
takeOffPositionChanged
)
Q_PROPERTY
(
QGeoCoordinate
*
landPosition
READ
landPosition
WRITE
setLandPosition
NOTIFY
landPositionChanged
)
Q_PROPERTY
(
WimaTrackerPolyline
*
polyline
READ
polyline
CONSTANT
)
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaServiceAreaMapVisual.qml"
;}
...
...
@@ -20,16 +23,23 @@ public:
// Property acessors
QGeoCoordinate
*
takeOffPosition
(
void
)
{
return
&
_takeOffPosition
;}
QGeoCoordinate
*
landPosition
(
void
)
{
return
&
_landPosition
;}
WimaTrackerPolyline
*
polyline
(
void
)
{
return
&
_polyline
;}
WimaVCorridor
*
vehicleCorridor
(
void
)
{
return
_vehicleCorridor
;}
// Property setters
void
setTakeOffPosition
(
QGeoCoordinate
*
coordinate
);
void
setLandPosition
(
QGeoCoordinate
*
coordinate
);
void
setVehicleCorridor
(
WimaVCorridor
*
corridor
);
signals:
void
takeOffPositionChanged
(
void
);
void
landPositionChanged
(
void
);
void
vehicleCorridorChanged
(
WimaVCorridor
*
corridor
);
private:
WimaTrackerPolyline
_polyline
;
QGeoCoordinate
_takeOffPosition
;
QGeoCoordinate
_landPosition
;
WimaVCorridor
*
_vehicleCorridor
;
};
src/Wima/WimaTrackerPolyline.cc
View file @
07975ff6
...
...
@@ -33,11 +33,12 @@ void WimaTrackerPolyline::unbindPolygon()
}
}
void
WimaTrackerPolyline
::
swap
Limi
ts
()
void
WimaTrackerPolyline
::
swap
EndPoin
ts
()
{
int
storage
=
_startVertexIndex
;
_startVertexIndex
=
_endVertexIndex
;
_endVertexIndex
=
storage
;
recalcPolyline
();
}
...
...
@@ -115,7 +116,7 @@ void WimaTrackerPolyline::snapStartVertex()
void
WimaTrackerPolyline
::
recalcPolyline
()
{
qWarning
(
"WimaTrackerPolyline::recalcPolyline()"
);
//
qWarning("WimaTrackerPolyline::recalcPolyline()");
if
(
_boundArea
!=
nullptr
&&
_boundArea
->
count
()
>
0
){
if
(
_startVertexIndex
>=
_boundArea
->
count
()){
_startVertexIndex
=
0
;
...
...
@@ -124,10 +125,10 @@ void WimaTrackerPolyline::recalcPolyline()
_endVertexIndex
=
_boundArea
->
count
()
-
1
;
}
_polyline
.
clear
();
this
->
clear
();
int
i
=
_startVertexIndex
;
while
(
1
){
_polyline
.
appendVertex
(
_boundArea
->
vertexCoordinate
(
i
));
this
->
appendVertex
(
_boundArea
->
vertexCoordinate
(
i
));
if
(
i
==
_boundArea
->
count
()
-
1
&&
i
!=
_endVertexIndex
){
i
=
0
;
}
else
if
(
i
==
_endVertexIndex
)
{
...
...
src/Wima/WimaTrackerPolyline.h
View file @
07975ff6
...
...
@@ -23,7 +23,7 @@ public:
//Property setters
Q_INVOKABLE
void
bindPolygon
(
WimaArea
*
polygon
);
Q_INVOKABLE
void
unbindPolygon
();
Q_INVOKABLE
void
swap
Limits
();
Q_INVOKABLE
void
swap
EndPoints
();
Q_INVOKABLE
void
setStartVertexIndex
(
int
PolygonVertexIndex
);
Q_INVOKABLE
void
setEndVertexIndex
(
int
PolygonVertexIndex
);
...
...
@@ -48,7 +48,6 @@ public slots:
void
recalcPolyline
(
void
);
private:
QGCMapPolyline
_polyline
;
WimaArea
*
_boundArea
;
// this->vertexCoordinate(this->count()-1) and _boundArea->vertexCoordinate(_startVertexIndex) are linked
int
_startVertexIndex
;
...
...
src/Wima/WimaVCorridor.cc
View file @
07975ff6
...
...
@@ -7,7 +7,39 @@ WimaVCorridor::WimaVCorridor(QObject *parent):
}
WimaVCorridor
::
WimaVCorridor
(
WimaArea
*
other
,
QObject
*
parent
)
:
WimaArea
(
other
,
parent
)
WimaArea
(
other
,
parent
)
,
_serviceArea
(
nullptr
)
,
_opArea
(
nullptr
)
{
this
->
setObjectName
(
"Corridor"
);
}
void
WimaVCorridor
::
setServiceArea
(
WimaServiceArea
*
serviceArea
)
{
if
(
serviceArea
!=
nullptr
){
if
(
serviceArea
!=
_serviceArea
){
_serviceArea
=
serviceArea
;
emit
serviceAreaChanged
(
_serviceArea
);
}
else
{
qWarning
(
"WimaVCorridor::setServiceArea(): new serviceArea does not differ from old _serviceArea!"
);
}
}
else
{
qWarning
(
"WimaVCorridor::setServiceArea(): serviceArea == nullptr!"
);
}
}
void
WimaVCorridor
::
setOpArea
(
WimaGOperationArea
*
opArea
)
{
if
(
opArea
!=
nullptr
){
if
(
&
opArea
!=
&
_opArea
){
_opArea
=
opArea
;
emit
opAreaChanged
(
_opArea
);
}
else
{
qWarning
(
"WimaVCorridor::setOpArea(): new opArea does not differ from old _opArea!"
);
}
}
else
{
qWarning
(
"WimaVCorridor::setOpArea(): opArea == nullptr!"
);
}
}
src/Wima/WimaVCorridor.h
View file @
07975ff6
...
...
@@ -2,6 +2,8 @@
#include <QObject>
#include "WimaArea.h"
#include "WimaServiceArea.h"
#include "WimaGOperationArea.h"
class
WimaVCorridor
:
public
WimaArea
{
...
...
@@ -13,5 +15,20 @@ public:
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaVCorridorMapVisual.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaVCorridorEditor.qml"
;}
// Methodes
void
setServiceArea
(
WimaServiceArea
*
serviceArea
);
void
setOpArea
(
WimaGOperationArea
*
opArea
);
WimaServiceArea
*
serviceArea
(
void
)
const
{
return
_serviceArea
;}
WimaGOperationArea
*
opArea
(
void
)
const
{
return
_opArea
;}
signals:
void
serviceAreaChanged
(
WimaServiceArea
*
serviceArea
);
void
opAreaChanged
(
WimaGOperationArea
*
opArea
);
private:
WimaServiceArea
*
_serviceArea
;
WimaGOperationArea
*
_opArea
;
};
src/WimaView/WimaGOperationAreaEditor.qml
View file @
07975ff6
...
...
@@ -28,11 +28,29 @@ Rectangle {
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_fieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10.5
property
var
polyline
:
areaItem
.
polyline
property
var
operatingPolygon
:
areaItem
property
bool
polylineInteractive
:
polyline
.
interactive
property
bool
polygonInteractive
:
areaItem
.
interactive
property
var
polygon
:
areaItem
property
bool
initNecesarry
:
true
onPolylineInteractiveChanged
:
{
polyline
.
interactive
=
polylineInteractive
;
}
onPolygonInteractiveChanged
:
{
polygon
.
interactive
=
polygonInteractive
;
}
function
editPolyline
(){
polyline
.
interactive
=
true
;
if
(
polylineInteractive
){
//polyline.interactive = false;
polylineInteractive
=
false
;
//polygonInteractive = true;
}
else
{
//polyline.interactive = true;
polylineInteractive
=
true
;
//polygonInteractive = false;
}
}
...
...
@@ -74,7 +92,7 @@ Rectangle {
Layout.fillWidth
:
true
}
/*
QGCLabel { text: qsTr("Number of Layers") }
QGCLabel
{
text
:
qsTr
(
"
Number of Layers
"
)
}
FactTextField
{
fact
:
areaItem
.
numberOfLayers
Layout.fillWidth
:
true
...
...
@@ -84,7 +102,7 @@ Rectangle {
FactTextField
{
fact
:
areaItem
.
layerDistance
Layout.fillWidth
:
true
}
*/
}
}
...
...
@@ -104,11 +122,21 @@ Rectangle {
anchors.topMargin
:
_margin
/
2
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
text
:
"
Edit Polyline
"
text
:
polylineInteractive
?
"
Done
"
:
"
Edit
"
onClicked
:
editPolyline
()
}
QGCButton
{
id
:
swapEndpoints
anchors.topMargin
:
_margin
/
2
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
text
:
"
Swap End-Points
"
onClicked
:
polyline
.
swapEndPoints
()
}
SectionHeader
{
id
:
statsHeader
text
:
qsTr
(
"
Statistics
"
)
...
...
src/WimaView/WimaGOperationAreaMapVisual.qml
View file @
07975ff6
...
...
@@ -65,7 +65,7 @@ Item {
function
_addInitialPolyline
(){
_polyline
.
setStartVertexIndex
(
0
);
_polyline
.
setEndVertexIndex
(
2
);
_polyline
.
setEndVertexIndex
(
1
);
}
...
...
@@ -95,22 +95,10 @@ Item {
mapControl
:
map
mapPolyline
:
_polyline
lineWidth
:
4
lineColor
:
interactive
?
"
yellow
"
:
"
green
"
lineColor
:
interactive
?
"
white
"
:
"
green
"
enableSplitHandels
:
false
enableDragHandels
:
true
edgeHandelsOnly
:
true
}
/*QGCMapPolylineVisuals {
id: mapPolylineVisuals
qgcView: _root.qgcView
mapControl: map
mapPolyline: _polyline
lineWidth: 3
lineColor: "#be781c"
}*/
}
src/WimaView/WimaMapPolylineVisuals.qml
View file @
07975ff6
...
...
@@ -108,6 +108,7 @@ Item {
}
Component.onCompleted
:
{
addInitialPolyline
()
addVisuals
()
if
(
interactive
)
{
addHandles
()
...
...
@@ -151,6 +152,11 @@ Item {
text
:
qsTr
(
"
Remove vertex
"
)
onTriggered
:
mapPolyline
.
removeVertex
(
menu
.
_removeVertexIndex
)
}
MenuItem
{
id
:
swapEndPoints
text
:
qsTr
(
"
Swap End-Points
"
)
onTriggered
:
mapPolyline
.
swapEndPoints
()
}
MenuSeparator
{
visible
:
removeVertexItem
.
visible
...
...
@@ -283,7 +289,7 @@ Item {
onDragStop
:
{
if
(
_creationComplete
)
{
// During component creation some bad coordinate values got through which screws up draw
mapPolyline
.
snapVert
ices
(
polylineVertex
)
mapPolyline
.
snapVert
ex
(
polylineVertex
)
}
}
...
...
src/WimaView/WimaServiceAreaEditor.qml
0 → 100644
View file @
07975ff6
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.4
import
QtQuick
.
Dialogs
1.2
import
QtQuick
.
Extras
1.4
import
QtQuick
.
Layouts
1.2
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Vehicle
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
FlightMap
1.0
// Editor for Operating Area items
Rectangle
{
id
:
_root
height
:
visible
?
(
editorColumn
.
height
+
(
_margin
*
2
))
:
0
width
:
availableWidth
color
:
qgcPal
.
windowShadeDark
radius
:
_radius
// The following properties must be available up the hierarchy chain
//property real availableWidth ///< Width for control
//property var areaItem ///< Mission Item for editor
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_fieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10.5
property
var
polyline
:
areaItem
.
polyline
property
bool
polylineInteractive
:
polyline
.
interactive
property
bool
polygonInteractive
:
areaItem
.
interactive
property
var
polygon
:
areaItem
property
bool
initNecesarry
:
true
onPolylineInteractiveChanged
:
{
polyline
.
interactive
=
polylineInteractive
;
}
onPolygonInteractiveChanged
:
{
polygon
.
interactive
=
polygonInteractive
;
}
function
editPolyline
(){
if
(
polylineInteractive
){
//polyline.interactive = false;
polylineInteractive
=
false
;
//polygonInteractive = true;
}
else
{
//polyline.interactive = true;
polylineInteractive
=
true
;
//polygonInteractive = false;
}
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
Column
{
id
:
editorColumn
anchors.margins
:
_margin
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
_margin
SectionHeader
{
id
:
scanHeader
text
:
qsTr
(
"
Settings
"
)
}
Column
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
rightsetI
spacing
:
_margin
visible
:
scanHeader
.
checked
GridLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
columnSpacing
:
_margin
rowSpacing
:
_margin
columns
:
2
/*QGCLabel {
text: qsTr("Bottom Layer Altitude")
}
FactTextField {
fact: areaItem.bottomLayerAltitude
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Number of Layers") }
FactTextField {
fact: areaItem.numberOfLayers
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Layer Distance") }
FactTextField {
fact: areaItem.layerDistance
Layout.fillWidth: true
}*/
}
Item
{
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
1
}
}
// 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
:
polylineInteractive
?
"
Done
"
:
"
Edit
"
onClicked
:
editPolyline
()
}
QGCButton
{
id
:
swapEndpoints
anchors.topMargin
:
_margin
/
2
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
text
:
"
Swap End-Points
"
onClicked
:
polyline
.
swapEndPoints
()
}
SectionHeader
{
id
:
statsHeader
text
:
qsTr
(
"
Statistics
"
)
}
Grid
{
columns
:
2
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
statsHeader
.
checked
/*QGCLabel { text: qsTr("Layers") }
QGCLabel { text: areaItem.layers.valueString }*/
}
}
// Column
}
// Rectangle
src/WimaView/WimaServiceAreaMapVisual.qml
View file @
07975ff6
...
...
@@ -25,7 +25,9 @@ Item {
property
var
map
///< Map control to place item in
property
var
qgcView
///< QGCView to use for popping dialogs
property
var
_polygon
:
object
property
var
areaItem
:
object
property
var
_polygon
:
areaItem
property
var
_polyline
:
areaItem
.
polyline
signal
clicked
(
int
sequenceNumber
)
...
...
@@ -61,8 +63,16 @@ Item {
}
}
function
_addInitialPolyline
(){
_polyline
.
setStartVertexIndex
(
0
);
_polyline
.
setEndVertexIndex
(
1
);
}
Component.onCompleted
:
{
_addInitialPolygon
()
_addInitialPolyline
()
}
Component.onDestruction
:
{
...
...
@@ -78,7 +88,14 @@ Item {
interiorOpacity
:
0.25
}
WimaMapPolylineVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolyline
:
_polyline
lineWidth
:
4
lineColor
:
interactive
?
"
white
"
:
"
yellow
"
enableSplitHandels
:
false
enableDragHandels
:
true
edgeHandelsOnly
:
true
}
}
src/WimaView/WimaVCorridorMapVisual.qml
0 → 100644
View file @
07975ff6
/****************************************************************************
*
* (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtLocation
5.3
import
QtPositioning
5.3
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightMap
1.0
/// Wima Global Measurement Area visuals
Item
{
id
:
_root
property
var
map
///< Map control to place item in
property
var
qgcView
///< QGCView to use for popping dialogs
property
var
areaItem
:
object
property
var
_polygon
:
areaItem
//property var _polyline: areaItem.polyline
signal
clicked
(
int
sequenceNumber
)
/// Add an initial 4 sided polygon if there is none
function
_addInitialPolygon
()
{
if
(
_polygon
.
count
<
3
)
{
// Initial polygon is inset to take 2/3rds space
var
rect
=
Qt
.
rect
(
map
.
centerViewport
.
x
,
map
.
centerViewport
.
y
,
map
.
centerViewport
.
width
,
map
.
centerViewport
.
height
)
rect
.
x
+=
(
rect
.
width
*
0.25
)
/
2
rect
.
y
+=
(
rect
.
height
*
0.25
)
/
2
rect
.
width
*=
0.25
rect
.
height
*=
0.25
var
centerCoord
=
map
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
(
rect
.
width
/
2
),
rect
.
y
+
(
rect
.
height
/
2
)),
false
/* clipToViewPort */
)
var
topLeftCoord
=
map
.
toCoordinate
(
Qt
.
point
(
rect
.
x
,
rect
.
y
),
false
/* clipToViewPort */
)
var
topRightCoord
=
map
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
rect
.
width
,
rect
.
y
),
false
/* clipToViewPort */
)
var
bottomLeftCoord
=
map
.
toCoordinate
(
Qt
.
point
(
rect
.
x
,
rect
.
y
+
rect
.
height
),
false
/* clipToViewPort */
)
var
bottomRightCoord
=
map
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
rect
.
width
,
rect
.
y
+
rect
.
height
),
false
/* clipToViewPort */
)
// Adjust polygon to max size
var
maxSize
=
100
var
halfWidthMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
topRightCoord
),
maxSize
)
/
2
var
halfHeightMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
bottomLeftCoord
),
maxSize
)
/
2
topLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
0
)
topRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
0
)
bottomLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
bottomRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
_polygon
.
appendVertex
(
topLeftCoord
)
_polygon
.
appendVertex
(
topRightCoord
)
_polygon
.
appendVertex
(
bottomRightCoord
)
_polygon
.
appendVertex
(
bottomLeftCoord
)
}
}
/*function _addInitialPolyline(){
_polyline.setStartVertexIndex(0);
_polyline.setEndVertexIndex(1);
}*/
Component.onCompleted
:
{
//_addInitialPolygon()
//_addInitialPolyline()
}
Component.onDestruction
:
{
}
WimaMapPolygonVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolygon
:
_polygon
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
blue
"
interactive
:
false
interiorOpacity
:
0.2
}
/*WimaMapPolylineVisuals {
qgcView: _root.qgcView
mapControl: map
mapPolyline: _polyline
lineWidth: 4
lineColor: interactive ? "white" : "yellow"
enableSplitHandels: false
enableDragHandels: true
edgeHandelsOnly: true
}*/
}
src/WimaView/WimaView.qml
View file @
07975ff6
...
...
@@ -624,7 +624,8 @@ QGCView {
/*if (_singleComplexItem) {
addComplexItem(_missionController.complexMissionItemNames[0])
}*/
FlyArea
}*/
wimaController
.
updateMission
();
break
case
5
:
editorMap
.
zoomLevel
+=
0.5
...
...
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