diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc
index ddead71c552c4677adffb76daa64d75900c2713a..7a73d84ae47cc0701f9a8ea79b3996fedd4ff42e 100644
--- a/qgroundcontrol.qrc
+++ b/qgroundcontrol.qrc
@@ -261,26 +261,20 @@
src/QmlControls/QmlTest.qml
src/AutoPilotPlugins/Common/RadioComponent.qml
src/ui/preferences/SerialSettings.qml
- src/WimaView/CircularGeneratorEditor.qml
- src/WimaView/CircularGeneratorMapVisual.qml
- src/WimaView/MeasurementItemEditor.qml
- src/WimaView/MeasurementItemMapVisual.qml
- src/WimaView/CoordinateIndicator.qml
- src/WimaView/CoordinateIndicatorDrag.qml
- src/WimaView/DragCoordinate.qml
- src/WimaView/LinearGeneratorEditor.qml
- src/WimaView/ProgressIndicator.qml
- src/WimaView/Wima.qmldir
- src/WimaView/WimaAreaMapVisual.qml
- src/WimaView/WimaCorridorEditor.qml
- src/WimaView/WimaItemEditor.qml
- src/WimaView/WimaMapPolygonVisuals.qml
- src/WimaView/WimaMapVisual.qml
- src/WimaView/MeasurementAreaEditor.qml
- src/WimaView/MeasurementAreaMapVisual.qml
- src/WimaView/SafeAreaEditor.qml
- src/WimaView/SafeAreaMapVisual.qml
- src/WimaView/WimaToolBar.qml
+ src/MeasurementComplexItem/qml/CircularGeneratorEditor.qml
+ src/MeasurementComplexItem/qml/CircularGeneratorMapVisual.qml
+ src/MeasurementComplexItem/qml/MeasurementItemEditor.qml
+ src/MeasurementComplexItem/qml/MeasurementItemMapVisual.qml
+ src/MeasurementComplexItem/qml/CoordinateIndicator.qml
+ src/MeasurementComplexItem/qml/CoordinateIndicatorDrag.qml
+ src/MeasurementComplexItem/qml/DragCoordinate.qml
+ src/MeasurementComplexItem/qml/LinearGeneratorEditor.qml
+ src/MeasurementComplexItem/qml/ProgressIndicator.qml
+ src/MeasurementComplexItem/qml/GeoAreaVisualLoader.qml
+ src/MeasurementComplexItem/qml/MeasurementAreaEditor.qml
+ src/MeasurementComplexItem/qml/MeasurementAreaMapVisual.qml
+ src/MeasurementComplexItem/qml/SafeAreaEditor.qml
+ src/MeasurementComplexItem/qml/SafeAreaMapVisual.qml
src/VehicleSetup/SetupParameterEditor.qml
src/VehicleSetup/SetupView.qml
src/PlanView/SimpleItemEditor.qml
@@ -295,6 +289,7 @@
src/AnalyzeView/VibrationPage.qml
src/FlightDisplay/VirtualJoystick.qml
src/PlanView/VTOLLandingPatternEditor.qml
+ src/MeasurementComplexItem/qml/GeoAreaEditorLoader.qml
src/FirstRunPromptDialogs/UnitsFirstRunPrompt.qml
@@ -352,9 +347,10 @@
src/Settings/Video.SettingsGroup.json
src/MissionManager/VTOLLandingPattern.FactMetaData.json
src/Settings/Wima.SettingsGroup.json
- src/MeasurementComplexItem/json/CircularGenerator.SettingsGroup.json
- src/MeasurementComplexItem/json/LinearGenerator.SettingsGroup.json
- src/MeasurementComplexItem/json/MeasurementComplexItem.SettingsGroup.json
+ src/MeasurementComplexItem/json/CircularGenerator.SettingsGroup.json
+ src/MeasurementComplexItem/json/LinearGenerator.SettingsGroup.json
+ src/MeasurementComplexItem/json/MeasurementComplexItem.SettingsGroup.json
+ src/MeasurementComplexItem/geometry/json/MeasurementArea.SettingsGroup.json
src/comm/APMArduSubMockLink.params
diff --git a/src/MeasurementComplexItem/AreaData.cc b/src/MeasurementComplexItem/AreaData.cc
index 1a56f2740e95958c3e2b78ec08259834e2e33acd..e433c9f886ef0f12279cd592221285cfdce653fb 100644
--- a/src/MeasurementComplexItem/AreaData.cc
+++ b/src/MeasurementComplexItem/AreaData.cc
@@ -30,29 +30,11 @@ AreaData &AreaData::operator=(const AreaData &other) {
}
bool AreaData::insert(GeoArea *areaData) {
- {
- SafeArea *area = qobject_cast(areaData);
- if (area != nullptr) {
- if (Q_LIKELY(!this->_areaList.contains(area))) {
- _areaList.append(area);
- emit areaList();
- return true;
- } else {
- return false;
- }
- }
- }
-
- {
- MeasurementArea *area = qobject_cast(areaData);
- if (area != nullptr) {
- if (Q_LIKELY(!this->_areaList.contains(area))) {
- _areaList.append(area);
- emit areaList();
- return true;
- } else {
- return false;
- }
+ if (areaData != nullptr) {
+ if (Q_LIKELY(!this->_areaList.contains(areaData))) {
+ _areaList.append(areaData);
+ emit areaList();
+ return true;
}
}
@@ -111,7 +93,9 @@ bool AreaData::initialize(const QGeoCoordinate &bottomLeft,
auto *safeArea = getGeoArea(_areaList);
if (safeArea == nullptr) {
- if (!insert(new SafeArea())) {
+ safeArea = new SafeArea(this);
+ if (!insert(safeArea)) {
+ safeArea->deleteLater();
qCCritical(AreaDataLog)
<< "initialize(): safeArea == nullptr, but insert() failed.";
return false;
@@ -119,7 +103,9 @@ bool AreaData::initialize(const QGeoCoordinate &bottomLeft,
}
if (measurementArea == nullptr) {
- if (!insert(new MeasurementArea())) {
+ measurementArea = new MeasurementArea(this);
+ if (!insert(measurementArea)) {
+ measurementArea->deleteLater();
qCCritical(AreaDataLog) << "initialize(): measurementArea == nullptr, "
"but insert() failed.";
return false;
diff --git a/src/MeasurementComplexItem/MeasurementComplexItem.cc b/src/MeasurementComplexItem/MeasurementComplexItem.cc
index b8d879e969335efa44a83a3c503fd7f807d64c6a..15789e07418f9e5a81e103b10b2d3d5c636b7c53 100644
--- a/src/MeasurementComplexItem/MeasurementComplexItem.cc
+++ b/src/MeasurementComplexItem/MeasurementComplexItem.cc
@@ -41,14 +41,15 @@ MeasurementComplexItem::MeasurementComplexItem(
const QString &kmlOrShpFile, QObject *parent)
: ComplexMissionItem(masterController, flyView, parent),
_masterController(masterController), _sequenceNumber(0),
- _followTerrain(false),
- _altitude(settingsGroup, _metaDataMap[altitudeName]), _state(STATE::IDLE),
+ _followTerrain(false), _state(STATE::IDLE),
_metaDataMap(FactMetaData::createMapFromJsonFile(
QStringLiteral(":/json/MeasurementComplexItem.SettingsGroup.json"),
this)),
+ _altitude(settingsGroup, _metaDataMap[altitudeName]),
_variant(settingsGroup, _metaDataMap[variantName]),
- _areaData(new AreaData(this)), _editorData(new AreaData(this)),
- _currentData(_areaData), _pWorker(new RoutingThread(this)) {
+ _pAreaData(new AreaData(this)), _pEditorData(new AreaData(this)),
+ _pCurrentData(_pAreaData), _pGenerator(nullptr),
+ _pWorker(new RoutingThread(this)) {
Q_UNUSED(kmlOrShpFile)
_editorQml = "qrc:/qml/MeasurementItemEditor.qml";
@@ -61,7 +62,7 @@ MeasurementComplexItem::MeasurementComplexItem(
connect(this->_pWorker, &RoutingThread::result, this,
&MeasurementComplexItem::_storeRoutingData);
- // Connect coordinate and exitCoordinate
+ // Connect coordinate and exitCoordinate.
connect(this, &MeasurementComplexItem::routeChanged,
[this] { emit this->coordinateChanged(this->coordinate()); });
connect(this, &MeasurementComplexItem::routeChanged,
@@ -71,10 +72,14 @@ MeasurementComplexItem::MeasurementComplexItem(
this->exitCoordinateSameAsEntry());
});
+ // Connect complexDistance.
+ connect(this, &MeasurementComplexItem::routeChanged,
+ [this] { emit this->complexDistanceChanged(); });
+
// Register Generators.
- auto lg = new routing::LinearGenerator(this->_areaData, this);
+ auto lg = new routing::LinearGenerator(this->_pAreaData, this);
registerGenerator(lg->name(), lg);
- auto cg = new routing::CircularGenerator(this->_areaData, this);
+ auto cg = new routing::CircularGenerator(this->_pAreaData, this);
registerGenerator(cg->name(), cg);
qCritical() << "ToDo: _altitude connections missing.";
@@ -86,10 +91,10 @@ MeasurementComplexItem::~MeasurementComplexItem() {}
void MeasurementComplexItem::reverseRoute() { _reverseRoute(); }
const AreaData *MeasurementComplexItem::areaData() const {
- return this->_currentData;
+ return this->_pCurrentData;
}
-AreaData *MeasurementComplexItem::areaData() { return this->_currentData; }
+AreaData *MeasurementComplexItem::areaData() { return this->_pCurrentData; }
QVariantList MeasurementComplexItem::route() { return _route; }
@@ -155,6 +160,24 @@ bool MeasurementComplexItem::load(const QJsonObject &complexObject,
return true;
}
+double
+MeasurementComplexItem::greatestDistanceTo(const QGeoCoordinate &other) const {
+ double d = -1 * std::numeric_limits::infinity();
+ if (other.isValid()) {
+ if (this->_route.size() > 0) {
+ std::for_each(this->_route.cbegin(), this->_route.cend(),
+ [&d, &other](const QVariant &variant) {
+ auto vertex = variant.value();
+ d = std::max(d, vertex.distanceTo(other));
+ });
+ }
+ } else {
+ qCDebug(MeasurementComplexItemLog)
+ << "greatestDistanceTo(): invalid QGeoCoordinate: " << other;
+ }
+ return d;
+}
+
bool MeasurementComplexItem::dirty() const { return _dirty; }
bool MeasurementComplexItem::isSimpleItem() const { return false; }
@@ -202,6 +225,18 @@ double MeasurementComplexItem::maxAMSLAltitude() const {
return amslEntryAlt();
}
+QString MeasurementComplexItem::commandDescription() const {
+ return QStringLiteral("Measurement");
+}
+
+QString MeasurementComplexItem::commandName() const {
+ return QStringLiteral("Measurement");
+}
+
+QString MeasurementComplexItem::abbreviation() const {
+ return QStringLiteral("M");
+}
+
bool MeasurementComplexItem::specifiesCoordinate() const {
return _route.count() > 0;
}
@@ -283,8 +318,12 @@ bool MeasurementComplexItem::_setGenerator(PtrGenerator newG) {
}
this->_pGenerator = newG;
- connect(this->_pGenerator, &routing::GeneratorBase::generatorChanged, this,
- &MeasurementComplexItem::_updateRoute);
+
+ if (this->_pGenerator != nullptr) {
+ connect(this->_pGenerator, &routing::GeneratorBase::generatorChanged,
+ this, &MeasurementComplexItem::_updateRoute);
+ }
+
emit generatorChanged();
if (!editing()) {
@@ -321,14 +360,18 @@ bool MeasurementComplexItem::_calculating(MeasurementComplexItem::STATE state) {
return state == STATE::ROUTING;
}
+bool MeasurementComplexItem::_editing(MeasurementComplexItem::STATE state) {
+ return state == STATE::EDITING;
+}
+
bool MeasurementComplexItem::_ready(MeasurementComplexItem::STATE state) {
return state == STATE::IDLE;
}
void MeasurementComplexItem::_setAreaData(
MeasurementComplexItem::PtrAreaData data) {
- if (_currentData != data) {
- _currentData = data;
+ if (_pCurrentData != data) {
+ _pCurrentData = data;
emit areaDataChanged();
}
}
@@ -340,10 +383,10 @@ bool MeasurementComplexItem::_updateRoute() {
this->_variantNames.clear();
emit variantNamesChanged();
- if (this->_areaData->isValid()) {
+ if (this->_pAreaData->isValid()) {
// Prepare data.
- auto origin = this->_areaData->origin();
+ auto origin = this->_pAreaData->origin();
origin.setAltitude(0);
if (!origin.isValid()) {
qCDebug(MeasurementComplexItemLog)
@@ -353,7 +396,7 @@ bool MeasurementComplexItem::_updateRoute() {
// Convert safe area.
auto serviceArea =
- getGeoArea(*this->_areaData->areaList());
+ getGeoArea(*this->_pAreaData->areaList());
auto geoSafeArea = serviceArea->coordinateList();
if (!(geoSafeArea.size() >= 3)) {
qCDebug(MeasurementComplexItemLog)
@@ -378,7 +421,7 @@ bool MeasurementComplexItem::_updateRoute() {
snake::areaToEnu(origin, geoSafeArea, safeAreaENU);
// Create generator.
- if (this->_pGenerator) {
+ if (this->_pGenerator != nullptr) {
routing::GeneratorBase::Generator g; // Transect generator.
if (this->_pGenerator->get(g)) {
// Start/Restart routing worker.
@@ -491,6 +534,24 @@ void MeasurementComplexItem::setSequenceNumber(int sequenceNumber) {
QString MeasurementComplexItem::patternName() const { return name; }
+double MeasurementComplexItem::complexDistance() const {
+ double d = 0;
+ if (this->_route.size() > 1) {
+ auto vertex = _route.first().value();
+ std::for_each(this->_route.cbegin() + 1, this->_route.cend(),
+ [&vertex, &d](const QVariant &variant) {
+ auto otherVertex = variant.value();
+ d += vertex.distanceTo(otherVertex);
+ vertex = otherVertex;
+ });
+ }
+ return d;
+}
+
+int MeasurementComplexItem::lastSequenceNumber() const {
+ return _sequenceNumber + std::max(0, this->_route.size() - 1);
+}
+
bool MeasurementComplexItem::registerGenerator(const QString &name,
routing::GeneratorBase *g) {
if (name.isEmpty()) {
@@ -602,20 +663,20 @@ int MeasurementComplexItem::generatorIndex() {
void MeasurementComplexItem::editingStart() {
if (!_editing(this->_state)) {
- *_editorData = *_areaData;
- _setAreaData(_editorData);
+ *_pEditorData = *_pAreaData;
+ _setAreaData(_pEditorData);
_setState(STATE::EDITING);
}
}
void MeasurementComplexItem::editingStop() {
if (_editing(this->_state)) {
- if (_editorData->isValid()) {
- *_areaData = *_editorData;
+ if (_pEditorData->isValid()) {
+ *_pAreaData = *_pEditorData;
}
- _setAreaData(_areaData);
+ _setAreaData(_pAreaData);
_setState(STATE::IDLE);
- if (_editorData->isValid() && *_editorData != *_areaData) {
+ if (_pEditorData->isValid() && *_pEditorData != *_pAreaData) {
_updateRoute();
}
}
@@ -625,7 +686,7 @@ void MeasurementComplexItem::_storeRoutingData(
MeasurementComplexItem::PtrRoutingData pRoute) {
if (this->_state == STATE::ROUTING) {
// Store solutions.
- auto ori = this->_areaData->origin();
+ auto ori = this->_pAreaData->origin();
ori.setAltitude(0);
const auto &transectsENU = pRoute->transects;
QVector variantVector;
@@ -742,4 +803,6 @@ bool MeasurementComplexItem::calculating() const {
bool MeasurementComplexItem::editing() const { return _editing(this->_state); }
+bool MeasurementComplexItem::ready() const { return _ready(this->_state); }
+
bool MeasurementComplexItem::followTerrain() const { return _followTerrain; }
diff --git a/src/MeasurementComplexItem/MeasurementComplexItem.h b/src/MeasurementComplexItem/MeasurementComplexItem.h
index c1a7ee42c875d7f3ff8b1cf583581a8c1f019d30..19adddd2b1db4fd986d845e148fcf6bee8415727 100644
--- a/src/MeasurementComplexItem/MeasurementComplexItem.h
+++ b/src/MeasurementComplexItem/MeasurementComplexItem.h
@@ -45,8 +45,6 @@ public:
Q_PROPERTY(
routing::GeneratorBase *generator READ generator NOTIFY generatorChanged)
Q_PROPERTY(int generatorIndex READ generatorIndex NOTIFY generatorChanged)
- Q_PROPERTY(bool editing READ editing NOTIFY editingChanged)
- Q_PROPERTY(bool editing READ editing NOTIFY editingChanged)
Q_PROPERTY(AreaData *areaData READ areaData NOTIFY areaDataChanged)
Q_PROPERTY(QVariantList route READ route NOTIFY routeChanged)
@@ -91,6 +89,9 @@ public:
virtual double amslExitAlt(void) const override final;
virtual double minAMSLAltitude(void) const override final;
virtual double maxAMSLAltitude(void) const override final;
+ virtual QString commandDescription(void) const override final;
+ virtual QString commandName(void) const override final;
+ virtual QString abbreviation(void) const override final;
// Generator
bool registerGenerator(const QString &name, routing::GeneratorBase *g);
@@ -171,20 +172,20 @@ private:
PlanMasterController *_masterController;
int _sequenceNumber;
bool _followTerrain;
- SettingsFact _altitude;
// State.
STATE _state;
// Facts
QMap _metaDataMap;
+ SettingsFact _altitude;
SettingsFact _variant;
QStringList _variantNames;
// Area data
- PtrAreaData _areaData;
- PtrAreaData _editorData;
- PtrAreaData _currentData;
+ PtrAreaData _pAreaData;
+ PtrAreaData _pEditorData;
+ PtrAreaData _pCurrentData;
// Generators
QList _generatorList;
diff --git a/src/MeasurementComplexItem/geometry/MeasurementArea.cc b/src/MeasurementComplexItem/geometry/MeasurementArea.cc
index 3bea51cc6fc911192eebe4844bc1b2da6019ed2e..95eb58463fc3576a280a0670250193ff5eceb859 100644
--- a/src/MeasurementComplexItem/geometry/MeasurementArea.cc
+++ b/src/MeasurementComplexItem/geometry/MeasurementArea.cc
@@ -73,7 +73,7 @@ const char *MeasurementArea::MeasurementAreaName = "Measurement Area";
MeasurementArea::MeasurementArea(QObject *parent)
: GeoArea(parent),
_metaDataMap(FactMetaData::createMapFromJsonFile(
- QStringLiteral(":/json/WimaMeasurementArea.SettingsGroup.json"),
+ QStringLiteral(":/json/MeasurementArea.SettingsGroup.json"),
this /* QObject parent */)),
_tileHeight(SettingsFact(settingsGroup, _metaDataMap[tileHeightName],
this /* QObject parent */)),
diff --git a/src/MeasurementComplexItem/geometry/json/WimaMeasurementArea.SettingsGroup.json b/src/MeasurementComplexItem/geometry/json/MeasurementArea.SettingsGroup.json
similarity index 93%
rename from src/MeasurementComplexItem/geometry/json/WimaMeasurementArea.SettingsGroup.json
rename to src/MeasurementComplexItem/geometry/json/MeasurementArea.SettingsGroup.json
index c4fda54e2296fc8eaf992feaac5054d0aa969c90..87acca6c7a486e44d4314776253e23e1e366d7af 100644
--- a/src/MeasurementComplexItem/geometry/json/WimaMeasurementArea.SettingsGroup.json
+++ b/src/MeasurementComplexItem/geometry/json/MeasurementArea.SettingsGroup.json
@@ -1,3 +1,7 @@
+{
+ "version": 1,
+ "fileType": "FactMetaData",
+ "QGC.MetaData.Facts":
[
{
"name": "TileHeight",
@@ -43,3 +47,4 @@
"defaultValue": 5
}
]
+}
diff --git a/src/MeasurementComplexItem/geometry/json/WimaArea.SettingsGroup.json b/src/MeasurementComplexItem/geometry/json/WimaArea.SettingsGroup.json
deleted file mode 100644
index 321fa4747e2e973f30e8d0831bbd879620119e7a..0000000000000000000000000000000000000000
--- a/src/MeasurementComplexItem/geometry/json/WimaArea.SettingsGroup.json
+++ /dev/null
@@ -1,17 +0,0 @@
-[
-{
- "name": "BorderPolygonOffset",
- "shortDescription": "The distance between the measurement area and it's surrounding polygon",
- "type": "double",
- "units": "m",
- "min": 0,
- "decimalPlaces": 1,
- "defaultValue": 5
-},
-{
- "name": "ShowBorderPolygon",
- "shortDescription": "Border polygon will be displayed if checked.",
- "type": "bool",
- "defaultValue": true
-}
-]
diff --git a/src/WimaView/CircularGeneratorEditor.qml b/src/MeasurementComplexItem/qml/CircularGeneratorEditor.qml
similarity index 93%
rename from src/WimaView/CircularGeneratorEditor.qml
rename to src/MeasurementComplexItem/qml/CircularGeneratorEditor.qml
index c70751f87fed7c85a8aded01e4bc25e7181ca8e3..fac58e7b5c0a0649ccd87ea6e712897be40092d1 100644
--- a/src/WimaView/CircularGeneratorEditor.qml
+++ b/src/MeasurementComplexItem/qml/CircularGeneratorEditor.qml
@@ -7,11 +7,13 @@ import QGroundControl.FactControls 1.0
import QGroundControl.ScreenTools 1.0
GridLayout {
+ id: grid
property var generator // CircularGenerator
-
+ property var availableWidth
property real _margin: ScreenTools.defaultFontPixelWidth / 2
+ width: availableWidth
columnSpacing: _margin
rowSpacing: _margin
columns: 2
diff --git a/src/WimaView/CircularGeneratorMapVisual.qml b/src/MeasurementComplexItem/qml/CircularGeneratorMapVisual.qml
similarity index 98%
rename from src/WimaView/CircularGeneratorMapVisual.qml
rename to src/MeasurementComplexItem/qml/CircularGeneratorMapVisual.qml
index 6a7fea20642669f18bb3d9536095bff358b5bce2..489234a8208a51093bc52ffd3dec4cad5db6961b 100644
--- a/src/WimaView/CircularGeneratorMapVisual.qml
+++ b/src/MeasurementComplexItem/qml/CircularGeneratorMapVisual.qml
@@ -1,5 +1,4 @@
import QtQuick 2.0
-import Wima 1.0
import QGroundControl 1.0
Item {
diff --git a/src/WimaView/CoordinateIndicator.qml b/src/MeasurementComplexItem/qml/CoordinateIndicator.qml
similarity index 100%
rename from src/WimaView/CoordinateIndicator.qml
rename to src/MeasurementComplexItem/qml/CoordinateIndicator.qml
diff --git a/src/WimaView/CoordinateIndicatorDrag.qml b/src/MeasurementComplexItem/qml/CoordinateIndicatorDrag.qml
similarity index 100%
rename from src/WimaView/CoordinateIndicatorDrag.qml
rename to src/MeasurementComplexItem/qml/CoordinateIndicatorDrag.qml
diff --git a/src/WimaView/DragCoordinate.qml b/src/MeasurementComplexItem/qml/DragCoordinate.qml
similarity index 100%
rename from src/WimaView/DragCoordinate.qml
rename to src/MeasurementComplexItem/qml/DragCoordinate.qml
diff --git a/src/WimaView/WimaItemEditor.qml b/src/MeasurementComplexItem/qml/GeoAreaEditorLoader.qml
similarity index 100%
rename from src/WimaView/WimaItemEditor.qml
rename to src/MeasurementComplexItem/qml/GeoAreaEditorLoader.qml
diff --git a/src/WimaView/WimaMapVisual.qml b/src/MeasurementComplexItem/qml/GeoAreaVisualLoader.qml
similarity index 76%
rename from src/WimaView/WimaMapVisual.qml
rename to src/MeasurementComplexItem/qml/GeoAreaVisualLoader.qml
index 33e90ee2750ea4d4ee0ff9202eeec69692a40d4b..783bf594eb79c4a23c1c9ee160d8e9c559b826d9 100644
--- a/src/WimaView/WimaMapVisual.qml
+++ b/src/MeasurementComplexItem/qml/GeoAreaVisualLoader.qml
@@ -15,26 +15,27 @@ import QtPositioning 5.3
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
+import QGroundControl 1.0
-/// Wima map visual
Item {
id: _root
property var map ///< Map control to place item in
property var qgcView ///< QGCView to use for popping dialogs
+ property var geoArea ///< GeoArea derived class
signal clicked(int sequenceNumber)
property var _visualItem
Component.onCompleted: {
- if (object.mapVisualQML) {
- var component = Qt.createComponent(object.mapVisualQML)
+ if (geoArea.mapVisualQML) {
+ var component = Qt.createComponent(geoArea.mapVisualQML)
if (component.status === Component.Error) {
- console.log("Error loading Qml: ", object.mapVisualQML, component.errorString())
+ console.log("Error loading Qml: ", geoArea.mapVisualQML, component.errorString())
}
- _visualItem = component.createObject(map, { "map": _root.map, "qgcView": _root.qgcView })
+ _visualItem = component.createObject(map, { "map": _root.map, "qgcView": _root.qgcView, "geoArea": _root.geoArea})
_visualItem.clicked.connect(_root.clicked)
}
}
diff --git a/src/WimaView/LinearGeneratorEditor.qml b/src/MeasurementComplexItem/qml/LinearGeneratorEditor.qml
similarity index 92%
rename from src/WimaView/LinearGeneratorEditor.qml
rename to src/MeasurementComplexItem/qml/LinearGeneratorEditor.qml
index 24962ec849ee88d4a2bb247f46696a45e3ea0958..88761ac2489cdaef26342f746bc627fa923a7912 100644
--- a/src/WimaView/LinearGeneratorEditor.qml
+++ b/src/MeasurementComplexItem/qml/LinearGeneratorEditor.qml
@@ -8,10 +8,11 @@ import QGroundControl.ScreenTools 1.0
GridLayout {
- property var generator ///< LinearGenerator
-
+ property var generator // CircularGenerator
+ property var availableWidth
property real _margin: ScreenTools.defaultFontPixelWidth / 2
+ width: availableWidth
columnSpacing: _margin
rowSpacing: _margin
columns: 2
diff --git a/src/WimaView/MeasurementAreaEditor.qml b/src/MeasurementComplexItem/qml/MeasurementAreaEditor.qml
similarity index 100%
rename from src/WimaView/MeasurementAreaEditor.qml
rename to src/MeasurementComplexItem/qml/MeasurementAreaEditor.qml
diff --git a/src/MeasurementComplexItem/qml/MeasurementAreaMapVisual.qml b/src/MeasurementComplexItem/qml/MeasurementAreaMapVisual.qml
new file mode 100644
index 0000000000000000000000000000000000000000..89a8adea848bf42efeaa74821c5a19378762a9e4
--- /dev/null
+++ b/src/MeasurementComplexItem/qml/MeasurementAreaMapVisual.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+ *
+ * (c) 2009-2016 QGROUNDCONTROL PROJECT
+ *
+ * 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 1.2
+import QtLocation 5.3
+import QtPositioning 5.3
+
+import QGroundControl 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.FlightMap 1.0
+
+Item {
+ id: _root
+
+ property var map ///< Map control to place item in
+ property var qgcView ///< QGCView to use for popping dialogs
+ property var areaItem ///< GeoArea derived class
+
+ property var opacity: 0.5
+
+ signal clicked(int sequenceNumber)
+
+
+ // Area polygon
+ QGCMapPolygonVisuals {
+ id: mapPolygonVisuals
+ mapControl: map
+ mapPolygon: areaItem
+ interactive: true
+ borderWidth: 1
+ borderColor: "black"
+ interiorColor: "green"
+ altColor: QGroundControl.globalPalette.surveyPolygonTerrainCollision
+ interiorOpacity: _root.opacity
+ }
+
+ // Add Snake tiles to the map
+ Component {
+ id: tileComponent
+
+ Item{
+ id: root
+
+ property MapPolygon polygon
+
+ MapPolygon{
+ id:mapPolygon
+ path: []
+ }
+
+ Component.onCompleted: {
+ polygon = mapPolygon
+ map.addMapItem(mapPolygon)
+ }
+
+ Component.onDestruction: {
+ map.removeMapItem(mapPolygon)
+ }
+ }
+ }
+
+ function getColor(progress) {
+ if (progress === 0)
+ return "transparent"
+ if (progress < 33)
+ return "orange"
+ if (progress < 66)
+ return "yellow"
+ if (progress < 100)
+ return "greenyellow"
+ return "limegreen"
+ }
+
+ Repeater {
+ id: progressRepeater
+ property bool enable: areaItem.showTiles.value
+ model: enable ? areaItem.tiles : []
+
+ Item{
+ property var _tileComponent
+ property int _progress: _root.areaItem.progress[index] ?
+ _root.areaItem.progress[index] : 0
+
+ Component.onCompleted: {
+ _tileComponent = tileComponent.createObject(map)
+
+ _tileComponent.polygon.path =
+ Qt.binding(function(){return object.path})
+ _tileComponent.polygon.opacity = 0.6
+ _tileComponent.polygon.border.color = "black"
+ _tileComponent.polygon.border.width = 1
+ _tileComponent.polygon.color =
+ Qt.binding(function(){return getColor(_progress)})
+ }
+
+ Component.onDestruction: {
+ _tileComponent.destroy()
+ }
+
+ }
+ }
+}
diff --git a/src/MeasurementComplexItem/qml/MeasurementItemEditor.qml b/src/MeasurementComplexItem/qml/MeasurementItemEditor.qml
new file mode 100644
index 0000000000000000000000000000000000000000..c612208d91624b9b9c8e88ff01e4cd20dbd6758c
--- /dev/null
+++ b/src/MeasurementComplexItem/qml/MeasurementItemEditor.qml
@@ -0,0 +1,270 @@
+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.FactSystem 1.0
+import QGroundControl.FactControls 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.FlightMap 1.0
+
+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 missionItem ///< Mission Item for editor
+
+ property real _margin: ScreenTools.defaultFontPixelWidth / 2
+ property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5
+ property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ?
+ QGroundControl.multiVehicleManager.activeVehicle :
+ QGroundControl.multiVehicleManager.offlineEditingVehicle
+ property var _missionItem: missionItem
+
+ property var _generator: missionItem.generator
+ property var _generatorEditor: undefined
+
+ QGCPalette { id: qgcPal; colorGroupEnabled: true }
+
+ Component.onCompleted: {
+ _addGeneratorEditor()
+ }
+
+ Component.onDestruction: {
+ _destroyGeneratorEditor()
+ }
+
+ on_GeneratorChanged: {
+ _destroyGeneratorEditor()
+ _addGeneratorEditor()
+ }
+
+ Column { // main column
+ id: editorColumn
+ anchors.margins: _margin
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.right: parent.right
+
+ // ColumnLayout {
+ // id: wizardColumn
+ // anchors.left: parent.left
+ // anchors.right: parent.right
+ // spacing: _margin
+ // visible: !_missionItem.surveyAreaPolygon.isValid || _missionItem.wizardMode
+
+ // ColumnLayout {
+ // Layout.fillWidth: true
+ // spacing: _margin
+ // visible: !_polygonDone
+
+ // QGCLabel {
+ // Layout.fillWidth: true
+ // wrapMode: Text.WordWrap
+ // horizontalAlignment: Text.AlignHCenter
+ // text: qsTr("Use the Polygon Tools to create the polygon which outlines your survey area.")
+ // }
+ // }
+ // }
+
+ Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ spacing: _margin
+ //visible: !wizardColumn.visible
+
+ // QGCTabBar {
+ // id: tabBar
+ // anchors.left: parent.left
+ // anchors.right: parent.right
+
+ // Component.onCompleted: currentIndex = QGroundControl.settingsManager.planViewSettings.displayPresetsTabFirst.rawValue ? 2 : 0
+
+ // QGCTabButton { icon.source: "/qmlimages/PatternGrid.png"; icon.height: ScreenTools.defaultFontPixelHeight }
+ // QGCTabButton { icon.source: "/qmlimages/PatternCamera.png"; icon.height: ScreenTools.defaultFontPixelHeight }
+ // QGCTabButton { icon.source: "/qmlimages/PatternTerrain.png"; icon.height: ScreenTools.defaultFontPixelHeight }
+ // QGCTabButton { icon.source: "/qmlimages/PatternPresets.png"; icon.height: ScreenTools.defaultFontPixelHeight }
+ // }
+
+ // Grid tab
+ Column {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ spacing: _margin
+ // visible: tabBar.currentIndex === 0
+
+ SectionHeader {
+ id: generalHeader
+ anchors.left: parent.left
+ anchors.right: parent.right
+ text: qsTr("General")
+ }
+
+
+ GridLayout {
+ id: generalGrid
+ anchors.left: parent.left
+ anchors.right: parent.right
+ columnSpacing: _margin
+ rowSpacing: _margin
+ columns: 2
+ visible: generalHeader.checked
+
+ QGCLabel { text: qsTr("Altitude!!!") }
+ QGCLabel { text: qsTr("Relative Altitude!!!") }
+
+ QGCLabel {
+ text: qsTr("Variant")
+ Layout.columnSpan: 2
+ visible: variantRepeater.len > 0
+ }
+
+ GridLayout{
+ Layout.columnSpan: 2
+
+ columnSpacing: _margin
+ rowSpacing: _margin
+ columns: 6
+
+ Repeater{
+ id: variantRepeater
+
+ property var fact: missionItem.variant
+ property int variant: fact.value
+ property var names: missionItem.variantNames
+ property int len: missionItem.variantNames.length
+
+ model: len
+ delegate: QGCRadioButton {
+ checked: index === variantRepeater.variant
+ text: variantRepeater.names[index] ? variantRepeater.names[index]: ""
+
+ onCheckedChanged: {
+ if (checked){
+ missionItem.variant.value = index
+ }
+ checked = Qt.binding(function(){ return index === variantRepeater.variant})
+ }
+ }
+ } // variant repeater
+ } // variant grid
+ } // general grid
+
+ // Generator Editor
+ SectionHeader {
+ id: generatorHeader
+ anchors.left: parent.left
+ anchors.right: parent.right
+ text: qsTr("Generator")
+ }
+
+ GridLayout{
+ anchors.left: parent.left
+ anchors.right: parent.right
+ columnSpacing: _margin
+ rowSpacing: _margin
+ columns: 2
+ visible: generatorHeader.checked
+
+ QGCComboBox {
+ property var names: missionItem.generatorNameList
+ property int length: names.length
+
+ anchors.margins: ScreenTools.defaultFontPixelWidth
+ currentIndex: missionItem.generatorIndex
+ Layout.columnSpan: 2
+ model: missionItem.generatorNameList
+
+ onActivated: {
+ missionItem.switchToGenerator(index)
+ }
+ }
+ }
+
+ ColumnLayout{
+ id:generatorEditorParent
+ anchors.left: parent.left
+ anchors.right: parent.right
+ visible: generatorHeader.checked
+ }
+
+ // bussy indicator
+ ColumnLayout{
+ anchors.left: parent.left
+ anchors.right: parent.right
+ spacing: _margin
+
+ BusyIndicator{
+ id: indicator
+ anchors.horizontalCenter: parent.horizontalCenter
+ property bool calculating: missionItem.calculating
+ running: calculating
+ visible: calculating || timer.running
+
+ onCalculatingChanged: {
+ if(!calculating){
+ // defer hiding
+ timer.restart()
+ }
+ }
+
+ Timer{
+ id: timer
+ interval: 1000
+ repeat: false
+ running: false
+ }
+ }
+ } // indicator column
+ } // Grid Column
+ } // Main editing column
+ } // Top level Column
+
+ KMLOrSHPFileDialog {
+ id: kmlOrSHPLoadDialog
+ title: qsTr("Select Polygon File")
+ selectExisting: true
+
+ onAcceptedForLoad: {
+ _missionItem.surveyAreaPolygon.loadKMLOrSHPFile(file)
+ _missionItem.resetState = false
+ //editorMap.mapFitFunctions.fitMapViewportTo_missionItems()
+ close()
+ }
+ }
+
+ function _addGeneratorEditor(){
+ if (_generator.editorQml && !_generatorEditor) {
+ var component = Qt.createComponent(_generator.editorQml)
+ if (component.status === Component.Error) {
+ console.log("Error loading Qml: ",
+ _generator.editorQml, component.errorString())
+ } else {
+ _generatorEditor =
+ component.createObject(
+ generatorEditorParent, {
+ "generator": _root._generator,
+ "availableWidth": generatorEditorParent.width,
+ })
+ }
+ }
+ }
+
+ function _destroyGeneratorEditor(){
+ if (_generatorEditor){
+ _generatorEditor.destroy()
+ _generatorEditor = undefined
+ }
+ }
+} // Rectangle
diff --git a/src/WimaView/MeasurementItemMapVisual.qml b/src/MeasurementComplexItem/qml/MeasurementItemMapVisual.qml
similarity index 75%
rename from src/WimaView/MeasurementItemMapVisual.qml
rename to src/MeasurementComplexItem/qml/MeasurementItemMapVisual.qml
index 3f4e86eab845e65492d2eaf27bf461a9381dde22..3bf46cd363f1c2b2449a9adfea3868030a6cbbee 100644
--- a/src/WimaView/MeasurementItemMapVisual.qml
+++ b/src/MeasurementComplexItem/qml/MeasurementItemMapVisual.qml
@@ -51,6 +51,8 @@ Item {
_addExitCoordinate()
_addTransectsComponent()
_addGeneratorVisuals()
+ var bbox = boundingBox()
+ _areaData.initialize(bbox[0], bbox[1])
}
Component.onDestruction: {
@@ -70,7 +72,7 @@ Item {
id: visualTransectsComponent
MapPolyline {
- property var transects: _missionItem.visualTransectPoints
+ property var transects: _missionItem.route
line.color: "white"
line.width: 2
path: transects.length > 0 ? transects : []
@@ -120,13 +122,10 @@ Item {
Repeater {
model: _areaData.areaList
- delegate: WimaMapVisual {
+ delegate: GeoAreaVisualLoader {
map: _root.map
qgcView: _root.qgcView
- }
-
- onItemAdded: {
- //console.log("Item added")
+ geoArea: _areaData.areaList[index]
}
}
@@ -205,4 +204,32 @@ Item {
_transectsComponent = undefined
}
}
+
+ function boundingBox() {
+ // 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 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 topLeftCoord = map.toCoordinate(Qt.point(rect.x, rect.y), false /* clipToViewPort */)
+ var bottomRightCoord = map.toCoordinate(Qt.point(rect.x + rect.width, rect.y + rect.height), false /* clipToViewPort */)
+
+ // Initial polygon has max width and height of 3000 meters
+ var halfWidthMeters = Math.min(topLeftCoord.distanceTo(topRightCoord), 3000) / 2
+ var halfHeightMeters = Math.min(topLeftCoord.distanceTo(bottomLeftCoord), 3000) / 2
+ topRightCoord = centerCoord.atDistanceAndAzimuth(halfWidthMeters, 90).atDistanceAndAzimuth(halfHeightMeters, 0)
+ bottomLeftCoord = centerCoord.atDistanceAndAzimuth(halfWidthMeters, -90).atDistanceAndAzimuth(halfHeightMeters, 180)
+
+ return [ bottomLeftCoord, topRightCoord ]
+ }
}
diff --git a/src/WimaView/ProgressIndicator.qml b/src/MeasurementComplexItem/qml/ProgressIndicator.qml
similarity index 100%
rename from src/WimaView/ProgressIndicator.qml
rename to src/MeasurementComplexItem/qml/ProgressIndicator.qml
diff --git a/src/WimaView/SafeAreaEditor.qml b/src/MeasurementComplexItem/qml/SafeAreaEditor.qml
similarity index 100%
rename from src/WimaView/SafeAreaEditor.qml
rename to src/MeasurementComplexItem/qml/SafeAreaEditor.qml
diff --git a/src/MeasurementComplexItem/qml/SafeAreaMapVisual.qml b/src/MeasurementComplexItem/qml/SafeAreaMapVisual.qml
new file mode 100644
index 0000000000000000000000000000000000000000..2d482e3a0ea83b8a8f2d23ba82f6bd8fa3e9eabb
--- /dev/null
+++ b/src/MeasurementComplexItem/qml/SafeAreaMapVisual.qml
@@ -0,0 +1,113 @@
+/****************************************************************************
+ *
+ * (c) 2009-2016 QGROUNDCONTROL PROJECT
+ *
+ * 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 1.2
+import QtLocation 5.3
+import QtPositioning 5.3
+
+import QGroundControl 1.0
+import QGroundControl.ScreenTools 1.0
+import QGroundControl.Palette 1.0
+import QGroundControl.Controls 1.0
+import QGroundControl.FlightMap 1.0
+
+Item {
+ id: _root
+
+ property var map ///< Map control to place item in
+ property var qgcView ///< QGCView to use for popping dialogs
+ property var areaItem ///< GeoArea derived class.
+
+ property var _polygon: areaItem
+ property var _depot: undefined
+ property bool _showDepot: areaItem.interactive || areaItem.borderPolygon.interactive
+
+ signal clicked(int sequenceNumber)
+
+ on_ShowDepotChanged: {
+ if (_showDepot){
+ _addDepot()
+ } else {
+ _destroyDepot()
+ }
+ }
+
+ Component.onCompleted: {
+ if (_showDepot){
+ _addDepot()
+ }
+ }
+
+ Component.onDestruction: {
+ _destroyDepot()
+ }
+
+ // Area polygon
+ QGCMapPolygonVisuals {
+ id: mapPolygonVisuals
+ mapControl: map
+ mapPolygon: areaItem
+ interactive: true
+ borderWidth: 1
+ borderColor: "black"
+ interiorColor: "blue"
+ altColor: QGroundControl.globalPalette.surveyPolygonTerrainCollision
+ interiorOpacity: _root.opacity
+ }
+
+ // Depot Point.
+ Component {
+ id: depotPointComponent
+ DragCoordinate {
+ property var depot: _root.areaItem.depot
+
+ map: _root.map
+ qgcView: _root.qgcView
+ z: QGroundControl.zOrderMapItems
+ checked: _root._showDepot
+ coordinate: _root.areaItem.depot
+ label: "Depot"
+
+ function syncAndBind(){
+ if (coordinate.latitude !== depot.latitude ||
+ coordinate.longitude !== depot.longitude){
+ if (_root.areaItem.containsCoordinate(coordinate)){
+ _root.areaItem.depot = coordinate
+ }
+ }
+ coordinate = Qt.binding(function(){return _root.areaItem.depot})
+ }
+
+ onDragReleased: {
+ syncAndBind()
+ }
+
+ Component.onCompleted: {
+ syncAndBind()
+ }
+
+ }
+ }
+
+ function _addDepot() {
+ if (!_depot){
+ _depot = depotPointComponent.createObject(_root)
+ map.addMapItem(_depot)
+ }
+ }
+
+ function _destroyDepot() {
+ if (_depot){
+ map.removeMapItem(_depot)
+ _depot.destroy()
+ _depot = undefined
+ }
+ }
+}
diff --git a/src/WimaView/WimaAreaMapVisual.qml b/src/MeasurementComplexItem/qml/WimaAreaMapVisual.qml
similarity index 100%
rename from src/WimaView/WimaAreaMapVisual.qml
rename to src/MeasurementComplexItem/qml/WimaAreaMapVisual.qml
diff --git a/src/WimaView/WimaMapPolygonVisuals.qml b/src/MeasurementComplexItem/qml/WimaMapPolygonVisuals.qml
similarity index 100%
rename from src/WimaView/WimaMapPolygonVisuals.qml
rename to src/MeasurementComplexItem/qml/WimaMapPolygonVisuals.qml
diff --git a/src/WimaView/WimaView.qml b/src/MeasurementComplexItem/qml/WimaView.qml
similarity index 100%
rename from src/WimaView/WimaView.qml
rename to src/MeasurementComplexItem/qml/WimaView.qml
diff --git a/src/PlanView/MissionItemMapVisual.qml b/src/PlanView/MissionItemMapVisual.qml
index b7910e570e290cdfe6d0ea19851c9c05eaf067cf..a8d12752fc953a97657d303a1a22406e46ab75ad 100644
--- a/src/PlanView/MissionItemMapVisual.qml
+++ b/src/PlanView/MissionItemMapVisual.qml
@@ -15,7 +15,6 @@ import QtPositioning 5.3
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
-import Wima 1.0
/// Mission item map visual
Item {
diff --git a/src/PlanView/SurveyItemEditor.qml b/src/PlanView/SurveyItemEditor.qml
index 4796591f6656b1eae3c358e403e05294b9987c8b..f2bb710233ff7519b7f6a99ecd7f1dc72f4d6b33 100644
--- a/src/PlanView/SurveyItemEditor.qml
+++ b/src/PlanView/SurveyItemEditor.qml
@@ -26,7 +26,9 @@ Rectangle {
property real _margin: ScreenTools.defaultFontPixelWidth / 2
property real _fieldWidth: ScreenTools.defaultFontPixelWidth * 10.5
- property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ? QGroundControl.multiVehicleManager.activeVehicle : QGroundControl.multiVehicleManager.offlineEditingVehicle
+ property var _vehicle: QGroundControl.multiVehicleManager.activeVehicle ?
+ QGroundControl.multiVehicleManager.activeVehicle :
+ QGroundControl.multiVehicleManager.offlineEditingVehicle
property real _cameraMinTriggerInterval: _missionItem.cameraCalc.minTriggerInterval.rawValue
property bool _polygonDone: false
property string _doneAdjusting: qsTr("Done")
diff --git a/src/QmlControls/QGroundControl/Controls/qmldir b/src/QmlControls/QGroundControl/Controls/qmldir
index 3d5c4ad9d1e2772c7b6bfcebc54ff3ed83850a63..53436f988c7557cc37435fb08802b2a76f93d3c2 100644
--- a/src/QmlControls/QGroundControl/Controls/qmldir
+++ b/src/QmlControls/QGroundControl/Controls/qmldir
@@ -110,3 +110,6 @@ VehicleRotationCal 1.0 VehicleRotationCal.qml
VehicleSummaryRow 1.0 VehicleSummaryRow.qml
QGCHoverButton 1.0 QGCHoverButton.qml
MAVLinkChart 1.0 MAVLinkChart.qml
+MeasurementItemMapVisual 1.0 MeasurementItemMapVisual.qml
+CircularGeneratorMapVisual 1.0 CircularGeneratorMapVisual.qml
+GeoAreaVisualLoader 1.0 GeoAreaVisualLoader.qml
diff --git a/src/WimaView/MeasurementAreaMapVisual.qml b/src/WimaView/MeasurementAreaMapVisual.qml
deleted file mode 100644
index 06dbb0645ac2c451452cf6970c4b7dd297e1daa8..0000000000000000000000000000000000000000
--- a/src/WimaView/MeasurementAreaMapVisual.qml
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
- *
- * (c) 2009-2016 QGROUNDCONTROL PROJECT
- *
- * 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 1.2
-import QtLocation 5.3
-import QtPositioning 5.3
-
-import QGroundControl 1.0
-import QGroundControl.ScreenTools 1.0
-import QGroundControl.Palette 1.0
-import QGroundControl.Controls 1.0
-import QGroundControl.FlightMap 1.0
-
-/// Wima Global Measurement Area visuals
-Item {
- id: _root
-
- property var map ///< Map control to place item in
- property var qgcView ///< QGCView to use for popping dialogs
-
- property var areaItem: object
- property var _polygon: areaItem
-
- signal clicked(int sequenceNumber)
-
- /// Add an initial 4 sided polygon if there is none
- function _addInitialPolygon() {
-
- // 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)
-
- 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: {
- _addInitialPolygon()
- //_addInitialPolyline()
- }
-
- Component.onDestruction: {
- }
-
- // Polygon
- WimaMapPolygonVisuals {
- qgcView: _root.qgcView
- mapControl: map
- mapPolygon: _polygon
- borderWidth: 1
- borderColor: "black"
- interiorColor: "green"
- interiorOpacity: 0.25
- }
-
- // Border Polygon
- WimaMapPolygonVisuals {
- qgcView: _root.qgcView
- mapControl: map
- mapPolygon: areaItem.borderPolygon
- borderWidth: 1
- borderColor: areaItem.borderPolygon.interactive ? "white" : "transparent"
- interiorColor: "transparent"
- interiorOpacity: 1
- }
-
- // Add Snake tiles to the map
- Component {
- id: tileComponent
-
- Item{
- id: root
-
- property MapPolygon polygon
-
- MapPolygon{
- id:mapPolygon
- path: []
- }
-
- Component.onCompleted: {
- polygon = mapPolygon
- map.addMapItem(mapPolygon)
- }
-
- Component.onDestruction: {
- map.removeMapItem(mapPolygon)
- }
- }
- }
- function getColor(progress) {
- if (progress === 0)
- return "transparent"
- if (progress < 33)
- return "orange"
- if (progress < 66)
- return "yellow"
- if (progress < 100)
- return "greenyellow"
- return "limegreen"
- }
-
- Repeater {
- id: progressRepeater
- property bool enable: areaItem.showTiles.value
- model: enable ? areaItem.tiles : []
-
- Item{
- property var _tileComponent
- property int _progress: _root.areaItem.progress[index] ?
- _root.areaItem.progress[index] : 0
-
- Component.onCompleted: {
- _tileComponent = tileComponent.createObject(map)
-
- _tileComponent.polygon.path =
- Qt.binding(function(){return object.path})
- _tileComponent.polygon.opacity = 0.6
- _tileComponent.polygon.border.color = "black"
- _tileComponent.polygon.border.width = 1
- _tileComponent.polygon.color =
- Qt.binding(function(){return getColor(_progress)})
- }
-
- Component.onDestruction: {
- _tileComponent.destroy()
- }
-
- }
- }
-}
diff --git a/src/WimaView/MeasurementItemEditor.qml b/src/WimaView/MeasurementItemEditor.qml
deleted file mode 100644
index fc0cb381565e5aa2c32db8d4b5fc385b6d627fdc..0000000000000000000000000000000000000000
--- a/src/WimaView/MeasurementItemEditor.qml
+++ /dev/null
@@ -1,209 +0,0 @@
-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.FactSystem 1.0
-import QGroundControl.FactControls 1.0
-import QGroundControl.Palette 1.0
-import QGroundControl.FlightMap 1.0
-
-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 missionItem ///< Mission Item for editor
-
- property real _margin: ScreenTools.defaultFontPixelWidth / 2
-
- property var _generator: missionItem.generator
- property var _generatorEditor: undefined
-
- QGCPalette { id: qgcPal; colorGroupEnabled: true }
-
- Component.onCompleted: {
- _addGeneratorEditor()
- }
- Component.onDestruction: {
- _destroyGeneratorEditor()
- }
-
- on_GeneratorChanged: {
- _destroyGeneratorEditor()
- _addGeneratorEditor()
- }
-
- Column {
- id: editorColumn
- anchors.margins: _margin
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
- spacing: _margin
-
- SectionHeader {
- id: generalHeader
- text: qsTr("General")
- }
-
-
- GridLayout {
- id: generalGrid
- anchors.left: parent.left
- anchors.right: parent.right
- columnSpacing: _margin
- rowSpacing: _margin
- columns: 2
- visible: generalHeader.checked
-
- QGCLabel { text: qsTr("Altitude") }
- FactTextField {
- fact: missionItem.cameraCalc.distanceToSurface
- Layout.fillWidth: true
- }
-
- QGCCheckBox {
- id: relAlt
- text: qsTr("Relative altitude")
- checked: missionItem.cameraCalc.distanceToSurfaceRelative
- enabled: missionItem.cameraCalc.isManualCamera && !missionItem.followTerrain
- visible: QGroundControl.corePlugin.options.showMissionAbsoluteAltitude || (!missionItem.cameraCalc.distanceToSurfaceRelative && !missionItem.followTerrain)
- onClicked: missionItem.cameraCalc.distanceToSurfaceRelative = checked
- Layout.fillWidth: true
- Layout.columnSpan: 2
-
- Connections {
- target: missionItem.cameraCalc
- onDistanceToSurfaceRelativeChanged: relAlt.checked = missionItem.cameraCalc.distanceToSurfaceRelative
- }
- }
-
- QGCLabel {
- text: qsTr("Generator Type")
- Layout.columnSpan: 2
- }
-
- QGCComboBox {
- property var names: missionItem.generatorNameList
- property int length: names.length
-
- anchors.margins: ScreenTools.defaultFontPixelWidth
- currentIndex: missionItem.generatorIndex
- Layout.columnSpan: 2
- model: missionItem.generatorNameList
-
- onActivated: {
- missionItem.switchToGenerator(index)
- }
- }
-
- QGCLabel {
- text: qsTr("Variant")
- Layout.columnSpan: 2
- }
-
- GridLayout{
- Layout.columnSpan: 2
-
- columnSpacing: _margin
- rowSpacing: _margin
- columns: 6
-
- Repeater{
- id: variantRepeater
-
- property var fact: missionItem.variant
- property int variant: fact.value
- property var names: missionItem.variantNames
- property int len: missionItem.variantNames.length
-
- model: len
- delegate: QGCRadioButton {
- checked: index === variantRepeater.variant
- text: variantRepeater.names[index] ? variantRepeater.names[index]: ""
-
- onCheckedChanged: {
- if (checked){
- missionItem.variant.value = index
- }
- checked = Qt.binding(function(){ return index === variantRepeater.variant})
- }
- }
- }
- }
- }
-
- // Generator Editor
- SectionHeader {
- id: transectsHeader
- text: qsTr("Generator")
- }
-
- Column{
- id:generatorEditorParent
- visible: transectsHeader.checked
- }
-
- Column{
- anchors.left: parent.left
- anchors.right: parent.right
- spacing: _margin
-
- BusyIndicator{
- id: indicator
- anchors.horizontalCenter: parent.horizontalCenter
- property bool calculating: missionItem.calculating
- running: calculating
- visible: calculating || timer.running
-
- onCalculatingChanged: {
- if(!calculating){
- // defer hiding
- timer.restart()
- }
- }
-
- Timer{
- id: timer
- interval: 1000
- repeat: false
- running: false
- }
- }
- }
- } // Column
-
- function _addGeneratorEditor(){
- if (_generator.editorQml && !_generatorEditor) {
- var component = Qt.createComponent(_generator.editorQml)
- if (component.status === Component.Error) {
- console.log("Error loading Qml: ",
- _generator.editorQml, component.errorString())
- } else {
- _generatorEditor =
- component.createObject(
- generatorEditorParent, {
- "generator": _root._generator,
- })
- }
- }
- }
-
- function _destroyGeneratorEditor(){
- if (_generatorEditor){
- _generatorEditor.destroy()
- _generatorEditor = undefined
- }
- }
-} // Rectangle
diff --git a/src/WimaView/SafeAreaMapVisual.qml b/src/WimaView/SafeAreaMapVisual.qml
deleted file mode 100644
index 2fc0f94a3e122ee15efe890b1a48ec362ea4ecaa..0000000000000000000000000000000000000000
--- a/src/WimaView/SafeAreaMapVisual.qml
+++ /dev/null
@@ -1,167 +0,0 @@
-/****************************************************************************
- *
- * (c) 2009-2016 QGROUNDCONTROL PROJECT
- *
- * 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 1.2
-import QtLocation 5.3
-import QtPositioning 5.3
-
-import QGroundControl 1.0
-import QGroundControl.ScreenTools 1.0
-import QGroundControl.Palette 1.0
-import QGroundControl.Controls 1.0
-import QGroundControl.FlightMap 1.0
-
-Item {
- id: _root
-
- property var map ///< Map control to place item in
- property var qgcView ///< QGCView to use for popping dialogs
-
- property var areaItem: object
- property var _polygon: areaItem
- property var _depot: undefined
- property bool _showDepot: areaItem.interactive || areaItem.borderPolygon.interactive
-
- on_ShowDepotChanged: {
- if (_showDepot){
- _addDepot()
- } else {
- _destroyDepot()
- }
- }
-
- signal clicked(int sequenceNumber)
-
- function _addDepot() {
- if (!_depot){
- _depot = depotPointComponent.createObject(_root)
- map.addMapItem(_depot)
- }
- }
-
- function _destroyDepot() {
- if (_depot){
- map.removeMapItem(_depot)
- _depot.destroy()
- _depot = undefined
- }
- }
-
- /// Add an initial 4 sided polygon if there is none
- function _addInitialPolygon() {
-
- // 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)
-
- 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: {
- _addInitialPolygon()
- if (_showDepot){
- _addDepot()
- }
- }
-
- Component.onDestruction: {
- _destroyDepot()
- }
-
- WimaMapPolygonVisuals {
- qgcView: _root.qgcView
- mapControl: map
- mapPolygon: _polygon
- borderWidth: 1
- borderColor: "black"
- interiorColor: "yellow"
- interiorOpacity: 0.25
- }
-
- WimaMapPolygonVisuals {
- qgcView: _root.qgcView
- mapControl: map
- mapPolygon: areaItem.borderPolygon
- borderWidth: 1
- borderColor: areaItem.borderPolygon.interactive ? "white" : "transparent"
- interiorColor: "transparent"
- interiorOpacity: 1
- }
-
- // Depot Point.
- Component {
- id: depotPointComponent
- DragCoordinate {
- property var depot: _root.areaItem.depot
-
- map: _root.map
- qgcView: _root.qgcView
- z: QGroundControl.zOrderMapItems
- checked: _root._showDepot
- coordinate: _root.areaItem.depot
- label: "Depot"
-
- function syncAndBind(){
- if (coordinate.latitude !== depot.latitude ||
- coordinate.longitude !== depot.longitude){
- if (_root.areaItem.containsCoordinate(coordinate)){
- _root.areaItem.depot = coordinate
- }
- }
- coordinate = Qt.binding(function(){return _root.areaItem.depot})
- }
-
- onDragReleased: {
- syncAndBind()
- }
-
- Component.onCompleted: {
- syncAndBind()
- }
-
- }
- }
-
-}
diff --git a/src/WimaView/Wima.qmldir b/src/WimaView/Wima.qmldir
deleted file mode 100644
index b308e2a9f1261750222669d0055f786068139cc4..0000000000000000000000000000000000000000
--- a/src/WimaView/Wima.qmldir
+++ /dev/null
@@ -1,18 +0,0 @@
-WimaMapVisual 1.0 WimaMapVisual.qml
-WimaMeasurementAreaMapVisual 1.0 WimaMeasurementAreaMapVisual.qml
-WimaJoinedAreaMapVisual 1.0 WimaJoinedAreaMapVisual.qml
-WimaMeasurementAreaEditor 1.0 WimaMeasurementAreaEditor.qml
-WimaServiceAreaMapVisual 1.0 WimaServiceAreaMapVisual.qml
-WimaAreaMapVisual 1.0 WimaAreaMapVisual.qml
-WimaServiceAreaEditor 1.0 WimaServiceAreaEditor.qml
-WimaCorridorMapVisual 1.0 WimaCorridorMapVisual.qml
-WimaItemEditor 1.0 WimaItemEditor.qml
-WimaMapPolygonVisuals 1.0 WimaMapPolygonVisuals.qml
-WimaMapPolylineVisuals 1.0 WimaMapPolylineVisuals.qml
-CircularSurveyMapVisual 1.0 CircularSurveyMapVisual.qml
-DragCoordinate 1.0 DragCoordinate.qml
-CoordinateIndicator 1.0 CoordinateIndicator.qml
-CoordinateIndicatorDrag 1.0 CoordinateIndicatorDrag.qml
-ProgressIndicator 1.0 ProgressIndicator.qml
-WimaToolBar 1.0 WimaToolBar.qml
-
diff --git a/src/WimaView/WimaCorridorEditor.qml b/src/WimaView/WimaCorridorEditor.qml
deleted file mode 100644
index cd3340878de5cb34f76924dcda9268c2cca12775..0000000000000000000000000000000000000000
--- a/src/WimaView/WimaCorridorEditor.qml
+++ /dev/null
@@ -1,176 +0,0 @@
-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 }*/
-
- QGCLabel { text: qsTr("Area") }
- QGCLabel { text: QGroundControl.squareMetersToAppSettingsAreaUnits(areaItem.area).toFixed(2) + " " + QGroundControl.appSettingsAreaUnitsString }
-
- }
- } // Column
-} // Rectangle
diff --git a/src/WimaView/WimaToolBar.qml b/src/WimaView/WimaToolBar.qml
deleted file mode 100644
index 18ebb9405b5f4ed24bbbcd382f0673553badd985..0000000000000000000000000000000000000000
--- a/src/WimaView/WimaToolBar.qml
+++ /dev/null
@@ -1,465 +0,0 @@
-import QtQuick 2.3
-import QtQuick.Controls 1.2
-import QtQuick.Layouts 1.2
-import QtQuick.Dialogs 1.2
-
-import QGroundControl 1.0
-import QGroundControl.ScreenTools 1.0
-import QGroundControl.Controls 1.0
-import QGroundControl.FactControls 1.0
-import QGroundControl.Palette 1.0
-
-// Toolbar for Wima View
-Rectangle {
- id: _root
- height: ScreenTools.toolbarHeight
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: parent.top
- z: toolBar.z + 1
- color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.8) : Qt.rgba(0,0,0,0.75)
- visible: false
- anchors.bottomMargin: 1
-
- signal showFlyView
-
- property var planMasterController
- property var wimaPlaner
- property var currentMissionItem ///< Mission item to display status for
-
- property var missionItems: _controllerValid ? planMasterController.missionController.visualItems : undefined
- property real missionDistance: _controllerValid ? planMasterController.missionController.missionDistance : NaN
- property real missionTime: _controllerValid ? planMasterController.missionController.missionTime : NaN
- property real missionMaxTelemetry: _controllerValid ? planMasterController.missionController.missionMaxTelemetry : NaN
- property bool missionDirty: _controllerValid ? planMasterController.missionController.dirty : false
-
- property bool _controllerValid: planMasterController !== undefined
- property bool _controllerOffline: _controllerValid ? planMasterController.offline : true
- property var _controllerDirty: _controllerValid ? planMasterController.dirty : false
- property var _controllerSyncInProgress: _controllerValid ? planMasterController.syncInProgress : false
-
- property bool _statusValid: currentMissionItem !== undefined
- property bool _missionValid: missionItems !== undefined
-
- property real _dataFontSize: ScreenTools.defaultFontPointSize
- property real _largeValueWidth: ScreenTools.defaultFontPixelWidth * 8
- property real _mediumValueWidth: ScreenTools.defaultFontPixelWidth * 4
- property real _smallValueWidth: ScreenTools.defaultFontPixelWidth * 3
- property real _labelToValueSpacing: ScreenTools.defaultFontPixelWidth
- property real _rowSpacing: ScreenTools.isMobile ? 1 : 0
- property real _distance: _statusValid && currentMissionItem ? currentMissionItem.distance : NaN
- property real _altDifference: _statusValid && currentMissionItem ? currentMissionItem.altDifference : NaN
- property real _gradient: _statusValid && currentMissionItem && currentMissionItem.distance > 0 ? Math.atan(currentMissionItem.altDifference / currentMissionItem.distance) : NaN
- property real _gradientPercent: isNaN(_gradient) ? NaN : _gradient * 100
- property real _azimuth: _statusValid && currentMissionItem ? currentMissionItem.azimuth : NaN
- property real _heading: _statusValid && currentMissionItem ? currentMissionItem.missionVehicleYaw : NaN
- property real _missionDistance: _missionValid ? missionDistance : NaN
- property real _missionMaxTelemetry: _missionValid ? missionMaxTelemetry : NaN
- property real _missionTime: _missionValid ? missionTime : NaN
- property int _batteryChangePoint: _controllerValid ? planMasterController.missionController.batteryChangePoint : -1
- property int _batteriesRequired: _controllerValid ? planMasterController.missionController.batteriesRequired : -1
- property bool _batteryInfoAvailable: _batteryChangePoint >= 0 || _batteriesRequired >= 0
- property real _controllerProgressPct: _controllerValid ? planMasterController.missionController.progressPct : 0
- property bool _syncInProgress: _controllerValid ? planMasterController.missionController.syncInProgress : false
-
- property string _distanceText: isNaN(_distance) ? "-.-" : QGroundControl.metersToAppSettingsDistanceUnits(_distance).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString
- property string _altDifferenceText: isNaN(_altDifference) ? "-.-" : QGroundControl.metersToAppSettingsDistanceUnits(_altDifference).toFixed(1) + " " + QGroundControl.appSettingsDistanceUnitsString
- property string _gradientText: isNaN(_gradient) ? "-.-" : _gradientPercent.toFixed(0) + " %"
- property string _azimuthText: isNaN(_azimuth) ? "-.-" : Math.round(_azimuth) % 360
- property string _headingText: isNaN(_azimuth) ? "-.-" : Math.round(_heading) % 360
- property string _missionDistanceText: isNaN(_missionDistance) ? "-.-" : QGroundControl.metersToAppSettingsDistanceUnits(_missionDistance).toFixed(0) + " " + QGroundControl.appSettingsDistanceUnitsString
- property string _missionMaxTelemetryText: isNaN(_missionMaxTelemetry) ? "-.-" : QGroundControl.metersToAppSettingsDistanceUnits(_missionMaxTelemetry).toFixed(0) + " " + QGroundControl.appSettingsDistanceUnitsString
- property string _batteryChangePointText: _batteryChangePoint < 0 ? "N/A" : _batteryChangePoint
- property string _batteriesRequiredText: _batteriesRequired < 0 ? "N/A" : _batteriesRequired
-
- readonly property real _margins: ScreenTools.defaultFontPixelWidth
-
- QGCPalette { id: qgcPal }
-
- function getMissionTime() {
- if(isNaN(_missionTime)) {
- return "00:00:00"
- }
- var t = new Date(0, 0, 0, 0, 0, Number(_missionTime))
- return Qt.formatTime(t, 'hh:mm:ss')
- }
-
- //-- Eat mouse events, preventing them from reaching toolbar, which is underneath us.
- DeadMouseArea {
- anchors.fill: parent
- }
-
- //-- The reason for this Row to be here is so the Logo (Home) button is in the same
- // location as the one in the main toolbar.
- Row {
- id: logoRow
- anchors.bottomMargin: 1
- anchors.left: parent.left
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- QGCToolBarButton {
- id: settingsButton
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- source: "/qmlimages/PaperPlane.svg"
- logo: true
- checked: false
- onClicked: {
- checked = false
- showFlyView()
- }
- }
- }
-
- // Progress bar
-
- on_ControllerProgressPctChanged: {
- if (_controllerProgressPct === 1) {
- missionStats.visible = false
- uploadCompleteText.visible = true
- progressBar.visible = false
- resetProgressTimer.start()
- } else if (_controllerProgressPct > 0) {
- progressBar.visible = true
- }
- }
-
- Timer {
- id: resetProgressTimer
- interval: 5000
- onTriggered: {
- missionStats.visible = true
- uploadCompleteText.visible = false
- }
- }
-
- QGCLabel {
- id: uploadCompleteText
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.left: logoRow.right
- anchors.right: buttonsRow.left
- font.pointSize: ScreenTools.largeFontPointSize
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- text: "Done"
- visible: false
- }
-
- GridLayout {
- id: missionStats
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- anchors.leftMargin: _margins
- anchors.rightMargin: _margins
- anchors.left: logoRow.right
- anchors.right: buttonsRow.left
- columnSpacing: 0
- columns: 4
-
- GridLayout {
- columns: 8
- rowSpacing: _rowSpacing
- columnSpacing: _labelToValueSpacing
- Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
-
- QGCLabel {
- text: qsTr("Selected Waypoint")
- Layout.columnSpan: 8
- font.pointSize: ScreenTools.smallFontPointSize
- }
-
- QGCLabel { text: qsTr("Alt diff:"); font.pointSize: _dataFontSize; }
- QGCLabel {
- text: _altDifferenceText
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _mediumValueWidth
- }
-
- Item { width: 1; height: 1 }
-
- QGCLabel { text: qsTr("Azimuth:"); font.pointSize: _dataFontSize; }
- QGCLabel {
- text: _azimuthText
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _smallValueWidth
- }
-
- Item { width: 1; height: 1 }
-
- QGCLabel { text: qsTr("Distance:"); font.pointSize: _dataFontSize; }
- QGCLabel {
- text: _distanceText
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _largeValueWidth
- }
-
- QGCLabel { text: qsTr("Gradient:"); font.pointSize: _dataFontSize; }
- QGCLabel {
- text: _gradientText
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _mediumValueWidth
- }
-
- Item { width: 1; height: 1 }
-
- QGCLabel { text: qsTr("Heading:"); font.pointSize: _dataFontSize; }
- QGCLabel {
- text: _headingText
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _smallValueWidth
- }
- }
-
- GridLayout {
- columns: 5
- rowSpacing: _rowSpacing
- columnSpacing: _labelToValueSpacing
- Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
-
- QGCLabel {
- text: qsTr("Total Mission")
- Layout.columnSpan: 5
- font.pointSize: ScreenTools.smallFontPointSize
- }
-
- QGCLabel { text: qsTr("Distance:"); font.pointSize: _dataFontSize; }
- QGCLabel {
- text: _missionDistanceText
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _largeValueWidth
- }
-
- Item { width: 1; height: 1 }
-
- QGCLabel { text: qsTr("Max telem dist:"); font.pointSize: _dataFontSize; }
- QGCLabel {
- text: _missionMaxTelemetryText
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _largeValueWidth
- }
-
- QGCLabel { text: qsTr("Time:"); font.pointSize: _dataFontSize; }
- QGCLabel {
- text: getMissionTime()
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _largeValueWidth
- }
- }
-
- GridLayout {
- columns: 3
- rowSpacing: _rowSpacing
- columnSpacing: _labelToValueSpacing
- Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
- visible: _batteryInfoAvailable
-
- QGCLabel {
- text: qsTr("Battery")
- Layout.columnSpan: 3
- font.pointSize: ScreenTools.smallFontPointSize
- }
-
- QGCLabel { text: qsTr("Batteries required:"); font.pointSize: _dataFontSize; }
- QGCLabel {
- text: _batteriesRequiredText
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _mediumValueWidth
- }
-
- Item { width: 1; height: 1 }
- /*
- FIXME: Swap point display is currently hidden since the code which calcs it doesn't work correctly
- QGCLabel { text: qsTr("Swap waypoint:"); font.pointSize: _dataFontSize; }
- QGCLabel {
- text: _batteryChangePointText
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _mediumValueWidth
- }
-*/
- }
-
- GridLayout {
- columns: 3
- rowSpacing: _rowSpacing
- columnSpacing: _labelToValueSpacing
- Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
-
-
- QGCLabel {
- text: qsTr("ROS")
- Layout.columnSpan: 3
- font.pointSize: ScreenTools.smallFontPointSize
- }
-
- QGCCheckBox {
- id: enableCheckbox
-
- property var nemo: wimaPlaner ? wimaPlaner.nemoInterface : undefined
-
- text: qsTr("Enable")
- checked: nemo ? nemo.running : false
- onCheckedChanged: {
- if (nemo){
- if (checked){
- nemo.start()
- } else {
- nemo.stop()
- }
-
- checked = Qt.binding(function(){return nemo.running})
- }
- }
- Layout.minimumWidth: _mediumValueWidth
- }
-
- QGCLabel {
- property var nemo: wimaPlaner ? wimaPlaner.nemoInterface : undefined
-
- text: nemo ? nemo.statusString : ""
- font.pointSize: _dataFontSize
- Layout.minimumWidth: _mediumValueWidth
- visible: enableCheckbox.checked
- Layout.columnSpan: 2
- }
-
- QGCCheckBox {
- property var nemo: wimaPlaner ? wimaPlaner.nemoInterface : undefined
-
- text: qsTr("Lock Progress")
- checked: wimaPlaner ? wimaPlaner.progressLocked : false
- visible: enableCheckbox.checked
- onCheckedChanged: {
- if (wimaPlaner){
- if (checked){
- wimaPlaner.progressLocked = true
- } else {
- wimaPlaner.progressLocked = false
- }
- }
- }
- Layout.minimumWidth: _mediumValueWidth
- }
- }
- }
-
- Row {
- id:buttonsRow
- anchors.rightMargin: _margins
- anchors.right: parent.right
- anchors.verticalCenter: parent.verticalCenter
- spacing: _margins
-
- QGCButton {
- id: uploadButton
- text: qsTr("Upload")
- enabled: wimaPlaner ?
- wimaPlaner.readyForSynchronization : false
- onClicked: {
- if (wimaPlaner){
- if (wimaPlaner.readyForSynchronization) {
- wimaPlaner.synchronize()
- planMasterController.sendToVehicle()
- }
- }
- }
-
- PropertyAnimation on opacity {
- easing.type: Easing.OutQuart
- from: 0.5
- to: 1
- loops: Animation.Infinite
- running: wimaPlaner ? (wimaPlaner.readyForSynchronization
- && !wimaPlaner.synchronized)
- : false
- alwaysRunToEnd: true
- duration: 2000
- }
- } // uploadButton
-
- QGCButton {
- id: updateButton
- text: qsTr("Update")
- enabled: true
- onClicked: {
- if (wimaPlaner){
- wimaPlaner.update()
- }
- }
- } // updateButton
- } // buttonRow
-
- // Small mission download progress bar
- Rectangle {
- id: progressBar
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- height: 4
- width: _controllerProgressPct * parent.width
- color: qgcPal.colorGreen
- visible: false
-
- onVisibleChanged: {
- if (visible) {
- largeProgressBar._userHide = false
- }
- }
- }
-
- /*
- Rectangle {
- anchors.bottom: parent.bottom
- height: toolBar.height * 0.05
- width: _activeVehicle ? _activeVehicle.parameterManager.loadProgress * parent.width : 0
- color: qgcPal.colorGreen
- visible: !largeProgressBar.visible
- }
- */
-
- // Large mission download progress bar
- Rectangle {
- id: largeProgressBar
- anchors.bottom: parent.bottom
- anchors.left: parent.left
- anchors.right: parent.right
- height: parent.height
- color: qgcPal.window
- visible: _showLargeProgress
-
- property bool _userHide: false
- property bool _showLargeProgress: progressBar.visible && !_userHide && qgcPal.globalTheme === QGCPalette.Light
-
- Connections {
- target: QGroundControl.multiVehicleManager
- onActiveVehicleChanged: largeProgressBar._userHide = false
- }
-
- Rectangle {
- anchors.top: parent.top
- anchors.bottom: parent.bottom
- width: _controllerProgressPct * parent.width
- color: qgcPal.colorGreen
- }
-
- QGCLabel {
- anchors.centerIn: parent
- text: qsTr("Syncing Mission")
- font.pointSize: ScreenTools.largeFontPointSize
- }
-
- QGCLabel {
- anchors.margins: _margin
- anchors.right: parent.right
- anchors.bottom: parent.bottom
- text: qsTr("Click anywhere to hide")
-
- property real _margin: ScreenTools.defaultFontPixelWidth / 2
- }
-
- MouseArea {
- anchors.fill: parent
- onClicked: largeProgressBar._userHide = true
- }
- }
-}
-