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
6256464b
Commit
6256464b
authored
Jun 17, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
saveToJson works
parent
c82f5a2a
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
202 additions
and
121 deletions
+202
-121
WimaArea.cc
src/Wima/WimaArea.cc
+46
-34
WimaArea.h
src/Wima/WimaArea.h
+7
-5
WimaController.cc
src/Wima/WimaController.cc
+26
-7
WimaController.h
src/Wima/WimaController.h
+6
-3
WimaGOperationArea.cc
src/Wima/WimaGOperationArea.cc
+19
-7
WimaGOperationArea.h
src/Wima/WimaGOperationArea.h
+5
-8
WimaServiceArea.cc
src/Wima/WimaServiceArea.cc
+10
-4
WimaServiceArea.h
src/Wima/WimaServiceArea.h
+4
-3
WimaVCorridor.cc
src/Wima/WimaVCorridor.cc
+14
-6
WimaVCorridor.h
src/Wima/WimaVCorridor.h
+5
-4
WimaGOperationAreaEditor.qml
src/WimaView/WimaGOperationAreaEditor.qml
+8
-8
WimaGOperationAreaMapVisual.qml
src/WimaView/WimaGOperationAreaMapVisual.qml
+5
-6
WimaServiceAreaEditor.qml
src/WimaView/WimaServiceAreaEditor.qml
+8
-8
WimaServiceAreaMapVisual.qml
src/WimaView/WimaServiceAreaMapVisual.qml
+6
-6
WimaView.qml
src/WimaView/WimaView.qml
+33
-12
No files found.
src/Wima/WimaArea.cc
View file @
6256464b
...
...
@@ -6,28 +6,41 @@ const char* WimaArea::wimaAreaName = "WimaArea";
const
char
*
WimaArea
::
areaTypeName
=
"AreaType"
;
WimaArea
::
WimaArea
(
QObject
*
parent
)
:
WimaArea
(
nullptr
,
parent
)
WimaArea
::
WimaArea
(
)
:
QGCMapPolygon
(
nullptr
)
{
//qWarning() << "WimaPolygon:: polygon count" << _polygon->count();
this
->
setObjectName
(
wimaAreaName
);
_maxAltitude
=
30
;
_wimaVehicle
=
new
WimaVehicle
(
this
);
}
WimaArea
::
WimaArea
(
Q
GCMapPolygon
*
other
,
Q
Object
*
parent
)
:
QGCMapPolygon
(
other
,
parent
)
WimaArea
::
WimaArea
(
QObject
*
parent
)
:
QGCMapPolygon
(
parent
)
{
this
->
setObjectName
(
wimaAreaName
);
WimaArea
*
wimaPoly
=
qobject_cast
<
WimaArea
*>
(
other
);
if
(
wimaPoly
!=
nullptr
)
{
_maxAltitude
=
wimaPoly
->
maxAltitude
();
_wimaVehicle
=
wimaPoly
->
vehicle
();
}
else
{
_maxAltitude
=
30
;
_wimaVehicle
=
new
WimaVehicle
(
this
);
}
_maxAltitude
=
30
;
_wimaVehicle
=
new
WimaVehicle
(
this
);
}
WimaArea
::
WimaArea
(
const
QGCMapPolygon
&
other
,
QObject
*
parent
)
:
QGCMapPolygon
(
other
,
parent
)
{
this
->
setObjectName
(
wimaAreaName
);
_maxAltitude
=
30
;
_wimaVehicle
=
new
WimaVehicle
(
this
);
}
WimaArea
::
WimaArea
(
const
WimaArea
&
other
,
QObject
*
parent
)
:
WimaArea
(
parent
)
{
this
->
setObjectName
(
wimaAreaName
);
this
->
setPath
(
other
.
path
());
this
->
setCenter
(
other
.
center
());
this
->
setCenterDrag
(
other
.
centerDrag
());
this
->
setInteractive
(
other
.
interactive
());
_maxAltitude
=
other
.
maxAltitude
();
_wimaVehicle
=
other
.
vehicle
();
}
void
WimaArea
::
setMaxAltitude
(
double
alt
)
...
...
@@ -38,7 +51,6 @@ void WimaArea::setMaxAltitude(double alt)
}
}
void
WimaArea
::
setVehicle
(
WimaVehicle
*
vehicle
)
{
if
(
_wimaVehicle
!=
vehicle
){
...
...
@@ -94,15 +106,15 @@ QGeoCoordinate WimaArea::getClosestVertex(const QGeoCoordinate& coordinate) cons
return
this
->
vertexCoordinate
(
getClosestVertexIndex
(
coordinate
));
}
QGCMapPolygon
&
WimaArea
::
toQGCPolygon
(
const
WimaArea
&
poly
)
const
QGCMapPolygon
WimaArea
::
toQGCPolygon
(
const
WimaArea
&
poly
)
const
{
QGCMapPolygon
*
qgcPoly
=
new
QGCMapPolygon
()
;
qgcPoly
->
setPath
(
poly
.
path
());
qgcPoly
->
setCenter
(
poly
.
center
());
qgcPoly
->
setCenterDrag
(
poly
.
centerDrag
());
qgcPoly
->
setInteractive
(
poly
.
interactive
());
QGCMapPolygon
qgcPoly
;
qgcPoly
.
setPath
(
poly
.
path
());
qgcPoly
.
setCenter
(
poly
.
center
());
qgcPoly
.
setCenterDrag
(
poly
.
centerDrag
());
qgcPoly
.
setInteractive
(
poly
.
interactive
());
return
*
qgcPoly
;
return
QGCMapPolygon
(
qgcPoly
)
;
}
void
WimaArea
::
join
(
QList
<
WimaArea
*>*
polyList
,
WimaArea
*
joinedPoly
)
...
...
@@ -110,18 +122,16 @@ void WimaArea::join(QList<WimaArea *>* polyList, WimaArea* joinedPoly)
return
;
}
void
WimaArea
::
join
(
const
WimaArea
&
poly1
,
const
WimaArea
&
poly2
,
WimaArea
&
joinedPoly
)
void
WimaArea
::
join
(
WimaArea
&
poly1
,
WimaArea
&
poly2
,
WimaArea
&
joinedPoly
)
{
if
(
poly1
.
count
()
>=
3
&&
poly2
.
count
()
>=
3
)
{
WimaArea
cpoly1
(
poly1
);
WimaArea
cpoly2
(
poly2
);
cpoly1
.
verifyClockwiseWinding
();
cpoly2
.
verifyClockwiseWinding
();
poly1
.
verifyClockwiseWinding
();
poly2
.
verifyClockwiseWinding
();
WimaArea
*
walkerPoly
=
&
c
poly1
;
// "walk" on this polygon towards higher indices
WimaArea
*
crossPoly
=
&
c
poly2
;
// check for crossings with this polygon while "walking"
WimaArea
*
walkerPoly
=
&
poly1
;
// "walk" on this polygon towards higher indices
WimaArea
*
crossPoly
=
&
poly2
;
// check for crossings with this polygon while "walking"
// and swicht to this polygon on a intersection,
// continue to walk towards higher indices
...
...
@@ -160,7 +170,7 @@ void WimaArea::join(const WimaArea &poly1, const WimaArea &poly2, WimaArea &join
QList
<
QPair
<
int
,
int
>>
neighbourList
;
QList
<
QGeoCoordinate
>
intersectionList
;
//qDebug("IntersectionList.size() on init: %i", intersectionList.size());
intersects
(
walkerPolySegment
,
crossPoly
,
intersectionList
,
neighbourList
);
intersects
(
walkerPolySegment
,
*
crossPoly
,
intersectionList
,
neighbourList
);
//qDebug("IntersectionList.size(): %i", intersectionList.size());
...
...
@@ -215,10 +225,10 @@ void WimaArea::join(const WimaArea &poly1, const WimaArea &poly2, WimaArea &join
}
}
void
WimaArea
::
join
(
const
WimaArea
&
poly
)
void
WimaArea
::
join
(
WimaArea
&
poly
)
{
WimaArea
joinedArea
(
this
)
;
join
(
this
,
poly
,
joinedArea
);
WimaArea
joinedArea
;
join
(
*
this
,
poly
,
joinedArea
);
this
->
setPath
(
joinedArea
.
path
());
return
;
}
...
...
@@ -302,7 +312,7 @@ bool WimaArea::intersects(const QGCMapPolyline &line1, const QGCMapPolyline &lin
QPointF
pt21
(
x
,
y
);
convertGeoToNed
(
line2
.
vertexCoordinate
(
1
),
origin
,
&
x
,
&
y
,
&
z
);
QPointF
pt22
(
x
,
y
);
QPointF
pt22
(
x
,
y
);
;
QLineF
kartLine2
(
pt21
,
pt22
);
...
...
@@ -377,6 +387,8 @@ double WimaArea::distInsidePoly(const QGeoCoordinate &c1, const QGeoCoordinate &
//if ( intersectionList.size() == (c1InPolyRim || c2InPolyRim ? 2:0) ){
if
(
intersectionList
.
size
()
==
0
){
return
c1
.
distanceTo
(
c2
);
}
else
{
return
std
::
numeric_limits
<
qreal
>::
infinity
();
}
}
else
{
...
...
src/Wima/WimaArea.h
View file @
6256464b
...
...
@@ -15,8 +15,10 @@ class WimaArea : public QGCMapPolygon //abstract base class for all WimaAreas
{
Q_OBJECT
public:
WimaArea
(
QObject
*
parent
=
nullptr
);
WimaArea
(
QGCMapPolygon
*
other
=
nullptr
,
QObject
*
parent
=
nullptr
);
WimaArea
();
WimaArea
(
QObject
*
parent
);
WimaArea
(
const
QGCMapPolygon
&
other
,
QObject
*
parent
);
WimaArea
(
const
WimaArea
&
other
,
QObject
*
parent
);
...
...
@@ -45,13 +47,13 @@ public:
int
getClosestVertexIndex
(
const
QGeoCoordinate
&
coordinate
)
const
;
//iterates over all vertices in _polygon and returns that one closest to coordinate
QGeoCoordinate
getClosestVertex
(
const
QGeoCoordinate
&
coordinate
)
const
;
QGCMapPolygon
&
toQGCPolygon
(
const
WimaArea
&
poly
)
const
;
QGCMapPolygon
toQGCPolygon
(
const
WimaArea
&
poly
)
const
;
static
void
join
(
QList
<
WimaArea
*>*
polyList
,
WimaArea
*
joinedPoly
);
// change to & notation
/// joins the poly1 and poly2 if possible, joins the polygons to form a simple polygon (no holes)
/// see https://en.wikipedia.org/wiki/Simple_polygon
/// @return the joined polygon of poly1 and poly2 if possible, poly1 else
static
void
join
(
const
WimaArea
&
poly1
,
const
WimaArea
&
poly2
,
WimaArea
&
joinedPoly
);
void
join
(
const
WimaArea
&
poly
);
static
void
join
(
WimaArea
&
poly1
,
WimaArea
&
poly2
,
WimaArea
&
joinedPoly
);
void
join
(
WimaArea
&
poly
);
bool
isDisjunct
(
QList
<
WimaArea
*>*
polyList
);
// change to & notation, if necessary
bool
isDisjunct
(
WimaArea
*
poly1
,
WimaArea
*
poly2
);
// change to & notation, if necessary
/// calculates the next polygon vertex index
...
...
src/Wima/WimaController.cc
View file @
6256464b
...
...
@@ -11,6 +11,16 @@ WimaController::WimaController(QObject *parent) :
connect
(
this
,
&
WimaController
::
currentPolygonIndexChanged
,
this
,
&
WimaController
::
recalcPolygonInteractivity
);
}
QStringList
WimaController
::
loadNameFilters
()
const
{
QStringList
filters
;
filters
<<
tr
(
"Supported types (*.%1)"
).
arg
(
wimaFileExtension
)
<<
tr
(
"All Files (*.*)"
);
return
filters
;
}
void
WimaController
::
setMasterController
(
PlanMasterController
*
masterC
)
{
_masterController
=
masterC
;
...
...
@@ -106,6 +116,7 @@ void WimaController::resumeMission()
bool
WimaController
::
updateMission
()
{
#define debug 0
// pick first WimaGOperationArea
WimaGOperationArea
*
opArea
=
nullptr
;
for
(
int
i
=
0
;
i
<
_visualItems
->
count
();
i
++
)
{
...
...
@@ -115,6 +126,8 @@ bool WimaController::updateMission()
break
;
}
}
if
(
opArea
==
nullptr
)
return
false
;
// pick first WimaServiceArea
WimaServiceArea
*
serArea
=
nullptr
;
...
...
@@ -125,6 +138,8 @@ bool WimaController::updateMission()
break
;
}
}
if
(
serArea
==
nullptr
)
return
false
;
// pick first WimaVCorridor
WimaVCorridor
*
corridor
=
nullptr
;
...
...
@@ -135,18 +150,20 @@ bool WimaController::updateMission()
break
;
}
}
// join service area and op area
WimaArea
joinedArea
(
this
)
;
WimaArea
joinedArea
;
if
(
corridor
!=
nullptr
)
{
WimaArea
::
join
(
*
corridor
,
*
serArea
,
joinedArea
);
joinedArea
.
join
(
*
opArea
);
}
else
{
WimaArea
::
join
(
serArea
,
opArea
,
joinedArea
);
WimaArea
::
join
(
*
serArea
,
*
opArea
,
joinedArea
);
}
#if debug
WimaArea
*
joinedAreaPt
=
new
WimaArea
(
joinedArea
,
this
);
_visualItems
->
append
(
joinedAreaPt
);
#endif
_visualItems
->
append
(
&
joinedArea
);
// reset visual items
...
...
@@ -208,6 +225,8 @@ bool WimaController::updateMission()
}
}
saveToFile
(
"TestFile"
);
return
true
;
}
...
...
@@ -306,21 +325,21 @@ QJsonDocument WimaController::saveToJson()
if
(
opArea
!=
nullptr
)
{
opArea
->
saveToJson
(
json
);
jsonArray
.
append
(
json
);
break
;
continue
;
}
WimaServiceArea
*
serArea
=
qobject_cast
<
WimaServiceArea
*>
(
area
);
if
(
serArea
!=
nullptr
)
{
serArea
->
saveToJson
(
json
);
jsonArray
.
append
(
json
);
break
;
continue
;
}
WimaVCorridor
*
corridor
=
qobject_cast
<
WimaVCorridor
*>
(
area
);
if
(
corridor
!=
nullptr
)
{
corridor
->
saveToJson
(
json
);
jsonArray
.
append
(
json
);
break
;
continue
;
}
// if non of the obove branches was trigger, type must be WimaArea
...
...
src/Wima/WimaController.h
View file @
6256464b
...
...
@@ -27,7 +27,9 @@ public:
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
)
Q_PROPERTY
(
const
QString
currentFile
READ
currentFile
NOTIFY
currentFileChanged
)
Q_PROPERTY
(
const
QString
currentFile
READ
currentFile
NOTIFY
currentFileChanged
)
Q_PROPERTY
(
QStringList
loadNameFilters
READ
loadNameFilters
CONSTANT
)
Q_PROPERTY
(
QString
fileExtenstion
READ
fileExtenstion
CONSTANT
)
// Property accessors
...
...
@@ -35,8 +37,9 @@ public:
MissionController
*
missionController
(
void
)
const
{
return
_missionController
;
}
QmlObjectListModel
*
visualItems
(
void
)
const
{
return
_visualItems
;
}
int
currentPolygonIndex
(
void
)
const
{
return
_currentPolygonIndex
;
}
const
QString
&
currentFile
(
void
)
const
{
return
_currentFile
;
}
const
QString
currentFile
(
void
)
const
{
return
_currentFile
;
}
QStringList
loadNameFilters
(
void
)
const
;
QString
fileExtenstion
(
void
)
const
{
return
wimaFileExtension
;
}
...
...
src/Wima/WimaGOperationArea.cc
View file @
6256464b
...
...
@@ -8,14 +8,14 @@ const char* WimaGOperationArea::layerDistanceName = "LayerDistance
const
char
*
WimaGOperationArea
::
borderPolygonOffsetName
=
"BorderPolygonOffset"
;
const
char
*
WimaGOperationArea
::
wimaGOperationAreaName
=
"Operation Area"
;
WimaGOperationArea
::
WimaGOperationArea
(
QObject
*
parent
)
:
WimaGOperationArea
(
nullptr
,
parent
)
WimaGOperationArea
::
WimaGOperationArea
()
:
WimaGOperationArea
(
nullptr
)
{
}
WimaGOperationArea
::
WimaGOperationArea
(
WimaArea
*
other
,
QObject
*
parent
)
:
WimaArea
(
other
,
parent
)
WimaGOperationArea
::
WimaGOperationArea
(
QObject
*
parent
)
:
WimaArea
(
parent
)
,
_metaDataMap
(
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/WimaGOperationArea.SettingsGroup.json"
),
this
/* QObject parent */
))
,
_bottomLayerAltitude
(
settingsGroup
,
_metaDataMap
[
bottomLayerAltitudeName
])
,
_numberOfLayers
(
settingsGroup
,
_metaDataMap
[
numberOfLayersName
])
...
...
@@ -26,10 +26,22 @@ WimaGOperationArea::WimaGOperationArea(WimaArea *other, QObject *parent)
this
->
setObjectName
(
wimaGOperationAreaName
);
connect
(
this
,
&
WimaGOperationArea
::
pathChanged
,
this
,
&
WimaGOperationArea
::
recalcBorderPolygon
);
connect
(
&
_borderPolygonOffset
,
&
SettingsFact
::
rawValueChanged
,
this
,
&
WimaGOperationArea
::
recalcBorderPolygon
);
//qWarning("Here I am!");
//connect(&_polyline, &WimaTrackerPolyline::pathChanged, this, &WimaGOperationArea::polylineChanged );
}
WimaGOperationArea
::
WimaGOperationArea
(
const
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
])
,
_borderPolygonOffset
(
settingsGroup
,
_metaDataMap
[
borderPolygonOffsetName
])
,
_borderPolygon
(
new
QGCMapPolygon
(
this
))
{
this
->
setObjectName
(
wimaGOperationAreaName
);
connect
(
this
,
&
WimaGOperationArea
::
pathChanged
,
this
,
&
WimaGOperationArea
::
recalcBorderPolygon
);
connect
(
&
_borderPolygonOffset
,
&
SettingsFact
::
rawValueChanged
,
this
,
&
WimaGOperationArea
::
recalcBorderPolygon
);
}
void
WimaGOperationArea
::
addVehicle
(
WimaVehicle
*
vehicle
)
{
if
(
vehicle
!=
nullptr
){
...
...
@@ -113,7 +125,7 @@ bool WimaGOperationArea::loadFromJson(const QJsonObject &json, QString& errorStr
void
WimaGOperationArea
::
recalcBorderPolygon
()
{
//qWarning("WimaGOperationArea::recalcBorderPolygon() %f", _borderPolygonOffset.rawValue().toDouble());
QGCMapPolygon
polyCopy
=
this
->
toQGCPolygon
(
this
);
QGCMapPolygon
polyCopy
=
this
->
toQGCPolygon
(
*
this
);
polyCopy
.
offset
(
_borderPolygonOffset
.
rawValue
().
toDouble
());
_borderPolygon
.
setPath
(
polyCopy
.
path
());
polyCopy
.
deleteLater
();
...
...
src/Wima/WimaGOperationArea.h
View file @
6256464b
...
...
@@ -12,8 +12,9 @@ class WimaGOperationArea : public WimaArea
{
Q_OBJECT
public:
WimaGOperationArea
(
QObject
*
parent
=
nullptr
);
WimaGOperationArea
(
WimaArea
*
other
,
QObject
*
parent
=
nullptr
);
WimaGOperationArea
();
WimaGOperationArea
(
QObject
*
parent
);
WimaGOperationArea
(
const
WimaArea
&
other
,
QObject
*
parent
=
nullptr
);
Q_PROPERTY
(
Fact
*
bottomLayerAltitude
READ
bottomLayerAltitude
CONSTANT
)
Q_PROPERTY
(
Fact
*
numberOfLayers
READ
numberOfLayers
CONSTANT
)
...
...
@@ -42,8 +43,8 @@ public:
Fact
*
bottomLayerAltitude
(
void
)
{
return
&
_bottomLayerAltitude
;}
Fact
*
numberOfLayers
(
void
)
{
return
&
_numberOfLayers
;}
Fact
*
layerDistance
(
void
)
{
return
&
_layerDistance
;}
Fact
*
borderPolygonOffset
(
void
)
{
return
&
_borderPolygonOffset
;}
/*QmlObjectListModel* vehicleList
(void) const { return _vehicleList;}
Fact
*
borderPolygonOffset
(
void
)
{
return
&
_borderPolygonOffset
;}
/*QmlObjectListModel* vehicleList (void) const { return _vehicleList;}
QmlObjectListModel* vehiclePolygons (void) const { return _vehiclePolygons;}*/
WimaVCorridor
*
vehicleCorridor
(
void
)
{
return
_vehicleCorridor
;}
QGCMapPolygon
*
borderPolygon
(
void
)
{
return
&
_borderPolygon
;}
...
...
@@ -88,10 +89,6 @@ private:
QmlObjectListModel* _vehiclePolygons;*/
WimaVCorridor
*
_vehicleCorridor
;
QGCMapPolygon
_borderPolygon
;
};
src/Wima/WimaServiceArea.cc
View file @
6256464b
...
...
@@ -2,14 +2,20 @@
const
char
*
WimaServiceArea
::
wimaServiceAreaName
=
"Service Area"
;
WimaServiceArea
::
WimaServiceArea
(
QObject
*
parent
)
:
WimaServiceArea
(
nullptr
,
parent
)
WimaServiceArea
::
WimaServiceArea
(
)
:
WimaServiceArea
(
nullptr
)
{
}
WimaServiceArea
::
WimaServiceArea
(
WimaArea
*
other
,
QObject
*
parent
)
:
WimaArea
(
other
,
parent
)
WimaServiceArea
::
WimaServiceArea
(
QObject
*
parent
)
:
WimaArea
(
parent
)
{
this
->
setObjectName
(
wimaServiceAreaName
);
}
WimaServiceArea
::
WimaServiceArea
(
const
WimaArea
&
other
,
QObject
*
parent
)
:
WimaArea
(
other
,
parent
)
{
this
->
setObjectName
(
wimaServiceAreaName
);
}
...
...
src/Wima/WimaServiceArea.h
View file @
6256464b
...
...
@@ -8,8 +8,9 @@ class WimaServiceArea : public WimaArea
{
Q_OBJECT
public:
WimaServiceArea
(
QObject
*
parent
=
nullptr
);
WimaServiceArea
(
WimaArea
*
other
=
nullptr
,
QObject
*
parent
=
nullptr
);
WimaServiceArea
();
WimaServiceArea
(
QObject
*
parent
);
WimaServiceArea
(
const
WimaArea
&
other
,
QObject
*
parent
);
Q_PROPERTY
(
const
QGeoCoordinate
&
takeOffPosition
READ
takeOffPosition
WRITE
setTakeOffPosition
NOTIFY
takeOffPositionChanged
)
Q_PROPERTY
(
const
QGeoCoordinate
&
landPosition
READ
landPosition
WRITE
setLandPosition
NOTIFY
landPositionChanged
)
...
...
@@ -22,7 +23,7 @@ public:
// Property acessors
const
QGeoCoordinate
&
takeOffPosition
(
void
)
const
{
return
_takeOffPosition
;}
const
QGeoCoordinate
&
landPosition
(
void
)
const
{
return
_landPosition
;}
WimaVCorridor
&
vehicleCorridor
(
void
)
const
{
return
*
_vehicleCorridor
;}
WimaVCorridor
*
vehicleCorridor
(
void
)
const
{
return
_vehicleCorridor
;}
// Property setters
...
...
src/Wima/WimaVCorridor.cc
View file @
6256464b
...
...
@@ -2,16 +2,24 @@
const
char
*
WimaVCorridor
::
wimaVCorridorName
=
"Corridor"
;
WimaVCorridor
::
WimaVCorridor
(
QObject
*
parent
)
:
WimaVCorridor
(
nullptr
,
parent
)
WimaVCorridor
::
WimaVCorridor
(
)
:
WimaVCorridor
(
nullptr
)
{
}
WimaVCorridor
::
WimaVCorridor
(
WimaArea
*
other
,
QObject
*
parent
)
:
WimaArea
(
other
,
parent
)
,
_serviceArea
(
nullptr
)
,
_opArea
(
nullptr
)
WimaVCorridor
::
WimaVCorridor
(
QObject
*
parent
)
:
WimaArea
(
parent
)
,
_serviceArea
(
nullptr
)
,
_opArea
(
nullptr
)
{
this
->
setObjectName
(
wimaVCorridorName
);
}
WimaVCorridor
::
WimaVCorridor
(
const
WimaArea
&
other
,
QObject
*
parent
)
:
WimaArea
(
other
,
parent
)
,
_serviceArea
(
nullptr
)
,
_opArea
(
nullptr
)
{
this
->
setObjectName
(
wimaVCorridorName
);
}
...
...
src/Wima/WimaVCorridor.h
View file @
6256464b
...
...
@@ -9,8 +9,9 @@ class WimaVCorridor : public WimaArea
{
Q_OBJECT
public:
WimaVCorridor
(
QObject
*
parent
=
nullptr
);
WimaVCorridor
(
WimaArea
*
other
=
nullptr
,
QObject
*
parent
=
nullptr
);
WimaVCorridor
();
WimaVCorridor
(
QObject
*
parent
);
WimaVCorridor
(
const
WimaArea
&
other
,
QObject
*
parent
);
// Overrides from WimaPolygon
QString
mapVisualQML
(
void
)
const
{
return
"WimaVCorridorMapVisual.qml"
;}
...
...
@@ -19,8 +20,8 @@ public:
// Methodes
void
setServiceArea
(
WimaServiceArea
&
serviceArea
);
void
setOpArea
(
WimaGOperationArea
&
opArea
);
WimaServiceArea
&
serviceArea
(
void
)
const
{
return
*
_serviceArea
;}
WimaGOperationArea
&
opArea
(
void
)
const
{
return
*
_opArea
;}
WimaServiceArea
*
serviceArea
(
void
)
const
{
return
_serviceArea
;}
WimaGOperationArea
*
opArea
(
void
)
const
{
return
_opArea
;}
void
saveToJson
(
QJsonObject
&
json
);
bool
loadFromJson
(
const
QJsonObject
&
json
,
QString
&
errorString
);
...
...
src/WimaView/WimaGOperationAreaEditor.qml
View file @
6256464b
...
...
@@ -27,21 +27,21 @@ Rectangle {
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_fieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10.5
property
var
polyline
:
areaItem
.
polyline
property
bool
polylineInteractive
:
polyline
.
interactive
//
property var polyline: areaItem.polyline
//
property bool polylineInteractive: polyline.interactive
property
bool
polygonInteractive
:
areaItem
.
interactive
property
var
polygon
:
areaItem
property
bool
initNecesarry
:
true
onPolylineInteractiveChanged
:
{
/*
onPolylineInteractiveChanged: {
polyline.interactive = polylineInteractive;
}
}
*/
onPolygonInteractiveChanged
:
{
polygon
.
interactive
=
polygonInteractive
;
}
function
editPolyline
(){
/*
function editPolyline(){
if (polylineInteractive){
//polyline.interactive = false;
polylineInteractive = false;
...
...
@@ -51,7 +51,7 @@ Rectangle {
polylineInteractive = true;
//polygonInteractive = false;
}
}
}
*/
...
...
@@ -120,7 +120,7 @@ Rectangle {
width
:
1
}
}
// Column - Settings
SectionHeader
{
/*
SectionHeader {
id: polylineHeader
text: qsTr("Gateway Poly Line")
}
...
...
@@ -143,7 +143,7 @@ Rectangle {
text: "Swap End-Points"
onClicked: polyline.swapEndPoints()
}
}
*/
SectionHeader
{
id
:
statsHeader
...
...
src/WimaView/WimaGOperationAreaMapVisual.qml
View file @
6256464b
...
...
@@ -27,7 +27,6 @@ Item {
property
var
areaItem
:
object
property
var
_polygon
:
areaItem
property
var
_polyline
:
areaItem
.
polyline
property
var
_borderPolygon
:
areaItem
.
borderPolygon
signal
clicked
(
int
sequenceNumber
)
...
...
@@ -64,16 +63,16 @@ Item {
}
}
function
_addInitialPolyline
(){
/*
function _addInitialPolyline(){
_polyline.setStartVertexIndex(0);
_polyline.setEndVertexIndex(1);
}
}
*/
Component.onCompleted
:
{
_addInitialPolygon
()
_addInitialPolyline
()
//
_addInitialPolyline()
}
Component.onDestruction
:
{
...
...
@@ -101,7 +100,7 @@ Item {
}
WimaMapPolylineVisuals
{
/*
WimaMapPolylineVisuals {
qgcView: _root.qgcView
mapControl: map
mapPolyline: _polyline
...
...
@@ -110,6 +109,6 @@ Item {
enableSplitHandels: false
enableDragHandels: true
edgeHandelsOnly: true
}
}
*/
}
src/WimaView/WimaServiceAreaEditor.qml
View file @
6256464b
...
...
@@ -27,21 +27,21 @@ Rectangle {
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_fieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
10.5
property
var
polyline
:
areaItem
.
polyline
property
bool
polylineInteractive
:
polyline
.
interactive
//
property var polyline: areaItem.polyline
//
property bool polylineInteractive: polyline.interactive
property
bool
polygonInteractive
:
areaItem
.
interactive
property
var
polygon
:
areaItem
property
bool
initNecesarry
:
true
onPolylineInteractiveChanged
:
{
/*
onPolylineInteractiveChanged: {
polyline.interactive = polylineInteractive;
}
}
*/
onPolygonInteractiveChanged
:
{
polygon
.
interactive
=
polygonInteractive
;
}
function
editPolyline
(){
/*
function editPolyline(){
if (polylineInteractive){
//polyline.interactive = false;
polylineInteractive = false;
...
...
@@ -51,7 +51,7 @@ Rectangle {
polylineInteractive = true;
//polygonInteractive = false;
}
}
}
*/
...
...
@@ -112,7 +112,7 @@ Rectangle {
width
:
1
}
}
// Column - Scan
SectionHeader
{
/*
SectionHeader {
id: polylineHeader
text: qsTr("Gateway Poly Line")
}
...
...
@@ -135,7 +135,7 @@ Rectangle {
text: "Swap End-Points"
onClicked: polyline.swapEndPoints()
}
}
*/
SectionHeader
{
id
:
statsHeader
...
...
src/WimaView/WimaServiceAreaMapVisual.qml
View file @
6256464b
...
...
@@ -27,7 +27,7 @@ Item {
property
var
areaItem
:
object
property
var
_polygon
:
areaItem
property
var
_polyline
:
areaItem
.
polyline
//
property var _polyline: areaItem.polyline
signal
clicked
(
int
sequenceNumber
)
...
...
@@ -63,16 +63,16 @@ Item {
}
}
function
_addInitialPolyline
(){
/*
function _addInitialPolyline(){
_polyline.setStartVertexIndex(0);
_polyline.setEndVertexIndex(1);
}
}
*/
Component.onCompleted
:
{
_addInitialPolygon
()
_addInitialPolyline
()
//
_addInitialPolyline()
}
Component.onDestruction
:
{
...
...
@@ -88,7 +88,7 @@ Item {
interiorOpacity
:
0.25
}
WimaMapPolylineVisuals
{
/*
WimaMapPolylineVisuals {
qgcView: _root.qgcView
mapControl: map
mapPolyline: _polyline
...
...
@@ -97,5 +97,5 @@ Item {
enableSplitHandels: false
enableDragHandels: true
edgeHandelsOnly: true
}
}
*/
}
src/WimaView/WimaView.qml
View file @
6256464b
...
...
@@ -96,7 +96,7 @@ QGCView {
MapFitFunctions
{
id
:
mapFitFunctions
// The name for this id cannot be changed without breaking references outside of this code. Beware!
map
:
editorMap
usePlannedHomePosition
:
true
usePlannedHomePosition
:
masterController
planMasterController
:
_planMasterController
}
...
...
@@ -177,6 +177,14 @@ QGCView {
wimaController
.
masterController
=
Qt
.
binding
(
function
()
{
return
masterController
})
wimaController
.
missionController
=
Qt
.
binding
(
function
()
{
return
masterController
.
missionController
})
}
function
loadFromSelectedFile
()
{
wimaFileDialog
.
title
=
qsTr
(
"
Select Wima File
"
)
wimaFileDialog
.
selectExisting
=
true
wimaFileDialog
.
nameFilters
=
wimaController
.
loadNameFilters
wimaFileDialog
.
fileExtension
=
wimaController
.
fileExtension
wimaFileDialog
.
openForLoad
()
}
}
PlanMasterController
{
...
...
@@ -318,6 +326,22 @@ QGCView {
}
}
QGCFileDialog
{
id
:
wimaFileDialog
qgcView
:
_qgcView
folder
:
_appSettings
.
missionSavePath
onAcceptedForSave
:
{
wimaController
.
saveToFile
(
file
)
close
()
}
onAcceptedForLoad
:
{
wimaController
.
loadFromFile
(
file
)
close
()
}
}
property
string
polygonSelectPatternFile
Component
{
id
:
patternPolygonSelectDialog
...
...
@@ -559,11 +583,11 @@ QGCView {
color
:
qgcPal
.
window
title
:
qsTr
(
"
Plan
"
)
z
:
QGroundControl
.
zOrderWidgets
showAlternateIcon
:
[
masterController
.
dirty
,
false
,
false
,
false
,
false
,
false
,
false
]
rotateImage
:
[
masterController
.
syncInProgress
,
false
,
false
,
false
,
false
,
false
,
false
]
animateImage
:
[
masterController
.
dirty
,
false
,
false
,
false
,
false
,
false
,
false
]
buttonEnabled
:
[
!
masterController
.
syncInProgress
,
true
,
true
,
true
,
true
,
true
,
true
]
buttonVisible
:
[
true
,
true
,
true
,
true
,
true
,
_showZoom
,
_showZoom
]
showAlternateIcon
:
[
masterController
.
dirty
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
]
rotateImage
:
[
masterController
.
syncInProgress
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
]
animateImage
:
[
masterController
.
dirty
,
false
,
false
,
false
,
false
,
false
,
false
,
false
,
false
]
buttonEnabled
:
[
!
masterController
.
syncInProgress
,
true
,
true
,
true
,
true
,
true
,
true
,
true
,
true
]
buttonVisible
:
[
true
,
true
,
true
,
true
,
true
,
true
,
true
,
_showZoom
,
_showZoom
]
maxHeight
:
mapScale
.
y
-
toolStrip
.
y
property
bool
_showZoom
:
!
ScreenTools
.
isMobile
...
...
@@ -1003,7 +1027,7 @@ QGCView {
id
:
columnHolder
spacing
:
_margin
property
string
_overwriteText
:
(
_editingLayer
==
_layerMission
)
?
qsTr
(
"
Mission overwrite
"
)
:
((
_editingLayer
==
_layerGeoFence
)
?
qsTr
(
"
GeoFence overwrite
"
)
:
qsTr
(
"
Rally Points overwrite
"
)
)
property
string
_overwriteText
:
qsTr
(
"
Mission overwrite
"
)
QGCLabel
{
width
:
sendSaveGrid
.
width
...
...
@@ -1142,6 +1166,8 @@ QGCView {
Rectangle
{
id
:
debugMessageWindow
visible
:
false
anchors.bottom
:
parent
.
bottom
width
:
parent
.
width
*
0.7
x
:
(
parent
.
width
-
width
)
/
2
...
...
@@ -1170,9 +1196,4 @@ QGCView {
}
}
}
// QGCVIew
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