Unverified Commit 0530bcdb authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #5815 from DonLakeFlyer/StructureScan

Structure Scan persistence and mission creation
parents 31fb5ea3 196165c5
This diff is collapsed.
......@@ -22,8 +22,8 @@ public:
Q_ENUMS(CameraSpecType)
Q_PROPERTY(CameraSpecType cameraSpecType MEMBER _cameraSpecType NOTIFY cameraSpecTypeChanged)
Q_PROPERTY(QString knownCameraName MEMBER _knownCameraName NOTIFY knownCameraNameChanged)
Q_PROPERTY(CameraSpecType cameraSpecType READ cameraSpecType WRITE setCameraSpecType NOTIFY cameraSpecTypeChanged)
Q_PROPERTY(QString knownCameraName READ knownCameraName WRITE setKnownCameraName NOTIFY knownCameraNameChanged)
Q_PROPERTY(Fact* valueSetIsDistance READ valueSetIsDistance CONSTANT) ///< true: distance specified, resolution calculated
Q_PROPERTY(Fact* distanceToSurface READ distanceToSurface CONSTANT) ///< Distance to surface for image foot print calculation
Q_PROPERTY(Fact* imageDensity READ imageDensity CONSTANT) ///< Image density on surface (cm/px)
......@@ -42,6 +42,11 @@ public:
CameraSpecKnown
};
CameraSpecType cameraSpecType(void) const { return _cameraSpecType; }
QString knownCameraName(void) const { return _knownCameraName; }
void setCameraSpecType(CameraSpecType cameraSpecType);
void setKnownCameraName(QString knownCameraName);
Fact* valueSetIsDistance (void) { return &_valueSetIsDistanceFact; }
Fact* distanceToSurface (void) { return &_distanceToSurfaceFact; }
Fact* imageDensity (void) { return &_imageDensityFact; }
......@@ -99,4 +104,6 @@ private:
static const char* _sideOverlapName;
static const char* _adjustedFootprintSideName;
static const char* _adjustedFootprintFrontalName;
static const char* _jsonCameraSpecTypeKey;
static const char* _jsonKnownCameraNameKey;
};
This diff is collapsed.
......@@ -17,22 +17,11 @@ class CameraSpec : public QObject
public:
CameraSpec(QObject* parent = NULL);
CameraSpec(const QString& name,
double sensorWidth,
double sensorHeight,
double imageWidth,
double imageHeight,
double focalLength,
bool landscape,
bool fixedOrientation,
double minTriggerInterval,
QObject* parent = NULL);
CameraSpec(const CameraSpec& other, QObject* parent);
const CameraSpec& operator=(const CameraSpec& other);
// These properties are persisted to Json
Q_PROPERTY(Fact* name READ name CONSTANT) ///< Camera name
Q_PROPERTY(Fact* sensorWidth READ sensorWidth CONSTANT) ///< Sensor size in millimeters
Q_PROPERTY(Fact* sensorHeight READ sensorHeight CONSTANT) ///< Sensor size in millimeters
Q_PROPERTY(Fact* imageWidth READ imageWidth CONSTANT) ///< Image size in pixels
......@@ -42,7 +31,6 @@ public:
Q_PROPERTY(Fact* fixedOrientation READ fixedOrientation CONSTANT) ///< true: camera is in fixed orientation
Q_PROPERTY(Fact* minTriggerInterval READ minTriggerInterval CONSTANT) ///< Minimum time in seconds between each photo taken, 0 for not specified
Fact* name (void) { return &_nameFact; }
Fact* sensorWidth (void) { return &_sensorWidthFact; }
Fact* sensorHeight (void) { return &_sensorHeightFact; }
Fact* imageWidth (void) { return &_imageWidthFact; }
......@@ -68,7 +56,6 @@ private:
QMap<QString, FactMetaData*> _metaDataMap;
Fact _nameFact;
Fact _sensorWidthFact;
Fact _sensorHeightFact;
Fact _imageWidthFact;
......@@ -78,7 +65,6 @@ private:
Fact _fixedOrientationFact;
Fact _minTriggerIntervalFact;
static const char* _nameName;
static const char* _sensorWidthName;
static const char* _sensorHeightName;
static const char* _imageWidthName;
......@@ -87,14 +73,4 @@ private:
static const char* _landscapeName;
static const char* _fixedOrientationName;
static const char* _minTriggerIntervalName;
static const char* _jsonNameKey;
static const char* _jsonSensorWidthKey;
static const char* _jsonSensorHeightKey;
static const char* _jsonImageWidthKey;
static const char* _jsonImageHeightKey;
static const char* _jsonFocalLengthKey;
static const char* _jsonLandscapeKey;
static const char* _jsonFixedOrientationKey;
static const char* _jsonMinTriggerIntervalKey;
};
......@@ -19,6 +19,7 @@
#include "SurveyMissionItem.h"
#include "FixedWingLandingComplexItem.h"
#include "StructureScanComplexItem.h"
#include "StructureScanComplexItem.h"
#include "JsonHelper.h"
#include "ParameterManager.h"
#include "QGroundControlQmlGlobal.h"
......@@ -266,11 +267,15 @@ void MissionController::convertToKMLDocument(QDomDocument& document)
{
QJsonObject missionJson;
QmlObjectListModel* visualItems = new QmlObjectListModel();
QList<MissionItem*> missionItens;
QList<MissionItem*> missionItems;
QString error;
save(missionJson);
_loadItemsFromJson(missionJson, visualItems, error);
_convertToMissionItems(visualItems, missionItens, this);
_convertToMissionItems(visualItems, missionItems, this);
if (missionItems.count() == 0) {
return;
}
float altitude = missionJson[_jsonPlannedHomePositionKey].toArray()[2].toDouble();
......@@ -278,7 +283,7 @@ void MissionController::convertToKMLDocument(QDomDocument& document)
QStringList coords;
// Drop home position
bool dropPoint = true;
for(const auto& item : missionItens) {
for(const auto& item : missionItems) {
if(dropPoint) {
dropPoint = false;
continue;
......@@ -657,6 +662,15 @@ bool MissionController::_loadJsonMissionFileV2(const QJsonObject& json, QmlObjec
nextSequenceNumber = landingItem->lastSequenceNumber() + 1;
qCDebug(MissionControllerLog) << "FW Landing Pattern load complete: nextSequenceNumber" << nextSequenceNumber;
visualItems->append(landingItem);
} else if (complexItemType == StructureScanComplexItem::jsonComplexItemTypeValue) {
qCDebug(MissionControllerLog) << "Loading Structure Scan: nextSequenceNumber" << nextSequenceNumber;
StructureScanComplexItem* structureItem = new StructureScanComplexItem(_controllerVehicle, visualItems);
if (!structureItem->load(itemObject, nextSequenceNumber++, errorString)) {
return false;
}
nextSequenceNumber = structureItem->lastSequenceNumber() + 1;
qCDebug(MissionControllerLog) << "Structure Scan load complete: nextSequenceNumber" << nextSequenceNumber;
visualItems->append(structureItem);
} else if (complexItemType == MissionSettingsItem::jsonComplexItemTypeValue) {
qCDebug(MissionControllerLog) << "Loading Mission Settings: nextSequenceNumber" << nextSequenceNumber;
MissionSettingsItem* settingsItem = new MissionSettingsItem(_controllerVehicle, visualItems);
......
......@@ -129,6 +129,9 @@ private:
static const char* _altitudeFactName;
static const char* _layersFactName;
static const char* _jsonCameraCalcKey;
static const char* _jsonAltitudeRelativeKey;
};
#endif
......@@ -60,7 +60,7 @@ Rectangle {
QGCLabel {
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("WARNING: WORK IN PROGRESS. DO NOT FLY. NO BUG REPORTS.")
text: qsTr("WORK IN PROGRESS. CAREFUL!")
wrapMode: Text.WordWrap
color: qgcPal.warningText
}
......
......@@ -91,7 +91,7 @@ Item {
borderWidth: 1
borderColor: "black"
interiorColor: "green"
interiorOpacity: 0.5
interiorOpacity: 0.25
}
QGCMapPolygonVisuals {
......
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