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
d9eb34d1
Unverified
Commit
d9eb34d1
authored
Oct 05, 2019
by
Don Gagne
Committed by
GitHub
Oct 05, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7873 from DonLakeFlyer/CorridorTools
Corridor edit toolbar
parents
9276e165
127b6740
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
444 additions
and
296 deletions
+444
-296
ChangeLog.md
ChangeLog.md
+1
-0
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
QGCMapPolygonVisuals.qml
src/MissionManager/QGCMapPolygonVisuals.qml
+40
-92
QGCMapPolyline.cc
src/MissionManager/QGCMapPolyline.cc
+44
-5
QGCMapPolyline.h
src/MissionManager/QGCMapPolyline.h
+14
-5
QGCMapPolylineVisuals.qml
src/MissionManager/QGCMapPolylineVisuals.qml
+118
-59
CorridorScanEditor.qml
src/PlanView/CorridorScanEditor.qml
+152
-133
CorridorScanMapVisual.qml
src/PlanView/CorridorScanMapVisual.qml
+0
-2
PlanEditToolbar.qml
src/PlanView/PlanEditToolbar.qml
+73
-0
qmldir
src/QmlControls/QGroundControl/Controls/qmldir
+1
-0
No files found.
ChangeLog.md
View file @
d9eb34d1
...
@@ -6,6 +6,7 @@ Note: This file only contains high level features or important fixes.
...
@@ -6,6 +6,7 @@ Note: This file only contains high level features or important fixes.
### 3.6.0 - Daily Build
### 3.6.0 - Daily Build
*
New Corridor editing tools ui. Includes ability to trace polyline by clicking.
*
New Polygon editing tools ui. Includes ability to trace polygon by clicking.
*
New Polygon editing tools ui. Includes ability to trace polygon by clicking.
*
ArduCopter/Rover: Follow Me setup page
*
ArduCopter/Rover: Follow Me setup page
*
More performant flight path display algorithm. Mobile builds no longer show limited path length.
*
More performant flight path display algorithm. Mobile builds no longer show limited path length.
...
...
qgroundcontrol.qrc
View file @
d9eb34d1
...
@@ -101,6 +101,7 @@
...
@@ -101,6 +101,7 @@
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file>
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
<file alias="QGroundControl/Controls/PIDTuning.qml">src/QmlControls/PIDTuning.qml</file>
<file alias="QGroundControl/Controls/PIDTuning.qml">src/QmlControls/PIDTuning.qml</file>
<file alias="QGroundControl/Controls/PlanEditToolbar.qml">src/PlanView/PlanEditToolbar.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckButton.qml">src/QmlControls/PreFlightCheckButton.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckButton.qml">src/QmlControls/PreFlightCheckButton.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckGroup.qml">src/QmlControls/PreFlightCheckGroup.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckGroup.qml">src/QmlControls/PreFlightCheckGroup.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckModel.qml">src/QmlControls/PreFlightCheckModel.qml</file>
<file alias="QGroundControl/Controls/PreFlightCheckModel.qml">src/QmlControls/PreFlightCheckModel.qml</file>
...
...
src/MissionManager/QGCMapPolygonVisuals.qml
View file @
d9eb34d1
...
@@ -71,9 +71,9 @@ Item {
...
@@ -71,9 +71,9 @@ Item {
}
}
function
addToolVisuals
()
{
function
addTool
bar
Visuals
()
{
if
(
_objMgrToolVisuals
.
empty
)
{
if
(
_objMgrToolVisuals
.
empty
)
{
_objMgrToolVisuals
.
createObject
(
editHeade
rComponent
,
mapControl
)
_objMgrToolVisuals
.
createObject
(
toolba
rComponent
,
mapControl
)
}
}
}
}
...
@@ -155,7 +155,7 @@ Item {
...
@@ -155,7 +155,7 @@ Item {
function
_handleInteractiveChanged
()
{
function
_handleInteractiveChanged
()
{
if
(
interactive
)
{
if
(
interactive
)
{
addEditingVisuals
()
addEditingVisuals
()
addToolVisuals
()
addTool
bar
Visuals
()
}
else
{
}
else
{
_traceMode
=
false
_traceMode
=
false
removeEditingVisuals
()
removeEditingVisuals
()
...
@@ -513,73 +513,53 @@ Item {
...
@@ -513,73 +513,53 @@ Item {
}
}
Component
{
Component
{
id
:
editHeade
rComponent
id
:
toolba
rComponent
Item
{
PlanEditToolbar
{
x
:
mapControl
.
centerViewport
.
left
+
_viewportMargins
x
:
mapControl
.
centerViewport
.
left
+
_margins
y
:
mapControl
.
centerViewport
.
top
+
_viewportMargins
y
:
mapControl
.
centerViewport
.
top
+
_margins
width
:
mapControl
.
centerViewport
.
width
-
(
_viewportMargins
*
2
)
width
:
mapControl
.
centerViewport
.
width
-
(
_margins
*
2
)
height
:
editHeaderRowLayout
.
y
+
editHeaderRowLayout
.
height
+
_viewportMargins
z
:
QGroundControl
.
zOrderMapItems
+
2
z
:
QGroundControl
.
zOrderMapItems
+
2
property
real
_radius
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
property
real
_viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
Rectangle
{
QGCButton
{
anchors.fill
:
parent
_horizontalPadding
:
0
radius
:
_radius
text
:
qsTr
(
"
Basic Polygon
"
)
color
:
"
white
"
visible
:
!
_traceMode
o
pacity
:
0.75
o
nClicked
:
_resetPolygon
()
}
}
RowLayout
{
QGCButton
{
id
:
editHeaderRowLayout
_horizontalPadding
:
0
anchors.margins
:
_viewportMargins
text
:
qsTr
(
"
Circular Polygon
"
)
anchors.top
:
parent
.
top
visible
:
!
_traceMode
anchors.left
:
parent
.
left
onClicked
:
_resetCircle
()
anchors.right
:
parent
.
right
}
QGCButton
{
text
:
qsTr
(
"
Basic Polygon
"
)
visible
:
!
_traceMode
onClicked
:
_resetPolygon
()
}
QGCButton
{
text
:
qsTr
(
"
Circular Polygon
"
)
visible
:
!
_traceMode
onClicked
:
_resetCircle
()
}
QGCButton
{
QGCButton
{
text
:
_traceMode
?
qsTr
(
"
Done Tracing
"
)
:
qsTr
(
"
Trace Polygon
"
)
_horizontalPadding
:
0
onClicked
:
{
text
:
_traceMode
?
qsTr
(
"
Done Tracing
"
)
:
qsTr
(
"
Trace Polygon
"
)
if
(
_traceMode
)
{
onClicked
:
{
if
(
mapPolygon
.
count
<
3
)
{
if
(
_traceMode
)
{
_restorePreviousVertices
()
if
(
mapPolygon
.
count
<
3
)
{
}
_restorePreviousVertices
()
_traceMode
=
false
}
else
{
_saveCurrentVertices
()
_circleMode
=
false
_traceMode
=
true
mapPolygon
.
clear
();
}
}
_traceMode
=
false
}
else
{
_saveCurrentVertices
()
_circleMode
=
false
_traceMode
=
true
mapPolygon
.
clear
();
}
}
}
}
}
QGCButton
{
QGCButton
{
text
:
qsTr
(
"
Load KML/SHP...
"
)
_horizontalPadding
:
0
onClicked
:
kmlOrSHPLoadDialog
.
openForLoad
()
text
:
qsTr
(
"
Load KML/SHP...
"
)
visible
:
!
_traceMode
onClicked
:
kmlOrSHPLoadDialog
.
openForLoad
()
}
visible
:
!
_traceMode
QGCLabel
{
id
:
instructionLabel
color
:
"
black
"
text
:
_instructionText
Layout.fillWidth
:
true
}
}
}
}
}
}
}
...
@@ -589,7 +569,7 @@ Item {
...
@@ -589,7 +569,7 @@ Item {
id
:
traceMouseAreaComponent
id
:
traceMouseAreaComponent
MouseArea
{
MouseArea
{
anchors.fill
:
map
anchors.fill
:
map
Control
preventStealing
:
true
preventStealing
:
true
z
:
QGroundControl
.
zOrderMapItems
+
1
// Over item indicators
z
:
QGroundControl
.
zOrderMapItems
+
1
// Over item indicators
...
@@ -640,38 +620,6 @@ Item {
...
@@ -640,38 +620,6 @@ Item {
_lastRadius
=
radius
_lastRadius
=
radius
}
}
}
}
/*
onItemCoordinateChanged: delayTimer.radius = mapPolygon.center.distanceTo(itemCoordinate)
onDragStart: delayTimer.start()
onDragStop: { delayTimer.stop(); delayTimer.update() }
// Use a delayed update to increase performance of redraw while dragging
Timer {
id: delayTimer
interval: 100
repeat: true
property real radius
property real _lastRadius
onRadiusChanged: console.log(radius)
function update() {
// Prevent signalling re-entrancy
if (!_circleRadiusDrag && radius != _lastRadius) {
_circleRadiusDrag = true
_createCircularPolygon(mapPolygon.center, radius)
_circleRadiusDragCoord = itemCoordinate
_circleRadiusDrag = false
_lastRadius = radius
}
}
onTriggered: update()
}
*/
}
}
}
}
...
...
src/MissionManager/QGCMapPolyline.cc
View file @
d9eb34d1
...
@@ -27,6 +27,7 @@ QGCMapPolyline::QGCMapPolyline(QObject* parent)
...
@@ -27,6 +27,7 @@ QGCMapPolyline::QGCMapPolyline(QObject* parent)
:
QObject
(
parent
)
:
QObject
(
parent
)
,
_dirty
(
false
)
,
_dirty
(
false
)
,
_interactive
(
false
)
,
_interactive
(
false
)
,
_resetActive
(
false
)
{
{
_init
();
_init
();
}
}
...
@@ -35,6 +36,7 @@ QGCMapPolyline::QGCMapPolyline(const QGCMapPolyline& other, QObject* parent)
...
@@ -35,6 +36,7 @@ QGCMapPolyline::QGCMapPolyline(const QGCMapPolyline& other, QObject* parent)
:
QObject
(
parent
)
:
QObject
(
parent
)
,
_dirty
(
false
)
,
_dirty
(
false
)
,
_interactive
(
false
)
,
_interactive
(
false
)
,
_resetActive
(
false
)
{
{
*
this
=
other
;
*
this
=
other
;
...
@@ -118,6 +120,8 @@ QPointF QGCMapPolyline::_pointFFromCoord(const QGeoCoordinate& coordinate) const
...
@@ -118,6 +120,8 @@ QPointF QGCMapPolyline::_pointFFromCoord(const QGeoCoordinate& coordinate) const
void
QGCMapPolyline
::
setPath
(
const
QList
<
QGeoCoordinate
>&
path
)
void
QGCMapPolyline
::
setPath
(
const
QList
<
QGeoCoordinate
>&
path
)
{
{
_beginResetIfNotActive
();
_polylinePath
.
clear
();
_polylinePath
.
clear
();
_polylineModel
.
clearAndDeleteContents
();
_polylineModel
.
clearAndDeleteContents
();
for
(
const
QGeoCoordinate
&
coord
:
path
)
{
for
(
const
QGeoCoordinate
&
coord
:
path
)
{
...
@@ -126,20 +130,22 @@ void QGCMapPolyline::setPath(const QList<QGeoCoordinate>& path)
...
@@ -126,20 +130,22 @@ void QGCMapPolyline::setPath(const QList<QGeoCoordinate>& path)
}
}
setDirty
(
true
);
setDirty
(
true
);
emit
pathChanged
();
_endResetIfNotActive
();
}
}
void
QGCMapPolyline
::
setPath
(
const
QVariantList
&
path
)
void
QGCMapPolyline
::
setPath
(
const
QVariantList
&
path
)
{
{
_
polylinePath
=
path
;
_
beginResetIfNotActive
()
;
_polylinePath
=
path
;
_polylineModel
.
clearAndDeleteContents
();
_polylineModel
.
clearAndDeleteContents
();
for
(
int
i
=
0
;
i
<
_polylinePath
.
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
_polylinePath
.
count
();
i
++
)
{
_polylineModel
.
append
(
new
QGCQGeoCoordinate
(
_polylinePath
[
i
].
value
<
QGeoCoordinate
>
(),
this
));
_polylineModel
.
append
(
new
QGCQGeoCoordinate
(
_polylinePath
[
i
].
value
<
QGeoCoordinate
>
(),
this
));
}
}
setDirty
(
true
);
setDirty
(
true
);
emit
pathChanged
();
_endResetIfNotActive
();
}
}
...
@@ -339,6 +345,8 @@ QList<QGeoCoordinate> QGCMapPolyline::offsetPolyline(double distance)
...
@@ -339,6 +345,8 @@ QList<QGeoCoordinate> QGCMapPolyline::offsetPolyline(double distance)
bool
QGCMapPolyline
::
loadKMLFile
(
const
QString
&
kmlFile
)
bool
QGCMapPolyline
::
loadKMLFile
(
const
QString
&
kmlFile
)
{
{
_beginResetIfNotActive
();
QString
errorString
;
QString
errorString
;
QList
<
QGeoCoordinate
>
rgCoords
;
QList
<
QGeoCoordinate
>
rgCoords
;
if
(
!
KMLFileHelper
::
loadPolylineFromFile
(
kmlFile
,
rgCoords
,
errorString
))
{
if
(
!
KMLFileHelper
::
loadPolylineFromFile
(
kmlFile
,
rgCoords
,
errorString
))
{
...
@@ -349,6 +357,8 @@ bool QGCMapPolyline::loadKMLFile(const QString& kmlFile)
...
@@ -349,6 +357,8 @@ bool QGCMapPolyline::loadKMLFile(const QString& kmlFile)
clear
();
clear
();
appendVertices
(
rgCoords
);
appendVertices
(
rgCoords
);
_endResetIfNotActive
();
return
true
;
return
true
;
}
}
...
@@ -380,12 +390,41 @@ double QGCMapPolyline::length(void) const
...
@@ -380,12 +390,41 @@ double QGCMapPolyline::length(void) const
void
QGCMapPolyline
::
appendVertices
(
const
QList
<
QGeoCoordinate
>&
coordinates
)
void
QGCMapPolyline
::
appendVertices
(
const
QList
<
QGeoCoordinate
>&
coordinates
)
{
{
QList
<
QObject
*>
objects
;
_beginResetIfNotActive
()
;
QList
<
QObject
*>
objects
;
for
(
const
QGeoCoordinate
&
coordinate
:
coordinates
)
{
for
(
const
QGeoCoordinate
&
coordinate
:
coordinates
)
{
objects
.
append
(
new
QGCQGeoCoordinate
(
coordinate
,
this
));
objects
.
append
(
new
QGCQGeoCoordinate
(
coordinate
,
this
));
_polylinePath
.
append
(
QVariant
::
fromValue
(
coordinate
));
_polylinePath
.
append
(
QVariant
::
fromValue
(
coordinate
));
}
}
_polylineModel
.
append
(
objects
);
_polylineModel
.
append
(
objects
);
_endResetIfNotActive
();
}
void
QGCMapPolyline
::
beginReset
(
void
)
{
_resetActive
=
true
;
_polylineModel
.
beginReset
();
}
void
QGCMapPolyline
::
endReset
(
void
)
{
_resetActive
=
false
;
_polylineModel
.
endReset
();
emit
pathChanged
();
emit
pathChanged
();
}
}
void
QGCMapPolyline
::
_beginResetIfNotActive
(
void
)
{
if
(
!
_resetActive
)
{
beginReset
();
}
}
void
QGCMapPolyline
::
_endResetIfNotActive
(
void
)
{
if
(
!
_resetActive
)
{
endReset
();
}
}
src/MissionManager/QGCMapPolyline.h
View file @
d9eb34d1
...
@@ -30,6 +30,8 @@ public:
...
@@ -30,6 +30,8 @@ public:
Q_PROPERTY
(
QmlObjectListModel
*
pathModel
READ
qmlPathModel
CONSTANT
)
Q_PROPERTY
(
QmlObjectListModel
*
pathModel
READ
qmlPathModel
CONSTANT
)
Q_PROPERTY
(
bool
dirty
READ
dirty
WRITE
setDirty
NOTIFY
dirtyChanged
)
Q_PROPERTY
(
bool
dirty
READ
dirty
WRITE
setDirty
NOTIFY
dirtyChanged
)
Q_PROPERTY
(
bool
interactive
READ
interactive
WRITE
setInteractive
NOTIFY
interactiveChanged
)
Q_PROPERTY
(
bool
interactive
READ
interactive
WRITE
setInteractive
NOTIFY
interactiveChanged
)
Q_PROPERTY
(
bool
isValid
READ
isValid
NOTIFY
countChanged
)
Q_PROPERTY
(
bool
empty
READ
empty
NOTIFY
countChanged
)
Q_INVOKABLE
void
clear
(
void
);
Q_INVOKABLE
void
clear
(
void
);
Q_INVOKABLE
void
appendVertex
(
const
QGeoCoordinate
&
coordinate
);
Q_INVOKABLE
void
appendVertex
(
const
QGeoCoordinate
&
coordinate
);
...
@@ -52,11 +54,14 @@ public:
...
@@ -52,11 +54,14 @@ public:
/// @return true: success
/// @return true: success
Q_INVOKABLE
bool
loadKMLFile
(
const
QString
&
kmlFile
);
Q_INVOKABLE
bool
loadKMLFile
(
const
QString
&
kmlFile
);
Q_INVOKABLE
void
beginReset
(
void
);
Q_INVOKABLE
void
endReset
(
void
);
/// Returns the path in a list of QGeoCoordinate's format
/// Returns the path in a list of QGeoCoordinate's format
QList
<
QGeoCoordinate
>
coordinateList
(
void
)
const
;
QList
<
QGeoCoordinate
>
coordinateList
(
void
)
const
;
/// Returns the QGeoCoordinate for the vertex specified
/// Returns the QGeoCoordinate for the vertex specified
QGeoCoordinate
vertexCoordinate
(
int
vertex
)
const
;
Q
_INVOKABLE
Q
GeoCoordinate
vertexCoordinate
(
int
vertex
)
const
;
/// Saves the polyline to the json object.
/// Saves the polyline to the json object.
/// @param json Json object to save to
/// @param json Json object to save to
...
@@ -76,12 +81,13 @@ public:
...
@@ -76,12 +81,13 @@ public:
double
length
(
void
)
const
;
double
length
(
void
)
const
;
// Property methods
// Property methods
int
count
(
void
)
const
{
return
_polylinePath
.
count
();
}
int
count
(
void
)
const
{
return
_polylinePath
.
count
();
}
bool
dirty
(
void
)
const
{
return
_dirty
;
}
bool
dirty
(
void
)
const
{
return
_dirty
;
}
void
setDirty
(
bool
dirty
);
void
setDirty
(
bool
dirty
);
bool
interactive
(
void
)
const
{
return
_interactive
;
}
bool
interactive
(
void
)
const
{
return
_interactive
;
}
QVariantList
path
(
void
)
const
{
return
_polylinePath
;
}
QVariantList
path
(
void
)
const
{
return
_polylinePath
;
}
bool
isValid
(
void
)
const
{
return
_polylineModel
.
count
()
>=
2
;
}
bool
empty
(
void
)
const
{
return
_polylineModel
.
count
()
==
0
;
}
QmlObjectListModel
*
qmlPathModel
(
void
)
{
return
&
_polylineModel
;
}
QmlObjectListModel
*
qmlPathModel
(
void
)
{
return
&
_polylineModel
;
}
QmlObjectListModel
&
pathModel
(
void
)
{
return
_polylineModel
;
}
QmlObjectListModel
&
pathModel
(
void
)
{
return
_polylineModel
;
}
...
@@ -104,12 +110,15 @@ private slots:
...
@@ -104,12 +110,15 @@ private slots:
void
_polylineModelDirtyChanged
(
bool
dirty
);
void
_polylineModelDirtyChanged
(
bool
dirty
);
private:
private:
void
_init
(
void
);
void
_init
(
void
);
QGeoCoordinate
_coordFromPointF
(
const
QPointF
&
point
)
const
;
QGeoCoordinate
_coordFromPointF
(
const
QPointF
&
point
)
const
;
QPointF
_pointFFromCoord
(
const
QGeoCoordinate
&
coordinate
)
const
;
QPointF
_pointFFromCoord
(
const
QGeoCoordinate
&
coordinate
)
const
;
void
_beginResetIfNotActive
(
void
);
void
_endResetIfNotActive
(
void
);
QVariantList
_polylinePath
;
QVariantList
_polylinePath
;
QmlObjectListModel
_polylineModel
;
QmlObjectListModel
_polylineModel
;
bool
_dirty
;
bool
_dirty
;
bool
_interactive
;
bool
_interactive
;
bool
_resetActive
;
};
};
src/MissionManager/QGCMapPolylineVisuals.qml
View file @
d9eb34d1
...
@@ -30,85 +30,92 @@ Item {
...
@@ -30,85 +30,92 @@ Item {
property
int
lineWidth
:
3
property
int
lineWidth
:
3
property
color
lineColor
:
"
#be781c
"
property
color
lineColor
:
"
#be781c
"
property
var
_polylineComponent
property
var
_dragHandlesComponent
property
var
_dragHandlesComponent
property
var
_splitHandlesComponent
property
var
_splitHandlesComponent
property
bool
_traceMode
:
false
property
real
_zorderDragHandle
:
QGroundControl
.
zOrderMapItems
+
3
// Highest to prevent splitting when items overlap
property
string
_instructionText
:
_corridorToolsText
property
real
_zorderSplitHandle
:
QGroundControl
.
zOrderMapItems
+
2
property
real
_zorderDragHandle
:
QGroundControl
.
zOrderMapItems
+
3
// Highest to prevent splitting when items overlap
property
real
_zorderSplitHandle
:
QGroundControl
.
zOrderMapItems
+
2
function
addVisuals
()
{
property
var
_savedVertices
:
[
]
_polylineComponent
=
polylineComponent
.
createObject
(
mapControl
)
mapControl
.
addMapItem
(
_polylineComponent
)
readonly
property
string
_corridorToolsText
:
qsTr
(
"
Corridor Tools
"
)
}
readonly
property
string
_traceText
:
qsTr
(
"
Click in the map to add vertices. Click 'Done Tracing' when finished.
"
)
function
removeVisuals
()
{
function
_addCommonVisuals
()
{
_polylineComponent
.
destroy
()
if
(
_objMgrCommonVisuals
.
empty
)
{
}
_objMgrCommonVisuals
.
createObject
(
polylineComponent
,
mapControl
,
true
)
function
addHandles
()
{
if
(
!
_dragHandlesComponent
)
{
_dragHandlesComponent
=
dragHandlesComponent
.
createObject
(
mapControl
)
_splitHandlesComponent
=
splitHandlesComponent
.
createObject
(
mapControl
)
}
}
}
}
function
removeHandles
()
{
function
_addInteractiveVisuals
()
{
if
(
_dragHandlesComponent
)
{
if
(
_objMgrInteractiveVisuals
.
empty
)
{
_dragHandlesComponent
.
destroy
()
_objMgrInteractiveVisuals
.
createObjects
([
dragHandlesComponent
,
splitHandlesComponent
,
toolbarComponent
],
mapControl
)
_dragHandlesComponent
=
undefined
}
if
(
_splitHandlesComponent
)
{
_splitHandlesComponent
.
destroy
()
_splitHandlesComponent
=
undefined
}
}
}
}
/// Calculate the default/initial polyline
/// Calculate the default/initial polyline
function
defaultPolylineVertices
()
{
function
_
defaultPolylineVertices
()
{
var
x
=
map
.
centerViewport
.
x
+
(
map
.
centerViewport
.
width
/
2
)
var
x
=
map
Control
.
centerViewport
.
x
+
(
mapControl
.
centerViewport
.
width
/
2
)
var
yInset
=
map
.
centerViewport
.
height
/
4
var
yInset
=
map
Control
.
centerViewport
.
height
/
4
var
topPointCoord
=
map
.
toCoordinate
(
Qt
.
point
(
x
,
map
.
centerViewport
.
y
+
yInset
),
false
/* clipToViewPort */
)
var
topPointCoord
=
map
Control
.
toCoordinate
(
Qt
.
point
(
x
,
mapControl
.
centerViewport
.
y
+
yInset
),
false
/* clipToViewPort */
)
var
bottomPointCoord
=
map
.
toCoordinate
(
Qt
.
point
(
x
,
map
.
centerViewport
.
y
+
map
.
centerViewport
.
height
-
yInset
),
false
/* clipToViewPort */
)
var
bottomPointCoord
=
map
Control
.
toCoordinate
(
Qt
.
point
(
x
,
mapControl
.
centerViewport
.
y
+
mapControl
.
centerViewport
.
height
-
yInset
),
false
/* clipToViewPort */
)
return
[
topPointCoord
,
bottomPointCoord
]
return
[
topPointCoord
,
bottomPointCoord
]
}
}
/// Add an initial 2 point polyline
/// Reset polyline back to initial default
function
addInitialPolyline
()
{
function
_resetPolyline
()
{
if
(
mapPolyline
.
count
<
2
)
{
mapPolyline
.
beginReset
()
mapPolyline
.
clear
()
mapPolyline
.
clear
()
var
initialVertices
=
defaultPolylineVertices
()
var
initialVertices
=
_defaultPolylineVertices
()
mapPolyline
.
appendVertex
(
initialVertices
[
0
])
mapPolyline
.
appendVertex
(
initialVertices
[
0
])
mapPolyline
.
appendVertex
(
initialVertices
[
1
])
mapPolyline
.
appendVertex
(
initialVertices
[
1
])
mapPolyline
.
endReset
()
}
function
_saveCurrentVertices
()
{
_savedVertices
=
[
]
for
(
var
i
=
0
;
i
<
mapPolyline
.
count
;
i
++
)
{
_savedVertices
.
push
(
mapPolyline
.
vertexCoordinate
(
i
))
}
}
}
}
/// Reset polyline back to initial default
function
_restorePreviousVertices
()
{
function
resetPolyline
()
{
mapPolyline
.
beginReset
()
mapPolyline
.
clear
()
mapPolyline
.
clear
()
addInitialPolyline
()
for
(
var
i
=
0
;
i
<
_savedVertices
.
length
;
i
++
)
{
mapPolyline
.
appendVertex
(
_savedVertices
[
i
])
}
mapPolyline
.
endReset
()
}
}
onInteractiveChanged
:
{
onInteractiveChanged
:
{
if
(
interactive
)
{
if
(
interactive
)
{
addHandles
()
_addInteractiveVisuals
()
}
else
{
_objMgrInteractiveVisuals
.
destroyObjects
()
}
}
on_TraceModeChanged
:
{
if
(
_traceMode
)
{
_instructionText
=
_traceText
_objMgrTraceVisuals
.
createObject
(
traceMouseAreaComponent
,
mapControl
,
false
)
}
else
{
}
else
{
removeHandles
()
_instructionText
=
_corridorToolsText
_objMgrTraceVisuals
.
destroyObjects
()
}
}
}
}
Component
.
onCompleted
:
{
Component
.
onCompleted
:
{
add
Visuals
()
_addCommon
Visuals
()
if
(
interactive
)
{
if
(
interactive
)
{
addHandle
s
()
_addInteractiveVisual
s
()
}
}
}
}
Component
.
onDestruction
:
{
QGCDynamicObjectManager
{
id
:
_objMgrCommonVisuals
}
removeVisuals
()
QGCDynamicObjectManager
{
id
:
_objMgrInteractiveVisuals
}
removeHandles
()
QGCDynamicObjectManager
{
id
:
_objMgrTraceVisuals
}
}
QGCPalette
{
id
:
qgcPal
}
QGCPalette
{
id
:
qgcPal
}
...
@@ -142,19 +149,10 @@ Item {
...
@@ -142,19 +149,10 @@ Item {
onTriggered
:
mapPolyline
.
removeVertex
(
menu
.
_removeVertexIndex
)
onTriggered
:
mapPolyline
.
removeVertex
(
menu
.
_removeVertexIndex
)
}
}
QGCMenuSeparator
{
visible
:
removeVertexItem
.
visible
}
QGCMenuItem
{
QGCMenuItem
{
text
:
qsTr
(
"
Edit position...
"
)
text
:
qsTr
(
"
Edit position...
"
)
onTriggered
:
mainWindow
.
showComponentDialog
(
editPositionDialog
,
qsTr
(
"
Edit Position
"
),
mainWindow
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
)
onTriggered
:
mainWindow
.
showComponentDialog
(
editPositionDialog
,
qsTr
(
"
Edit Position
"
),
mainWindow
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
)
}
}
QGCMenuItem
{
text
:
qsTr
(
"
Load KML...
"
)
onTriggered
:
kmlLoadDialog
.
openForLoad
()
}
}
}
Component
{
Component
{
...
@@ -311,5 +309,66 @@ Item {
...
@@ -311,5 +309,66 @@ Item {
}
}
}
}
}
}
Component
{
id
:
toolbarComponent
PlanEditToolbar
{
x
:
mapControl
.
centerViewport
.
left
+
_margins
y
:
mapControl
.
centerViewport
.
top
+
_margins
width
:
mapControl
.
centerViewport
.
width
-
(
_margins
*
2
)
z
:
QGroundControl
.
zOrderMapItems
+
2
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
QGCButton
{
_horizontalPadding
:
0
text
:
qsTr
(
"
Basic Corridor
"
)
visible
:
!
_traceMode
onClicked
:
_resetPolyline
()
}
QGCButton
{
_horizontalPadding
:
0
text
:
_traceMode
?
qsTr
(
"
Done Tracing
"
)
:
qsTr
(
"
Trace Corridor
"
)
onClicked
:
{
if
(
_traceMode
)
{
if
(
mapPolyline
.
count
<
2
)
{
_restorePreviousVertices
()
}
_traceMode
=
false
}
else
{
_saveCurrentVertices
()
_traceMode
=
true
mapPolyline
.
clear
();
}
}
}
QGCButton
{
_horizontalPadding
:
0
text
:
qsTr
(
"
Load KML...
"
)
onClicked
:
kmlLoadDialog
.
openForLoad
()
visible
:
!
_traceMode
}
}
}
// Mouse area to capture clicks for tracing a polyline
Component
{
id
:
traceMouseAreaComponent
MouseArea
{
anchors.fill
:
mapControl
preventStealing
:
true
z
:
QGroundControl
.
zOrderMapItems
+
1
// Over item indicators
onClicked
:
{
if
(
mouse
.
button
===
Qt
.
LeftButton
)
{
mapPolyline
.
appendVertex
(
mapControl
.
toCoordinate
(
Qt
.
point
(
mouse
.
x
,
mouse
.
y
),
false
/* clipToViewPort */
))
}
}
}
}
}
}
src/PlanView/CorridorScanEditor.qml
View file @
d9eb34d1
This diff is collapsed.
Click to expand it.
src/PlanView/CorridorScanMapVisual.qml
View file @
d9eb34d1
...
@@ -21,8 +21,6 @@ TransectStyleMapVisuals {
...
@@ -21,8 +21,6 @@ TransectStyleMapVisuals {
property
bool
_currentItem
:
object
.
isCurrentItem
property
bool
_currentItem
:
object
.
isCurrentItem
Component.onCompleted
:
mapPolylineVisuals
.
addInitialPolyline
()
QGCMapPolylineVisuals
{
QGCMapPolylineVisuals
{
id
:
mapPolylineVisuals
id
:
mapPolylineVisuals
mapControl
:
map
mapControl
:
map
...
...
src/PlanView/PlanEditToolbar.qml
0 → 100644
View file @
d9eb34d1
/****************************************************************************
*
* (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
2.11
import
QtQuick
.
Layouts
1.2
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
/// Toolbar used for things like Polygon editing tools
Item
{
height
:
toolsFlickable
.
y
+
toolsFlickable
.
height
+
_margins
z
:
QGroundControl
.
zOrderMapItems
+
2
property
real
_radius
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
/
2
Component.onCompleted
:
{
// Move the child controls from consumer into the layout control
var
moveList
=
[]
var
i
for
(
i
=
2
;
i
<
children
.
length
;
i
++
)
{
moveList
.
push
(
children
[
i
])
}
for
(
i
=
0
;
i
<
moveList
.
length
;
i
++
)
{
moveList
[
i
].
parent
=
toolsRowLayout
}
instructionComponent
.
createObject
(
toolsRowLayout
)
}
Rectangle
{
anchors.fill
:
parent
radius
:
_radius
color
:
"
white
"
opacity
:
0.75
}
QGCFlickable
{
id
:
toolsFlickable
anchors.margins
:
_margins
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
toolsRowLayout
.
height
clip
:
true
flickableDirection
:
Flickable
.
HorizontalFlick
contentWidth
:
toolsRowLayout
.
width
RowLayout
{
id
:
toolsRowLayout
spacing
:
_margins
}
}
Component
{
id
:
instructionComponent
QGCLabel
{
id
:
instructionLabel
color
:
"
black
"
text
:
_instructionText
Layout.fillWidth
:
true
}
}
}
src/QmlControls/QGroundControl/Controls/qmldir
View file @
d9eb34d1
...
@@ -39,6 +39,7 @@ PageView 1.0 PageView.qml
...
@@ -39,6 +39,7 @@ PageView 1.0 PageView.qml
ParameterEditor 1.0 ParameterEditor.qml
ParameterEditor 1.0 ParameterEditor.qml
ParameterEditorDialog 1.0 ParameterEditorDialog.qml
ParameterEditorDialog 1.0 ParameterEditorDialog.qml
PIDTuning 1.0 PIDTuning.qml
PIDTuning 1.0 PIDTuning.qml
PlanEditToolbar 1.0 PlanEditToolbar.qml
PreFlightCheckButton 1.0 PreFlightCheckButton.qml
PreFlightCheckButton 1.0 PreFlightCheckButton.qml
PreFlightCheckGroup 1.0 PreFlightCheckGroup.qml
PreFlightCheckGroup 1.0 PreFlightCheckGroup.qml
PreFlightCheckModel 1.0 PreFlightCheckModel.qml
PreFlightCheckModel 1.0 PreFlightCheckModel.qml
...
...
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