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
f1e3b187
Commit
f1e3b187
authored
Jan 05, 2019
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
fe691f5c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
209 additions
and
240 deletions
+209
-240
GeoFenceEditor.qml
src/PlanView/GeoFenceEditor.qml
+209
-240
No files found.
src/PlanView/GeoFenceEditor.qml
View file @
f1e3b187
...
...
@@ -10,13 +10,9 @@ import QGroundControl.FactControls 1.0
QGCFlickable
{
id
:
root
width
:
availableWidth
height
:
availableHeight
contentHeight
:
editorColumn
.
height
contentHeight
:
geoFenceEditorRect
.
height
clip
:
true
property
real
availableWidth
property
real
availableHeight
property
var
myGeoFenceController
property
var
flightMap
...
...
@@ -24,317 +20,290 @@ QGCFlickable {
readonly
property
real
_margin
:
ScreenTools
.
defaultFontPixelWidth
/
2
readonly
property
real
_radius
:
ScreenTools
.
defaultFontPixelWidth
/
2
Column
{
id
:
editorColumn
Rectangle
{
id
:
geoFenceEditorRect
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
geoFenceItems
.
y
+
geoFenceItems
.
height
+
(
_margin
*
2
)
radius
:
_radius
color
:
qgcPal
.
missionItemEditor
QGCLabel
{
id
:
geoFenceLabel
anchors.margins
:
_margin
anchors.left
:
parent
.
left
anchors.top
:
parent
.
top
text
:
qsTr
(
"
GeoFence
"
)
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
}
Rectangle
{
id
:
geoFenceEditorRect
width
:
parent
.
width
height
:
geoFenceItems
.
y
+
geoFenceItems
.
height
+
(
_margin
*
2
)
radius
:
_radius
color
:
qgcPal
.
missionItemEditor
QGCLabel
{
id
:
geoFenceLabel
id
:
geoFenceItems
anchors.margins
:
_margin
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
geoFenceLabel
.
bottom
height
:
fenceColumn
.
y
+
fenceColumn
.
height
+
(
_margin
*
2
)
color
:
qgcPal
.
windowShadeDark
radius
:
_radius
Column
{
id
:
fenceColumn
anchors.margins
:
_margin
anchors.left
:
parent
.
left
anchors.top
:
parent
.
top
text
:
qsTr
(
"
GeoFence
"
)
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
}
Rectangle
{
id
:
geoFenceItems
anchors.margins
:
_margin
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
geoFenceLabel
.
bottom
height
:
fenceColumn
.
y
+
fenceColumn
.
height
+
(
_margin
*
2
)
color
:
qgcPal
.
windowShadeDark
radius
:
_radius
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
Column
{
id
:
fenceColumn
anchors.margins
:
_margin
anchors.top
:
parent
.
top
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
wrapMode
:
Text
.
WordWrap
font.pointSize
:
myGeoFenceController
.
supported
?
ScreenTools
.
smallFontPointSize
:
ScreenTools
.
defaultFontPointSize
text
:
myGeoFenceController
.
supported
?
qsTr
(
"
GeoFencing allows you to set a virtual ‘fence’ around the area you want to fly in.
"
)
:
qsTr
(
"
This vehicle does not support GeoFence.
"
)
}
wrapMode
:
Text
.
WordWrap
font.pointSize
:
myGeoFenceController
.
supported
?
ScreenTools
.
smallFontPointSize
:
ScreenTools
.
defaultFontPointSize
text
:
myGeoFenceController
.
supported
?
qsTr
(
"
GeoFencing allows you to set a virtual ‘fence’ around the area you want to fly in.
"
)
:
qsTr
(
"
This vehicle does not support GeoFence.
"
)
}
Column
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
visible
:
myGeoFenceController
.
supported
Column
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
2
visible
:
myGeoFenceController
.
supported
Repeater
{
model
:
myGeoFenceController
.
params
Repeater
{
model
:
myGeoFenceController
.
params
Item
{
width
:
fenceColumn
.
width
height
:
textField
.
height
Item
{
width
:
fenceColumn
.
width
height
:
textField
.
height
property
bool
showCombo
:
modelData
.
enumStrings
.
length
>
0
property
bool
showCombo
:
modelData
.
enumStrings
.
length
>
0
QGCLabel
{
id
:
textFieldLabel
anchors.baseline
:
textField
.
baseline
text
:
myGeoFenceController
.
paramLabels
[
index
]
}
QGCLabel
{
id
:
textFieldLabel
anchors.baseline
:
textField
.
baseline
text
:
myGeoFenceController
.
paramLabels
[
index
]
}
FactTextField
{
id
:
textField
anchors.right
:
parent
.
right
width
:
_editFieldWidth
showUnits
:
true
fact
:
modelData
visible
:
!
parent
.
showCombo
}
FactTextField
{
id
:
textField
anchors.right
:
parent
.
right
width
:
_editFieldWidth
showUnits
:
true
fact
:
modelData
visible
:
!
parent
.
showCombo
}
FactComboBox
{
id
:
comboField
anchors.right
:
parent
.
right
width
:
_editFieldWidth
indexModel
:
false
fact
:
showCombo
?
modelData
:
_nullFact
visible
:
parent
.
showCombo
FactComboBox
{
id
:
comboField
anchors.right
:
parent
.
right
width
:
_editFieldWidth
indexModel
:
false
fact
:
showCombo
?
modelData
:
_nullFact
visible
:
parent
.
showCombo
property
var
_nullFact
:
Fact
{
}
}
property
var
_nullFact
:
Fact
{
}
}
}
}
SectionHeader
{
id
:
insertSection
text
:
qsTr
(
"
Insert GeoFence
"
)
}
SectionHeader
{
id
:
insertSection
text
:
qsTr
(
"
Insert GeoFence
"
)
}
QGCButton
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
text
:
qsTr
(
"
Polygon Fence
"
)
QGCButton
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
text
:
qsTr
(
"
Polygon Fence
"
)
onClicked
:
{
var
rect
=
Qt
.
rect
(
flightMap
.
centerViewport
.
x
,
flightMap
.
centerViewport
.
y
,
flightMap
.
centerViewport
.
width
,
flightMap
.
centerViewport
.
height
)
var
topLeftCoord
=
flightMap
.
toCoordinate
(
Qt
.
point
(
rect
.
x
,
rect
.
y
),
false
/* clipToViewPort */
)
var
bottomRightCoord
=
flightMap
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
rect
.
width
,
rect
.
y
+
rect
.
height
),
false
/* clipToViewPort */
)
myGeoFenceController
.
addInclusionPolygon
(
topLeftCoord
,
bottomRightCoord
)
}
onClicked
:
{
var
rect
=
Qt
.
rect
(
flightMap
.
centerViewport
.
x
,
flightMap
.
centerViewport
.
y
,
flightMap
.
centerViewport
.
width
,
flightMap
.
centerViewport
.
height
)
var
topLeftCoord
=
flightMap
.
toCoordinate
(
Qt
.
point
(
rect
.
x
,
rect
.
y
),
false
/* clipToViewPort */
)
var
bottomRightCoord
=
flightMap
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
rect
.
width
,
rect
.
y
+
rect
.
height
),
false
/* clipToViewPort */
)
myGeoFenceController
.
addInclusionPolygon
(
topLeftCoord
,
bottomRightCoord
)
}
}
QGCButton
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
text
:
qsTr
(
"
Circular Fence
"
)
QGCButton
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
text
:
qsTr
(
"
Circular Fence
"
)
onClicked
:
{
var
rect
=
Qt
.
rect
(
flightMap
.
centerViewport
.
x
,
flightMap
.
centerViewport
.
y
,
flightMap
.
centerViewport
.
width
,
flightMap
.
centerViewport
.
height
)
var
topLeftCoord
=
flightMap
.
toCoordinate
(
Qt
.
point
(
rect
.
x
,
rect
.
y
),
false
/* clipToViewPort */
)
var
bottomRightCoord
=
flightMap
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
rect
.
width
,
rect
.
y
+
rect
.
height
),
false
/* clipToViewPort */
)
myGeoFenceController
.
addInclusionCircle
(
topLeftCoord
,
bottomRightCoord
)
}
onClicked
:
{
var
rect
=
Qt
.
rect
(
flightMap
.
centerViewport
.
x
,
flightMap
.
centerViewport
.
y
,
flightMap
.
centerViewport
.
width
,
flightMap
.
centerViewport
.
height
)
var
topLeftCoord
=
flightMap
.
toCoordinate
(
Qt
.
point
(
rect
.
x
,
rect
.
y
),
false
/* clipToViewPort */
)
var
bottomRightCoord
=
flightMap
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
rect
.
width
,
rect
.
y
+
rect
.
height
),
false
/* clipToViewPort */
)
myGeoFenceController
.
addInclusionCircle
(
topLeftCoord
,
bottomRightCoord
)
}
}
SectionHeader
{
id
:
polygonSection
text
:
qsTr
(
"
Polygon Fences
"
)
}
SectionHeader
{
id
:
polygonSection
text
:
qsTr
(
"
Polygon Fences
"
)
}
QGCLabel
{
text
:
qsTr
(
"
None
"
)
visible
:
polygonSection
.
checked
&&
myGeoFenceController
.
polygons
.
count
===
0
}
GridLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
columns
:
3
flow
:
GridLayout
.
TopToBottom
visible
:
polygonSection
.
checked
&&
myGeoFenceController
.
polygons
.
count
>
0
QGCLabel
{
text
:
qsTr
(
"
None
"
)
visible
:
polygonSection
.
checked
&&
myGeoFenceController
.
polygons
.
count
===
0
text
:
qsTr
(
"
Inclusion
"
)
Layout.column
:
0
Layout.alignment
:
Qt
.
AlignHCenter
}
GridLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
columns
:
3
flow
:
GridLayout
.
TopToBottom
visible
:
polygonSection
.
checked
&&
myGeoFenceController
.
polygons
.
count
>
0
Repeater
{
model
:
myGeoFenceController
.
polygons
QGC
Label
{
text
:
qsTr
(
"
Inclusion
"
)
Layout.column
:
0
QGC
CheckBox
{
checked
:
object
.
inclusion
onClicked
:
object
.
inclusion
=
checked
Layout.alignment
:
Qt
.
AlignHCenter
}
}
Repeater
{
model
:
myGeoFenceController
.
polygons
QGCLabel
{
text
:
qsTr
(
"
Edit
"
)
Layout.column
:
1
Layout.alignment
:
Qt
.
AlignHCenter
}
QGCCheckBox
{
checked
:
object
.
inclusion
onClicked
:
object
.
inclusion
=
checked
Layout.alignment
:
Qt
.
AlignHCenter
}
}
Repeater
{
model
:
myGeoFenceController
.
polygons
QGCLabel
{
text
:
qsTr
(
"
Edit
"
)
Layout.column
:
1
QGCRadioButton
{
checked
:
_interactive
Layout.alignment
:
Qt
.
AlignHCenter
}
Repeater
{
model
:
myGeoFenceController
.
polygons
QGCRadioButton
{
checked
:
_interactive
Layout.alignment
:
Qt
.
AlignHCenter
property
bool
_interactive
:
object
.
interactive
property
bool
_interactive
:
object
.
interactive
on_InteractiveChanged
:
checked
=
_interactive
on_InteractiveChanged
:
checked
=
_interactive
onClicked
:
{
myGeoFenceController
.
clearAllInteractive
()
object
.
interactive
=
checked
}
onClicked
:
{
myGeoFenceController
.
clearAllInteractive
()
object
.
interactive
=
checked
}
}
}
QGCLabel
{
text
:
qsTr
(
"
Delete
"
)
Layout.column
:
2
Layout.alignment
:
Qt
.
AlignHCenter
}
QGCLabel
{
text
:
qsTr
(
"
Delete
"
)
Layout.column
:
2
Layout.alignment
:
Qt
.
AlignHCenter
}
Repeater
{
model
:
myGeoFenceController
.
polygons
Repeater
{
model
:
myGeoFenceController
.
polygons
QGCColoredImage
{
width
:
ScreenTools
.
defaultFontPixelHeight
height
:
width
sourceSize.height
:
width
source
:
"
/res/XDelete.svg
"
fillMode
:
Image
.
PreserveAspectFit
color
:
qgcPal
.
text
Layout.alignment
:
Qt
.
AlignHCenter
QGCButton
{
text
:
qsTr
(
"
Del
"
)
Layout.alignment
:
Qt
.
AlignHCenter
onClicked
:
myGeoFenceController
.
deletePolygon
(
index
)
}
}
}
// GridLayout
property
int
_polygonIndex
:
index
SectionHeader
{
id
:
circleSection
text
:
qsTr
(
"
Circular Fences
"
)
}
QGCMouseArea
{
fillItem
:
parent
onClicked
:
myGeoFenceController
.
deletePolygon
(
parent
.
_polygonIndex
)
}
}
}
}
// GridLayout
QGCLabel
{
text
:
qsTr
(
"
None
"
)
visible
:
circleSection
.
checked
&&
myGeoFenceController
.
circles
.
count
===
0
}
SectionHeader
{
id
:
circleSection
text
:
qsTr
(
"
Circular Fences
"
)
}
GridLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
columns
:
4
flow
:
GridLayout
.
TopToBottom
visible
:
polygonSection
.
checked
&&
myGeoFenceController
.
circles
.
count
>
0
QGCLabel
{
text
:
qsTr
(
"
None
"
)
visible
:
circleSection
.
checked
&&
myGeoFenceController
.
circles
.
count
===
0
text
:
qsTr
(
"
Inclusion
"
)
Layout.column
:
0
Layout.alignment
:
Qt
.
AlignHCenter
}
GridLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
columns
:
4
flow
:
GridLayout
.
TopToBottom
visible
:
polygonSection
.
checked
&&
myGeoFenceController
.
circles
.
count
>
0
Repeater
{
model
:
myGeoFenceController
.
circles
QGC
Label
{
text
:
qsTr
(
"
Inclusion
"
)
Layout.column
:
0
QGC
CheckBox
{
checked
:
object
.
inclusion
onClicked
:
object
.
inclusion
=
checked
Layout.alignment
:
Qt
.
AlignHCenter
}
}
Repeater
{
model
:
myGeoFenceController
.
circles
QGCLabel
{
text
:
qsTr
(
"
Edit
"
)
Layout.column
:
1
Layout.alignment
:
Qt
.
AlignHCenter
}
QGCCheckBox
{
checked
:
object
.
inclusion
onClicked
:
object
.
inclusion
=
checked
Layout.alignment
:
Qt
.
AlignHCenter
}
}
Repeater
{
model
:
myGeoFenceController
.
circles
QGCLabel
{
text
:
qsTr
(
"
Edit
"
)
Layout.column
:
1
QGCRadioButton
{
checked
:
_interactive
Layout.alignment
:
Qt
.
AlignHCenter
}
Repeater
{
model
:
myGeoFenceController
.
circles
QGCRadioButton
{
checked
:
_interactive
Layout.alignment
:
Qt
.
AlignHCenter
property
bool
_interactive
:
object
.
interactive
property
bool
_interactive
:
object
.
interactive
on_InteractiveChanged
:
checked
=
_
interactive
on_InteractiveChanged
:
checked
=
_interactive
onClicked
:
{
myGeoFenceController
.
clearAllInteractive
()
object
.
interactive
=
checked
}
onClicked
:
{
myGeoFenceController
.
clearAllInteractive
()
object
.
interactive
=
checked
}
}
}
QGCLabel
{
text
:
qsTr
(
"
Radius
"
)
Layout.column
:
2
Layout.alignment
:
Qt
.
AlignHCenter
}
Repeater
{
model
:
myGeoFenceController
.
circles
QGCLabel
{
text
:
qsTr
(
"
Radius
"
)
Layout.column
:
2
Layout.alignment
:
Qt
.
AlignHCenter
}
FactTextField
{
fact
:
object
.
radius
Layout.fillWidth
:
true
Layout.alignment
:
Qt
.
AlignHCenter
}
}
Repeater
{
model
:
myGeoFenceController
.
circles
QGCLabel
{
text
:
qsTr
(
"
Delete
"
)
Layout.
column
:
3
FactTextField
{
fact
:
object
.
radius
Layout.
fillWidth
:
true
Layout.alignment
:
Qt
.
AlignHCenter
}
}
Repeater
{
model
:
myGeoFenceController
.
circles
QGCColoredImage
{
width
:
ScreenTools
.
defaultFontPixelHeight
height
:
width
sourceSize.height
:
width
source
:
"
/res/XDelete.svg
"
fillMode
:
Image
.
PreserveAspectFit
color
:
qgcPal
.
text
Layout.alignment
:
Qt
.
AlignHCenter
QGCLabel
{
text
:
qsTr
(
"
Delete
"
)
Layout.column
:
3
Layout.alignment
:
Qt
.
AlignHCenter
}
property
int
_circleIndex
:
index
Repeater
{
model
:
myGeoFenceController
.
circles
QGCMouseArea
{
fillItem
:
parent
onClicked
:
myGeoFenceController
.
deleteCircle
(
parent
.
_polygonIndex
)
}
}
QGCButton
{
text
:
qsTr
(
"
Del
"
)
Layout.alignment
:
Qt
.
AlignHCenter
onClicked
:
myGeoFenceController
.
deleteCircle
(
index
)
}
}
// GridLayout
}
}
}
// GridLayout
}
}
}
// Rectangle
}
}
}
// Rectangle
}
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