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
00d7ea68
Commit
00d7ea68
authored
Mar 29, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding .qml files for WimaPolygons
parent
2ff5f135
Changes
27
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
735 additions
and
354 deletions
+735
-354
UnitTest.qrc
UnitTest.qrc
+1
-3
WimaGlobalMeasurementPolygonMapVisual.qml
WimaGlobalMeasurementPolygonMapVisual.qml
+86
-0
qgroundcontrol.pro
qgroundcontrol.pro
+0
-3
qgroundcontrol.qrc
qgroundcontrol.qrc
+4
-3
WimaController.cc
src/MissionManager/WimaController.cc
+80
-10
WimaController.h
src/MissionManager/WimaController.h
+15
-9
WimaFlyArea.cc
src/MissionManager/WimaFlyArea.cc
+0
-81
WimaFlyArea.h
src/MissionManager/WimaFlyArea.h
+0
-74
WimaGlobalMeasurementPolygon.cc
src/MissionManager/WimaGlobalMeasurementPolygon.cc
+16
-11
WimaGlobalMeasurementPolygon.h
src/MissionManager/WimaGlobalMeasurementPolygon.h
+13
-14
WimaPolygon.cc
src/MissionManager/WimaPolygon.cc
+15
-6
WimaPolygon.h
src/MissionManager/WimaPolygon.h
+24
-16
WimaServicePolygon.cc
src/MissionManager/WimaServicePolygon.cc
+8
-15
WimaServicePolygon.h
src/MissionManager/WimaServicePolygon.h
+11
-19
WimaVehicle.cc
src/MissionManager/WimaVehicle.cc
+41
-1
WimaVehicle.h
src/MissionManager/WimaVehicle.h
+24
-4
WimaVehicleCorridor.h
src/MissionManager/WimaVehicleCorridor.h
+2
-4
WimaVehicleMeasurementPolygon.h
src/MissionManager/WimaVehicleMeasurementPolygon.h
+3
-4
QGCApplication.cc
src/QGCApplication.cc
+0
-2
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+5
-1
FlyAreaEditor.qml
src/WimaView/FlyAreaEditor.qml
+0
-47
WimaGlobalMeasurementPolygonMapVisual.qml
src/WimaView/WimaGlobalMeasurementPolygonMapVisual.qml
+86
-0
WimaItemEditor.qml
src/WimaView/WimaItemEditor.qml
+0
-0
WimaItemEditor_old.qml
src/WimaView/WimaItemEditor_old.qml
+142
-0
WimaMapVisual.qml
src/WimaView/WimaMapVisual.qml
+47
-0
WimaServicePolygonMapVisual.qml
src/WimaView/WimaServicePolygonMapVisual.qml
+86
-0
WimaView.qml
src/WimaView/WimaView.qml
+26
-27
No files found.
UnitTest.qrc
View file @
00d7ea68
...
...
@@ -15,7 +15,5 @@
<file alias="PolygonBadXml.kml">src/MissionManager/UnitTest/PolygonBadXml.kml</file>
<file alias="PolygonBadCoordinatesNode.kml">src/MissionManager/UnitTest/PolygonBadCoordinatesNode.kml</file>
</qresource>
<qresource prefix="/">
<file>src/WimaView/FlyAreaMapVisual.qml</file>
</qresource>
<qresource prefix="/"/>
</RCC>
WimaGlobalMeasurementPolygonMapVisual.qml
0 → 100644
View file @
00d7ea68
/****************************************************************************
*
* (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
_missionItem
:
object
property
var
_polygon
:
object
.
polygon
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.75
rect
.
height
*=
0.75
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
)
}
}
Component.onCompleted
:
{
_addInitialPolygon
()
}
Component.onDestruction
:
{
}
QGCMapPolygonVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolygon
:
_polygon
interactive
:
_missionItem
.
isCurrentItem
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
green
"
interiorOpacity
:
0.25
}
}
qgroundcontrol.pro
View file @
00d7ea68
...
...
@@ -413,7 +413,6 @@ HEADERS += \
src
/
MissionManager
/
WimaVehicleCorridor
.
h
\
src
/
MissionManager
/
WimaVehicleMeasurementPolygon
.
h
\
src
/
MissionManager
/
WimaGlobalMeasurementPolygon
.
h
\
src
/
MissionManager
/
WimaPolygonContainer
.
h
\
src
/
MissionManager
/
WimaVehicle
.
h
SOURCES
+=
\
...
...
@@ -423,13 +422,11 @@ SOURCES += \
src
/
api
/
QmlComponentInfo
.
cc
\
src
/
comm
/
MavlinkMessagesTimer
.
cc
\
src
/
MissionManager
/
WimaController
.
cc
\
src
/
MissionManager
/
WimaFlyArea
.
cc
\
src
/
MissionManager
/
WimaPolygon
.
cc
\
src
/
MissionManager
/
WimaServicePolygon
.
cc
\
src
/
MissionManager
/
WimaVehicleCorridor
.
cc
\
src
/
MissionManager
/
WimaVehicleMeasurementPolygon
.
cc
\
src
/
MissionManager
/
WimaGlobalMeasurementPolygon
.
cc
\
src
/
MissionManager
/
WimaPolygonContainer
.
cc
\
src
/
MissionManager
/
WimaVehicle
.
cc
#
...
...
qgroundcontrol.qrc
View file @
00d7ea68
...
...
@@ -210,9 +210,10 @@
<file alias="VirtualJoystick.qml">src/FlightDisplay/VirtualJoystick.qml</file>
<file alias="QGroundControl/Controls/WimaToolBar.qml">src/WimaView/WimaToolBar.qml</file>
<file alias="WimaView.qml">src/WimaView/WimaView.qml</file>
<file alias="QGroundControl/Controls/FlyAreaPolygonMapVisual.qml">src/WimaView/FlyAreaPolygonMapVisual.qml</file>
<file alias="QGroundControl/Controls/FlyAreaEditor.qml">src/WimaView/FlyAreaEditor.qml</file>
<file alias="QGroundControl/Controls/FlyAreaItemEditor.qml">src/WimaView/FlyAreaItemEditor.qml</file>
<file alias="QGroundControl/Controls/WimaMapVisual.qml">src/WimaView/WimaMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaGlobalMeasurementPolygonMapVisual.qml">src/WimaView/WimaGlobalMeasurementPolygonMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaServicePolygonMapVisual.qml">src/WimaView/WimaServicePolygonMapVisual.qml</file>
<file alias="WimaItemEditor.qml">src/WimaView/WimaItemEditor.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
...
...
src/MissionManager/WimaController.cc
View file @
00d7ea68
...
...
@@ -2,11 +2,11 @@
#include "MissionController.h"
WimaController
::
WimaController
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_planView
(
true
)
QObject
(
parent
)
,
_planView
(
true
)
,
_visualItems
(
new
QmlObjectListModel
(
parent
))
{
connect
(
this
,
&
WimaController
::
currentPolygonIndexChanged
,
this
,
&
WimaController
::
recalcPolygonInteractivity
);
}
void
WimaController
::
setMasterController
(
PlanMasterController
*
masterC
)
...
...
@@ -21,18 +21,30 @@ void WimaController::setMissionController(MissionController *missionC)
emit
missionControllerChanged
();
}
void
WimaController
::
setCurrentPolygonIndex
(
int
index
)
{
if
(
index
>
0
&&
index
<
_visualItems
->
count
()
&&
index
!=
_currentPolygonIndex
){
_currentPolygonIndex
=
index
;
emit
currentPolygonIndexChanged
(
index
);
}
}
void
WimaController
::
addGlobalMeasurementArea
()
{
WimaGlobalMeasurementPolygon
*
poly
=
new
WimaGlobalMeasurementPolygon
(
this
);
_visualItems
.
append
(
poly
);
WimaGlobalMeasurementPolygon
*
newPoly
=
new
WimaGlobalMeasurementPolygon
(
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
.
size
()){
_visualItems
.
removeAt
(
index
);
if
(
index
>
0
&&
index
<
_visualItems
->
count
()){
_visualItems
->
removeAt
(
index
);
emit
visualItemsChanged
();
}
else
{
...
...
@@ -43,16 +55,74 @@ void WimaController::removeArea(int index)
void
WimaController
::
addServiceArea
()
{
WimaServicePolygon
*
poly
=
new
WimaServicePolygon
(
this
);
_visualItems
.
append
(
poly
);
resetAllIsCurrentPolygon
();
WimaServicePolygon
*
newPoly
=
new
WimaServicePolygon
(
this
);
newPoly
->
setIsCurrentPolygon
(
true
);
_visualItems
->
append
(
newPoly
);
emit
visualItemsChanged
();
}
void
WimaController
::
startMission
()
{
}
void
WimaController
::
abortMission
()
{
}
void
WimaController
::
pauseMission
()
{
}
void
WimaController
::
resumeMission
()
{
}
void
WimaController
::
saveMission
()
{
}
void
WimaController
::
loadMission
()
{
}
void
WimaController
::
recalcVehicleCorridor
()
{
}
void
WimaController
::
recalcVehicleMeasurementAreas
()
{
}
void
WimaController
::
recalcAll
()
{
}
void
WimaController
::
recalcPolygonInteractivity
(
int
index
)
{
resetAllIsCurrentPolygon
();
WimaPolygon
*
interactivePoly
=
qobject_cast
<
WimaPolygon
*>
(
_visualItems
->
get
(
index
));
interactivePoly
->
setIsCurrentPolygon
(
true
);
}
void
WimaController
::
resetAllIsCurrentPolygon
()
{
int
itemCount
=
_visualItems
->
count
();
for
(
int
i
=
0
;
i
<
itemCount
;
i
++
)
{
WimaPolygon
*
iteratorPoly
=
qobject_cast
<
WimaPolygon
*>
(
_visualItems
->
get
(
i
));
iteratorPoly
->
setIsCurrentPolygon
(
false
);
}
}
src/MissionManager/WimaController.h
View file @
00d7ea68
#
ifndef
WIMACONTROLLER_H
#define WIMACONTROLLER_H
#
pragma
once
#include <QObject>
#include "QGCMapPolygon.h"
#include "QmlObjectListModel.h"
#include "WimaPolygon.h"
#include "WimaGlobalMeasurementPolygon.h"
#include "WimaServicePolygon.h"
#include "WimaPolygonContainer.h"
#include "PlanMasterController.h"
#include "MissionController.h"
...
...
@@ -21,13 +21,15 @@ public:
Q_PROPERTY
(
PlanMasterController
*
masterController
READ
masterController
WRITE
setMasterController
NOTIFY
masterControllerChanged
)
Q_PROPERTY
(
MissionController
*
missionController
READ
missionController
WRITE
setMissionController
NOTIFY
missionControllerChanged
)
Q_PROPERTY
(
QList
<
WimaPolygon
*>&
visualItems
READ
visualItems
NOTIFY
visualItemsChanged
)
Q_PROPERTY
(
QList
<
WimaPolygon
*>&
editorItems
READ
editorItems
NOTIFY
visualItemsChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
visualItems
READ
visualItems
NOTIFY
visualItemsChanged
)
Q_PROPERTY
(
int
currentPolygonIndex
READ
currentPolygonIndex
WRITE
setCurrentPolygonIndex
NOTIFY
currentPolygonIndexChanged
)
// Property accessors
PlanMasterController
*
masterController
(
void
)
const
{
return
_masterController
;}
MissionController
*
missionController
(
void
)
const
{
return
_missionController
;}
QList
<
WimaPolygon
*>&
visualItems
(
void
)
{
return
_visualItemsContainer
.
returnFlatList
();
}
QmlObjectListModel
*
visualItems
(
void
)
{
return
_visualItems
;
}
int
currentPolygonIndex
(
void
)
const
{
return
_currentPolygonIndex
;
}
...
...
@@ -35,6 +37,7 @@ public:
// Property setters
void
setMasterController
(
PlanMasterController
*
masterController
);
void
setMissionController
(
MissionController
*
missionController
);
void
setCurrentPolygonIndex
(
int
index
);
Q_INVOKABLE
void
addGlobalMeasurementArea
();
Q_INVOKABLE
void
removeArea
(
int
index
);
...
...
@@ -48,25 +51,28 @@ public:
Q_INVOKABLE
void
saveMission
();
Q_INVOKABLE
void
loadMission
();
Q_INVOKABLE
void
resetAllIsCurrentPolygon
(
void
);
signals:
void
masterControllerChanged
(
void
);
void
missionControllerChanged
(
void
);
void
visualItemsChanged
(
void
);
void
currentPolygonIndexChanged
(
int
index
);
private
slots
:
void
recalcVehicleCorridor
();
void
recalcVehicleMeasurementAreas
();
void
recalcAll
();
void
recalcPolygonInteractivity
(
int
index
);
private:
bool
_planView
;
Q
List
<
WimaPolygon
*>
_visualItems
;
Q
mlObjectListModel
*
_visualItems
;
PlanMasterController
*
_masterController
;
MissionController
*
_missionController
;
int
_currentPolygonIndex
;
};
#endif // WIMACONTROLLER_H
src/MissionManager/WimaFlyArea.cc
deleted
100644 → 0
View file @
2ff5f135
#include "WimaFlyArea.h"
WimaFlyArea
::
WimaFlyArea
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_polygons
(
nullptr
)
{
}
WimaFlyArea
::
WimaFlyArea
(
const
WimaFlyArea
&
other
,
QObject
*
parent
)
:
QObject
(
parent
)
{
*
this
=
other
;
}
const
WimaFlyArea
&
WimaFlyArea
::
operator
=
(
const
WimaFlyArea
&
other
)
{
this
->
_polygons
=
other
.
_polygons
;
return
*
this
;
}
void
WimaFlyArea
::
_init
()
{
_polygons
=
new
QmlObjectListModel
(
this
);
}
void
WimaFlyArea
::
appendFlyAreaPolygon
()
{
QGCMapPolygon
*
newPolygon
=
new
QGCMapPolygon
();
_polygons
->
append
(
newPolygon
);
int
index
=
_polygons
->
count
()
-
1
;
selectCurrentPolygon
(
index
);
emit
polygonsChanged
();
}
void
WimaFlyArea
::
removeFlyAreaPolygon
(
int
index
)
{
if
(
index
>=
0
&&
index
<
_polygons
->
count
())
{
_polygons
->
removeAt
(
index
);
emit
polygonsChanged
();
}
}
void
WimaFlyArea
::
selectCurrentPolygon
(
int
index
)
{
if
(
index
>=
0
&&
index
<
_polygons
->
count
())
{
disselectAllPolygons
();
_currentPolygonIndex
=
index
;
_currentPolygonItem
=
qobject_cast
<
QGCMapPolygon
*>
(
_polygons
->
get
(
index
));
_currentPolygonItem
->
setInteractive
(
true
);
if
(
index
!=
_currentPolygonIndex
){
emit
currentPolygonItemChanged
(
_currentPolygonItem
);
emit
currentPolygonIndexChanged
(
index
);
}
}
}
void
WimaFlyArea
::
disselectAllPolygons
()
{
for
(
int
i
=
0
;
i
<
_polygons
->
count
();
i
++
)
{
QGCMapPolygon
*
polygon
=
qobject_cast
<
QGCMapPolygon
*>
(
_polygons
->
get
(
i
));
polygon
->
setInteractive
(
false
);
}
}
/*void WimaFlyArea::setBottomLayerAltitude(double alt)
{
if(_bottomLayerAltitude != alt){
_bottomLayerAltitude = alt;
emit bottomLayerAltitudeChanged(_bottomLayerAltitude);
}
}*/
src/MissionManager/WimaFlyArea.h
deleted
100644 → 0
View file @
2ff5f135
#ifndef WIMAFLYAREA_H
#define WIMAFLYAREA_H
#include <QObject>
#include "QGCMapPolygon.h"
#include "QmlObjectListModel.h"
class
WimaFlyArea
:
public
QObject
{
Q_OBJECT
public:
WimaFlyArea
(
QObject
*
parent
=
nullptr
);
WimaFlyArea
(
const
WimaFlyArea
&
other
,
QObject
*
parent
=
nullptr
);
const
WimaFlyArea
&
operator
=
(
const
WimaFlyArea
&
other
);
Q_PROPERTY
(
QmlObjectListModel
*
polygons
READ
polygons
NOTIFY
polygonsChanged
)
Q_PROPERTY
(
QGCMapPolygon
*
currentPolygonItem
READ
currentPolygonItem
NOTIFY
currentPolygonItemChanged
)
Q_PROPERTY
(
int
currentPolygonIndex
READ
currentPolygonIndex
NOTIFY
currentPolygonIndexChanged
)
//Q_PROPERTY(QList<double>* bottomLayerAltitude READ bottomLayerAltitude WRITE setBottomLayerAltitude NOTIFY bottomLayerAltitudeChanged)
//Q_PROPERTY(QList<int>* layerNumber READ layerNumber WRITE setLayerNumber NOTIFY layerNumberChanged)
//Q_PROPERTY(QList<double>* layerDistance READ layerDistance WRITE setLayerDistance NOTIFY layerDistanceChanged)
Q_INVOKABLE
void
appendFlyAreaPolygon
();
Q_INVOKABLE
void
removeFlyAreaPolygon
(
int
index
);
Q_INVOKABLE
void
selectCurrentPolygon
(
int
index
);
Q_INVOKABLE
void
disselectAllPolygons
();
// Property Accessors
QmlObjectListModel
*
polygons
(
void
)
{
return
_polygons
;}
QGCMapPolygon
*
currentPolygonItem
(
void
)
{
return
_currentPolygonItem
;}
int
currentPolygonIndex
(
void
)
{
return
_currentPolygonIndex
;}
//QList<double>* bottomLayerAltitude (void) { return _bottomLayerAltitude;}
//QList<int>* layerNumber (void) { return _layerNumber;}
//QList<double>* layerDistance (void) { return _layerDistance;}
// Property Writers
//void setBottomLayerAltitude(double alt);
//void setLayerNumber(int layerNumber);
//void setLayerDistance(double dist);
// Methodes
void
_init
(
void
);
signals:
void
polygonsChanged
(
void
);
void
currentPolygonItemChanged
(
QGCMapPolygon
*
polygon
);
void
currentPolygonIndexChanged
(
int
index
);
void
bottomLayerAltitudeChanged
(
double
alt
);
void
layerNumberChanged
(
int
alt
);
void
layerDistanceChanged
(
double
dist
);
public
slots
:
private:
QmlObjectListModel
*
_polygons
;
QGCMapPolygon
*
_currentPolygonItem
;
int
_currentPolygonIndex
;
bool
_visible
;
//QList<double>* _bottomLayerAltitude;
//QList<int>* _layerNumber;
//QList<double>* _layerDistance;
};
#endif // WIMAFLYAREA_H
src/MissionManager/WimaGlobalMeasurementPolygon.cc
View file @
00d7ea68
...
...
@@ -17,25 +17,30 @@ WimaGlobalMeasurementPolygon::WimaGlobalMeasurementPolygon(QGCMapPolygon *other,
void
WimaGlobalMeasurementPolygon
::
addVehicle
(
Vehicle
*
vehicle
)
{
if
(
vehicle
!=
nullptr
){
_vehicleList
.
append
(
vehicle
);
emit
vehicleListChanged
(
_vehicleList
);
_vehicleList
->
append
(
vehicle
);
emit
vehicleListChanged
();
}
}
void
WimaGlobalMeasurementPolygon
::
removeVehicle
(
int
vehicleIndex
)
{
if
(
vehicleIndex
>=
0
&&
vehicleIndex
<
_vehicleList
.
count
()){
_vehicleList
.
removeAt
(
vehicleIndex
);
emit
vehicleListChanged
(
_vehicleList
);
if
(
vehicleIndex
>=
0
&&
vehicleIndex
<
_vehicleList
->
count
()){
_vehicleList
->
removeAt
(
vehicleIndex
);
emit
vehicleListChanged
();
}
}
void
WimaGlobalMeasurementPolygon
::
recalculatesubPolygons
()
{
int
vehicleCount
=
_vehicleList
->
count
();
WimaVehicleMeasurementPolygon
*
newPolygon
=
new
WimaVehicleMeasurementPolygon
(
this
);
QScopedPointer
<
QList
<
QGCMapPolygon
*>>
listQGCPoly
(
this
->
splitPolygonArea
(
vehicleCount
)
);
_subPolygons
=
this
->
splitPolygonArea
(
vehicleCount
);
int
polyCount
=
listQGCPoly
->
size
();
_subPolygons
->
clear
();
for
(
int
i
=
0
;
i
<
polyCount
;
i
++
){
WimaVehicleMeasurementPolygon
*
subPoly
=
new
WimaVehicleMeasurementPolygon
(
listQGCPoly
->
takeAt
(
i
),
this
);
_subPolygons
->
append
(
subPoly
);
}
}
void
WimaGlobalMeasurementPolygon
::
removeAllVehicles
()
...
...
@@ -47,14 +52,14 @@ void WimaGlobalMeasurementPolygon::removeAllVehicles()
counter
--
;
}
emit
vehicleListChanged
(
_vehicleList
);
emit
vehicleListChanged
();
}
void
WimaGlobalMeasurementPolygon
::
setBottomLayerAltitude
(
double
altitude
)
{
if
(
altitude
>
0
&&
altitude
!=
_bottomLayerAltitude
){
_bottomLayerAltitude
=
altitude
;
emit
bottomLayerAltitudeChanged
(
altitude
);
emit
bottomLayerAltitudeChanged
();
}
}
...
...
@@ -62,7 +67,7 @@ void WimaGlobalMeasurementPolygon::setNumberOfLayers(int numberOfLayers)
{
if
(
numberOfLayers
>
0
&&
_numberOfLayers
!=
numberOfLayers
){
_numberOfLayers
=
numberOfLayers
;
emit
numberOfLayersChanged
(
numberOfLayers
);
emit
numberOfLayersChanged
();
}
}
...
...
@@ -70,6 +75,6 @@ void WimaGlobalMeasurementPolygon::setLayerDistance(double distance)
{
if
(
distance
>
0
&&
distance
!=
_layerDistance
){
_layerDistance
=
distance
;
emit
layerDistanceChanged
(
distance
);
emit
layerDistanceChanged
();
}
}
src/MissionManager/WimaGlobalMeasurementPolygon.h
View file @
00d7ea68
#ifndef WIMAGLOBALMEASUREMENTPOLYGON_H
#define WIMAGLOBALMEASUREMENTPOLYGON_H
#pragma once
#include <QObject>
#include "WimaPolygon.h"
...
...
@@ -7,6 +6,8 @@
#include "QGCMapPolygon.h"
#include "WimaVehicleMeasurementPolygon.h"
#include "QScopedPointer"
class
WimaGlobalMeasurementPolygon
:
public
WimaPolygon
{
Q_OBJECT
...
...
@@ -17,9 +18,8 @@ public:
Q_PROPERTY
(
double
bottomLayerAltitude
READ
bottomLayerAltitude
WRITE
setBottomLayerAltitude
NOTIFY
bottomLayerAltitudeChanged
)
Q_PROPERTY
(
int
numberOfLayers
READ
numberOfLayers
WRITE
setNumberOfLayers
NOTIFY
numberOfLayersChanged
)
Q_PROPERTY
(
double
layerDistance
READ
layerDistance
WRITE
setLayerDistance
NOTIFY
layerDistanceChanged
)
Q_PROPERTY
(
Q
List
<
Vehicle
*>
vehicleList
READ
vehicleList
NOTIFY
vehicleListChanged
)
Q_PROPERTY
(
Q
mlObjectListModel
*
vehicleList
READ
vehicleList
NOTIFY
vehicleListChanged
)
Q_PROPERTY
(
QGCMapPolyline
*
entryPolyline
READ
entryPolyline
NOTIFY
entryPolylineChanged
)
Q_PROPERTY
(
QList
<
WimaPolygon
*>
subPolygons
READ
subPolygons
NOTIFY
subPolygonsChanged
)
Q_INVOKABLE
void
addVehicle
(
Vehicle
*
vehicle
);
Q_INVOKABLE
void
removeVehicle
(
int
vehicleIndex
);
...
...
@@ -28,14 +28,14 @@ public:
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaGlobalMeasurementPolygonMapVisal.qml"
;}
QString
mapVisualQML
(
void
)
const
{
return
"WimaGlobalMeasurementPolygonMapVis
u
al.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaGlobalMeasurementPolygonEditor.qml"
;}
// Property accessors
double
bottomLayerAltitude
(
void
)
const
{
return
_bottomLayerAltitude
;}
int
numberOfLayers
(
void
)
const
{
return
_numberOfLayers
;}
double
layerDistance
(
void
)
const
{
return
_layerDistance
;}
Q
List
<
Vehicle
*>
vehicleList
(
void
)
const
{
return
_vehicleList
;}
Q
mlObjectListModel
*
vehicleList
(
void
)
const
{
return
_vehicleList
;}
QGCMapPolyline
*
entryPolyline
(
void
)
const
{
return
_entryPolyline
;}
// Property setters
...
...
@@ -45,21 +45,20 @@ public:
void
setLayerDistance
(
double
distance
);
signals:
void
bottomLayerAltitudeChanged
(
double
altitude
);
void
numberOfLayersChanged
(
int
numberOfLayers
);
void
layerDistanceChanged
(
double
distance
);
void
vehicleListChanged
(
QList
<
Vehicle
*>
vehicleList
);
void
entryPolylineChanged
(
QGCMapPolyline
*
polyline
);
void
subPolygonsChanged
(
QList
<
WimaPolygon
*>
subPolygons
);
void
bottomLayerAltitudeChanged
(
void
);
void
numberOfLayersChanged
(
void
);
void
layerDistanceChanged
(
void
);
void
vehicleListChanged
(
void
);
void
entryPolylineChanged
(
void
);
void
subPolygonsChanged
(
void
);
private:
double
_bottomLayerAltitude
;
int
_numberOfLayers
;
double
_layerDistance
;
Q
List
<
Vehicle
*>
_vehicleList
;
Q
mlObjectListModel
*
_vehicleList
;
QGCMapPolyline
*
_entryPolyline
;
};
#endif // WIMAGLOBALMEASUREMENTPOLYGON_H
src/MissionManager/WimaPolygon.cc
View file @
00d7ea68
...
...
@@ -3,15 +3,16 @@
WimaPolygon
::
WimaPolygon
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_maxAltitude
(
30
)
,
_vehicle
(
nullptr
)
,
_vehicle
(
parent
)
,
_polygon
(
new
QGCMapPolygon
(
this
))
,
_subPolygons
(
new
QmlObjectListModel
(
this
))
,
_subPolylines
(
new
QmlObjectListModel
(
this
))
{
}
WimaPolygon
::
WimaPolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
)
:
WimaPolygon
(
parent
)
{
delete
_polygon
;
*
_polygon
=
*
other
;
}
...
...
@@ -27,17 +28,25 @@ void WimaPolygon::setMaxAltitude(double alt)
void
WimaPolygon
::
setVehicle
(
Vehicle
*
vehicle
)
{
if
(
_vehicle
!=
vehicle
){
_vehicle
=
vehicle
;
if
(
_vehicle
.
vehicle
()
!=
vehicle
){
_vehicle
.
setVehicle
(
vehicle
)
;
emit
vehicleChanged
();
}
}
QGCMapPolygon
*
WimaPolygon
::
splitPolygonArea
(
int
numberOfFractions
)
void
WimaPolygon
::
setIsCurrentPolygon
(
bool
isCurrentPolygon
)
{
_isCurrentPolygon
=
isCurrentPolygon
;
emit
isCurrentPolygonChanged
();
}
QList
<
QGCMapPolygon
*>*
WimaPolygon
::
splitPolygonArea
(
int
numberOfFractions
)
{
if
(
numberOfFractions
>
0
){
QGCMapPolygon
*
poly
=
new
QGCMapPolygon
(
this
->
polygon
(),
this
);
return
poly
;
QList
<
QGCMapPolygon
*>*
list
=
new
QList
<
QGCMapPolygon
*>
();
list
->
append
(
poly
);
return
list
;
}
return
nullptr
;
}
...
...
src/MissionManager/WimaPolygon.h
View file @
00d7ea68
#
ifndef WIMAPOLYGON_H
#define WIMAPOLYGON_H
#
pragma once
#include "QGCMapPolygon.h"
#include "QGCMapPolyline.h"
#include "Vehicle.h"
#include "qobject.h"
#include "WimaVehicle.h"
...
...
@@ -22,15 +25,17 @@ 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
(
QList
<
WimaPolygon
*>
subPolygons
READ
subPolygons
NOTIFY
subPolygonsChanged
)
Q_PROPERTY
(
QList
<
QGCMapPolyline
*>
subPolylines
READ
subPolylines
NOTIFY
subPolylinesChanged
)
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
)
//Property accessors
double
maxAltitude
(
void
)
const
{
return
_maxAltitude
;}
Vehicle
*
vehicle
(
void
)
const
{
return
_vehicle
;}
Vehicle
*
vehicle
(
void
)
const
{
return
_vehicle
.
vehicle
()
;}
QGCMapPolygon
*
polygon
(
void
)
const
{
return
_polygon
;}
QList
<
WimaPolygon
*>
subPolygons
(
void
)
const
{
return
_subPolygons
;}
QList
<
QGCMapPolyline
*>
subPolylines
(
void
)
const
{
return
_subPolylines
;}
QmlObjectListModel
*
subPolygons
(
void
)
const
{
return
_subPolygons
;}
QmlObjectListModel
*
subPolylines
(
void
)
const
{
return
_subPolylines
;}
bool
isCurrentPolygon
(
void
)
const
{
return
_isCurrentPolygon
;}
virtual
QString
mapVisualQML
(
void
)
const
=
0
;
virtual
QString
editorQML
(
void
)
const
=
0
;
...
...
@@ -39,25 +44,28 @@ public:
void
setMaxAltitude
(
double
alt
);
void
setName
(
QString
name
);
void
setVehicle
(
Vehicle
*
vehicle
);
void
setIsCurrentPolygon
(
bool
isCurrentPolygon
);
Q
GCMapPolygon
*
splitPolygonArea
(
int
numberOfFractions
);
Q
List
<
QGCMapPolygon
*>*
splitPolygonArea
(
int
numberOfFractions
);
// use QScopedPointer to store return value
signals:
void
maxAltitudeChanged
(
void
);
void
vehicleChanged
(
void
);
void
subPolygons
(
void
);
private:
void
polygonChanged
(
void
);
void
subPolygonsChanged
(
void
);
void
subPolylinesChanged
(
void
);
void
isCurrentPolygonChanged
(
void
);
protected:
double
_maxAltitude
;
Vehicle
*
_vehicle
;
WimaVehicle
_vehicle
;
QGCMapPolygon
*
_polygon
;
QList
<
WimaPolygon
*>
_subPolygons
;
QList
<
QGCMapPolyline
*>
_subPolylines
;
QmlObjectListModel
*
_subPolygons
;
QmlObjectListModel
*
_subPolylines
;
bool
_isCurrentPolygon
;
};
#endif // WIMAPOLYGON_H
src/MissionManager/WimaServicePolygon.cc
View file @
00d7ea68
...
...
@@ -12,26 +12,19 @@ WimaServicePolygon::WimaServicePolygon(QGCMapPolygon *other, QObject *parent):
}
void
WimaServicePolygon
::
setTakeOffPosition
(
QGeoCoordinate
coordinate
)
void
WimaServicePolygon
::
setTakeOffPosition
(
QGeoCoordinate
*
coordinate
)
{
if
(
_takeOffPosition
!=
coordinate
){
_takeOffPosition
=
coordinate
;
emit
takeOffPositionChanged
(
coordinate
);
if
(
_takeOffPosition
!=
*
coordinate
){
_takeOffPosition
=
*
coordinate
;
emit
takeOffPositionChanged
();
}
}
void
WimaServicePolygon
::
setLandPosition
(
QGeoCoordinate
coordinate
)
void
WimaServicePolygon
::
setLandPosition
(
QGeoCoordinate
*
coordinate
)
{
if
(
_landPosition
!=
coordinate
){
_landPosition
=
coordinate
;
emit
landPositionChanged
(
coordinate
);
if
(
_landPosition
!=
*
coordinate
){
_landPosition
=
*
coordinate
;
emit
landPositionChanged
();
}
}
void
WimaServicePolygon
::
setVehicle
(
Vehicle
*
vehicle
)
{
if
(
_vehicle
!=
vehicle
){
_vehicle
=
vehicle
;
emit
vehicleChanged
(
vehicle
);
}
}
src/MissionManager/WimaServicePolygon.h
View file @
00d7ea68
#ifndef WIMASERVICEPOLYGON_H
#define WIMASERVICEPOLYGON_H
#pragma once
#include
"QObject"
#include
<QObject>
#include "WimaPolygon.h"
class
WimaServicePolygon
:
public
WimaPolygon
...
...
@@ -11,33 +10,26 @@ public:
WimaServicePolygon
(
QObject
*
parent
=
nullptr
);
WimaServicePolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
QGeoCoordiante
takeOffPosition
READ
takeOffPosition
WRITE
setTakeOffPosition
NOTIFY
takeOffPositionChanged
)
Q_PROPERTY
(
QGeoCoordinate
landPosition
READ
landPosition
WRITE
setLandPosition
NOTIFY
landPositionChanged
)
Q_PROPERTY
(
Vehicle
*
vehicle
READ
vehicle
WRITE
setVehicle
NOTIFY
vehicleChanged
)
Q_PROPERTY
(
QGeoCoordinate
*
takeOffPosition
READ
takeOffPosition
WRITE
setTakeOffPosition
NOTIFY
takeOffPositionChanged
)
Q_PROPERTY
(
QGeoCoordinate
*
landPosition
READ
landPosition
WRITE
setLandPosition
NOTIFY
landPositionChanged
)
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaServicePolygonMapVisal.qml"
;}
QString
mapVisualQML
(
void
)
const
{
return
"WimaServicePolygonMapVis
u
al.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaServicePolygonEditor.qml"
;}
// Property acessors
QGeoCoordinate
takeOffPosition
(
void
)
const
{
return
_takeOffPosition
;}
QGeoCoordinate
landPosition
(
void
)
const
{
return
_landPosition
;}
Vehicle
*
vehicle
(
void
)
const
{
return
_vehicle
;}
QGeoCoordinate
*
takeOffPosition
(
void
)
{
return
&
_takeOffPosition
;}
QGeoCoordinate
*
landPosition
(
void
)
{
return
&
_landPosition
;}
// Property setters
void
setTakeOffPosition
(
QGeoCoordinate
coordinate
);
void
setLandPosition
(
QGeoCoordinate
coordinate
);
void
setVehicle
(
Vehicle
*
vehicle
);
void
setTakeOffPosition
(
QGeoCoordinate
*
coordinate
);
void
setLandPosition
(
QGeoCoordinate
*
coordinate
);
signals:
void
takeOffPositionChanged
(
QGeoCoordinate
takeOffPos
);
void
landPositionChanged
(
QGeoCoordinate
landPos
);
void
vehicleChanged
(
Vehicle
*
vehicle
);
void
takeOffPositionChanged
(
void
);
void
landPositionChanged
(
void
);
private:
QGeoCoordinate
_takeOffPosition
;
QGeoCoordinate
_landPosition
;
Vehicle
*
_vehicle
;
};
#endif // WIMASERVICEPOLYGON_H
src/MissionManager/WimaVehicle.cc
View file @
00d7ea68
...
...
@@ -3,7 +3,47 @@
WimaVehicle
::
WimaVehicle
(
QObject
*
parent
)
:
Vehicle
(
parent
)
QObject
(
parent
)
,
_vehicle
(
nullptr
)
,
_servicePolygon
(
nullptr
)
,
_vehicleCorridor
(
nullptr
)
,
_measurementPolygon
(
nullptr
)
{
}
void
WimaVehicle
::
setVehicle
(
Vehicle
*
vehicle
)
{
if
(
vehicle
!=
nullptr
){
_vehicle
=
vehicle
;
}
else
{
qWarning
(
"Not a valid vehicle!"
);
}
}
void
WimaVehicle
::
setServicePolygon
(
WimaServicePolygon
*
servicePolygon
)
{
if
(
servicePolygon
!=
nullptr
){
_servicePolygon
=
servicePolygon
;
}
else
{
qWarning
(
"Not a valid service Polygon!"
);
}
}
void
WimaVehicle
::
setVehicleCorridor
(
WimaVehicleCorridor
*
vehicleCorridor
)
{
if
(
vehicleCorridor
!=
nullptr
){
_vehicleCorridor
=
vehicleCorridor
;
}
else
{
qWarning
(
"Not a valid vehicle Corridor!"
);
}
}
void
WimaVehicle
::
setMeasurementPolygon
(
WimaVehicleMeasurementPolygon
*
measurementPolygon
)
{
if
(
measurementPolygon
!=
nullptr
){
_measurementPolygon
=
measurementPolygon
;
}
else
{
qWarning
(
"Not a valid measurementPolygon!"
);
}
}
src/MissionManager/WimaVehicle.h
View file @
00d7ea68
#ifndef WIMAVEHICLE_H
#define WIMAVEHICLE_H
#pragma once
#include <QObject>
#include "Vehicle.h"
class
WimaVehicle
:
public
Vehicle
class
WimaServicePolygon
;
class
WimaVehicleCorridor
;
class
WimaVehicleMeasurementPolygon
;
class
WimaVehicle
:
public
QObject
{
Q_OBJECT
public:
WimaVehicle
(
QObject
*
parent
);
Vehicle
*
vehicle
(
void
)
const
{
return
_vehicle
;}
WimaServicePolygon
*
servicePolygon
(
void
)
const
{
return
_servicePolygon
;}
WimaVehicleCorridor
*
vehicleCorridor
(
void
)
const
{
return
_vehicleCorridor
;}
WimaVehicleMeasurementPolygon
*
measurementPolygon
(
void
)
const
{
return
_measurementPolygon
;}
void
setVehicle
(
Vehicle
*
vehicle
);
void
setServicePolygon
(
WimaServicePolygon
*
servicePolygon
);
void
setVehicleCorridor
(
WimaVehicleCorridor
*
vehicleCorridor
);
void
setMeasurementPolygon
(
WimaVehicleMeasurementPolygon
*
measurementPolygon
);
private:
Vehicle
*
_vehicle
;
WimaServicePolygon
*
_servicePolygon
;
WimaVehicleCorridor
*
_vehicleCorridor
;
WimaVehicleMeasurementPolygon
*
_measurementPolygon
;
};
#endif // WIMAVEHICLE_H
src/MissionManager/WimaVehicleCorridor.h
View file @
00d7ea68
#ifndef WIMAVEHICLECORRIDOR_H
#define WIMAVEHICLECORRIDOR_H
#pragma once
#include <QObject>
#include "WimaPolygon.h"
...
...
@@ -12,8 +11,7 @@ public:
WimaVehicleCorridor
(
QGCMapPolygon
*
other
,
QObject
*
parent
);
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaVehicleCorridorMapVisal.qml"
;}
QString
mapVisualQML
(
void
)
const
{
return
"WimaVehicleCorridorMapVis
u
al.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaVehicleCorridorEditor.qml"
;}
};
#endif // WIMAVEHICLECORRIDOR_H
src/MissionManager/WimaVehicleMeasurementPolygon.h
View file @
00d7ea68
#ifndef WIMAVEHICLEMEASUREMENTPOLYGON_H
#define WIMAVEHICLEMEASUREMENTPOLYGON_H
#pragma once
#include <QObject>
#include "WimaPolygon.h"
...
...
@@ -12,8 +11,8 @@ public:
WimaVehicleMeasurementPolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
);
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaVehicleMeasurementPolygonMapVisal.qml"
;}
QString
mapVisualQML
(
void
)
const
{
return
"WimaVehicleMeasurementPolygonMapVis
u
al.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaVehicleMeasurementPolygonEditor.qml"
;}
};
#endif // WIMAVEHICLEMEASUREMENTPOLYGON_H
src/QGCApplication.cc
View file @
00d7ea68
...
...
@@ -68,7 +68,6 @@
#include "CoordinateVector.h"
#include "PlanMasterController.h"
#include "WimaController.h" //custom
#include "WimaFlyArea.h" //custom
#include "VideoManager.h"
#include "VideoSurface.h"
#include "VideoReceiver.h"
...
...
@@ -466,7 +465,6 @@ void QGCApplication::_initCommon(void)
qmlRegisterType
<
MavlinkConsoleController
>
(
kQGCControllers
,
1
,
0
,
"MavlinkConsoleController"
);
#endif
// Wima
qmlRegisterUncreatableType
<
WimaFlyArea
>
(
"Wima"
,
1
,
0
,
"WimaFlyArea"
,
kRefOnly
);
//custom
qmlRegisterType
<
WimaController
>
(
"Wima"
,
1
,
0
,
"WimaController"
);
//custom
...
...
src/QmlControls/QGroundControl.Controls.qmldir
View file @
00d7ea68
...
...
@@ -83,5 +83,9 @@ ToolStrip 1.0 ToolStrip.qml
VehicleRotationCal 1.0 VehicleRotationCal.qml
VehicleSummaryRow 1.0 VehicleSummaryRow.qml
ViewWidget 1.0 ViewWidget.qml
FlyAreaPolygonMapVisual 1.0 FlyAreaPolygonMapVisual.qml
FlyAreaItemEditor 1.0 FlyAreaItemEditor.qml
WimaMapVisual 1.0 WimaMapVisual.qml
WimaGlobalMeasurementPolygonMapVisual 1.0 WimaGlobalMeasurementPolygonMapVisual.qml
WimaServicePolygonMapVisual 1.0 WimaServicePolygonMapVisual.qml
WimaItemEditor 1.0 WimaItemEditor.qml
src/WimaView/FlyAreaEditor.qml
deleted
100644 → 0
View file @
2ff5f135
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 Survery mission 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
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_fieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10.5
property
var
_vehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
?
QGroundControl
.
multiVehicleManager
.
activeVehicle
:
QGroundControl
.
multiVehicleManager
.
offlineEditingVehicle
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
}
// Column
}
// Rectangle
src/WimaView/WimaGlobalMeasurementPolygonMapVisual.qml
0 → 100644
View file @
00d7ea68
/****************************************************************************
*
* (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
_missionItem
:
object
property
var
_polygon
:
object
.
polygon
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.75
rect
.
height
*=
0.75
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
)
}
}
Component.onCompleted
:
{
_addInitialPolygon
()
}
Component.onDestruction
:
{
}
QGCMapPolygonVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolygon
:
_polygon
interactive
:
_missionItem
.
isCurrentPolygon
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
green
"
interiorOpacity
:
0.25
}
}
src/WimaView/
FlyAre
aItemEditor.qml
→
src/WimaView/
Wim
aItemEditor.qml
View file @
00d7ea68
File moved
src/WimaView/WimaItemEditor_old.qml
0 → 100644
View file @
00d7ea68
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.4
import
QtQuick
.
Dialogs
1.2
import
QtQml
2.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
/// Fly Area Item edit control
Rectangle
{
id
:
_root
height
:
editorLoader
.
visible
?
(
editorLoader
.
y
+
editorLoader
.
height
+
(
_margin
*
2
))
:
(
descriptionLabel
.
y
+
descriptionLabel
.
height
+
_margin
/
2
)
color
:
_currentItem
?
qgcPal
.
missionItemEditor
:
qgcPal
.
windowShade
radius
:
_radius
property
var
map
///< Map control
property
var
flyArea
property
var
masterController
property
var
polygon
///< MissionItem associated with this editor
property
bool
readOnly
///< true: read only view, false: full editing view
property
var
rootQgcView
property
int
_index
signal
clicked
signal
remove
property
var
_masterController
:
masterController
property
var
_missionController
:
_masterController
.
missionController
property
bool
_currentItem
:
polygon
.
interactive
property
color
_outerTextColor
:
_currentItem
?
qgcPal
.
primaryButtonText
:
qgcPal
.
text
property
bool
_noMissionItemsAdded
:
ListView
.
view
.
model
.
count
===
1
property
real
_sectionSpacer
:
ScreenTools
.
defaultFontPixelWidth
/
2
// spacing between section headings
readonly
property
real
_editFieldWidth
:
Math
.
min
(
width
-
_margin
*
2
,
ScreenTools
.
defaultFontPixelWidth
*
12
)
readonly
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
readonly
property
real
_radius
:
ScreenTools
.
defaultFontPixelWidth
/
2
readonly
property
real
_hamburgerSize
:
descriptionLabel
.
height
*
0.75
readonly
property
bool
_waypointsOnlyMode
:
QGroundControl
.
corePlugin
.
options
.
missionWaypointsOnly
QGCPalette
{
id
:
qgcPal
colorGroupEnabled
:
enabled
}
FocusScope
{
id
:
currentItemScope
anchors.fill
:
parent
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
currentItemScope
.
focus
=
true
_root
.
clicked
()
}
}
}
QGCLabel
{
id
:
label
anchors.verticalCenter
:
descriptionLabel
.
verticalCenter
anchors.leftMargin
:
_margin
anchors.left
:
parent
.
left
text
:
index
color
:
_outerTextColor
}
QGCColoredImage
{
id
:
hamburger
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.right
:
parent
.
right
anchors.verticalCenter
:
descriptionLabel
.
verticalCenter
width
:
_hamburgerSize
height
:
_hamburgerSize
sourceSize.height
:
_hamburgerSize
source
:
"
qrc:/qmlimages/Hamburger.svg
"
visible
:
_currentItem
color
:
qgcPal
.
text
}
QGCMouseArea
{
fillItem
:
hamburger
visible
:
hamburger
.
visible
onClicked
:
{
currentItemScope
.
focus
=
true
hamburgerMenu
.
popup
()
}
Menu
{
id
:
hamburgerMenu
MenuItem
{
text
:
qsTr
(
"
Insert Fly Area
"
)
onTriggered
:
flyArea
.
appendFlyAreaPolygon
()
}
MenuItem
{
text
:
qsTr
(
"
Delete
"
)
onTriggered
:
remove
()
}
MenuItem
{
text
:
qsTr
(
"
Copy Fly Area
"
)
//onTriggered: //To Do
}
}
}
QGCLabel
{
id
:
descriptionLabel
anchors.topMargin
:
_margin
/
2
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
2
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.left
:
label
.
right
anchors.top
:
parent
.
top
text
:
"
Fly Area
"
verticalAlignment
:
Text
.
AlignVCenter
color
:
_outerTextColor
}
Loader
{
id
:
editorLoader
anchors.leftMargin
:
_margin
anchors.topMargin
:
_margin
anchors.left
:
parent
.
left
anchors.top
:
descriptionLabel
.
bottom
source
:
"
FlyAreaEditor.qml
"
visible
:
_currentItem
property
var
masterController
:
_masterController
property
real
availableWidth
:
_root
.
width
-
(
_margin
*
2
)
///< How wide the editor should be
property
var
editorRoot
:
_root
}
}
// Rectangle
src/WimaView/WimaMapVisual.qml
0 → 100644
View file @
00d7ea68
/****************************************************************************
*
* (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
.
ScreenTools
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
/// Wima map visual
Item
{
id
:
_root
property
var
map
///< Map control to place item in
property
var
qgcView
///< QGCView to use for popping dialogs
signal
clicked
(
int
sequenceNumber
)
property
var
_visualItem
Component.onCompleted
:
{
if
(
object
.
mapVisualQML
)
{
var
component
=
Qt
.
createComponent
(
object
.
mapVisualQML
)
if
(
component
.
status
===
Component
.
Error
)
{
console
.
log
(
"
Error loading Qml:
"
,
object
.
mapVisualQML
,
component
.
errorString
())
}
_visualItem
=
component
.
createObject
(
map
,
{
"
map
"
:
_root
.
map
,
"
qgcView
"
:
_root
.
qgcView
})
_visualItem
.
clicked
.
connect
(
_root
.
clicked
)
}
}
Component
.
onDestruction
:
{
if
(
_visualItem
)
{
_visualItem
.
destroy
()
}
}
}
src/WimaView/WimaServicePolygonMapVisual.qml
0 → 100644
View file @
00d7ea68
/****************************************************************************
*
* (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
_missionItem
:
object
property
var
_polygon
:
object
.
polygon
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
)
}
}
Component.onCompleted
:
{
_addInitialPolygon
()
}
Component.onDestruction
:
{
}
QGCMapPolygonVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolygon
:
_polygon
interactive
:
_missionItem
.
isCurrentPolygon
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
yellow
"
interiorOpacity
:
0.25
}
}
src/WimaView/WimaView.qml
View file @
00d7ea68
...
...
@@ -68,7 +68,7 @@ QGCView {
property
var
_appSettings
:
QGroundControl
.
settingsManager
.
appSettings
readonly
property
int
_layerMission
:
1
readonly
property
int
_layer
FlyAre
a
:
2
readonly
property
int
_layer
Wim
a
:
2
readonly
property
string
_armedVehicleUploadPrompt
:
qsTr
(
"
Vehicle is currently armed. Do you want to upload the mission to the vehicle?
"
)
Component.onCompleted
:
{
...
...
@@ -155,7 +155,7 @@ QGCView {
}
}
}
}
}
_layerWimaPlan
Connections
{
target
:
QGroundControl
.
airspaceManager
...
...
@@ -174,7 +174,8 @@ QGCView {
id
:
wimaController
Component.onCompleted
:
{
wimaController
.
start
()
wimaController
.
masterController
=
Qt
.
binding
(
function
()
{
return
masterController
})
wimaController
.
missionController
=
Qt
.
binding
(
function
()
{
return
masterController
.
missionController
})
}
}
...
...
@@ -256,7 +257,7 @@ QGCView {
}
Connections
{
target
:
_missionController
target
:
_missionController
_layerWimaPlan
onNewItemsFromVehicle
:
{
if
(
_visualItems
&&
_visualItems
.
count
!=
1
)
{
...
...
@@ -375,7 +376,7 @@ QGCView {
toIndex
=
1
}
_missionController
.
moveMissionItem
(
_moveDialogMissionItemIndex
,
toIndex
)
hideDialog
()
hideDialog
()
_layerWimaPlan
}
Column
{
...
...
@@ -433,7 +434,7 @@ QGCView {
QGCMapPalette
{
id
:
mapPal
;
lightColors
:
editorMap
.
isSatelliteMap
}
onZoomLevelChanged
:
updateAirspace
(
false
)
onCenterChanged
:
updateAirspace
(
false
)
onCenterChanged
:
updateAirspace
(
false
)
_layerWimaPlan
MouseArea
{
//-- It's a whole lot faster to just fill parent and deal with top offset below
...
...
@@ -484,13 +485,13 @@ QGCView {
model
:
_editingLayer
==
_layerMission
?
_missionController
.
waypointLines
:
undefined
}
//Add
fly area
//Add
Wima Visuals
Repeater
{
model
:
_flyArea
.
polygon
s
delegate
:
FlyAreaPolygon
MapVisual
{
model
:
wimaController
.
visualItem
s
delegate
:
Wima
MapVisual
{
map
:
editorMap
///< Map control to place item in
qgcView
:
_qgcView
///< QGCView to use for popping dialogs
_flyAreaPolygon
:
object
visible
:
true
}
onItemAdded
:
{
...
...
@@ -575,11 +576,11 @@ QGCView {
dropPanelComponent
:
syncDropPanel
},
{
name
:
qsTr
(
"
Fly
Area
"
),
name
:
qsTr
(
"
Global
Area
"
),
iconSource
:
"
/qmlimages/Target.svg
"
},
{
name
:
qsTr
(
"
No Fly
"
),
name
:
qsTr
(
"
Service Area
"
),
iconSource
:
"
/qmlimages/noFlyArea.svg
"
},
{
...
...
@@ -609,15 +610,13 @@ QGCView {
onClicked
:
{
switch
(
index
)
{
case
1
:
_flyArea
.
appendFlyAreaPolygon
();
console
.
log
(
"
polygon count:
"
,
_flyArea
.
polygons
.
count
)
wimaController
.
addGlobalMeasurementArea
();
//addComplexItem(_missionController.complexMissionItemNames[2])
/*_addWaypointOnClick = checked
_addROIOnClick = false*/
break
case
2
:
/*
wimaController
.
addServiceArea
();
/*
_addROIOnClick = checked
_addWaypointOnClick = false*/
break
...
...
@@ -625,7 +624,7 @@ QGCView {
/*if (_singleComplexItem) {
addComplexItem(_missionController.complexMissionItemNames[0])
}*/
}*/
FlyArea
break
case
5
:
editorMap
.
zoomLevel
+=
0.5
...
...
@@ -757,16 +756,16 @@ QGCView {
case
planElementMission
:
_editingLayer
=
_layerMission
break
case
planElement
FlyAre
a
:
_editingLayer
=
_layer
FlyAre
a
case
planElement
Wim
a
:
_editingLayer
=
_layer
Wim
a
break
}
}
}
QGCRadioButton
{
id
:
planElement
FlyAre
a
id
:
planElement
Wim
a
exclusiveGroup
:
planElementSelectorGroup
text
:
qsTr
(
"
Fly Are
a
"
)
text
:
qsTr
(
"
Wim
a
"
)
checked
:
true
visible
:
QGroundControl
.
corePlugin
.
options
.
enablePlanViewSelector
anchors.verticalCenter
:
parent
.
verticalCenter
...
...
@@ -784,7 +783,7 @@ QGCView {
}
}
//-------------------------------------------------------
//
Fly Are
a Item Editor
//
Wim
a Item Editor
Item
{
id
:
flyAreaItemEditor
anchors.left
:
parent
.
left
...
...
@@ -793,20 +792,20 @@ QGCView {
anchors.topMargin
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.bottom
:
parent
.
bottom
anchors.bottomMargin
:
ScreenTools
.
defaultFontPixelHeight
*
0.25
visible
:
_editingLayer
==
_layer
FlyAre
a
&&
!
planControlColapsed
visible
:
_editingLayer
==
_layer
Wim
a
&&
!
planControlColapsed
QGCListView
{
id
:
flyAreaItemEditorListView
anchors.fill
:
parent
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
4
orientation
:
ListView
.
Vertical
model
:
_flyArea
.
polygon
s
model
:
wimaController
.
visualItem
s
cacheBuffer
:
Math
.
max
(
height
*
2
,
0
)
clip
:
true
currentIndex
:
_flyArea
.
currentPolygonIndex
currentIndex
:
wimaController
.
currentPolygonIndex
highlightMoveDuration
:
250
visible
:
_editingLayer
==
_layer
FlyAre
a
&&
!
planControlColapsed
visible
:
_editingLayer
==
_layer
Wim
a
&&
!
planControlColapsed
//-- List Elements
delegate
:
FlyAre
aItemEditor
{
delegate
:
Wim
aItemEditor
{
map
:
editorMap
masterController
:
_planMasterController
flyArea
:
_flyArea
...
...
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