Commit 7a669919 authored by DonLakeFlyer's avatar DonLakeFlyer

Support scan distance from structure

Fix crash when adding second structure scan
parent cc9f9d52
...@@ -23,6 +23,15 @@ ...@@ -23,6 +23,15 @@
"units": "m", "units": "m",
"defaultValue": 25 "defaultValue": 25
}, },
{
"name": "Scan distance",
"shortDescription": "Scan distance away from structure.",
"type": "double",
"decimalPlaces": 2,
"min": 0,
"units": "m",
"defaultValue": 25
},
{ {
"name": "Trigger distance", "name": "Trigger distance",
"shortDescription": "Distance between each triggering of the camera. 0 specifies not camera trigger.", "shortDescription": "Distance between each triggering of the camera. 0 specifies not camera trigger.",
......
...@@ -30,20 +30,24 @@ public: ...@@ -30,20 +30,24 @@ public:
Q_PROPERTY(Fact* layers READ layers CONSTANT) Q_PROPERTY(Fact* layers READ layers CONSTANT)
Q_PROPERTY(Fact* layerDistance READ layerDistance CONSTANT) Q_PROPERTY(Fact* layerDistance READ layerDistance CONSTANT)
Q_PROPERTY(Fact* cameraTriggerDistance READ cameraTriggerDistance 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(bool altitudeRelative MEMBER _altitudeRelative NOTIFY altitudeRelativeChanged)
Q_PROPERTY(int cameraShots READ cameraShots NOTIFY cameraShotsChanged) Q_PROPERTY(int cameraShots READ cameraShots NOTIFY cameraShotsChanged)
Q_PROPERTY(double timeBetweenShots READ timeBetweenShots NOTIFY timeBetweenShotsChanged) Q_PROPERTY(double timeBetweenShots READ timeBetweenShots NOTIFY timeBetweenShotsChanged)
Q_PROPERTY(double cameraMinTriggerInterval MEMBER _cameraMinTriggerInterval NOTIFY cameraMinTriggerIntervalChanged) 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* altitude (void) { return &_altitudeFact; }
Fact* layers (void) { return &_layersFact; } Fact* layers (void) { return &_layersFact; }
Fact* layerDistance (void) { return &_layerDistanceFact; } Fact* layerDistance (void) { return &_layerDistanceFact; }
Fact* cameraTriggerDistance (void) { return &_cameraTriggerDistanceFact; } Fact* cameraTriggerDistance (void) { return &_cameraTriggerDistanceFact; }
Fact* scanDistance (void) { return &_scanDistanceFact; }
int cameraShots (void) const; int cameraShots (void) const;
double timeBetweenShots(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); Q_INVOKABLE void rotateEntryPoint(void);
...@@ -95,9 +99,10 @@ private slots: ...@@ -95,9 +99,10 @@ private slots:
void _setDirty(void); void _setDirty(void);
void _polygonDirtyChanged(bool dirty); void _polygonDirtyChanged(bool dirty);
void _polygonCountChanged(int count); void _polygonCountChanged(int count);
void _polygonPathChanged(void); void _flightPathChanged(void);
void _clearInternal(void); void _clearInternal(void);
void _updateCoordinateAltitudes(void); void _updateCoordinateAltitudes(void);
void _rebuildFlightPolygon(void);
private: private:
void _setExitCoordinate(const QGeoCoordinate& coordinate); void _setExitCoordinate(const QGeoCoordinate& coordinate);
...@@ -107,7 +112,8 @@ private: ...@@ -107,7 +112,8 @@ private:
int _sequenceNumber; int _sequenceNumber;
bool _dirty; bool _dirty;
QGCMapPolygon _mapPolygon; QGCMapPolygon _structurePolygon;
QGCMapPolygon _flightPolygon;
bool _altitudeRelative; bool _altitudeRelative;
int _entryVertex; // Polygon vertext which is used as the mission entry point int _entryVertex; // Polygon vertext which is used as the mission entry point
...@@ -124,39 +130,13 @@ private: ...@@ -124,39 +130,13 @@ private:
Fact _layersFact; Fact _layersFact;
Fact _layerDistanceFact; Fact _layerDistanceFact;
Fact _cameraTriggerDistanceFact; Fact _cameraTriggerDistanceFact;
Fact _scanDistanceFact;
static const char* _altitudeFactName; static const char* _altitudeFactName;
static const char* _layersFactName; static const char* _layersFactName;
static const char* _layerDistanceFactName; static const char* _layerDistanceFactName;
static const char* _cameraTriggerDistanceFactName; static const char* _cameraTriggerDistanceFactName;
static const char* _scanDistanceFactName;
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;
}; };
#endif #endif
...@@ -60,11 +60,19 @@ Rectangle { ...@@ -60,11 +60,19 @@ Rectangle {
QGCLabel { QGCLabel {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right 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 wrapMode: Text.WordWrap
color: qgcPal.warningText 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 { QGCLabel {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
...@@ -99,6 +107,12 @@ Rectangle { ...@@ -99,6 +107,12 @@ Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
} }
QGCLabel { text: qsTr("Scan distance") }
FactTextField {
fact: missionItem.scanDistance
Layout.fillWidth: true
}
QGCLabel { text: qsTr("Trigger Distance") } QGCLabel { text: qsTr("Trigger Distance") }
FactTextField { FactTextField {
fact: missionItem.cameraTriggerDistance fact: missionItem.cameraTriggerDistance
......
...@@ -25,31 +25,28 @@ Item { ...@@ -25,31 +25,28 @@ Item {
property var map ///< Map control to place item in property var map ///< Map control to place item in
property var _missionItem: object property var _missionItem: object
property var _mapPolygon: object.mapPolygon property var _structurePolygon: object.structurePolygon
property var _gridComponent property var _flightPolygon: object.flightPolygon
property var _entryCoordinate property var _entryCoordinate
property var _exitCoordinate property var _exitCoordinate
signal clicked(int sequenceNumber) signal clicked(int sequenceNumber)
function _addVisualElements() { function _addVisualElements() {
_gridComponent = gridComponent.createObject(map)
_entryCoordinate = entryPointComponent.createObject(map) _entryCoordinate = entryPointComponent.createObject(map)
_exitCoordinate = exitPointComponent.createObject(map) _exitCoordinate = exitPointComponent.createObject(map)
map.addMapItem(_gridComponent)
map.addMapItem(_entryCoordinate) map.addMapItem(_entryCoordinate)
map.addMapItem(_exitCoordinate) map.addMapItem(_exitCoordinate)
} }
function _destroyVisualElements() { function _destroyVisualElements() {
_gridComponent.destroy()
_entryCoordinate.destroy() _entryCoordinate.destroy()
_exitCoordinate.destroy() _exitCoordinate.destroy()
} }
/// 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 (_mapPolygon.count < 3) { if (_structurePolygon.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
...@@ -71,10 +68,10 @@ Item { ...@@ -71,10 +68,10 @@ Item {
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)
_mapPolygon.appendVertex(topLeftCoord) _structurePolygon.appendVertex(topLeftCoord)
_mapPolygon.appendVertex(topRightCoord) _structurePolygon.appendVertex(topRightCoord)
_mapPolygon.appendVertex(bottomRightCoord) _structurePolygon.appendVertex(bottomRightCoord)
_mapPolygon.appendVertex(bottomLeftCoord) _structurePolygon.appendVertex(bottomLeftCoord)
} }
} }
...@@ -88,9 +85,8 @@ Item { ...@@ -88,9 +85,8 @@ Item {
} }
QGCMapPolygonVisuals { QGCMapPolygonVisuals {
id: mapPolygonVisuals
mapControl: map mapControl: map
mapPolygon: _mapPolygon mapPolygon: _structurePolygon
interactive: _missionItem.isCurrentItem interactive: _missionItem.isCurrentItem
borderWidth: 1 borderWidth: 1
borderColor: "black" borderColor: "black"
...@@ -98,15 +94,12 @@ Item { ...@@ -98,15 +94,12 @@ Item {
interiorOpacity: 0.5 interiorOpacity: 0.5
} }
// Survey grid lines QGCMapPolygonVisuals {
Component { mapControl: map
id: gridComponent mapPolygon: _flightPolygon
interactive: false
MapPolyline { borderWidth: 2
line.color: "white" borderColor: "white"
line.width: 2
path: _missionItem.gridPoints
}
} }
// Entry point // Entry point
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment