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
9f6ade3f
Commit
9f6ade3f
authored
Sep 17, 2019
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
border polygon works now
parent
b43e55c3
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
389 additions
and
136 deletions
+389
-136
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
WimaArea.cc
src/Wima/WimaArea.cc
+31
-0
WimaArea.h
src/Wima/WimaArea.h
+17
-9
WimaPlaner.cc
src/Wima/WimaPlaner.cc
+2
-2
WimaCorridorEditor.qml
src/WimaView/WimaCorridorEditor.qml
+173
-0
WimaCorridorMapVisual.qml
src/WimaView/WimaCorridorMapVisual.qml
+50
-40
WimaItemEditor.qml
src/WimaView/WimaItemEditor.qml
+1
-1
WimaMeasurementAreaEditor.qml
src/WimaView/WimaMeasurementAreaEditor.qml
+5
-8
WimaMeasurementAreaMapVisual.qml
src/WimaView/WimaMeasurementAreaMapVisual.qml
+42
-34
WimaServiceAreaEditor.qml
src/WimaView/WimaServiceAreaEditor.qml
+16
-2
WimaServiceAreaMapVisual.qml
src/WimaView/WimaServiceAreaMapVisual.qml
+51
-40
No files found.
qgroundcontrol.qrc
View file @
9f6ade3f
...
@@ -226,6 +226,7 @@
...
@@ -226,6 +226,7 @@
<file alias="QGroundControl/Controls/CoordinateIndicatorDrag.qml">src/WimaView/CoordinateIndicatorDrag.qml</file>
<file alias="QGroundControl/Controls/CoordinateIndicatorDrag.qml">src/WimaView/CoordinateIndicatorDrag.qml</file>
<file alias="QGroundControl/Controls/CoordinateIndicator.qml">src/WimaView/CoordinateIndicator.qml</file>
<file alias="QGroundControl/Controls/CoordinateIndicator.qml">src/WimaView/CoordinateIndicator.qml</file>
<file alias="QGroundControl/Controls/WimaJoinedAreaMapVisual.qml">src/WimaView/WimaJoinedAreaMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaJoinedAreaMapVisual.qml">src/WimaView/WimaJoinedAreaMapVisual.qml</file>
<file alias="QGroundControl/Controls/WimaCorridorEditor.qml">src/WimaView/WimaCorridorEditor.qml</file>
</qresource>
</qresource>
<qresource prefix="/json">
<qresource prefix="/json">
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
<file alias="APMMavlinkStreamRate.SettingsGroup.json">src/Settings/APMMavlinkStreamRate.SettingsGroup.json</file>
...
...
src/Wima/WimaArea.cc
View file @
9f6ade3f
...
@@ -34,6 +34,7 @@ WimaArea::WimaArea(QObject *parent)
...
@@ -34,6 +34,7 @@ WimaArea::WimaArea(QObject *parent)
,
_borderPolygonOffset
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
borderPolygonOffsetName
],
this
/* QObject parent */
))
,
_borderPolygonOffset
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
borderPolygonOffsetName
],
this
/* QObject parent */
))
,
_showBorderPolygon
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showBorderPolygonName
],
this
/* QObject parent */
))
,
_showBorderPolygon
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showBorderPolygonName
],
this
/* QObject parent */
))
,
_borderPolygon
(
QGCMapPolygon
(
this
))
,
_borderPolygon
(
QGCMapPolygon
(
this
))
,
_wimaAreaInteractive
(
false
)
{
{
init
();
init
();
_maxAltitude
=
30
;
_maxAltitude
=
30
;
...
@@ -45,6 +46,7 @@ WimaArea::WimaArea(const WimaArea &other, QObject *parent)
...
@@ -45,6 +46,7 @@ WimaArea::WimaArea(const WimaArea &other, QObject *parent)
,
_borderPolygonOffset
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
borderPolygonOffsetName
],
this
/* QObject parent */
))
,
_borderPolygonOffset
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
borderPolygonOffsetName
],
this
/* QObject parent */
))
,
_showBorderPolygon
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showBorderPolygonName
],
this
/* QObject parent */
))
,
_showBorderPolygon
(
SettingsFact
(
settingsGroup
,
_metaDataMap
[
showBorderPolygonName
],
this
/* QObject parent */
))
,
_borderPolygon
(
QGCMapPolygon
(
this
))
,
_borderPolygon
(
QGCMapPolygon
(
this
))
,
_wimaAreaInteractive
(
false
)
{
{
init
();
init
();
*
this
=
other
;
*
this
=
other
;
...
@@ -66,6 +68,15 @@ WimaArea &WimaArea::operator=(const WimaArea &other)
...
@@ -66,6 +68,15 @@ WimaArea &WimaArea::operator=(const WimaArea &other)
return
*
this
;
return
*
this
;
}
}
void
WimaArea
::
setWimaAreaInteractive
(
bool
interactive
)
{
if
(
WimaArea
::
_wimaAreaInteractive
!=
interactive
)
{
WimaArea
::
_wimaAreaInteractive
=
interactive
;
emit
WimaArea
::
wimaAreaInteractiveChanged
();
}
}
/*!
/*!
\fn void WimaArea::setMaxAltitude(double altitude)
\fn void WimaArea::setMaxAltitude(double altitude)
...
@@ -101,12 +112,14 @@ void WimaArea::recalcPolygons()
...
@@ -101,12 +112,14 @@ void WimaArea::recalcPolygons()
if
(
_showBorderPolygon
.
rawValue
().
toBool
()
==
true
)
{
if
(
_showBorderPolygon
.
rawValue
().
toBool
()
==
true
)
{
if
(
_borderPolygon
.
count
()
>=
3
)
{
if
(
_borderPolygon
.
count
()
>=
3
)
{
//_borderPolygon.verifyClockwiseWinding(); // causes seg. fault
this
->
setPath
(
_borderPolygon
.
coordinateList
());
this
->
setPath
(
_borderPolygon
.
coordinateList
());
this
->
offset
(
-
_borderPolygonOffset
.
rawValue
().
toDouble
());
this
->
offset
(
-
_borderPolygonOffset
.
rawValue
().
toDouble
());
}
}
}
else
{
}
else
{
if
(
this
->
count
()
>=
3
){
if
(
this
->
count
()
>=
3
){
//this->verifyClockwiseWinding(); // causes seg. fault
_borderPolygon
.
setPath
(
this
->
coordinateList
());
_borderPolygon
.
setPath
(
this
->
coordinateList
());
_borderPolygon
.
offset
(
_borderPolygonOffset
.
rawValue
().
toDouble
());
_borderPolygon
.
offset
(
_borderPolygonOffset
.
rawValue
().
toDouble
());
}
}
...
@@ -128,6 +141,22 @@ void WimaArea::updatePolygonConnections(QVariant showBorderPolygon)
...
@@ -128,6 +141,22 @@ void WimaArea::updatePolygonConnections(QVariant showBorderPolygon)
}
}
}
}
void
WimaArea
::
recalcInteractivity
()
{
if
(
_wimaAreaInteractive
==
false
)
{
this
->
setWimaAreaInteractive
(
false
);
_borderPolygon
.
setInteractive
(
false
);
}
else
{
if
(
_showBorderPolygon
.
rawValue
().
toBool
()
==
true
)
{
_borderPolygon
.
setInteractive
(
true
);
this
->
setInteractive
(
false
);
}
else
{
_borderPolygon
.
setInteractive
(
false
);
this
->
setInteractive
(
true
);
}
}
}
/*!
/*!
* \fn int WimaArea::getClosestVertexIndex(const QGeoCoordinate &coordinate) const
* \fn int WimaArea::getClosestVertexIndex(const QGeoCoordinate &coordinate) const
* Returns the index of the vertex (element of the polygon path)
* Returns the index of the vertex (element of the polygon path)
...
@@ -434,6 +463,8 @@ void WimaArea::init()
...
@@ -434,6 +463,8 @@ void WimaArea::init()
connect
(
&
_borderPolygonOffset
,
&
SettingsFact
::
rawValueChanged
,
this
,
&
WimaArea
::
recalcPolygons
);
connect
(
&
_borderPolygonOffset
,
&
SettingsFact
::
rawValueChanged
,
this
,
&
WimaArea
::
recalcPolygons
);
connect
(
&
_showBorderPolygon
,
&
SettingsFact
::
rawValueChanged
,
this
,
&
WimaArea
::
updatePolygonConnections
);
connect
(
&
_showBorderPolygon
,
&
SettingsFact
::
rawValueChanged
,
this
,
&
WimaArea
::
updatePolygonConnections
);
connect
(
&
_showBorderPolygon
,
&
SettingsFact
::
rawValueChanged
,
this
,
&
WimaArea
::
recalcInteractivity
);
connect
(
this
,
&
WimaArea
::
wimaAreaInteractiveChanged
,
this
,
&
WimaArea
::
recalcInteractivity
);
}
}
/*!
/*!
...
...
src/Wima/WimaArea.h
View file @
9f6ade3f
...
@@ -23,12 +23,13 @@ public:
...
@@ -23,12 +23,13 @@ public:
WimaArea
&
operator
=
(
const
WimaArea
&
other
);
WimaArea
&
operator
=
(
const
WimaArea
&
other
);
Q_PROPERTY
(
double
maxAltitude
READ
maxAltitude
WRITE
setMaxAltitude
NOTIFY
maxAltitudeChanged
)
Q_PROPERTY
(
double
maxAltitude
READ
maxAltitude
WRITE
setMaxAltitude
NOTIFY
maxAltitudeChanged
)
Q_PROPERTY
(
QString
mapVisualQML
READ
mapVisualQML
CONSTANT
)
Q_PROPERTY
(
QString
mapVisualQML
READ
mapVisualQML
CONSTANT
)
Q_PROPERTY
(
QString
editorQML
READ
editorQML
CONSTANT
)
Q_PROPERTY
(
QString
editorQML
READ
editorQML
CONSTANT
)
Q_PROPERTY
(
Fact
*
borderPolygonOffset
READ
borderPolygonOffsetFact
CONSTANT
)
Q_PROPERTY
(
Fact
*
borderPolygonOffset
READ
borderPolygonOffsetFact
CONSTANT
)
Q_PROPERTY
(
QGCMapPolygon
*
borderPolygon
READ
borderPolygon
NOTIFY
borderPolygonChanged
)
Q_PROPERTY
(
QGCMapPolygon
*
borderPolygon
READ
borderPolygon
NOTIFY
borderPolygonChanged
)
Q_PROPERTY
(
Fact
*
showBorderPolygon
READ
showBorderPolygon
CONSTANT
)
Q_PROPERTY
(
Fact
*
showBorderPolygon
READ
showBorderPolygon
CONSTANT
)
Q_PROPERTY
(
bool
wimaAreaInteractive
READ
wimaAreaInteractive
WRITE
setWimaAreaInteractive
NOTIFY
wimaAreaInteractiveChanged
)
//Property accessors
//Property accessors
...
@@ -37,6 +38,9 @@ public:
...
@@ -37,6 +38,9 @@ public:
Fact
*
showBorderPolygon
(
void
)
{
return
&
_showBorderPolygon
;}
Fact
*
showBorderPolygon
(
void
)
{
return
&
_showBorderPolygon
;}
double
borderPolygonOffset
(
void
)
const
{
return
_borderPolygonOffset
.
rawValue
().
toDouble
();}
double
borderPolygonOffset
(
void
)
const
{
return
_borderPolygonOffset
.
rawValue
().
toDouble
();}
QGCMapPolygon
*
borderPolygon
(
void
)
{
return
&
_borderPolygon
;}
QGCMapPolygon
*
borderPolygon
(
void
)
{
return
&
_borderPolygon
;}
bool
wimaAreaInteractive
(
void
)
const
{
return
_wimaAreaInteractive
;}
void
setWimaAreaInteractive
(
bool
interactive
);
// overrides from WimaArea
// overrides from WimaArea
virtual
QString
mapVisualQML
(
void
)
const
{
return
""
;
}
virtual
QString
mapVisualQML
(
void
)
const
{
return
""
;
}
...
@@ -76,9 +80,10 @@ public:
...
@@ -76,9 +80,10 @@ public:
static
const
char
*
settingsGroup
;
static
const
char
*
settingsGroup
;
signals:
signals:
void
maxAltitudeChanged
(
void
);
void
maxAltitudeChanged
(
void
);
void
borderPolygonChanged
(
void
);
void
borderPolygonChanged
(
void
);
void
borderPolygonOffsetChanged
(
void
);
void
borderPolygonOffsetChanged
(
void
);
void
wimaAreaInteractiveChanged
(
void
);
public
slots
:
public
slots
:
void
setMaxAltitude
(
double
altitude
);
void
setMaxAltitude
(
double
altitude
);
...
@@ -86,8 +91,9 @@ public slots:
...
@@ -86,8 +91,9 @@ public slots:
void
setBorderPolygonOffset
(
double
offset
);
void
setBorderPolygonOffset
(
double
offset
);
private
slots
:
private
slots
:
void
recalcPolygons
(
void
);
void
recalcPolygons
(
void
);
void
updatePolygonConnections
(
QVariant
value
);
void
updatePolygonConnections
(
QVariant
value
);
void
recalcInteractivity
(
void
);
private:
private:
...
@@ -100,6 +106,8 @@ private:
...
@@ -100,6 +106,8 @@ private:
SettingsFact
_showBorderPolygon
;
SettingsFact
_showBorderPolygon
;
QGCMapPolygon
_borderPolygon
;
QGCMapPolygon
_borderPolygon
;
bool
_wimaAreaInteractive
;
};
};
...
...
src/Wima/WimaPlaner.cc
View file @
9f6ade3f
...
@@ -557,7 +557,7 @@ void WimaPlaner::recalcPolygonInteractivity(int index)
...
@@ -557,7 +557,7 @@ void WimaPlaner::recalcPolygonInteractivity(int index)
if
(
index
>=
0
&&
index
<
_visualItems
.
count
())
{
if
(
index
>=
0
&&
index
<
_visualItems
.
count
())
{
resetAllInteractive
();
resetAllInteractive
();
WimaArea
*
interactivePoly
=
qobject_cast
<
WimaArea
*>
(
_visualItems
.
get
(
index
));
WimaArea
*
interactivePoly
=
qobject_cast
<
WimaArea
*>
(
_visualItems
.
get
(
index
));
interactivePoly
->
setInteractive
(
true
);
interactivePoly
->
set
WimaArea
Interactive
(
true
);
}
}
}
}
...
@@ -649,7 +649,7 @@ void WimaPlaner::resetAllInteractive()
...
@@ -649,7 +649,7 @@ void WimaPlaner::resetAllInteractive()
if
(
itemCount
>
0
){
if
(
itemCount
>
0
){
for
(
int
i
=
0
;
i
<
itemCount
;
i
++
)
{
for
(
int
i
=
0
;
i
<
itemCount
;
i
++
)
{
WimaArea
*
iteratorPoly
=
qobject_cast
<
WimaArea
*>
(
_visualItems
.
get
(
i
));
WimaArea
*
iteratorPoly
=
qobject_cast
<
WimaArea
*>
(
_visualItems
.
get
(
i
));
iteratorPoly
->
setInteractive
(
false
);
iteratorPoly
->
set
WimaArea
Interactive
(
false
);
}
}
}
}
}
}
...
...
src/WimaView/WimaCorridorEditor.qml
0 → 100644
View file @
9f6ade3f
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
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 bool polylineInteractive: polyline.interactive
property
bool
polygonInteractive
:
areaItem
.
interactive
property
var
polygon
:
areaItem
property
bool
initNecesarry
:
true
/*onPolylineInteractiveChanged: {
polyline.interactive = polylineInteractive;
}*/
onPolygonInteractiveChanged
:
{
polygon
.
interactive
=
polygonInteractive
;
}
/*function editPolyline(){
if (polylineInteractive){
//polyline.interactive = false;
polylineInteractive = false;
//polygonInteractive = true;
}else{
//polyline.interactive = true;
polylineInteractive = true;
//polygonInteractive = false;
}
}*/
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
.
right
spacing
:
_margin
visible
:
scanHeader
.
checked
GridLayout
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
columnSpacing
:
_margin
rowSpacing
:
_margin
columns
:
2
QGCLabel
{
text
:
qsTr
(
"
Offset
"
)
}
FactTextField
{
fact
:
areaItem
.
borderPolygonOffset
Layout.fillWidth
:
true
}
/*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
}
}
FactCheckBox
{
text
:
qsTr
(
"
Border Polygon
"
)
fact
:
areaItem
.
showBorderPolygon
//enabled: !missionItem.followTerrain
}
// 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: polylineInteractive ? "Done" : "Edit"
onClicked: editPolyline()
}
QGCButton {
id: swapEndpoints
anchors.topMargin: _margin / 2
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
text: "Swap End-Points"
onClicked: polyline.swapEndPoints()
}*/
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/WimaCorridorMapVisual.qml
View file @
9f6ade3f
...
@@ -33,40 +33,50 @@ Item {
...
@@ -33,40 +33,50 @@ Item {
/// Add an initial 4 sided polygon if there is none
/// Add an initial 4 sided polygon if there is none
function
_addInitialPolygon
()
{
function
_addInitialPolygon
()
{
if
(
_polygon
.
count
<
3
)
{
// Initial polygon is inset to take 2/3rds space
// 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
.
centerViewport
.
x
,
map
.
centerViewport
.
y
,
map
.
centerViewport
.
width
,
map
.
centerViewport
.
height
)
rect
.
x
+=
(
rect
.
width
*
0.25
)
/
2
rect
.
x
+=
(
rect
.
width
*
0.25
)
/
2
rect
.
y
+=
(
rect
.
height
*
0.25
)
/
2
rect
.
y
+=
(
rect
.
height
*
0.25
)
/
2
rect
.
width
*=
0.25
rect
.
width
*=
0.75
rect
.
height
*=
0.25
rect
.
height
*=
0.75
var
centerCoord
=
map
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
(
rect
.
width
/
2
),
rect
.
y
+
(
rect
.
height
/
2
)),
false
/* clipToViewPort */
)
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
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
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
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
bottomRightCoord
=
map
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
rect
.
width
,
rect
.
y
+
rect
.
height
),
false
/* clipToViewPort */
)
// Adjust polygon to max size
// Adjust polygon to max size
var
maxSize
=
100
var
maxSize
=
100
var
halfWidthMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
topRightCoord
),
maxSize
)
/
2
var
halfWidthMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
topRightCoord
),
maxSize
)
/
2
var
halfHeightMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
bottomLeftCoord
),
maxSize
)
/
2
var
halfHeightMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
bottomLeftCoord
),
maxSize
)
/
2
topLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
0
)
topLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
0
)
topRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
0
)
topRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
0
)
bottomLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
bottomLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
bottomRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
bottomRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
_polygon
.
appendVertex
(
topLeftCoord
)
if
(
areaItem
.
showBorderPolygon
.
rawValue
===
true
)
{
_polygon
.
appendVertex
(
topRightCoord
)
_polygon
.
appendVertex
(
bottomRightCoord
)
if
(
areaItem
.
borderPolygon
.
count
<
3
)
{
_polygon
.
appendVertex
(
bottomLeftCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
topLeftCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
topRightCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
bottomRightCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
bottomLeftCoord
)
}
}
else
{
if
(
_polygon
.
count
<
3
)
{
_polygon
.
appendVertex
(
topLeftCoord
)
_polygon
.
appendVertex
(
topRightCoord
)
_polygon
.
appendVertex
(
bottomRightCoord
)
_polygon
.
appendVertex
(
bottomLeftCoord
)
}
}
}
}
/*function _addInitialPolyline(){
_polyline.setStartVertexIndex(0);
}
_polyline.setEndVertexIndex(1);
}*/
...
@@ -88,14 +98,14 @@ Item {
...
@@ -88,14 +98,14 @@ Item {
interiorOpacity
:
0.2
interiorOpacity
:
0.2
}
}
/*WimaMapPolyline
Visuals {
WimaMapPolygon
Visuals
{
qgcView
:
_root
.
qgcView
qgcView
:
_root
.
qgcView
mapControl
:
map
mapControl
:
map
mapPoly
line: _polyline
mapPoly
gon
:
areaItem
.
borderPolygon
lineWidth: 4
borderWidth
:
1
lineColor: interactive ? "white" : "yellow
"
borderColor
:
areaItem
.
borderPolygon
.
interactive
?
"
white
"
:
"
transparent
"
enableSplitHandels: false
interiorColor
:
"
transparent
"
enableDragHandels: true
interiorOpacity
:
1
edgeHandelsOnly: true
}
}*/
}
}
src/WimaView/WimaItemEditor.qml
View file @
9f6ade3f
...
@@ -32,7 +32,7 @@ Rectangle {
...
@@ -32,7 +32,7 @@ Rectangle {
property
var
_masterController
:
masterController
property
var
_masterController
:
masterController
property
var
_missionController
:
_masterController
.
missionController
property
var
_missionController
:
_masterController
.
missionController
property
bool
interactive
:
areaItem
.
i
nteractive
property
bool
interactive
:
areaItem
.
wimaAreaI
nteractive
property
color
_outerTextColor
:
interactive
?
qgcPal
.
primaryButtonText
:
qgcPal
.
text
property
color
_outerTextColor
:
interactive
?
qgcPal
.
primaryButtonText
:
qgcPal
.
text
property
real
_sectionSpacer
:
ScreenTools
.
defaultFontPixelWidth
/
2
// spacing between section headings
property
real
_sectionSpacer
:
ScreenTools
.
defaultFontPixelWidth
/
2
// spacing between section headings
...
...
src/WimaView/WimaMeasurementAreaEditor.qml
View file @
9f6ade3f
...
@@ -95,15 +95,12 @@ Rectangle {
...
@@ -95,15 +95,12 @@ Rectangle {
fact
:
areaItem
.
borderPolygonOffset
fact
:
areaItem
.
borderPolygonOffset
Layout.fillWidth
:
true
Layout.fillWidth
:
true
}
}
}
QGCLabel
{
text
:
qsTr
(
"
Border Poly.
"
)
}
FactCheckBox
{
text
:
qsTr
(
"
Border Polygon
"
)
FactTextField
{
fact
:
areaItem
.
showBorderPolygon
fact
:
areaItem
.
showBorderPolygon
//enabled: !missionItem.followTerrain
Layout.fillWidth
:
true
}
}
}
Item
{
Item
{
...
...
src/WimaView/WimaMeasurementAreaMapVisual.qml
View file @
9f6ade3f
...
@@ -32,42 +32,50 @@ Item {
...
@@ -32,42 +32,50 @@ Item {
/// Add an initial 4 sided polygon if there is none
/// Add an initial 4 sided polygon if there is none
function
_addInitialPolygon
()
{
function
_addInitialPolygon
()
{
if
(
areaItem
.
borderPolygon
.
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
)
areaItem
.
borderPolygon
.
appendVertex
(
topLeftCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
topRightCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
bottomRightCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
bottomLeftCoord
)
}
}
/*function _addInitialPolyline(){
// Initial polygon is inset to take 2/3rds space
_polyline.setStartVertexIndex(0);
var
rect
=
Qt
.
rect
(
map
.
centerViewport
.
x
,
map
.
centerViewport
.
y
,
map
.
centerViewport
.
width
,
map
.
centerViewport
.
height
)
_polyline.setEndVertexIndex(1);
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
)
if
(
areaItem
.
showBorderPolygon
.
rawValue
===
true
)
{
if
(
areaItem
.
borderPolygon
.
count
<
3
)
{
areaItem
.
borderPolygon
.
appendVertex
(
topLeftCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
topRightCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
bottomRightCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
bottomLeftCoord
)
}
}
else
{
if
(
_polygon
.
count
<
3
)
{
_polygon
.
appendVertex
(
topLeftCoord
)
_polygon
.
appendVertex
(
topRightCoord
)
_polygon
.
appendVertex
(
bottomRightCoord
)
_polygon
.
appendVertex
(
bottomLeftCoord
)
}
}
}
Component.onCompleted
:
{
Component.onCompleted
:
{
_addInitialPolygon
()
_addInitialPolygon
()
...
@@ -93,7 +101,7 @@ Item {
...
@@ -93,7 +101,7 @@ Item {
mapControl
:
map
mapControl
:
map
mapPolygon
:
areaItem
.
borderPolygon
mapPolygon
:
areaItem
.
borderPolygon
borderWidth
:
1
borderWidth
:
1
borderColor
:
"
white
"
borderColor
:
areaItem
.
borderPolygon
.
interactive
?
"
white
"
:
"
transparent
"
interiorColor
:
"
transparent
"
interiorColor
:
"
transparent
"
interiorOpacity
:
1
interiorOpacity
:
1
}
}
...
...
src/WimaView/WimaServiceAreaEditor.qml
View file @
9f6ade3f
...
@@ -73,7 +73,7 @@ Rectangle {
...
@@ -73,7 +73,7 @@ Rectangle {
Column
{
Column
{
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
setI
anchors.right
:
parent
.
right
spacing
:
_margin
spacing
:
_margin
visible
:
scanHeader
.
checked
visible
:
scanHeader
.
checked
...
@@ -84,6 +84,13 @@ Rectangle {
...
@@ -84,6 +84,13 @@ Rectangle {
rowSpacing
:
_margin
rowSpacing
:
_margin
columns
:
2
columns
:
2
QGCLabel
{
text
:
qsTr
(
"
Offset
"
)
}
FactTextField
{
fact
:
areaItem
.
borderPolygonOffset
Layout.fillWidth
:
true
}
/*QGCLabel {
/*QGCLabel {
text: qsTr("Bottom Layer Altitude")
text: qsTr("Bottom Layer Altitude")
}
}
...
@@ -111,7 +118,14 @@ Rectangle {
...
@@ -111,7 +118,14 @@ Rectangle {
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
height
:
ScreenTools
.
defaultFontPixelHeight
/
2
width
:
1
width
:
1
}
}
}
// Column - Scan
}
FactCheckBox
{
text
:
qsTr
(
"
Border Polygon
"
)
fact
:
areaItem
.
showBorderPolygon
//enabled: !missionItem.followTerrain
}
// Column - Scan
/*SectionHeader {
/*SectionHeader {
id: polylineHeader
id: polylineHeader
text: qsTr("Gateway Poly Line")
text: qsTr("Gateway Poly Line")
...
...
src/WimaView/WimaServiceAreaMapVisual.qml
View file @
9f6ade3f
...
@@ -31,42 +31,53 @@ Item {
...
@@ -31,42 +31,53 @@ Item {
signal
clicked
(
int
sequenceNumber
)
signal
clicked
(
int
sequenceNumber
)
/// Add an initial 4 sided polygon if there is none
/// Add an initial 4 sided polygon if there is none
/// Add an initial 4 sided polygon if there is none
function
_addInitialPolygon
()
{
function
_addInitialPolygon
()
{
if
(
_polygon
.
count
<
3
)
{
// Initial polygon is inset to take 2/3rds space
// 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
.
centerViewport
.
x
,
map
.
centerViewport
.
y
,
map
.
centerViewport
.
width
,
map
.
centerViewport
.
height
)
rect
.
x
+=
(
rect
.
width
*
0.25
)
/
2
rect
.
x
+=
(
rect
.
width
*
0.25
)
/
2
rect
.
y
+=
(
rect
.
height
*
0.25
)
/
2
rect
.
y
+=
(
rect
.
height
*
0.25
)
/
2
rect
.
width
*=
0.25
rect
.
width
*=
0.75
rect
.
height
*=
0.25
rect
.
height
*=
0.75
var
centerCoord
=
map
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
(
rect
.
width
/
2
),
rect
.
y
+
(
rect
.
height
/
2
)),
false
/* clipToViewPort */
)
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
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
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
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
bottomRightCoord
=
map
.
toCoordinate
(
Qt
.
point
(
rect
.
x
+
rect
.
width
,
rect
.
y
+
rect
.
height
),
false
/* clipToViewPort */
)
// Adjust polygon to max size
// Adjust polygon to max size
var
maxSize
=
100
var
maxSize
=
100
var
halfWidthMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
topRightCoord
),
maxSize
)
/
2
var
halfWidthMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
topRightCoord
),
maxSize
)
/
2
var
halfHeightMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
bottomLeftCoord
),
maxSize
)
/
2
var
halfHeightMeters
=
Math
.
min
(
topLeftCoord
.
distanceTo
(
bottomLeftCoord
),
maxSize
)
/
2
topLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
0
)
topLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
0
)
topRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
0
)
topRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
0
)
bottomLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
bottomLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
bottomRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
bottomRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
_polygon
.
appendVertex
(
topLeftCoord
)
if
(
areaItem
.
showBorderPolygon
.
rawValue
===
true
)
{
_polygon
.
appendVertex
(
topRightCoord
)
_polygon
.
appendVertex
(
bottomRightCoord
)
if
(
areaItem
.
borderPolygon
.
count
<
3
)
{
_polygon
.
appendVertex
(
bottomLeftCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
topLeftCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
topRightCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
bottomRightCoord
)
areaItem
.
borderPolygon
.
appendVertex
(
bottomLeftCoord
)
}
}
else
{
if
(
_polygon
.
count
<
3
)
{
_polygon
.
appendVertex
(
topLeftCoord
)
_polygon
.
appendVertex
(
topRightCoord
)
_polygon
.
appendVertex
(
bottomRightCoord
)
_polygon
.
appendVertex
(
bottomLeftCoord
)
}
}
}
}
/*function _addInitialPolyline(){
_polyline.setStartVertexIndex(0);
}
_polyline.setEndVertexIndex(1);
}*/
...
@@ -88,14 +99,14 @@ Item {
...
@@ -88,14 +99,14 @@ Item {
interiorOpacity
:
0.25
interiorOpacity
:
0.25
}
}
/*WimaMapPolyline
Visuals {
WimaMapPolygon
Visuals
{
qgcView
:
_root
.
qgcView
qgcView
:
_root
.
qgcView
mapControl
:
map
mapControl
:
map
mapPoly
line: _polyline
mapPoly
gon
:
areaItem
.
borderPolygon
lineWidth: 4
borderWidth
:
1
lineColor: interactive ? "white" : "yellow
"
borderColor
:
areaItem
.
borderPolygon
.
interactive
?
"
white
"
:
"
transparent
"
enableSplitHandels: false
interiorColor
:
"
transparent
"
enableDragHandels: true
interiorOpacity
:
1
edgeHandelsOnly: true
}
}*/
}
}
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