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
6c9cee43
Commit
6c9cee43
authored
May 17, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
polyline not beeing displayed
parent
d60a1318
Changes
49
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
2134 additions
and
1097 deletions
+2134
-1097
WimaGlobalMeasurementPolygonEditor.qml
WimaGlobalMeasurementPolygonEditor.qml
+0
-5
android.pri
android.pri
+4
-0
qgroundcontrol.pro
qgroundcontrol.pro
+15
-18
qgroundcontrol.qrc
qgroundcontrol.qrc
+6
-3
WimaController.h
src/MissionManager/WimaController.h
+0
-78
WimaGlobalMeasurementPolygon.SettingsGroup.json
...onManager/WimaGlobalMeasurementPolygon.SettingsGroup.json
+0
-27
WimaGlobalMeasurementPolygon.h
src/MissionManager/WimaGlobalMeasurementPolygon.h
+0
-80
WimaPolygon.cc
src/MissionManager/WimaPolygon.cc
+0
-67
WimaPolygon.h
src/MissionManager/WimaPolygon.h
+0
-72
WimaPolygonContainer.cc
src/MissionManager/WimaPolygonContainer.cc
+0
-75
WimaPolygonContainer.h
src/MissionManager/WimaPolygonContainer.h
+0
-34
WimaPolyline.cc
src/MissionManager/WimaPolyline.cc
+0
-97
WimaPolyline.h
src/MissionManager/WimaPolyline.h
+0
-56
WimaServicePolygon.cc
src/MissionManager/WimaServicePolygon.cc
+0
-30
WimaServicePolygon.h
src/MissionManager/WimaServicePolygon.h
+0
-35
WimaVehicle.cc
src/MissionManager/WimaVehicle.cc
+0
-49
WimaVehicleCorridor.cc
src/MissionManager/WimaVehicleCorridor.cc
+0
-13
WimaVehicleCorridor.h
src/MissionManager/WimaVehicleCorridor.h
+0
-17
WimaVehicleMeasurementPolygon.cc
src/MissionManager/WimaVehicleMeasurementPolygon.cc
+0
-14
WimaVehicleMeasurementPolygon.h
src/MissionManager/WimaVehicleMeasurementPolygon.h
+0
-18
QGCApplication.cc
src/QGCApplication.cc
+1
-1
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+7
-4
WimaArea.cc
src/Wima/WimaArea.cc
+90
-1
WimaArea.h
src/Wima/WimaArea.h
+48
-5
WimaController.cc
src/Wima/WimaController.cc
+129
-1
WimaController.h
src/Wima/WimaController.h
+67
-6
WimaGOperationArea.SettingsGroup.json
src/Wima/WimaGOperationArea.SettingsGroup.json
+27
-0
WimaGOperationArea.cc
src/Wima/WimaGOperationArea.cc
+102
-1
WimaGOperationArea.h
src/Wima/WimaGOperationArea.h
+72
-5
WimaServiceArea.cc
src/Wima/WimaServiceArea.cc
+25
-1
WimaServiceArea.h
src/Wima/WimaServiceArea.h
+29
-5
WimaTrackerPolyline.cc
src/Wima/WimaTrackerPolyline.cc
+140
-1
WimaTrackerPolyline.h
src/Wima/WimaTrackerPolyline.h
+53
-5
WimaVCorridor.cc
src/Wima/WimaVCorridor.cc
+8
-1
WimaVCorridor.h
src/Wima/WimaVCorridor.h
+11
-5
WimaVehicle.cc
src/Wima/WimaVehicle.cc
+44
-1
WimaVehicle.h
src/Wima/WimaVehicle.h
+27
-5
FlyAreaPolygonMapVisual.qml
src/WimaView/FlyAreaPolygonMapVisual.qml
+0
-78
WimaGOperationAreaEditor.qml
src/WimaView/WimaGOperationAreaEditor.qml
+125
-3
WimaGOperationAreaMapVisual.qml
src/WimaView/WimaGOperationAreaMapVisual.qml
+112
-1
WimaGlobalMeasurementPolygonEditor.cc
src/WimaView/WimaGlobalMeasurementPolygonEditor.cc
+0
-46
WimaGlobalMeasurementPolygonEditor.h
src/WimaView/WimaGlobalMeasurementPolygonEditor.h
+0
-29
WimaItemEditor.qml
src/WimaView/WimaItemEditor.qml
+2
-3
WimaMapPolygonVisuals.qml
src/WimaView/WimaMapPolygonVisuals.qml
+559
-1
WimaMapPolylineVisuals.qml
src/WimaView/WimaMapPolylineVisuals.qml
+343
-1
WimaServiceAreaMapVisual.qml
src/WimaView/WimaServiceAreaMapVisual.qml
+80
-1
WimaServicePolygonMapVisual.qml
src/WimaView/WimaServicePolygonMapVisual.qml
+6
-17
WimaView.qml
src/WimaView/WimaView.qml
+2
-2
flyAreaPolygonMapVisual.qml
src/WimaView/flyAreaPolygonMapVisual.qml
+0
-79
No files found.
WimaGlobalMeasurementPolygonEditor.qml
deleted
100644 → 0
View file @
d60a1318
import
QtQuick
2.0
Item
{
}
android.pri
View file @
6c9cee43
...
...
@@ -25,3 +25,7 @@ DISTFILES += \
$$PWD/android/build.gradle \
$$PWD/android/gradle/wrapper/gradle-wrapper.properties \
$$PWD/android/gradlew.bat
HEADERS += \
SOURCES += \
qgroundcontrol.pro
View file @
6c9cee43
...
...
@@ -407,29 +407,26 @@ HEADERS += \
src
/
api
/
QmlComponentInfo
.
h
\
src
/
comm
/
MavlinkMessagesTimer
.
h
\
src
/
GPS
/
Drivers
/
src
/
base_station
.
h
\
src
/
MissionManager
/
WimaController
.
h
\
src
/
MissionManager
/
WimaPolygon
.
h
\
src
/
MissionManager
/
WimaServicePolygon
.
h
\
src
/
MissionManager
/
WimaVehicleCorridor
.
h
\
src
/
MissionManager
/
WimaVehicleMeasurementPolygon
.
h
\
src
/
MissionManager
/
WimaGlobalMeasurementPolygon
.
h
\
src
/
MissionManager
/
WimaVehicle
.
h
\
src
/
MissionManager
/
WimaPolyline
.
h
src
/
Wima
/
WimaArea
.
h
\
src
/
Wima
/
WimaGOperationArea
.
h
\
src
/
Wima
/
WimaServiceArea
.
h
\
src
/
Wima
/
WimaVCorridor
.
h
\
src
/
Wima
/
WimaTrackerPolyline
.
h
\
src
/
Wima
/
WimaController
.
h
\
src
/
Wima
/
WimaVehicle
.
h
SOURCES
+=
\
src
/
api
/
QGCCorePlugin
.
cc
\
src
/
api
/
QGCOptions
.
cc
\
src
/
api
/
QGCSettings
.
cc
\
src
/
api
/
QmlComponentInfo
.
cc
\
src
/
comm
/
MavlinkMessagesTimer
.
cc
\
src
/
MissionManager
/
WimaController
.
cc
\
src
/
MissionManager
/
WimaPolygon
.
cc
\
src
/
MissionManager
/
WimaServicePolygon
.
cc
\
src
/
MissionManager
/
WimaVehicleCorridor
.
cc
\
src
/
MissionManager
/
WimaVehicleMeasurementPolygon
.
cc
\
src
/
MissionManager
/
WimaGlobalMeasurementPolygon
.
cc
\
src
/
MissionManager
/
WimaVehicle
.
cc
\
src
/
MissionManager
/
WimaPolyline
.
cc
src
/
Wima
/
WimaArea
.
cc
\
src
/
Wima
/
WimaGOperationArea
.
cc
\
src
/
Wima
/
WimaServiceArea
.
cc
\
src
/
Wima
/
WimaVCorridor
.
cc
\
src
/
Wima
/
WimaTrackerPolyline
.
cc
\
src
/
Wima
/
WimaController
.
cc
\
src
/
Wima
/
WimaVehicle
.
cc
#
#
Unit
Test
specific
configuration
goes
here
(
requires
full
debug
build
with
all
plugins
)
...
...
@@ -1311,4 +1308,4 @@ contains (CONFIG, QGC_DISABLE_INSTALLER_SETUP) {
}
DISTFILES
+=
\
src
/
MissionManager
/
WimaGlobalMeasurementPolygon
.
SettingsGroup
.
json
src
/
Wima
/
WimaGOperationArea
.
SettingsGroup
.
json
qgroundcontrol.qrc
View file @
6c9cee43
...
...
@@ -211,10 +211,13 @@
<file alias="QGroundControl/Controls/WimaToolBar.qml">src/WimaView/WimaToolBar.qml</file>
<file alias="WimaView.qml">src/WimaView/WimaView.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="QGroundControl/Controls/WimaItemEditor.qml">src/WimaView/WimaItemEditor.qml</file>
<file alias="QGroundControl/Controls/WimaGlobalMeasurementPolygonEditor.qml">WimaGlobalMeasurementPolygonEditor.qml</file>
<file alias="QGroundControl/Controls/WimaMapPolylineVisuals.qml">src/WimaView/WimaMapPolylineVisuals.qml</file>
<file alias="QGroundControl/Controls/WimaMapPolygonVisuals.qml">src/WimaView/WimaMapPolygonVisuals.qml</file>
<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>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
...
...
@@ -259,7 +262,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 alias="WimaG
lobalMeasurementPolygon.SettingsGroup.json">src/MissionManager/WimaGlobalMeasurementPolygon
.SettingsGroup.json</file>
<file alias="WimaG
OperationArea.SettingsGroup.json">src/Wima/WimaGOperationArea
.SettingsGroup.json</file>
</qresource>
<qresource prefix="/MockLink">
<file alias="APMArduCopterMockLink.params">src/comm/APMArduCopterMockLink.params</file>
...
...
src/MissionManager/WimaController.h
deleted
100644 → 0
View file @
d60a1318
#
pragma
once
#include <QObject>
#include "QGCMapPolygon.h"
#include "QmlObjectListModel.h"
#include "WimaPolygon.h"
#include "WimaGlobalMeasurementPolygon.h"
#include "WimaServicePolygon.h"
#include "PlanMasterController.h"
#include "MissionController.h"
class
WimaController
:
public
QObject
{
Q_OBJECT
public:
WimaController
(
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
PlanMasterController
*
masterController
READ
masterController
WRITE
setMasterController
NOTIFY
masterControllerChanged
)
Q_PROPERTY
(
MissionController
*
missionController
READ
missionController
WRITE
setMissionController
NOTIFY
missionControllerChanged
)
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
;}
QmlObjectListModel
*
visualItems
(
void
)
{
return
_visualItems
;
}
int
currentPolygonIndex
(
void
)
const
{
return
_currentPolygonIndex
;
}
// Property setters
void
setMasterController
(
PlanMasterController
*
masterController
);
void
setMissionController
(
MissionController
*
missionController
);
void
setCurrentPolygonIndex
(
int
index
);
Q_INVOKABLE
void
addGlobalMeasurementArea
();
Q_INVOKABLE
void
removeArea
(
int
index
);
Q_INVOKABLE
void
addServiceArea
();
Q_INVOKABLE
void
startMission
();
Q_INVOKABLE
void
abortMission
();
Q_INVOKABLE
void
pauseMission
();
Q_INVOKABLE
void
resumeMission
();
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
;
QmlObjectListModel
*
_visualItems
;
PlanMasterController
*
_masterController
;
MissionController
*
_missionController
;
int
_currentPolygonIndex
;
};
src/MissionManager/WimaGlobalMeasurementPolygon.SettingsGroup.json
deleted
100644 → 0
View file @
d60a1318
[
{
"name"
:
"BottomLayerAltitude"
,
"shortDescription"
:
"Altitude of the bottom layer."
,
"type"
:
"double"
,
"units"
:
"m"
,
"min"
:
1
,
"decimalPlaces"
:
2
,
"defaultValue"
:
5
},
{
"name"
:
"NumberOfLayers"
,
"shortDescription"
:
"The number of layers"
,
"type"
:
"uint32"
,
"min"
:
1
,
"defaultValue"
:
1
},
{
"name"
:
"LayerDistance"
,
"shortDescription"
:
"The distance between to adjacent layers."
,
"type"
:
"double"
,
"units"
:
"m"
,
"min"
:
0
,
"decimalPlaces"
:
2
,
"defaultValue"
:
1
}
]
src/MissionManager/WimaGlobalMeasurementPolygon.h
deleted
100644 → 0
View file @
d60a1318
#
pragma
once
#include <QObject>
#include "WimaPolygon.h"
#include "QGCMapPolyline.h"
#include "QGCMapPolygon.h"
#include "WimaVehicleMeasurementPolygon.h"
#include "SettingsFact.h"
#include "QScopedPointer"
class
WimaGlobalMeasurementPolygon
:
public
WimaPolygon
{
Q_OBJECT
public:
WimaGlobalMeasurementPolygon
(
QObject
*
parent
);
WimaGlobalMeasurementPolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
);
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
(
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
addVehiclePolygon
();
Q_INVOKABLE
void
removeVehiclePolygon
(
int
polygonIndex
);
Q_INVOKABLE
void
removeVehiclePolygon
(
WimaVehicleMeasurementPolygon
*
wimaPolygon
);
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaGlobalMeasurementPolygonMapVisual.qml"
;}
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
;}
QmlObjectListModel
*
vehiclePolygons
(
void
)
const
{
return
_vehiclePolygons
;}
WimaPolyline
*
polyline
(
void
)
{
return
&
_polyline
;}
static
const
char
*
settingsGroup
;
static
const
char
*
bottomLayerAltitudeName
;
static
const
char
*
numberOfLayersName
;
static
const
char
*
layerDistanceName
;
signals:
void
bottomLayerAltitudeChanged
(
void
);
void
numberOfLayersChanged
(
void
);
void
layerDistanceChanged
(
void
);
void
vehicleListChanged
(
void
);
void
gatewayPolylinesChanged
(
void
);
void
vehiclePolygonsChanged
(
void
);
private:
QMap
<
QString
,
FactMetaData
*>
_metaDataMap
;
SettingsFact
_bottomLayerAltitude
;
SettingsFact
_numberOfLayers
;
SettingsFact
_layerDistance
;
QmlObjectListModel
*
_vehicleList
;
QmlObjectListModel
*
_vehiclePolygons
;
WimaPolyline
_polyline
;
};
src/MissionManager/WimaPolygon.cc
deleted
100644 → 0
View file @
d60a1318
#include "WimaPolygon.h"
WimaPolygon
::
WimaPolygon
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_maxAltitude
(
30
)
,
_vehicle
(
parent
)
,
_polygon
(
new
QGCMapPolygon
(
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
()
{
}
void
WimaPolygon
::
setMaxAltitude
(
double
alt
)
{
if
(
alt
>
0
&&
alt
!=
_maxAltitude
){
_maxAltitude
=
alt
;
emit
maxAltitudeChanged
();
}
}
void
WimaPolygon
::
setVehicle
(
Vehicle
*
vehicle
)
{
if
(
_vehicle
.
vehicle
()
!=
vehicle
){
_vehicle
.
setVehicle
(
vehicle
);
emit
vehicleChanged
();
}
}
void
WimaPolygon
::
setInteractive
(
bool
interactive
)
{
_polygon
->
setInteractive
(
interactive
);
}
QList
<
QGCMapPolygon
*>
*
WimaPolygon
::
splitPolygonArea
(
QGCMapPolygon
*
polygonToSplitt
,
int
numberOfFractions
)
{
if
(
numberOfFractions
>
0
&&
polygonToSplitt
!=
nullptr
){
QGCMapPolygon
*
poly
=
new
QGCMapPolygon
(
polygonToSplitt
,
this
);
QList
<
QGCMapPolygon
*>*
list
=
new
QList
<
QGCMapPolygon
*>
();
list
->
append
(
poly
);
return
list
;
}
return
nullptr
;
}
QList
<
QGCMapPolygon
*>*
WimaPolygon
::
splitPolygonArea
(
int
numberOfFractions
)
{
return
splitPolygonArea
(
_polygon
,
numberOfFractions
);
}
src/MissionManager/WimaPolygon.h
deleted
100644 → 0
View file @
d60a1318
#pragma once
#include "QGCMapPolygon.h"
#include "QGCMapPolyline.h"
#include "Vehicle.h"
#include "qobject.h"
#include "WimaVehicle.h"
#include "WimaPolyline.h"
class
WimaPolygon
:
public
QObject
//abstract base class for all WimaPolygons
{
Q_OBJECT
public:
WimaPolygon
(
QObject
*
parent
=
nullptr
);
WimaPolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
=
nullptr
);
~
WimaPolygon
();
Q_PROPERTY
(
double
maxAltitude
READ
maxAltitude
WRITE
setMaxAltitude
NOTIFY
maxAltitudeChanged
)
Q_PROPERTY
(
QString
mapVisualQML
READ
mapVisualQML
CONSTANT
)
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
(
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
;}
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
setInteractive
(
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
interactiveChanged
(
void
);
void
polylineChanged
(
void
);
void
countChanged
(
void
);
protected:
double
_maxAltitude
;
WimaVehicle
_vehicle
;
QGCMapPolygon
*
_polygon
;
};
src/MissionManager/WimaPolygonContainer.cc
deleted
100644 → 0
View file @
d60a1318
#include "WimaPolygonContainer.h"
WimaPolygonContainer
::
WimaPolygonContainer
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_flatListDirty
(
true
)
{
connect
(
this
,
&
WimaPolygonContainer
::
itemListChanged
,
this
,
&
WimaPolygonContainer
::
setFlatListDirty
);
}
QList
<
WimaPolygon
*>
&
WimaPolygonContainer
::
returnItems
()
{
return
_itemList
;
}
void
WimaPolygonContainer
::
addItem
(
WimaPolygon
*
polygon
)
{
if
(
polygon
!=
nullptr
){
_itemList
.
append
(
polygon
);
emit
itemListChanged
();
}
else
{
qWarning
(
"Not a valid WimaPolygon!"
);
}
}
void
WimaPolygonContainer
::
removeItem
(
int
itemIndex
)
{
if
(
itemIndex
>=
0
&&
itemIndex
<
_itemList
.
count
()){
_itemList
.
removeAt
(
itemIndex
);
emit
itemListChanged
();
}
else
{
qWarning
(
"Invalid item Index. Index must be in 0..%i."
,
_itemList
.
count
()
-
1
);
}
}
void
WimaPolygonContainer
::
removeItem
(
WimaPolygon
*
polygon
)
{
if
(
polygon
!=
nullptr
){
_itemList
.
removeOne
(
polygon
);
emit
itemListChanged
();
}
else
{
qWarning
(
"Not a valid WimaPolygon!"
);
}
}
QList
<
WimaPolygon
*>&
WimaPolygonContainer
::
returnFlatList
()
{
if
(
_flatListDirty
){
_flatList
.
clear
();
int
count
=
_itemList
.
count
();
for
(
int
i
=
0
;
i
<
count
;
i
++
){
WimaPolygon
*
poly
=
_itemList
.
takeAt
(
i
);
_flatList
.
append
(
poly
);
_flatList
.
append
(
poly
->
subPolygons
());
// returns an emptey list, if no sub polygons exist
}
_flatListDirty
=
false
;
}
return
_flatList
;
}
int
WimaPolygonContainer
::
count
()
{
return
_itemList
.
size
();
}
void
WimaPolygonContainer
::
setFlatListDirty
(
void
)
{
_flatListDirty
=
true
;
}
src/MissionManager/WimaPolygonContainer.h
deleted
100644 → 0
View file @
d60a1318
#ifndef WIMAPOLYGONCONTAINER_H
#define WIMAPOLYGONCONTAINER_H
#include <QObject>
#include "WimaPolygon.h"
class
WimaPolygonContainer
:
public
QObject
{
Q_OBJECT
public:
WimaPolygonContainer
(
QObject
*
parent
=
nullptr
);
QList
<
WimaPolygon
*>&
returnItems
();
void
addItem
(
WimaPolygon
*
polygon
);
void
removeItem
(
int
itemIndex
);
void
removeItem
(
WimaPolygon
*
polygon
);
QList
<
WimaPolygon
*>&
returnFlatList
();
int
count
(
void
);
signals:
void
itemListChanged
(
void
);
private
slots
:
void
setFlatListDirty
(
void
);
private:
QList
<
WimaPolygon
*>
_itemList
;
QList
<
WimaPolygon
*>
_flatList
;
bool
_flatListDirty
;
};
#endif // WIMAPOLYGONCONTAINER_H
src/MissionManager/WimaPolyline.cc
deleted
100644 → 0
View file @
d60a1318
#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
deleted
100644 → 0
View file @
d60a1318
#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/MissionManager/WimaServicePolygon.cc
deleted
100644 → 0
View file @
d60a1318
#include "WimaServicePolygon.h"
WimaServicePolygon
::
WimaServicePolygon
(
QObject
*
parent
)
:
WimaPolygon
(
parent
)
{
this
->
setObjectName
(
"Service Area"
);
}
WimaServicePolygon
::
WimaServicePolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
)
:
WimaPolygon
(
other
,
parent
)
{
}
void
WimaServicePolygon
::
setTakeOffPosition
(
QGeoCoordinate
*
coordinate
)
{
if
(
_takeOffPosition
!=
*
coordinate
){
_takeOffPosition
=
*
coordinate
;
emit
takeOffPositionChanged
();
}
}
void
WimaServicePolygon
::
setLandPosition
(
QGeoCoordinate
*
coordinate
)
{
if
(
_landPosition
!=
*
coordinate
){
_landPosition
=
*
coordinate
;
emit
landPositionChanged
();
}
}
src/MissionManager/WimaServicePolygon.h
deleted
100644 → 0
View file @
d60a1318
#pragma once
#include <QObject>
#include "WimaPolygon.h"
class
WimaServicePolygon
:
public
WimaPolygon
{
Q_OBJECT
public:
WimaServicePolygon
(
QObject
*
parent
=
nullptr
);
WimaServicePolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
=
nullptr
);
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
"WimaServicePolygonMapVisual.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaServicePolygonEditor.qml"
;}
// Property acessors
QGeoCoordinate
*
takeOffPosition
(
void
)
{
return
&
_takeOffPosition
;}
QGeoCoordinate
*
landPosition
(
void
)
{
return
&
_landPosition
;}
// Property setters
void
setTakeOffPosition
(
QGeoCoordinate
*
coordinate
);
void
setLandPosition
(
QGeoCoordinate
*
coordinate
);
signals:
void
takeOffPositionChanged
(
void
);
void
landPositionChanged
(
void
);
private:
QGeoCoordinate
_takeOffPosition
;
QGeoCoordinate
_landPosition
;
};
src/MissionManager/WimaVehicle.cc
deleted
100644 → 0
View file @
d60a1318
#include "WimaVehicle.h"
WimaVehicle
::
WimaVehicle
(
QObject
*
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/WimaVehicleCorridor.cc
deleted
100644 → 0
View file @
d60a1318
#include "WimaVehicleCorridor.h"
WimaVehicleCorridor
::
WimaVehicleCorridor
(
QObject
*
parent
)
:
WimaPolygon
(
parent
)
{
this
->
setObjectName
(
"Corridor"
);
}
WimaVehicleCorridor
::
WimaVehicleCorridor
(
QGCMapPolygon
*
other
,
QObject
*
parent
)
:
WimaPolygon
(
other
,
parent
)
{
}
src/MissionManager/WimaVehicleCorridor.h
deleted
100644 → 0
View file @
d60a1318
#pragma once
#include <QObject>
#include "WimaPolygon.h"
class
WimaVehicleCorridor
:
public
WimaPolygon
{
Q_OBJECT
public:
WimaVehicleCorridor
(
QObject
*
parent
);
WimaVehicleCorridor
(
QGCMapPolygon
*
other
,
QObject
*
parent
);
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaVehicleCorridorMapVisual.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaVehicleCorridorEditor.qml"
;}
};
src/MissionManager/WimaVehicleMeasurementPolygon.cc
deleted
100644 → 0
View file @
d60a1318
#include "WimaVehicleMeasurementPolygon.h"
WimaVehicleMeasurementPolygon
::
WimaVehicleMeasurementPolygon
(
QObject
*
parent
)
:
WimaPolygon
(
parent
)
{
this
->
setObjectName
(
"Vehicle Area"
);
}
WimaVehicleMeasurementPolygon
::
WimaVehicleMeasurementPolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
)
:
WimaPolygon
(
other
,
parent
)
{
}
src/MissionManager/WimaVehicleMeasurementPolygon.h
deleted
100644 → 0
View file @
d60a1318
#pragma once
#include <QObject>
#include "WimaPolygon.h"
class
WimaVehicleMeasurementPolygon
:
public
WimaPolygon
{
Q_OBJECT
public:
WimaVehicleMeasurementPolygon
(
QObject
*
parent
);
WimaVehicleMeasurementPolygon
(
QGCMapPolygon
*
other
,
QObject
*
parent
);
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaVehicleMeasurementPolygonMapVisual.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaVehicleMeasurementPolygonEditor.qml"
;}
};
src/QGCApplication.cc
View file @
6c9cee43
...
...
@@ -67,7 +67,7 @@
#include "FlightMapSettings.h"
#include "CoordinateVector.h"
#include "PlanMasterController.h"
#include "WimaController.h" //custom
#include "Wima
/Wima
Controller.h" //custom
#include "VideoManager.h"
#include "VideoSurface.h"
#include "VideoReceiver.h"
...
...
src/QmlControls/QGroundControl.Controls.qmldir
View file @
6c9cee43
...
...
@@ -85,7 +85,10 @@ VehicleSummaryRow 1.0 VehicleSummaryRow.qml
ViewWidget 1.0 ViewWidget.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
WimaMapVisual 1.0 WimaMapVisual.qml
WimaGOperationAreaMapVisual 1.0 WimaGOperationAreaMapVisual.qml
WimaGOperationAreaEditor 1.0 WimaGOperationAreaEditor.qml
WimaServiceAreaMapVisual 1.0 WimaServiceAreaMapVisual.qml
WimaItemEditor 1.0 WimaItemEditor.qml
WimaMapPolygonVisuals 1.0 WimaMapPolygonVisuals.qml
WimaMapPolylineVisuals 1.0 WimaMapPolylineVisuals.qml
src/Wima/WimaArea.cc
View file @
6c9cee43
#include "WimaArea.h"
WimaArea
::
WimaArea
()
WimaArea
::
WimaArea
(
QObject
*
parent
)
:
WimaArea
(
nullptr
,
parent
)
{
//qWarning() << "WimaPolygon:: polygon count" << _polygon->count();
}
WimaArea
::
WimaArea
(
WimaArea
*
other
,
QObject
*
parent
)
:
QGCMapPolygon
(
parent
)
,
_maxAltitude
(
30
)
,
_wimaVehicle
(
new
WimaVehicle
(
this
))
{
if
(
other
!=
nullptr
)
{
_maxAltitude
=
other
->
maxAltitude
();
_wimaVehicle
=
other
->
vehicle
();
setPath
(
other
->
path
());
setCenter
(
other
->
center
());
setCenterDrag
(
other
->
centerDrag
());
setInteractive
(
other
->
interactive
());
}
}
WimaArea
::~
WimaArea
()
{
}
void
WimaArea
::
setMaxAltitude
(
double
alt
)
{
if
(
alt
>
0
&&
alt
!=
_maxAltitude
){
_maxAltitude
=
alt
;
emit
maxAltitudeChanged
();
}
}
void
WimaArea
::
setVehicle
(
WimaVehicle
*
vehicle
)
{
if
(
_wimaVehicle
!=
vehicle
){
_wimaVehicle
->
deleteLater
();
_wimaVehicle
=
vehicle
;
emit
vehicleChanged
();
}
}
/*QList<WimaArea *>* WimaArea::splitArea<T>(WimaArea *polygonToSplitt, int numberOfFractions)
{
if(numberOfFractions > 0 && polygonToSplitt != nullptr){
WimaArea* poly;
if(p)
= new WimaArea(polygonToSplitt, this);
QList<WimaArea*>* list = new QList<WimaArea*>();
list->append(poly);
return list;
}
return nullptr;
}
QList<QGCMapPolygon*>* WimaArea::splitArea(int numberOfFractions)
{
return splitPolygonArea(this, numberOfFractions);
}*/
int
WimaArea
::
getClosestVertexIndex
(
QGeoCoordinate
coordinate
)
{
if
(
this
->
count
()
==
0
)
{
qWarning
(
"Polygon count == 0!"
);
return
-
1
;
}
else
if
(
this
->
count
()
==
1
)
{
return
0
;
}
else
{
int
index
=
0
;
double
min_dist
=
coordinate
.
distanceTo
(
this
->
vertexCoordinate
(
index
));
for
(
int
i
=
1
;
i
<
this
->
count
();
i
++
){
double
dist
=
coordinate
.
distanceTo
(
this
->
vertexCoordinate
(
i
));
if
(
dist
<
min_dist
){
min_dist
=
dist
;
index
=
i
;
}
}
return
index
;
}
}
QGeoCoordinate
WimaArea
::
getClosestVertex
(
QGeoCoordinate
coordinate
)
{
return
this
->
vertexCoordinate
(
getClosestVertexIndex
(
coordinate
));
}
src/Wima/WimaArea.h
View file @
6c9cee43
#ifndef WIMAAREA_H
#define WIMAAREA_H
#pragma once
#include "QGCMapPolygon.h"
#include "Vehicle.h"
#include "qobject.h"
#include "WimaVehicle.h"
class
WimaArea
class
WimaArea
:
public
QGCMapPolygon
//abstract base class for all WimaAreas
{
Q_OBJECT
public:
WimaArea
();
WimaArea
(
QObject
*
parent
=
nullptr
);
WimaArea
(
WimaArea
*
other
,
QObject
*
parent
=
nullptr
);
~
WimaArea
();
Q_PROPERTY
(
double
maxAltitude
READ
maxAltitude
WRITE
setMaxAltitude
NOTIFY
maxAltitudeChanged
)
Q_PROPERTY
(
QString
mapVisualQML
READ
mapVisualQML
CONSTANT
)
Q_PROPERTY
(
QString
editorQML
READ
editorQML
CONSTANT
)
Q_PROPERTY
(
WimaVehicle
*
vehicle
READ
vehicle
WRITE
setVehicle
NOTIFY
vehicleChanged
)
//Property accessors
double
maxAltitude
(
void
)
const
{
return
_maxAltitude
;}
WimaVehicle
*
vehicle
(
void
)
const
{
return
_wimaVehicle
;}
virtual
QString
mapVisualQML
(
void
)
const
=
0
;
virtual
QString
editorQML
(
void
)
const
=
0
;
//Property setters
void
setMaxAltitude
(
double
alt
);
void
setVehicle
(
WimaVehicle
*
vehicle
);
// Member Methodes
/*template <class T>
QList<T*>* splitArea (WimaArea *polygonToSplitt, int numberOfFractions); // use QScopedPointer to store return value
template <class T>
QList<T*>* splitArea (int numberOfFractions); // use QScopedPointer to store return value*/
//iterates over all vertices in _polygon and returns the index of that one closest to coordinate
int
getClosestVertexIndex
(
QGeoCoordinate
coordinate
);
//iterates over all vertices in _polygon and returns that one closest to coordinate
QGeoCoordinate
getClosestVertex
(
QGeoCoordinate
coordinate
);
signals:
void
maxAltitudeChanged
(
void
);
void
vehicleChanged
(
void
);
protected:
double
_maxAltitude
;
WimaVehicle
*
_wimaVehicle
;
};
#endif // WIMAAREA_H
\ No newline at end of file
src/Wima/WimaController.cc
View file @
6c9cee43
#include "WimaController.h"
#include "MissionController.h"
WimaController
::
WimaController
(
QObject
*
parent
)
:
QObject
(
parent
)
WimaController
::
WimaController
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_planView
(
true
)
,
_visualItems
(
new
QmlObjectListModel
(
parent
))
{
connect
(
this
,
&
WimaController
::
currentPolygonIndexChanged
,
this
,
&
WimaController
::
recalcPolygonInteractivity
);
}
void
WimaController
::
setMasterController
(
PlanMasterController
*
masterC
)
{
_masterController
=
masterC
;
emit
masterControllerChanged
();
}
void
WimaController
::
setMissionController
(
MissionController
*
missionC
)
{
_missionController
=
missionC
;
emit
missionControllerChanged
();
}
void
WimaController
::
setCurrentPolygonIndex
(
int
index
)
{
if
(
index
>=
0
&&
index
<
_visualItems
->
count
()
&&
index
!=
_currentPolygonIndex
){
_currentPolygonIndex
=
index
;
emit
currentPolygonIndexChanged
(
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
()){
_visualItems
->
removeAt
(
index
);
emit
visualItemsChanged
();
if
(
_currentPolygonIndex
>=
_visualItems
->
count
()){
setCurrentPolygonIndex
(
_visualItems
->
count
()
-
1
);
}
else
{
recalcPolygonInteractivity
(
_currentPolygonIndex
);
}
}
else
{
qWarning
(
"Index out of bounds!"
);
}
}
void
WimaController
::
addServiceArea
()
{
resetAllIsCurrentPolygon
();
WimaServiceArea
*
newPoly
=
new
WimaServiceArea
(
this
);
newPoly
->
setInteractive
(
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
();
WimaArea
*
interactivePoly
=
qobject_cast
<
WimaArea
*>
(
_visualItems
->
get
(
index
));
interactivePoly
->
setInteractive
(
true
);
}
void
WimaController
::
resetAllIsCurrentPolygon
()
{
int
itemCount
=
_visualItems
->
count
();
for
(
int
i
=
0
;
i
<
itemCount
;
i
++
)
{
WimaArea
*
iteratorPoly
=
qobject_cast
<
WimaArea
*>
(
_visualItems
->
get
(
i
));
iteratorPoly
->
setInteractive
(
false
);
}
}
src/Wima/WimaController.h
View file @
6c9cee43
#ifndef WIMACONTROLLER_H
#define WIMACONTROLLER_H
#pragma once
#include <QObject>
#include "QGCMapPolygon.h"
#include "QmlObjectListModel.h"
#include "WimaArea.h"
#include "WimaGOperationArea.h"
#include "WimaServiceArea.h"
#include "PlanMasterController.h"
#include "MissionController.h"
class
WimaController
:
public
QObject
{
Q_OBJECT
public:
explicit
WimaController
(
QObject
*
parent
=
nullptr
);
WimaController
(
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
PlanMasterController
*
masterController
READ
masterController
WRITE
setMasterController
NOTIFY
masterControllerChanged
)
Q_PROPERTY
(
MissionController
*
missionController
READ
missionController
WRITE
setMissionController
NOTIFY
missionControllerChanged
)
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
;}
QmlObjectListModel
*
visualItems
(
void
)
{
return
_visualItems
;
}
int
currentPolygonIndex
(
void
)
const
{
return
_currentPolygonIndex
;
}
// Property setters
void
setMasterController
(
PlanMasterController
*
masterController
);
void
setMissionController
(
MissionController
*
missionController
);
void
setCurrentPolygonIndex
(
int
index
);
Q_INVOKABLE
void
addGOperationArea
();
Q_INVOKABLE
void
removeArea
(
int
index
);
Q_INVOKABLE
void
addServiceArea
();
Q_INVOKABLE
void
startMission
();
Q_INVOKABLE
void
abortMission
();
Q_INVOKABLE
void
pauseMission
();
Q_INVOKABLE
void
resumeMission
();
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
);
public
slots
:
};
#endif // WIMACONTROLLER_H
\ No newline at end of file
private:
bool
_planView
;
QmlObjectListModel
*
_visualItems
;
PlanMasterController
*
_masterController
;
MissionController
*
_missionController
;
int
_currentPolygonIndex
;
};
src/Wima/WimaGOperationArea.SettingsGroup.json
View file @
6c9cee43
[
{
"name"
:
"BottomLayerAltitude"
,
"shortDescription"
:
"Altitude of the bottom layer."
,
"type"
:
"double"
,
"units"
:
"m"
,
"min"
:
1
,
"decimalPlaces"
:
2
,
"defaultValue"
:
50
},
{
"name"
:
"NumberOfLayers"
,
"shortDescription"
:
"The number of layers."
,
"type"
:
"uint32"
,
"min"
:
1
,
"defaultValue"
:
10
},
{
"name"
:
"LayerDistance"
,
"shortDescription"
:
"The distance between two adjacent layers."
,
"type"
:
"double"
,
"units"
:
"m"
,
"min"
:
0
,
"decimalPlaces"
:
2
,
"defaultValue"
:
10
}
]
src/Wima/WimaGOperationArea.cc
View file @
6c9cee43
#include "WimaGOperationArea.h"
WimaGOperationArea
::
WimaGOperationArea
()
const
char
*
WimaGOperationArea
::
settingsGroup
=
"OperatingArea"
;
const
char
*
WimaGOperationArea
::
bottomLayerAltitudeName
=
"BottomLayerAltitude"
;
const
char
*
WimaGOperationArea
::
numberOfLayersName
=
"NumberOfLayers"
;
const
char
*
WimaGOperationArea
::
layerDistanceName
=
"LayerDistance"
;
WimaGOperationArea
::
WimaGOperationArea
(
QObject
*
parent
)
:
WimaGOperationArea
(
nullptr
,
parent
)
{
}
WimaGOperationArea
::
WimaGOperationArea
(
WimaArea
*
other
,
QObject
*
parent
)
:
WimaArea
(
other
,
parent
)
,
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/WimaGOperationArea.SettingsGroup.json"
),
this
/* QObject parent */
))
,
_bottomLayerAltitude
(
settingsGroup
,
_metaDataMap
[
bottomLayerAltitudeName
])
,
_numberOfLayers
(
settingsGroup
,
_metaDataMap
[
numberOfLayersName
])
,
_layerDistance
(
settingsGroup
,
_metaDataMap
[
layerDistanceName
])
,
_polyline
(
new
WimaTrackerPolyline
(
this
))
{
this
->
setObjectName
(
"Operating Area"
);
_polyline
.
bindPolygon
(
this
);
//qWarning("Here I am!");
//connect(&_polyline, &WimaTrackerPolyline::pathChanged, this, &WimaGOperationArea::polylineChanged );
}
void
WimaGOperationArea
::
addVehicle
(
WimaVehicle
*
vehicle
)
{
if
(
vehicle
!=
nullptr
){
_wimaVehicle
=
vehicle
;
emit
vehicleChanged
();
}
}
void
WimaGOperationArea
::
removeVehicle
(
int
vehicleIndex
)
{
if
(
vehicleIndex
>=
0
){
_wimaVehicle
=
nullptr
;
emit
vehicleChanged
();
}
}
/*void WimaGOperationArea::recalculatesubPolygons()
{
int vehicleCount = _vehicleList->count();
QScopedPointer<QList<QGCMapPolygon*>> listQGCPoly(this->splitPolygonArea(vehicleCount));
int polyCount = listQGCPoly->size();
_vehiclePolygons->clear();
for(int i = 0; i < polyCount; i++){
WimaVehicleMeasurementPolygon* subPoly = new WimaVehicleMeasurementPolygon(listQGCPoly->takeAt(i), this);
_vehiclePolygons->append(subPoly);
}
}
void WimaGOperationArea::removeAllVehicles()
{
int count = _vehicleList->count();
if(count > 0){
do{
_vehicleList->removeAt(0);
count--;
}while(count > 0);
emit vehicleListChanged();
}
}
void WimaGOperationArea::addVehiclePolygon()
{
_vehiclePolygons->append(new WimaVehicleMeasurementPolygon(this));
emit vehiclePolygonsChanged();
}
void WimaGOperationArea::removeVehiclePolygon(int polygonIndex)
{
if(polygonIndex >= 0 && polygonIndex < _vehiclePolygons->count()){
_vehiclePolygons->removeAt(polygonIndex);
emit vehiclePolygonsChanged();
}else {
qWarning("Index out of bounds!");
}
}
void WimaGOperationArea::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/Wima/WimaGOperationArea.h
View file @
6c9cee43
#ifndef WIMAGOPERATIONAREA_H
#define WIMAGOPERATIONAREA_H
#pragma once
#include <QObject>
#include "WimaArea.h"
#include "SettingsFact.h"
#include "WimaTrackerPolyline.h"
class
WimaGOperationArea
#include "QScopedPointer"
class
WimaGOperationArea
:
public
WimaArea
{
Q_OBJECT
public:
WimaGOperationArea
();
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(QmlObjectListModel* vehicleList READ vehicleList NOTIFY vehicleListChanged)
Q_PROPERTY(QmlObjectListModel* vehiclePolygons READ vehiclePolygons NOTIFY vehiclePolygonsChanged)*/
Q_PROPERTY
(
WimaTrackerPolyline
*
polyline
READ
polyline
CONSTANT
)
Q_INVOKABLE
void
addVehicle
(
WimaVehicle
*
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
QString
mapVisualQML
(
void
)
const
{
return
"WimaGOperationAreaMapVisual.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaGOperationAreaEditor.qml"
;}
// Property accessors
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;}*/
WimaTrackerPolyline
*
polyline
(
void
)
{
return
&
_polyline
;}
static
const
char
*
settingsGroup
;
static
const
char
*
bottomLayerAltitudeName
;
static
const
char
*
numberOfLayersName
;
static
const
char
*
layerDistanceName
;
signals:
void
bottomLayerAltitudeChanged
(
void
);
void
numberOfLayersChanged
(
void
);
void
layerDistanceChanged
(
void
);
//void vehicleListChanged (void);
void
polylineChanged
(
void
);
//void vehiclePolygonsChanged (void);
private:
QMap
<
QString
,
FactMetaData
*>
_metaDataMap
;
SettingsFact
_bottomLayerAltitude
;
SettingsFact
_numberOfLayers
;
SettingsFact
_layerDistance
;
/*QmlObjectListModel* _vehicleList;
QmlObjectListModel* _vehiclePolygons;*/
WimaTrackerPolyline
_polyline
;
};
#endif // WIMAGOPERATIONAREA_H
\ No newline at end of file
src/Wima/WimaServiceArea.cc
View file @
6c9cee43
#include "WimaServiceArea.h"
WimaServiceArea
::
WimaServiceArea
()
WimaServiceArea
::
WimaServiceArea
(
QObject
*
parent
)
:
WimaServiceArea
(
nullptr
,
parent
)
{
}
WimaServiceArea
::
WimaServiceArea
(
WimaArea
*
other
,
QObject
*
parent
)
:
WimaArea
(
other
,
parent
)
{
this
->
setObjectName
(
"Service Area"
);
}
void
WimaServiceArea
::
setTakeOffPosition
(
QGeoCoordinate
*
coordinate
)
{
if
(
_takeOffPosition
!=
*
coordinate
){
_takeOffPosition
=
*
coordinate
;
emit
takeOffPositionChanged
();
}
}
void
WimaServiceArea
::
setLandPosition
(
QGeoCoordinate
*
coordinate
)
{
if
(
_landPosition
!=
*
coordinate
){
_landPosition
=
*
coordinate
;
emit
landPositionChanged
();
}
}
src/Wima/WimaServiceArea.h
View file @
6c9cee43
#ifndef WIMASERVICEAREA_H
#define WIMASERVICEAREA_H
#pragma once
#include <QObject>
#include "WimaArea.h"
class
WimaServiceArea
class
WimaServiceArea
:
public
WimaArea
{
Q_OBJECT
public:
WimaServiceArea
();
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
)
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaServiceAreaMapVisual.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaServiceAreaEditor.qml"
;}
// Property acessors
QGeoCoordinate
*
takeOffPosition
(
void
)
{
return
&
_takeOffPosition
;}
QGeoCoordinate
*
landPosition
(
void
)
{
return
&
_landPosition
;}
// Property setters
void
setTakeOffPosition
(
QGeoCoordinate
*
coordinate
);
void
setLandPosition
(
QGeoCoordinate
*
coordinate
);
signals:
void
takeOffPositionChanged
(
void
);
void
landPositionChanged
(
void
);
private:
QGeoCoordinate
_takeOffPosition
;
QGeoCoordinate
_landPosition
;
};
#endif // WIMASERVICEAREA_H
\ No newline at end of file
src/Wima/WimaTrackerPolyline.cc
View file @
6c9cee43
#include "WimaTrackerPolyline.h"
WimaTrackerPolyline
::
WimaTrackerPolyline
()
WimaTrackerPolyline
::
WimaTrackerPolyline
(
QObject
*
parent
)
:
WimaTrackerPolyline
(
nullptr
,
parent
)
{
}
WimaTrackerPolyline
::
WimaTrackerPolyline
(
QGCMapPolyline
*
other
,
QObject
*
parent
)
:
QGCMapPolyline
(
other
,
parent
)
,
_boundArea
(
nullptr
)
,
_startVertexIndex
(
0
)
,
_endVertexIndex
(
0
)
{
}
void
WimaTrackerPolyline
::
bindPolygon
(
WimaArea
*
polygon
)
{
if
(
polygon
!=
nullptr
){
_boundArea
=
polygon
;
connect
(
polygon
,
&
WimaArea
::
pathChanged
,
this
,
&
WimaTrackerPolyline
::
recalcPolyline
);
}
else
{
qWarning
(
"bindPolygon(): Invalid Object!"
);
}
}
void
WimaTrackerPolyline
::
unbindPolygon
()
{
if
(
_boundArea
!=
nullptr
){
disconnect
(
_boundArea
,
&
WimaArea
::
pathChanged
,
this
,
&
WimaTrackerPolyline
::
recalcPolyline
);
_boundArea
=
nullptr
;
}
else
{
qWarning
(
"unbindPolygon(): No Object bound!"
);
}
}
void
WimaTrackerPolyline
::
swapLimits
()
{
int
storage
=
_startVertexIndex
;
_startVertexIndex
=
_endVertexIndex
;
_endVertexIndex
=
storage
;
}
void
WimaTrackerPolyline
::
setStartVertexIndex
(
int
PolygonVertexIndex
)
{
if
(
PolygonVertexIndex
>=
0
&&
PolygonVertexIndex
<
_boundArea
->
count
()){
_startVertexIndex
=
PolygonVertexIndex
;
emit
startVertexIndexChanged
();
recalcPolyline
();
}
else
{
qWarning
(
"WimaTrackerPolyline::setStartVertexIndex(): Index out of bounds!"
);
}
}
void
WimaTrackerPolyline
::
setEndVertexIndex
(
int
PolygonVertexIndex
)
{
if
(
PolygonVertexIndex
>=
0
&&
PolygonVertexIndex
<
_boundArea
->
count
()){
_endVertexIndex
=
PolygonVertexIndex
;
emit
endVertexIndexChanged
();
recalcPolyline
();
}
else
{
qWarning
(
"WimaTrackerPolyline::setEndVertexIndex(): Index out of bounds!"
);
}
}
void
WimaTrackerPolyline
::
snapVertex
(
int
polylineVertexIndex
)
{
int
polylineVertexCount
=
this
->
count
();
if
(
polylineVertexIndex
>=
0
&&
polylineVertexIndex
<
polylineVertexCount
){
if
(
polylineVertexIndex
==
0
){
snapStartVertex
();
}
else
if
(
polylineVertexIndex
==
polylineVertexCount
-
1
)
{
snapEndVertex
();
}
else
{
int
polygonVertexIndex
=
_startVertexIndex
+
polylineVertexIndex
;
int
polygonVertexCount
=
_boundArea
->
count
();
if
(
polygonVertexIndex
>=
polygonVertexCount
){
polygonVertexIndex
=
polygonVertexIndex
-
polygonVertexCount
;
if
(
polygonVertexCount
>
_endVertexIndex
)
{
// This branch sould actually not be reachable, just in case...
qWarning
(
"WimaTrackerPolyline::snapVertex(): polylineVertexIndex out of bounds!"
);
return
;
}
}
this
->
adjustVertex
(
polylineVertexIndex
,
_boundArea
->
vertexCoordinate
(
polygonVertexIndex
));
}
}
else
{
qWarning
(
"WimaTrackerPolyline::snapVertex(): Index out of bounds!"
);
}
}
void
WimaTrackerPolyline
::
snapEndVertex
()
{
if
(
_boundArea
!=
nullptr
&&
_boundArea
->
count
()
>=
3
){
int
currentVertexIndex
=
this
->
count
()
-
1
;
int
closestVertexIndex
=
_boundArea
->
getClosestVertexIndex
(
this
->
vertexCoordinate
(
currentVertexIndex
));
QGeoCoordinate
closestVertex
=
_boundArea
->
vertexCoordinate
(
closestVertexIndex
);
_endVertexIndex
=
closestVertexIndex
;
this
->
adjustVertex
(
currentVertexIndex
,
closestVertex
);
this
->
recalcPolyline
();
}
}
void
WimaTrackerPolyline
::
snapStartVertex
()
{
if
(
_boundArea
!=
nullptr
&&
_boundArea
->
count
()
>=
3
){
int
currentVertexIndex
=
0
;
int
closestVertexIndex
=
_boundArea
->
getClosestVertexIndex
(
this
->
vertexCoordinate
(
currentVertexIndex
));
QGeoCoordinate
closestVertex
=
_boundArea
->
vertexCoordinate
(
closestVertexIndex
);
_startVertexIndex
=
closestVertexIndex
;
this
->
adjustVertex
(
currentVertexIndex
,
closestVertex
);
this
->
recalcPolyline
();
}
}
void
WimaTrackerPolyline
::
recalcPolyline
()
{
qWarning
(
"WimaTrackerPolyline::recalcPolyline()"
);
if
(
_boundArea
!=
nullptr
&&
_boundArea
->
count
()
>
0
){
if
(
_startVertexIndex
>=
_boundArea
->
count
()){
_startVertexIndex
=
0
;
}
if
(
_endVertexIndex
>=
_boundArea
->
count
()){
_endVertexIndex
=
_boundArea
->
count
()
-
1
;
}
_polyline
.
clear
();
int
i
=
_startVertexIndex
;
while
(
1
){
_polyline
.
appendVertex
(
_boundArea
->
vertexCoordinate
(
i
));
if
(
i
==
_boundArea
->
count
()
-
1
&&
i
!=
_endVertexIndex
){
i
=
0
;
}
else
if
(
i
==
_endVertexIndex
)
{
break
;
}
else
{
i
++
;
}
}
}
else
{
qWarning
(
"WimaTrackerPolyline::recalcPolyline(): No object bound!"
);
}
}
src/Wima/WimaTrackerPolyline.h
View file @
6c9cee43
#ifndef WIMATRACKERPOLYLINE_H
#define WIMATRACKERPOLYLINE_H
#pragma once
#include <QObject>
#include "WimaArea.h"
#include "QGCMapPolyline.h"
class
WimaTrackerPolyline
class
WimaTrackerPolyline
:
public
QGCMapPolyline
{
Q_OBJECT
public:
WimaTrackerPolyline
();
WimaTrackerPolyline
(
QObject
*
parent
=
nullptr
);
WimaTrackerPolyline
(
QGCMapPolyline
*
other
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
int
startVertexIndex
READ
startVertexIndex
WRITE
setStartVertexIndex
NOTIFY
startVertexIndexChanged
)
Q_PROPERTY
(
int
endVertexIndex
READ
endVertexIndex
WRITE
setEndVertexIndex
NOTIFY
endVertexIndexChanged
)
// Property accessors
int
startVertexIndex
(
void
)
const
{
return
_startVertexIndex
;}
int
endVertexIndex
(
void
)
const
{
return
_endVertexIndex
;}
//Property setters
Q_INVOKABLE
void
bindPolygon
(
WimaArea
*
polygon
);
Q_INVOKABLE
void
unbindPolygon
();
Q_INVOKABLE
void
swapLimits
();
Q_INVOKABLE
void
setStartVertexIndex
(
int
PolygonVertexIndex
);
Q_INVOKABLE
void
setEndVertexIndex
(
int
PolygonVertexIndex
);
// Methodes
// calls updateEndVertex() if VertexIndex == _endVertexIndex, calls updateStartVertex() if VertexIndex == _startVertexIndex, or
// calls both if VertexIndex != _endVertexIndex && VertexIndex != _startVertexIndex
Q_INVOKABLE
void
snapVertex
(
int
VertexIndex
);
// snaps the end vertex to the closest coordinate of _boundArea when called
void
snapEndVertex
();
// snaps the start vertex to the closest coordinate of _boundArea when called
void
snapStartVertex
();
signals:
void
startVertexIndexChanged
(
void
);
void
endVertexIndexChanged
(
void
);
public
slots
:
void
recalcPolyline
(
void
);
private:
QGCMapPolyline
_polyline
;
WimaArea
*
_boundArea
;
// this->vertexCoordinate(this->count()-1) and _boundArea->vertexCoordinate(_startVertexIndex) are linked
int
_startVertexIndex
;
// this->vertexCoordinate(0) and _boundArea->vertexCoordinate(_endVertexIndex) are linked
int
_endVertexIndex
;
};
#endif // WIMATRACKERPOLYLINE_H
\ No newline at end of file
src/Wima/WimaVCorridor.cc
View file @
6c9cee43
#include "WimaVCorridor.h"
WimaVCorridor
::
WimaVCorridor
()
WimaVCorridor
::
WimaVCorridor
(
QObject
*
parent
)
:
WimaVCorridor
(
nullptr
,
parent
)
{
}
WimaVCorridor
::
WimaVCorridor
(
WimaArea
*
other
,
QObject
*
parent
)
:
WimaArea
(
other
,
parent
)
{
this
->
setObjectName
(
"Corridor"
);
}
src/Wima/WimaVCorridor.h
View file @
6c9cee43
#ifndef WIMAVCORRIDOR_H
#define WIMAVCORRIDOR_H
#pragma once
#include <QObject>
#include "WimaArea.h"
class
WimaVCorridor
class
WimaVCorridor
:
public
WimaArea
{
Q_OBJECT
public:
WimaVCorridor
();
WimaVCorridor
(
QObject
*
parent
=
nullptr
);
WimaVCorridor
(
WimaArea
*
other
=
nullptr
,
QObject
*
parent
=
nullptr
);
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaVCorridorMapVisual.qml"
;}
QString
editorQML
(
void
)
const
{
return
"WimaVCorridorEditor.qml"
;}
};
#endif // WIMAVCORRIDOR_H
\ No newline at end of file
src/Wima/WimaVehicle.cc
View file @
6c9cee43
#include "WimaVehicle.h"
WimaVehicle
::
WimaVehicle
()
WimaVehicle
::
WimaVehicle
(
QObject
*
parent
)
:
QObject
(
parent
)
,
_vehicle
(
nullptr
)
,
_serviceArea
(
nullptr
)
,
_vehicleCorridor
(
nullptr
)
,
_operationArea
(
nullptr
)
{
}
void
WimaVehicle
::
setVehicle
(
Vehicle
*
vehicle
)
{
if
(
vehicle
!=
nullptr
){
_vehicle
=
vehicle
;
}
else
{
qWarning
(
"Not a valid vehicle!"
);
}
}
void
WimaVehicle
::
setServiceArea
(
WimaServiceArea
*
servicePolygon
)
{
if
(
servicePolygon
!=
nullptr
){
_serviceArea
=
servicePolygon
;
}
else
{
qWarning
(
"Not a valid service Polygon!"
);
}
}
void
WimaVehicle
::
setVCorridor
(
WimaVCorridor
*
vehicleCorridor
)
{
if
(
vehicleCorridor
!=
nullptr
){
_vehicleCorridor
=
vehicleCorridor
;
}
else
{
qWarning
(
"Not a valid vehicle Corridor!"
);
}
}
void
WimaVehicle
::
setOperationArea
(
WimaGOperationArea
*
operationArea
)
{
if
(
operationArea
!=
nullptr
){
_operationArea
=
operationArea
;
}
else
{
qWarning
(
"Not a valid measurementPolygon!"
);
}
}
src/Wima/WimaVehicle.h
View file @
6c9cee43
#ifndef WIMAVEHICLE_H
#define WIMAVEHICLE_H
#pragma once
#include <QObject>
#include "Vehicle.h"
class
WimaVehicle
class
WimaServiceArea
;
class
WimaVCorridor
;
class
WimaGOperationArea
;
class
WimaVehicle
:
public
QObject
{
Q_OBJECT
public:
WimaVehicle
();
WimaVehicle
(
QObject
*
parent
=
nullptr
);
WimaServiceArea
*
serviceArea
(
void
)
const
{
return
_serviceArea
;}
WimaVCorridor
*
vehicleCorridor
(
void
)
const
{
return
_vehicleCorridor
;}
WimaGOperationArea
*
operationArea
(
void
)
const
{
return
_operationArea
;}
void
setVehicle
(
Vehicle
*
vehicle
);
void
setServiceArea
(
WimaServiceArea
*
serviceArea
);
void
setVCorridor
(
WimaVCorridor
*
vehicleCorridor
);
void
setOperationArea
(
WimaGOperationArea
*
operationArea
);
private:
Vehicle
*
_vehicle
;
WimaServiceArea
*
_serviceArea
;
WimaVCorridor
*
_vehicleCorridor
;
WimaGOperationArea
*
_operationArea
;
};
#endif // WIMAVEHICLE_H
\ No newline at end of file
src/WimaView/FlyAreaPolygonMapVisual.qml
deleted
100644 → 0
View file @
d60a1318
/****************************************************************************
*
* (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
/// Fly 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
_flyAreaPolygon
/// Add an initial 4 sided polygon if there is none
function
_addInitialPolygon
()
{
if
(
_flyAreaPolygon
.
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
)
_flyAreaPolygon
.
appendVertex
(
topLeftCoord
)
_flyAreaPolygon
.
appendVertex
(
topRightCoord
)
_flyAreaPolygon
.
appendVertex
(
bottomRightCoord
)
_flyAreaPolygon
.
appendVertex
(
bottomLeftCoord
)
}
}
Component.onCompleted
:
{
_addInitialPolygon
()
}
QGCMapPolygonVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolygon
:
_flyAreaPolygon
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
green
"
interiorOpacity
:
0.25
}
}
src/WimaView/WimaGOperationAreaEditor.qml
View file @
6c9cee43
import
QtQuick
2.0
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
Item
{
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
var
operatingPolygon
:
areaItem
property
bool
initNecesarry
:
true
function
editPolyline
(){
polyline
.
interactive
=
true
;
}
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
:
"
Edit Polyline
"
onClicked
:
editPolyline
()
}
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/WimaGOperationAreaMapVisual.qml
View file @
6c9cee43
import
QtQuick
2.0
/****************************************************************************
*
* (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.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
)
}
}
function
_addInitialPolyline
(){
_polyline
.
setStartVertexIndex
(
0
);
_polyline
.
setEndVertexIndex
(
2
);
}
Component.onCompleted
:
{
_addInitialPolygon
()
_addInitialPolyline
()
}
Component.onDestruction
:
{
}
WimaMapPolygonVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolygon
:
_polygon
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
green
"
interiorOpacity
:
0.25
}
WimaMapPolylineVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolyline
:
_polyline
lineWidth
:
4
lineColor
:
interactive
?
"
yellow
"
:
"
green
"
}
/*QGCMapPolylineVisuals {
id: mapPolylineVisuals
qgcView: _root.qgcView
mapControl: map
mapPolyline: _polyline
lineWidth: 3
lineColor: "#be781c"
}*/
}
src/WimaView/WimaGlobalMeasurementPolygonEditor.cc
deleted
100644 → 0
View file @
d60a1318
#include "WimaGlobalMeasurementPolygonEditor.h"
WimaGlobalMeasurementPolygonEditor
::
WimaGlobalMeasurementPolygonEditor
(
QObject
*
parent
)
:
QAbstractItemModel
(
parent
)
{
}
QVariant
WimaGlobalMeasurementPolygonEditor
::
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
int
role
)
const
{
// FIXME: Implement me!
}
QModelIndex
WimaGlobalMeasurementPolygonEditor
::
index
(
int
row
,
int
column
,
const
QModelIndex
&
parent
)
const
{
// FIXME: Implement me!
}
QModelIndex
WimaGlobalMeasurementPolygonEditor
::
parent
(
const
QModelIndex
&
index
)
const
{
// FIXME: Implement me!
}
int
WimaGlobalMeasurementPolygonEditor
::
rowCount
(
const
QModelIndex
&
parent
)
const
{
if
(
!
parent
.
isValid
())
return
0
;
// FIXME: Implement me!
}
int
WimaGlobalMeasurementPolygonEditor
::
columnCount
(
const
QModelIndex
&
parent
)
const
{
if
(
!
parent
.
isValid
())
return
0
;
// FIXME: Implement me!
}
QVariant
WimaGlobalMeasurementPolygonEditor
::
data
(
const
QModelIndex
&
index
,
int
role
)
const
{
if
(
!
index
.
isValid
())
return
QVariant
();
// FIXME: Implement me!
return
QVariant
();
}
src/WimaView/WimaGlobalMeasurementPolygonEditor.h
deleted
100644 → 0
View file @
d60a1318
#ifndef WIMAGLOBALMEASUREMENTPOLYGONEDITOR_H
#define WIMAGLOBALMEASUREMENTPOLYGONEDITOR_H
#include <QAbstractItemModel>
class
WimaGlobalMeasurementPolygonEditor
:
public
QAbstractItemModel
{
Q_OBJECT
public:
explicit
WimaGlobalMeasurementPolygonEditor
(
QObject
*
parent
=
nullptr
);
// Header:
QVariant
headerData
(
int
section
,
Qt
::
Orientation
orientation
,
int
role
=
Qt
::
DisplayRole
)
const
override
;
// Basic functionality:
QModelIndex
index
(
int
row
,
int
column
,
const
QModelIndex
&
parent
=
QModelIndex
())
const
override
;
QModelIndex
parent
(
const
QModelIndex
&
index
)
const
override
;
int
rowCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
override
;
int
columnCount
(
const
QModelIndex
&
parent
=
QModelIndex
())
const
override
;
QVariant
data
(
const
QModelIndex
&
index
,
int
role
=
Qt
::
DisplayRole
)
const
override
;
private:
};
#endif // WIMAGLOBALMEASUREMENTPOLYGONEDITOR_H
\ No newline at end of file
src/WimaView/WimaItemEditor.qml
View file @
6c9cee43
...
...
@@ -32,7 +32,6 @@ Rectangle {
property
var
_masterController
:
masterController
property
var
_missionController
:
_masterController
.
missionController
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
...
...
@@ -95,8 +94,8 @@ Rectangle {
id
:
hamburgerMenu
MenuItem
{
text
:
qsTr
(
"
Add Operati
ng
Area
"
)
onTriggered
:
wimaController
.
addG
lobalMeasurement
Area
()
text
:
qsTr
(
"
Add Operati
on
Area
"
)
onTriggered
:
wimaController
.
addG
Operation
Area
()
}
MenuItem
{
...
...
src/WimaView/WimaMapPolygonVisuals.qml
View file @
6c9cee43
This diff is collapsed.
Click to expand it.
src/WimaView/WimaMapPolylineVisuals.qml
View file @
6c9cee43
This diff is collapsed.
Click to expand it.
src/WimaView/WimaServiceAreaMapVisual.qml
View file @
6c9cee43
import
QtQuick
2.0
/****************************************************************************
*
* (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
_polygon
:
object
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
:
{
}
WimaMapPolygonVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolygon
:
_polygon
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
yellow
"
interiorOpacity
:
0.25
}
}
WimaGlobalMeasurement
PolygonMapVisual.qml
→
src/WimaView/WimaService
PolygonMapVisual.qml
View file @
6c9cee43
...
...
@@ -27,7 +27,6 @@ Item {
property
var
_missionItem
:
object
property
var
_polygon
:
object
.
polygon
property
var
_polyline
:
object
.
polyline
signal
clicked
(
int
sequenceNumber
)
...
...
@@ -38,8 +37,8 @@ Item {
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.
7
5
rect
.
height
*=
0.
7
5
rect
.
width
*=
0.
2
5
rect
.
height
*=
0.
2
5
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 */
)
...
...
@@ -74,24 +73,14 @@ Item {
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolygon
:
_polygon
interactive
:
_missionItem
.
isCurrent
Item
interactive
:
_missionItem
.
isCurrent
Polygon
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
green
"
interiorOpacity
:
1
}
1
QGCMapPolylineVisuals
{
id
:
mapPolylineVisuals
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolyline
:
_polyline
interactive
:
true
lineWidth
:
3
lineColor
:
"
blue
"
interiorColor
:
"
yellow
"
interiorOpacity
:
0.25
}
}
src/WimaView/WimaView.qml
View file @
6c9cee43
...
...
@@ -610,7 +610,7 @@ QGCView {
onClicked
:
{
switch
(
index
)
{
case
1
:
wimaController
.
addG
lobalMeasurement
Area
();
wimaController
.
addG
Operation
Area
();
//addComplexItem(_missionController.complexMissionItemNames[2])
/*_addWaypointOnClick = checked
_addROIOnClick = false*/
...
...
@@ -1154,7 +1154,7 @@ QGCView {
color
:
"
lightsteelblue
"
radius
:
1
Text
{
text
:
"
Hello World!
"
text
:
""
}
}
}
...
...
src/WimaView/flyAreaPolygonMapVisual.qml
deleted
100644 → 0
View file @
d60a1318
/****************************************************************************
*
* (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
/// Survey Complex Mission Item visuals
Item
{
id
:
_root
property
var
map
///< Map control to place item in
property
var
qgcView
///< QGCView to use for popping dialogs
property
var
_flyAreaPolygon
/// Add an initial 4 sided polygon if there is none
function
_addInitialPolygon
()
{
if
(
_structurePolygon
.
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
)
_structurePolygon
.
appendVertex
(
topLeftCoord
)
_structurePolygon
.
appendVertex
(
topRightCoord
)
_structurePolygon
.
appendVertex
(
bottomRightCoord
)
_structurePolygon
.
appendVertex
(
bottomLeftCoord
)
}
}
Component.onCompleted
:
{
_addInitialPolygon
()
}
QGCMapPolygonVisuals
{
qgcView
:
_root
.
qgcView
mapControl
:
map
mapPolygon
:
_flyAreaPolygon
interactive
:
true
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
green
"
interiorOpacity
:
0.25
}
}
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