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
7a669919
Commit
7a669919
authored
Oct 17, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support scan distance from structure
Fix crash when adding second structure scan
parent
cc9f9d52
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
99 deletions
+85
-99
StructureScan.SettingsGroup.json
src/MissionManager/StructureScan.SettingsGroup.json
+9
-0
StructureScanComplexItem.cc
src/MissionManager/StructureScanComplexItem.cc
+35
-45
StructureScanComplexItem.h
src/MissionManager/StructureScanComplexItem.h
+12
-32
StructureScanEditor.qml
src/PlanView/StructureScanEditor.qml
+15
-1
StructureScanMapVisual.qml
src/PlanView/StructureScanMapVisual.qml
+14
-21
No files found.
src/MissionManager/StructureScan.SettingsGroup.json
View file @
7a669919
...
...
@@ -23,6 +23,15 @@
"units"
:
"m"
,
"defaultValue"
:
25
},
{
"name"
:
"Scan distance"
,
"shortDescription"
:
"Scan distance away from structure."
,
"type"
:
"double"
,
"decimalPlaces"
:
2
,
"min"
:
0
,
"units"
:
"m"
,
"defaultValue"
:
25
},
{
"name"
:
"Trigger distance"
,
"shortDescription"
:
"Distance between each triggering of the camera. 0 specifies not camera trigger."
,
...
...
src/MissionManager/StructureScanComplexItem.cc
View file @
7a669919
...
...
@@ -23,36 +23,11 @@ QGC_LOGGING_CATEGORY(StructureScanComplexItemLog, "StructureScanComplexItemLog")
const
char
*
StructureScanComplexItem
::
jsonComplexItemTypeValue
=
"StructureScan-WIP"
;
const
char
*
StructureScanComplexItem
::
_jsonGridObjectKey
=
"grid"
;
const
char
*
StructureScanComplexItem
::
_jsonGridAltitudeKey
=
"altitude"
;
const
char
*
StructureScanComplexItem
::
_jsonGridAltitudeRelativeKey
=
"relativeAltitude"
;
const
char
*
StructureScanComplexItem
::
_jsonGridAngleKey
=
"angle"
;
const
char
*
StructureScanComplexItem
::
_jsonGridSpacingKey
=
"spacing"
;
const
char
*
StructureScanComplexItem
::
_jsonGridEntryLocationKey
=
"entryLocation"
;
const
char
*
StructureScanComplexItem
::
_jsonTurnaroundDistKey
=
"turnAroundDistance"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraTriggerDistanceKey
=
"cameraTriggerDistance"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraTriggerInTurnaroundKey
=
"cameraTriggerInTurnaround"
;
const
char
*
StructureScanComplexItem
::
_jsonHoverAndCaptureKey
=
"hoverAndCapture"
;
const
char
*
StructureScanComplexItem
::
_jsonGroundResolutionKey
=
"groundResolution"
;
const
char
*
StructureScanComplexItem
::
_jsonFrontalOverlapKey
=
"imageFrontalOverlap"
;
const
char
*
StructureScanComplexItem
::
_jsonSideOverlapKey
=
"imageSideOverlap"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraSensorWidthKey
=
"sensorWidth"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraSensorHeightKey
=
"sensorHeight"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraResolutionWidthKey
=
"resolutionWidth"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraResolutionHeightKey
=
"resolutionHeight"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraFocalLengthKey
=
"focalLength"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraMinTriggerIntervalKey
=
"minTriggerInterval"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraObjectKey
=
"camera"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraNameKey
=
"name"
;
const
char
*
StructureScanComplexItem
::
_jsonManualGridKey
=
"manualGrid"
;
const
char
*
StructureScanComplexItem
::
_jsonCameraOrientationLandscapeKey
=
"orientationLandscape"
;
const
char
*
StructureScanComplexItem
::
_jsonFixedValueIsAltitudeKey
=
"fixedValueIsAltitude"
;
const
char
*
StructureScanComplexItem
::
_jsonRefly90DegreesKey
=
"refly90Degrees"
;
const
char
*
StructureScanComplexItem
::
_altitudeFactName
=
"Altitude"
;
const
char
*
StructureScanComplexItem
::
_layersFactName
=
"Layers"
;
const
char
*
StructureScanComplexItem
::
_layerDistanceFactName
=
"Layer distance"
;
const
char
*
StructureScanComplexItem
::
_cameraTriggerDistanceFactName
=
"Trigger distance"
;
const
char
*
StructureScanComplexItem
::
_scanDistanceFactName
=
"Scan distance"
;
QMap
<
QString
,
FactMetaData
*>
StructureScanComplexItem
::
_metaDataMap
;
...
...
@@ -70,22 +45,26 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, QObject* pa
,
_layersFact
(
0
,
_layersFactName
,
FactMetaData
::
valueTypeUint32
)
,
_layerDistanceFact
(
0
,
_layerDistanceFactName
,
FactMetaData
::
valueTypeDouble
)
,
_cameraTriggerDistanceFact
(
0
,
_cameraTriggerDistanceFactName
,
FactMetaData
::
valueTypeDouble
)
,
_scanDistanceFact
(
0
,
_scanDistanceFactName
,
FactMetaData
::
valueTypeDouble
)
{
_editorQml
=
"qrc:/qml/StructureScanEditor.qml"
;
if
(
_metaDataMap
.
isEmpty
())
{
_metaDataMap
=
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/StructureScan.SettingsGroup.json"
),
this
);
_metaDataMap
=
FactMetaData
::
createMapFromJsonFile
(
QStringLiteral
(
":/json/StructureScan.SettingsGroup.json"
),
NULL
/* QObject parent */
);
}
qDebug
()
<<
_metaDataMap
[
_altitudeFactName
];
_altitudeFact
.
setMetaData
(
_metaDataMap
[
_altitudeFactName
]);
_layersFact
.
setMetaData
(
_metaDataMap
[
_layersFactName
]);
_layerDistanceFact
.
setMetaData
(
_metaDataMap
[
_layerDistanceFactName
]);
_cameraTriggerDistanceFact
.
setMetaData
(
_metaDataMap
[
_cameraTriggerDistanceFactName
]);
_scanDistanceFact
.
setMetaData
(
_metaDataMap
[
_scanDistanceFactName
]);
_altitudeFact
.
setRawValue
(
_altitudeFact
.
rawDefaultValue
());
_layersFact
.
setRawValue
(
_layersFact
.
rawDefaultValue
());
_layerDistanceFact
.
setRawValue
(
_layerDistanceFact
.
rawDefaultValue
());
_cameraTriggerDistanceFact
.
setRawValue
(
_cameraTriggerDistanceFact
.
rawDefaultValue
());
_scanDistanceFact
.
setRawValue
(
_scanDistanceFact
.
rawDefaultValue
());
_altitudeFact
.
setRawValue
(
qgcApp
()
->
toolbox
()
->
settingsManager
()
->
appSettings
()
->
defaultMissionItemAltitude
()
->
rawValue
());
...
...
@@ -93,6 +72,7 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, QObject* pa
connect
(
&
_layersFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_setDirty
);
connect
(
&
_layerDistanceFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_setDirty
);
connect
(
&
_cameraTriggerDistanceFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_setDirty
);
connect
(
&
_scanDistanceFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_setDirty
);
connect
(
this
,
&
StructureScanComplexItem
::
altitudeRelativeChanged
,
this
,
&
StructureScanComplexItem
::
_setDirty
);
connect
(
this
,
&
StructureScanComplexItem
::
altitudeRelativeChanged
,
this
,
&
StructureScanComplexItem
::
coordinateHasRelativeAltitudeChanged
);
...
...
@@ -100,9 +80,13 @@ StructureScanComplexItem::StructureScanComplexItem(Vehicle* vehicle, QObject* pa
connect
(
&
_altitudeFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_updateCoordinateAltitudes
);
connect
(
&
_mapPolygon
,
&
QGCMapPolygon
::
dirtyChanged
,
this
,
&
StructureScanComplexItem
::
_polygonDirtyChanged
);
connect
(
&
_mapPolygon
,
&
QGCMapPolygon
::
countChanged
,
this
,
&
StructureScanComplexItem
::
_polygonCountChanged
);
connect
(
&
_mapPolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
StructureScanComplexItem
::
_polygonPathChanged
);
connect
(
&
_structurePolygon
,
&
QGCMapPolygon
::
dirtyChanged
,
this
,
&
StructureScanComplexItem
::
_polygonDirtyChanged
);
connect
(
&
_structurePolygon
,
&
QGCMapPolygon
::
countChanged
,
this
,
&
StructureScanComplexItem
::
_polygonCountChanged
);
connect
(
&
_structurePolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
StructureScanComplexItem
::
_rebuildFlightPolygon
);
connect
(
&
_flightPolygon
,
&
QGCMapPolygon
::
pathChanged
,
this
,
&
StructureScanComplexItem
::
_flightPathChanged
);
connect
(
&
_scanDistanceFact
,
&
Fact
::
valueChanged
,
this
,
&
StructureScanComplexItem
::
_rebuildFlightPolygon
);
}
void
StructureScanComplexItem
::
_setScanDistance
(
double
scanDistance
)
...
...
@@ -138,7 +122,7 @@ void StructureScanComplexItem::_polygonCountChanged(int count)
int
StructureScanComplexItem
::
lastSequenceNumber
(
void
)
const
{
return
_sequenceNumber
+
((
_
map
Polygon
.
count
()
+
1
)
*
_layersFact
.
rawValue
().
toInt
())
+
// 1 waypoint for each polygon vertex + 1 to go back to first polygon vertex
((
_
flight
Polygon
.
count
()
+
1
)
*
_layersFact
.
rawValue
().
toInt
())
+
// 1 waypoint for each polygon vertex + 1 to go back to first polygon vertex
1
;
// Gimbal yaw command
}
...
...
@@ -193,7 +177,7 @@ void StructureScanComplexItem::save(QJsonArray& missionItems)
}
// Polygon shape
_
map
Polygon.saveToJson(saveObject);
_
structure
Polygon.saveToJson(saveObject);
missionItems.append(saveObject);
#endif
...
...
@@ -260,7 +244,7 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen
_ignoreRecalc = true;
_
map
Polygon.clear();
_
structure
Polygon.clear();
setSequenceNumber(sequenceNumber);
...
...
@@ -346,8 +330,8 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen
/// @param required true: no polygon in object will generate error
/// @param errorString Error string if return is false
/// @return true: success, false: failure (errorString set)
if (!_
map
Polygon.loadFromJson(v2Object, true /* required */, errorString)) {
_
map
Polygon.clear();
if (!_
structure
Polygon.loadFromJson(v2Object, true /* required */, errorString)) {
_
structure
Polygon.clear();
return false;
}
...
...
@@ -364,7 +348,7 @@ bool StructureScanComplexItem::load(const QJsonObject& complexObject, int sequen
#endif
}
void
StructureScanComplexItem
::
_
polygon
PathChanged
(
void
)
void
StructureScanComplexItem
::
_
flight
PathChanged
(
void
)
{
emit
coordinateChanged
(
coordinate
());
emit
exitCoordinateChanged
(
exitCoordinate
());
...
...
@@ -374,7 +358,7 @@ void StructureScanComplexItem::_polygonPathChanged(void)
double
StructureScanComplexItem
::
greatestDistanceTo
(
const
QGeoCoordinate
&
other
)
const
{
double
greatestDistance
=
0.0
;
QList
<
QGeoCoordinate
>
vertices
=
_
map
Polygon
.
coordinateList
();
QList
<
QGeoCoordinate
>
vertices
=
_
flight
Polygon
.
coordinateList
();
for
(
int
i
=
0
;
i
<
vertices
.
count
();
i
++
)
{
QGeoCoordinate
vertex
=
vertices
[
i
];
...
...
@@ -389,7 +373,7 @@ double StructureScanComplexItem::greatestDistanceTo(const QGeoCoordinate &other)
bool
StructureScanComplexItem
::
specifiesCoordinate
(
void
)
const
{
return
_
map
Polygon
.
count
()
>
2
;
return
_
flight
Polygon
.
count
()
>
2
;
}
void
StructureScanComplexItem
::
appendMissionItems
(
QList
<
MissionItem
*>&
items
,
QObject
*
missionItemParent
)
...
...
@@ -413,8 +397,8 @@ void StructureScanComplexItem::appendMissionItems(QList<MissionItem*>& items, QO
for
(
int
layer
=
0
;
layer
<
_layersFact
.
rawValue
().
toInt
();
layer
++
)
{
double
layerAltitude
=
baseAltitude
+
(
layer
*
_layerDistanceFact
.
rawValue
().
toDouble
());
for
(
int
i
=
0
;
i
<
_
map
Polygon
.
count
();
i
++
)
{
QGeoCoordinate
vertexCoord
=
_
mapPolygon
.
pathModel
().
value
<
QGCQGeoCoordinate
*>
(
i
)
->
coordinate
(
);
for
(
int
i
=
0
;
i
<
_
flight
Polygon
.
count
();
i
++
)
{
QGeoCoordinate
vertexCoord
=
_
flightPolygon
.
vertexCoordinate
(
i
);
MissionItem
*
item
=
new
MissionItem
(
seqNum
++
,
MAV_CMD_NAV_WAYPOINT
,
...
...
@@ -432,7 +416,7 @@ void StructureScanComplexItem::appendMissionItems(QList<MissionItem*>& items, QO
items
.
append
(
item
);
}
QGeoCoordinate
vertexCoord
=
_
mapPolygon
.
pathModel
().
value
<
QGCQGeoCoordinate
*>
(
0
)
->
coordinate
(
);
QGeoCoordinate
vertexCoord
=
_
flightPolygon
.
vertexCoordinate
(
0
);
MissionItem
*
item
=
new
MissionItem
(
seqNum
++
,
MAV_CMD_NAV_WAYPOINT
,
...
...
@@ -489,9 +473,9 @@ double StructureScanComplexItem::timeBetweenShots(void) const
QGeoCoordinate
StructureScanComplexItem
::
coordinate
(
void
)
const
{
if
(
_
map
Polygon
.
count
()
>
0
)
{
int
entryVertex
=
qMax
(
qMin
(
_entryVertex
,
_
map
Polygon
.
count
()
-
1
),
0
);
return
_
map
Polygon
.
vertexCoordinate
(
entryVertex
);
if
(
_
flight
Polygon
.
count
()
>
0
)
{
int
entryVertex
=
qMax
(
qMin
(
_entryVertex
,
_
flight
Polygon
.
count
()
-
1
),
0
);
return
_
flight
Polygon
.
vertexCoordinate
(
entryVertex
);
}
else
{
return
QGeoCoordinate
();
}
...
...
@@ -511,9 +495,15 @@ void StructureScanComplexItem::_updateCoordinateAltitudes(void)
void
StructureScanComplexItem
::
rotateEntryPoint
(
void
)
{
_entryVertex
++
;
if
(
_entryVertex
>=
_
map
Polygon
.
count
())
{
if
(
_entryVertex
>=
_
flight
Polygon
.
count
())
{
_entryVertex
=
0
;
}
emit
coordinateChanged
(
coordinate
());
emit
exitCoordinateChanged
(
exitCoordinate
());
}
void
StructureScanComplexItem
::
_rebuildFlightPolygon
(
void
)
{
_flightPolygon
=
_structurePolygon
;
_flightPolygon
.
offset
(
_scanDistanceFact
.
rawValue
().
toDouble
());
}
src/MissionManager/StructureScanComplexItem.h
View file @
7a669919
...
...
@@ -30,20 +30,24 @@ public:
Q_PROPERTY
(
Fact
*
layers
READ
layers
CONSTANT
)
Q_PROPERTY
(
Fact
*
layerDistance
READ
layerDistance
CONSTANT
)
Q_PROPERTY
(
Fact
*
cameraTriggerDistance
READ
cameraTriggerDistance
CONSTANT
)
Q_PROPERTY
(
Fact
*
scanDistance
READ
scanDistance
CONSTANT
)
Q_PROPERTY
(
bool
altitudeRelative
MEMBER
_altitudeRelative
NOTIFY
altitudeRelativeChanged
)
Q_PROPERTY
(
int
cameraShots
READ
cameraShots
NOTIFY
cameraShotsChanged
)
Q_PROPERTY
(
double
timeBetweenShots
READ
timeBetweenShots
NOTIFY
timeBetweenShotsChanged
)
Q_PROPERTY
(
double
cameraMinTriggerInterval
MEMBER
_cameraMinTriggerInterval
NOTIFY
cameraMinTriggerIntervalChanged
)
Q_PROPERTY
(
QGCMapPolygon
*
mapPolygon
READ
mapPolygon
CONSTANT
)
Q_PROPERTY
(
QGCMapPolygon
*
structurePolygon
READ
structurePolygon
CONSTANT
)
Q_PROPERTY
(
QGCMapPolygon
*
flightPolygon
READ
flightPolygon
CONSTANT
)
Fact
*
altitude
(
void
)
{
return
&
_altitudeFact
;
}
Fact
*
layers
(
void
)
{
return
&
_layersFact
;
}
Fact
*
layerDistance
(
void
)
{
return
&
_layerDistanceFact
;
}
Fact
*
cameraTriggerDistance
(
void
)
{
return
&
_cameraTriggerDistanceFact
;
}
Fact
*
scanDistance
(
void
)
{
return
&
_scanDistanceFact
;
}
int
cameraShots
(
void
)
const
;
double
timeBetweenShots
(
void
)
const
;
QGCMapPolygon
*
mapPolygon
(
void
)
{
return
&
_mapPolygon
;
}
QGCMapPolygon
*
structurePolygon
(
void
)
{
return
&
_structurePolygon
;
}
QGCMapPolygon
*
flightPolygon
(
void
)
{
return
&
_flightPolygon
;
}
Q_INVOKABLE
void
rotateEntryPoint
(
void
);
...
...
@@ -95,9 +99,10 @@ private slots:
void
_setDirty
(
void
);
void
_polygonDirtyChanged
(
bool
dirty
);
void
_polygonCountChanged
(
int
count
);
void
_
polygon
PathChanged
(
void
);
void
_
flight
PathChanged
(
void
);
void
_clearInternal
(
void
);
void
_updateCoordinateAltitudes
(
void
);
void
_rebuildFlightPolygon
(
void
);
private:
void
_setExitCoordinate
(
const
QGeoCoordinate
&
coordinate
);
...
...
@@ -107,7 +112,8 @@ private:
int
_sequenceNumber
;
bool
_dirty
;
QGCMapPolygon
_mapPolygon
;
QGCMapPolygon
_structurePolygon
;
QGCMapPolygon
_flightPolygon
;
bool
_altitudeRelative
;
int
_entryVertex
;
// Polygon vertext which is used as the mission entry point
...
...
@@ -124,39 +130,13 @@ private:
Fact
_layersFact
;
Fact
_layerDistanceFact
;
Fact
_cameraTriggerDistanceFact
;
Fact
_scanDistanceFact
;
static
const
char
*
_altitudeFactName
;
static
const
char
*
_layersFactName
;
static
const
char
*
_layerDistanceFactName
;
static
const
char
*
_cameraTriggerDistanceFactName
;
static
const
char
*
_jsonGridObjectKey
;
static
const
char
*
_jsonGridAltitudeKey
;
static
const
char
*
_jsonGridAltitudeRelativeKey
;
static
const
char
*
_jsonGridAngleKey
;
static
const
char
*
_jsonGridSpacingKey
;
static
const
char
*
_jsonGridEntryLocationKey
;
static
const
char
*
_jsonTurnaroundDistKey
;
static
const
char
*
_jsonCameraTriggerDistanceKey
;
static
const
char
*
_jsonCameraTriggerInTurnaroundKey
;
static
const
char
*
_jsonHoverAndCaptureKey
;
static
const
char
*
_jsonGroundResolutionKey
;
static
const
char
*
_jsonFrontalOverlapKey
;
static
const
char
*
_jsonSideOverlapKey
;
static
const
char
*
_jsonCameraSensorWidthKey
;
static
const
char
*
_jsonCameraSensorHeightKey
;
static
const
char
*
_jsonCameraResolutionWidthKey
;
static
const
char
*
_jsonCameraResolutionHeightKey
;
static
const
char
*
_jsonCameraFocalLengthKey
;
static
const
char
*
_jsonCameraMinTriggerIntervalKey
;
static
const
char
*
_jsonManualGridKey
;
static
const
char
*
_jsonCameraObjectKey
;
static
const
char
*
_jsonCameraNameKey
;
static
const
char
*
_jsonCameraOrientationLandscapeKey
;
static
const
char
*
_jsonFixedValueIsAltitudeKey
;
static
const
char
*
_jsonRefly90DegreesKey
;
static
const
int
_hoverAndCaptureDelaySeconds
=
1
;
static
const
char
*
_scanDistanceFactName
;
};
#endif
src/PlanView/StructureScanEditor.qml
View file @
7a669919
...
...
@@ -60,11 +60,19 @@ Rectangle {
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
text
:
qsTr
(
"
WARNING: WORK IN PROGRESS. USE AT YOUR OWN RISK.
"
)
text
:
qsTr
(
"
WARNING: WORK IN PROGRESS. USE AT YOUR OWN RISK.
MEANT FOR DISCUSSION ONLY. DO NOT REPORT BUGS.
"
)
wrapMode
:
Text
.
WordWrap
color
:
qgcPal
.
warningText
}
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
text
:
qsTr
(
"
Note: Polygon respresents structure surface not vehicle flight path.
"
)
wrapMode
:
Text
.
WordWrap
font.pointSize
:
ScreenTools
.
smallFontPointSize
}
QGCLabel
{
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
...
...
@@ -99,6 +107,12 @@ Rectangle {
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Scan distance
"
)
}
FactTextField
{
fact
:
missionItem
.
scanDistance
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Trigger Distance
"
)
}
FactTextField
{
fact
:
missionItem
.
cameraTriggerDistance
...
...
src/PlanView/StructureScanMapVisual.qml
View file @
7a669919
...
...
@@ -25,31 +25,28 @@ Item {
property
var
map
///< Map control to place item in
property
var
_missionItem
:
object
property
var
_
mapPolygon
:
object
.
map
Polygon
property
var
_
gridComponent
property
var
_
structurePolygon
:
object
.
structure
Polygon
property
var
_
flightPolygon
:
object
.
flightPolygon
property
var
_entryCoordinate
property
var
_exitCoordinate
signal
clicked
(
int
sequenceNumber
)
function
_addVisualElements
()
{
_gridComponent
=
gridComponent
.
createObject
(
map
)
_entryCoordinate
=
entryPointComponent
.
createObject
(
map
)
_exitCoordinate
=
exitPointComponent
.
createObject
(
map
)
map
.
addMapItem
(
_gridComponent
)
map
.
addMapItem
(
_entryCoordinate
)
map
.
addMapItem
(
_exitCoordinate
)
}
function
_destroyVisualElements
()
{
_gridComponent
.
destroy
()
_entryCoordinate
.
destroy
()
_exitCoordinate
.
destroy
()
}
/// Add an initial 4 sided polygon if there is none
function
_addInitialPolygon
()
{
if
(
_
map
Polygon
.
count
<
3
)
{
if
(
_
structure
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
...
...
@@ -71,10 +68,10 @@ Item {
bottomLeftCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
-
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
bottomRightCoord
=
centerCoord
.
atDistanceAndAzimuth
(
halfWidthMeters
,
90
).
atDistanceAndAzimuth
(
halfHeightMeters
,
180
)
_
map
Polygon
.
appendVertex
(
topLeftCoord
)
_
map
Polygon
.
appendVertex
(
topRightCoord
)
_
map
Polygon
.
appendVertex
(
bottomRightCoord
)
_
map
Polygon
.
appendVertex
(
bottomLeftCoord
)
_
structure
Polygon
.
appendVertex
(
topLeftCoord
)
_
structure
Polygon
.
appendVertex
(
topRightCoord
)
_
structure
Polygon
.
appendVertex
(
bottomRightCoord
)
_
structure
Polygon
.
appendVertex
(
bottomLeftCoord
)
}
}
...
...
@@ -88,9 +85,8 @@ Item {
}
QGCMapPolygonVisuals
{
id
:
mapPolygonVisuals
mapControl
:
map
mapPolygon
:
_
map
Polygon
mapPolygon
:
_
structure
Polygon
interactive
:
_missionItem
.
isCurrentItem
borderWidth
:
1
borderColor
:
"
black
"
...
...
@@ -98,15 +94,12 @@ Item {
interiorOpacity
:
0.5
}
// Survey grid lines
Component
{
id
:
gridComponent
MapPolyline
{
line.color
:
"
white
"
line.width
:
2
path
:
_missionItem
.
gridPoints
}
QGCMapPolygonVisuals
{
mapControl
:
map
mapPolygon
:
_flightPolygon
interactive
:
false
borderWidth
:
2
borderColor
:
"
white
"
}
// Entry point
...
...
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