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
ddf64f6f
Commit
ddf64f6f
authored
Mar 20, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
last commit for today
parent
e7ee7d09
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
26 additions
and
106 deletions
+26
-106
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-1
QGCMapPolygonVisuals.qml
src/MissionManager/QGCMapPolygonVisuals.qml
+12
-7
WimaController.h
src/MissionManager/WimaController.h
+1
-0
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+1
-0
FlyAreaMapVisual.qml
src/WimaView/FlyAreaMapVisual.qml
+0
-79
FlyAreaPolygonMapVisual.qml
src/WimaView/FlyAreaPolygonMapVisual.qml
+6
-6
WimaView.qml
src/WimaView/WimaView.qml
+5
-13
No files found.
qgroundcontrol.qrc
View file @
ddf64f6f
...
...
@@ -210,7 +210,7 @@
<file alias="VirtualJoystick.qml">src/FlightDisplay/VirtualJoystick.qml</file>
<file alias="QGroundControl/Controls/WimaToolBar.qml">src/WimaView/WimaToolBar.qml</file>
<file alias="WimaView.qml">src/WimaView/WimaView.qml</file>
<file alias="QGroundControl/
FlightMap/FlyAreaMapVisual.qml">src/WimaView/FlyArea
MapVisual.qml</file>
<file alias="QGroundControl/
Controls/FlyAreaPolygonMapVisual.qml">src/WimaView/FlyAreaPolygon
MapVisual.qml</file>
</qresource>
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
...
...
src/MissionManager/QGCMapPolygonVisuals.qml
View file @
ddf64f6f
...
...
@@ -32,6 +32,7 @@ Item {
property
real
interiorOpacity
:
1
property
int
borderWidth
:
0
property
color
borderColor
:
"
black
"
property
bool
initPolygon
:
false
property
var
_polygonComponent
property
var
_dragHandlesComponent
...
...
@@ -80,17 +81,17 @@ Item {
/// Calculate the default/initial 4 sided polygon
function
defaultPolygonVertices
()
{
// 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
)
var
rect
=
Qt
.
rect
(
map
Control
.
centerViewport
.
x
,
mapControl
.
centerViewport
.
y
,
mapControl
.
centerViewport
.
width
,
mapControl
.
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 */
)
var
centerCoord
=
map
Control
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
(
rect
.
width
/
2
),
rect
.
y
+
(
rect
.
height
/
2
)),
false
/* clipToViewPort */
)
var
topLeftCoord
=
map
Control
.
toCoordinate
(
Qt
.
point
(
rect
.
x
,
rect
.
y
),
false
/* clipToViewPort */
)
var
topRightCoord
=
map
Control
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
rect
.
width
,
rect
.
y
),
false
/* clipToViewPort */
)
var
bottomLeftCoord
=
map
Control
.
toCoordinate
(
Qt
.
point
(
rect
.
x
,
rect
.
y
+
rect
.
height
),
false
/* clipToViewPort */
)
var
bottomRightCoord
=
map
Control
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
rect
.
width
,
rect
.
y
+
rect
.
height
),
false
/* clipToViewPort */
)
// Initial polygon has max width and height of 3000 meters
var
halfWidthMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
topRightCoord
),
3000
)
/
2
...
...
@@ -106,7 +107,7 @@ Item {
/// Add an initial 4 sided polygon
function
addInitialPolygon
()
{
if
(
mapPolygon
.
count
<
3
)
{
initialVertices
=
defaultPolygonVertices
()
var
initialVertices
=
defaultPolygonVertices
()
mapPolygon
.
appendVertex
(
initialVertices
[
0
])
mapPolygon
.
appendVertex
(
initialVertices
[
1
])
mapPolygon
.
appendVertex
(
initialVertices
[
2
])
...
...
@@ -158,6 +159,10 @@ Item {
}
Component.onCompleted
:
{
if
(
initPolygon
){
addInitialPolygon
()
}
addVisuals
()
if
(
interactive
)
{
addHandles
()
...
...
src/MissionManager/WimaController.h
View file @
ddf64f6f
...
...
@@ -20,6 +20,7 @@ public:
//Property Accessors
WimaFlyArea
*
flyArea
(
void
)
{
return
_flyArea
;
}
//QmlObjectListModel* visualItems (void) { return _visualItems; }
QString
QMLView
Q_INVOKABLE
void
start
(
void
);
...
...
src/QmlControls/QGroundControl.Controls.qmldir
View file @
ddf64f6f
...
...
@@ -83,3 +83,4 @@ ToolStrip 1.0 ToolStrip.qml
VehicleRotationCal 1.0 VehicleRotationCal.qml
VehicleSummaryRow 1.0 VehicleSummaryRow.qml
ViewWidget 1.0 ViewWidget.qml
FlyAreaPolygonMapVisual 1.0 FlyAreaPolygonMapVisual.qml
src/WimaView/FlyAreaMapVisual.qml
deleted
100644 → 0
View file @
e7ee7d09
/****************************************************************************
*
* (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 Map 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
interactive
:
true
borderWidth
:
1
borderColor
:
"
black
"
interiorColor
:
"
green
"
interiorOpacity
:
0.25
}
}
src/WimaView/FlyAreaPolygonMapVisual.qml
View file @
ddf64f6f
...
...
@@ -18,7 +18,7 @@ import QGroundControl.Palette 1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightMap
1.0
///
Survey Complex Mission Item
visuals
///
Fly Area
visuals
Item
{
id
:
_root
...
...
@@ -31,7 +31,7 @@ Item {
/// Add an initial 4 sided polygon if there is none
function
_addInitialPolygon
()
{
if
(
_
structure
Polygon
.
count
<
3
)
{
if
(
_
flyArea
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
...
...
@@ -54,10 +54,10 @@ Item {
bottomLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
bottomRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
_
structure
Polygon
.
appendVertex
(
topLeftCoord
)
_
structure
Polygon
.
appendVertex
(
topRightCoord
)
_
structure
Polygon
.
appendVertex
(
bottomRightCoord
)
_
structure
Polygon
.
appendVertex
(
bottomLeftCoord
)
_
flyArea
Polygon
.
appendVertex
(
topLeftCoord
)
_
flyArea
Polygon
.
appendVertex
(
topRightCoord
)
_
flyArea
Polygon
.
appendVertex
(
bottomRightCoord
)
_
flyArea
Polygon
.
appendVertex
(
bottomLeftCoord
)
}
}
...
...
src/WimaView/WimaView.qml
View file @
ddf64f6f
...
...
@@ -539,19 +539,11 @@ QGCView {
//Add fly area
Repeater
{
model
:
_flyArea
.
polygons
delegate
:
QGCMapPolygonVisuals
{
qgcView
:
_qgcView
///< QGCView for popping dialogs
mapControl
:
editorMap
///< Map control to place item in
mapPolygon
:
object
interiorColor
:
"
green
"
interiorOpacity
:
1
borderWidth
:
1
borderColor
:
"
white
"
Component.onCompleted
:
{
addInitialPolygon
()
}
model
:
_flyArea
.
polygons
delegate
:
FlyAreaPolygonMapVisual
{
map
:
editorMap
///< Map control to place item in
qgcView
:
_qgcView
///< QGCView to use for popping dialogs
_flyAreaPolygon
:
object
}
onItemAdded
:
{
...
...
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