diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 4aae7be2fefbf14592531d2bcf43f4aeedd28d87..22250809993f165cf9bc6c524406acc21f4a41c5 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -429,50 +429,49 @@ HEADERS += \ src/Snake/snake.h \ src/Snake/snake_geometry.h \ src/Snake/snake_global.h \ - src/Wima/GeoPoint3D.h \ - src/Wima/Polygon2D.h \ - src/Wima/PolygonArray.h \ - src/Wima/QNemoProgress.h \ - src/Wima/QtROSJsonFactory.h \ - src/Wima/QtROSTypeFactory.h \ - src/Wima/SnakeTiles.h \ - src/Wima/SnakeTilesLocal.h \ - src/Wima/SnakeWorker.h \ + src/Wima/Geometry/GeoPoint3D.h \ + src/Wima/Geometry/Polygon2D.h \ + src/Wima/Geometry/PolygonArray.h \ + src/Wima/Snake/QNemoProgress.h \ + src/Wima/Snake/QtROSJsonFactory.h \ + src/Wima/Snake/QtROSTypeFactory.h \ + src/Wima/Snake/SnakeTiles.h \ + src/Wima/Snake/SnakeTilesLocal.h \ + src/Wima/Snake/SnakeWorker.h \ src/Wima/WaypointManager/GenericPathSlicer.h \ src/Wima/WaypointManager/GenericWaypointManager.h \ - src/Wima/WimaPolygonArray.h \ - src/Wima/snaketile.h \ + src/Wima/Geometry/WimaPolygonArray.h \ + src/Wima/Snake/snaketile.h \ src/api/QGCCorePlugin.h \ src/api/QGCOptions.h \ src/api/QGCSettings.h \ src/api/QmlComponentInfo.h \ src/comm/MavlinkMessagesTimer.h \ src/GPS/Drivers/src/base_station.h \ - src/Wima/WimaArea.h \ - src/Wima/WimaServiceArea.h \ - src/Wima/WimaTrackerPolyline.h \ + src/Wima/Geometry/WimaArea.h \ + src/Wima/Geometry/WimaServiceArea.h \ + src/Wima/Geometry/WimaTrackerPolyline.h \ src/Wima/WimaController.h \ - src/Wima/WimaVehicle.h \ src/Wima/WimaDataContainer.h \ src/Wima/WimaPlaner.h \ - src/Wima/WimaMeasurementArea.h \ - src/Wima/WimaCorridor.h \ - src/Wima/WimaAreaData.h \ - src/Wima/WimaServiceAreaData.h \ - src/Wima/WimaCorridorData.h \ - src/Wima/WimaMeasurementAreaData.h \ + src/Wima/Geometry/WimaMeasurementArea.h \ + src/Wima/Geometry/WimaCorridor.h \ + src/Wima/Geometry/WimaAreaData.h \ + src/Wima/Geometry/WimaServiceAreaData.h \ + src/Wima/Geometry/WimaCorridorData.h \ + src/Wima/Geometry/WimaMeasurementAreaData.h \ src/Wima/WimaPlanData.h \ - src/Wima/WimaJoinedArea.h \ - src/Wima/WimaJoinedAreaData.h \ - src/Wima/SphereCalculus.h \ + src/Wima/Geometry/WimaJoinedArea.h \ + src/Wima/Geometry/WimaJoinedAreaData.h \ + src/Wima/Geometry/SphereCalculus.h \ src/Wima/CircularSurveyComplexItem.h \ - src/Wima/PlanimetryCalculus.h \ - src/Wima/Circle.h \ - src/Wima/PolygonCalculus.h \ + src/Wima/Geometry/PlanimetryCalculus.h \ + src/Wima/Geometry/Circle.h \ + src/Wima/Geometry/PolygonCalculus.h \ src/Wima/OptimisationTools.h \ - src/Wima/GeoUtilities.h \ - src/Wima/TestPolygonCalculus.h \ - src/Wima/testplanimetrycalculus.h \ + src/Wima/Geometry/GeoUtilities.h \ + src/Wima/Geometry/TestPolygonCalculus.h \ + src/Wima/Geometry/testplanimetrycalculus.h \ src/Settings/WimaSettings.h \ src/QmlControls/QmlObjectVectorModel.h \ src/comm/ros_bridge/include/CasePacker.h \ @@ -492,10 +491,10 @@ SOURCES += \ src/Snake/clipper/clipper.cpp \ src/Snake/snake.cpp \ src/Snake/snake_geometry.cpp \ - src/Wima/GeoPoint3D.cpp \ - src/Wima/PolygonArray.cc \ - src/Wima/QNemoProgress.cc \ - src/Wima/SnakeWorker.cc \ + src/Wima/Geometry/GeoPoint3D.cpp \ + src/Wima/Geometry/PolygonArray.cc \ + src/Wima/Snake/QNemoProgress.cc \ + src/Wima/Snake/SnakeWorker.cc \ src/Wima/WaypointManager/GenericPathSlicer.cpp \ src/Wima/WaypointManager/GenericWaypointManager.cpp \ src/comm/ros_bridge/include/ComPrivateInclude.cpp \ @@ -503,37 +502,36 @@ SOURCES += \ src/comm/ros_bridge/include/TopicPublisher.cpp \ src/comm/ros_bridge/include/TopicSubscriber.cpp \ src/comm/ros_bridge/src/CasePacker.cpp \ - src/Wima/snaketile.cpp \ + src/Wima/Snake/snaketile.cpp \ src/api/QGCCorePlugin.cc \ src/api/QGCOptions.cc \ src/api/QGCSettings.cc \ src/api/QmlComponentInfo.cc \ src/comm/MavlinkMessagesTimer.cc \ - src/Wima/WimaArea.cc \ - src/Wima/WimaServiceArea.cc \ - src/Wima/WimaTrackerPolyline.cc \ + src/Wima/Geometry/WimaArea.cc \ + src/Wima/Geometry/WimaServiceArea.cc \ + src/Wima/Geometry/WimaTrackerPolyline.cc \ src/Wima/WimaController.cc \ - src/Wima/WimaVehicle.cc \ src/Wima/WimaDataContainer.cc \ src/Wima/WimaPlaner.cc \ - src/Wima/WimaMeasurementArea.cc \ - src/Wima/WimaCorridor.cc \ - src/Wima/WimaAreaData.cc \ - src/Wima/WimaServiceAreaData.cc \ - src/Wima/WimaCorridorData.cpp \ + src/Wima/Geometry/WimaMeasurementArea.cc \ + src/Wima/Geometry/WimaCorridor.cc \ + src/Wima/Geometry/WimaAreaData.cc \ + src/Wima/Geometry/WimaServiceAreaData.cc \ + src/Wima/Geometry/WimaCorridorData.cpp \ src/Wima/WimaPlanData.cc \ - src/Wima/WimaMeasurementAreaData.cc \ - src/Wima/WimaJoinedArea.cc \ - src/Wima/WimaJoinedAreaData.cc \ - src/Wima/SphereCalculus.cc \ + src/Wima/Geometry/WimaMeasurementAreaData.cc \ + src/Wima/Geometry/WimaJoinedArea.cc \ + src/Wima/Geometry/WimaJoinedAreaData.cc \ + src/Wima/Geometry/SphereCalculus.cc \ src/Wima/CircularSurveyComplexItem.cc \ - src/Wima/PlanimetryCalculus.cc \ - src/Wima/Circle.cc \ + src/Wima/Geometry/PlanimetryCalculus.cc \ + src/Wima/Geometry/Circle.cc \ src/Wima/OptimisationTools.cc \ - src/Wima/GeoUtilities.cc \ - src/Wima/PolygonCalculus.cc \ - src/Wima/TestPolygonCalculus.cpp \ - src/Wima/testplanimetrycalculus.cpp \ + src/Wima/Geometry/GeoUtilities.cc \ + src/Wima/Geometry/PolygonCalculus.cc \ + src/Wima/Geometry/TestPolygonCalculus.cpp \ + src/Wima/Geometry/testplanimetrycalculus.cpp \ src/Settings/WimaSettings.cc \ src/QmlControls/QmlObjectVectorModel.cc \ src/comm/ros_bridge/src/ROSBridge.cpp diff --git a/qgroundcontrol.qrc b/qgroundcontrol.qrc index 3a379887c346443ec529efed085a81a1ff88a7e7..c90fdf78a81a4d6312045144daaa75aaeec05336 100644 --- a/qgroundcontrol.qrc +++ b/qgroundcontrol.qrc @@ -275,10 +275,10 @@ src/Vehicle/VibrationFact.json src/Vehicle/WindFact.json src/Settings/Video.SettingsGroup.json - src/Wima/WimaMeasurementArea.SettingsGroup.json - src/Wima/CircularSurvey.SettingsGroup.json - src/Wima/WimaArea.SettingsGroup.json - src/Wima/WimaController.SettingsGroup.json + src/Wima/Geometry/json/WimaMeasurementArea.SettingsGroup.json + src/Wima/json/CircularSurvey.SettingsGroup.json + src/Wima/Geometry/json/WimaArea.SettingsGroup.json + src/Wima/json/WimaController.SettingsGroup.json src/Settings/Wima.SettingsGroup.json diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index cbc61c3dd8e48d67ab67d32611aa2f7f2187df6c..baee3f32ed14daf2d195ef842208aa06920e556f 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -244,8 +244,8 @@ FlightMap { // Add Snake tiles center points to the map MapItemView { - property bool _lengthMatching: wimaController.snakeTileCenterPoints.length - === wimaController.snakeProgress.length + property bool _lengthMatching: wimaController.snakeTileCenterPoints.count + > 0 property bool _enable: wimaController.enableWimaController.value && wimaController.enableSnake.value diff --git a/src/Wima/Circle.c b/src/Wima/Circle.c deleted file mode 100644 index 7e72f32c8c124129810d6f7d5ae1049cbf45ab31..0000000000000000000000000000000000000000 --- a/src/Wima/Circle.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "Circle.h" - -Circle::Circle() -{ - -} diff --git a/src/Wima/GeoPoint3D.cpp b/src/Wima/GeoPoint3D.cpp deleted file mode 100644 index 8150b6fcbf57f7582a2d563a45853bb393a0a86f..0000000000000000000000000000000000000000 --- a/src/Wima/GeoPoint3D.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include "GeoPoint3D.h" - -GeoPoint3D *GeoPoint3D::Clone() const -{ - return new GeoPoint3D(*this); -} - -GeoPoint3D &GeoPoint3D::operator=(const GeoPoint3D &p) -{ - this->setLatitude(p.latitude()); - this->setLongitude(p.longitude()); - this->setAltitude(p.altitude()); - - return *this; -} diff --git a/src/Wima/GeoPoint3D.h b/src/Wima/GeoPoint3D.h deleted file mode 100644 index 5d47e3f1ce7c4cba9d51fba42819d19544a3ff77..0000000000000000000000000000000000000000 --- a/src/Wima/GeoPoint3D.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include "ros_bridge/include/JsonMethodes.h" -#include "ros_bridge/include/MessageBaseClass.h" -#include "ros_bridge/include/GenericMessages.h" - -#include -typedef ROSBridge::MessageBaseClass ROSMsg; -typedef ROSBridge::GenericMessages::GeographicMsgs::GeoPoint ROSGeoPoint; -namespace MsgGroups = ROSBridge::MessageGroups; -class GeoPoint3D : public QObject, public ROSGeoPoint -{ - Q_OBJECT -public: - typedef MsgGroups::GeoPointGroup Group; - - explicit GeoPoint3D(QObject *parent = nullptr) - : QObject(parent), ROSGeoPoint() {} - explicit GeoPoint3D(double latitude, - double longitude, - double altitude, - QObject *parent = nullptr) - : QObject(parent), ROSGeoPoint(latitude, longitude, altitude) - {} - explicit GeoPoint3D(const GeoPoint3D& p, - QObject *parent = nullptr) - : QObject(parent), ROSGeoPoint(p.latitude(), p.longitude(), p.altitude()) - {} - explicit GeoPoint3D(const ROSGeoPoint& p, - QObject *parent = nullptr) - : QObject(parent), ROSGeoPoint(p.latitude(), p.longitude(), p.altitude()) - {} - - virtual GeoPoint3D *Clone() const override; - GeoPoint3D &operator=(const GeoPoint3D&p); - -}; diff --git a/src/Wima/Circle.cc b/src/Wima/Geometry/Circle.cc similarity index 100% rename from src/Wima/Circle.cc rename to src/Wima/Geometry/Circle.cc diff --git a/src/Wima/Circle.h b/src/Wima/Geometry/Circle.h similarity index 100% rename from src/Wima/Circle.h rename to src/Wima/Geometry/Circle.h diff --git a/src/Wima/Geometry/GeoPoint3D.cpp b/src/Wima/Geometry/GeoPoint3D.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5f0165866e88da5c2c3d188ef1dc710305ef1d9f --- /dev/null +++ b/src/Wima/Geometry/GeoPoint3D.cpp @@ -0,0 +1,42 @@ +#include "GeoPoint3D.h" + +GeoPoint3D::GeoPoint3D(QObject *parent) + : QObject(parent), ROSGeoPoint() {} + +GeoPoint3D::GeoPoint3D(double latitude, double longitude, double altitude, QObject *parent) + : QObject(parent), ROSGeoPoint(latitude, longitude, altitude) +{} + +GeoPoint3D::GeoPoint3D(const GeoPoint3D &p, QObject *parent) + : QObject(parent), ROSGeoPoint(p.latitude(), p.longitude(), p.altitude()) +{} + +GeoPoint3D::GeoPoint3D(const ROSGeoPoint &p, QObject *parent) + : QObject(parent), ROSGeoPoint(p.latitude(), p.longitude(), p.altitude()) +{} + +GeoPoint3D::GeoPoint3D(const QGeoCoordinate &p, QObject *parent) + : QObject(parent), ROSGeoPoint(p.latitude(), p.longitude(), p.altitude()) +{} + +GeoPoint3D *GeoPoint3D::Clone() const +{ + return new GeoPoint3D(*this); +} + +GeoPoint3D &GeoPoint3D::operator=(const GeoPoint3D &p) +{ + this->setLatitude(p.latitude()); + this->setLongitude(p.longitude()); + this->setAltitude(p.altitude()); + + return *this; +} +GeoPoint3D &GeoPoint3D::operator=(const QGeoCoordinate &p) +{ + this->setLatitude(p.latitude()); + this->setLongitude(p.longitude()); + this->setAltitude(p.altitude()); + + return *this; +} diff --git a/src/Wima/Geometry/GeoPoint3D.h b/src/Wima/Geometry/GeoPoint3D.h new file mode 100644 index 0000000000000000000000000000000000000000..407297003ca40379e281d31a557f3b09d08b5252 --- /dev/null +++ b/src/Wima/Geometry/GeoPoint3D.h @@ -0,0 +1,38 @@ +#pragma once + +#include "ros_bridge/include/JsonMethodes.h" +#include "ros_bridge/include/MessageBaseClass.h" +#include "ros_bridge/include/GenericMessages.h" + +#include +#include + + +typedef ROSBridge::MessageBaseClass ROSMsg; +typedef ROSBridge::GenericMessages::GeographicMsgs::GeoPoint ROSGeoPoint; +namespace MsgGroups = ROSBridge::MessageGroups; +class GeoPoint3D : public QObject, public ROSGeoPoint +{ + Q_OBJECT +public: + typedef MsgGroups::GeoPointGroup Group; + + GeoPoint3D(QObject *parent = nullptr); + GeoPoint3D(double latitude, + double longitude, + double altitude, + QObject *parent = nullptr); + GeoPoint3D(const GeoPoint3D& p, + QObject *parent = nullptr); + GeoPoint3D(const ROSGeoPoint& p, + QObject *parent = nullptr); + GeoPoint3D(const QGeoCoordinate& p, + QObject *parent = nullptr); + + virtual GeoPoint3D *Clone() const override; + GeoPoint3D &operator=(const GeoPoint3D&p); + GeoPoint3D &operator=(const QGeoCoordinate&p); + +}; + + diff --git a/src/Wima/GeoUtilities.cc b/src/Wima/Geometry/GeoUtilities.cc similarity index 100% rename from src/Wima/GeoUtilities.cc rename to src/Wima/Geometry/GeoUtilities.cc diff --git a/src/Wima/GeoUtilities.h b/src/Wima/Geometry/GeoUtilities.h similarity index 100% rename from src/Wima/GeoUtilities.h rename to src/Wima/Geometry/GeoUtilities.h diff --git a/src/Wima/PlanimetryCalculus.cc b/src/Wima/Geometry/PlanimetryCalculus.cc similarity index 100% rename from src/Wima/PlanimetryCalculus.cc rename to src/Wima/Geometry/PlanimetryCalculus.cc diff --git a/src/Wima/PlanimetryCalculus.h b/src/Wima/Geometry/PlanimetryCalculus.h similarity index 100% rename from src/Wima/PlanimetryCalculus.h rename to src/Wima/Geometry/PlanimetryCalculus.h diff --git a/src/Wima/Polygon2D.h b/src/Wima/Geometry/Polygon2D.h similarity index 100% rename from src/Wima/Polygon2D.h rename to src/Wima/Geometry/Polygon2D.h diff --git a/src/Wima/PolygonArray.cc b/src/Wima/Geometry/PolygonArray.cc similarity index 100% rename from src/Wima/PolygonArray.cc rename to src/Wima/Geometry/PolygonArray.cc diff --git a/src/Wima/PolygonArray.h b/src/Wima/Geometry/PolygonArray.h similarity index 100% rename from src/Wima/PolygonArray.h rename to src/Wima/Geometry/PolygonArray.h diff --git a/src/Wima/PolygonCalculus.cc b/src/Wima/Geometry/PolygonCalculus.cc similarity index 100% rename from src/Wima/PolygonCalculus.cc rename to src/Wima/Geometry/PolygonCalculus.cc diff --git a/src/Wima/PolygonCalculus.h b/src/Wima/Geometry/PolygonCalculus.h similarity index 100% rename from src/Wima/PolygonCalculus.h rename to src/Wima/Geometry/PolygonCalculus.h diff --git a/src/Wima/SphereCalculus.cc b/src/Wima/Geometry/SphereCalculus.cc similarity index 100% rename from src/Wima/SphereCalculus.cc rename to src/Wima/Geometry/SphereCalculus.cc diff --git a/src/Wima/SphereCalculus.h b/src/Wima/Geometry/SphereCalculus.h similarity index 100% rename from src/Wima/SphereCalculus.h rename to src/Wima/Geometry/SphereCalculus.h diff --git a/src/Wima/SphericalGeometryCalculus.cc b/src/Wima/Geometry/SphericalGeometryCalculus.cc similarity index 100% rename from src/Wima/SphericalGeometryCalculus.cc rename to src/Wima/Geometry/SphericalGeometryCalculus.cc diff --git a/src/Wima/SphericalGeometryCalculus.h b/src/Wima/Geometry/SphericalGeometryCalculus.h similarity index 100% rename from src/Wima/SphericalGeometryCalculus.h rename to src/Wima/Geometry/SphericalGeometryCalculus.h diff --git a/src/Wima/TestPolygonCalculus.cpp b/src/Wima/Geometry/TestPolygonCalculus.cpp similarity index 100% rename from src/Wima/TestPolygonCalculus.cpp rename to src/Wima/Geometry/TestPolygonCalculus.cpp diff --git a/src/Wima/TestPolygonCalculus.h b/src/Wima/Geometry/TestPolygonCalculus.h similarity index 100% rename from src/Wima/TestPolygonCalculus.h rename to src/Wima/Geometry/TestPolygonCalculus.h diff --git a/src/Wima/WimaArea.cc b/src/Wima/Geometry/WimaArea.cc similarity index 100% rename from src/Wima/WimaArea.cc rename to src/Wima/Geometry/WimaArea.cc diff --git a/src/Wima/WimaArea.h b/src/Wima/Geometry/WimaArea.h similarity index 100% rename from src/Wima/WimaArea.h rename to src/Wima/Geometry/WimaArea.h diff --git a/src/Wima/WimaAreaData.cc b/src/Wima/Geometry/WimaAreaData.cc similarity index 100% rename from src/Wima/WimaAreaData.cc rename to src/Wima/Geometry/WimaAreaData.cc diff --git a/src/Wima/WimaAreaData.h b/src/Wima/Geometry/WimaAreaData.h similarity index 100% rename from src/Wima/WimaAreaData.h rename to src/Wima/Geometry/WimaAreaData.h diff --git a/src/Wima/WimaCorridor.cc b/src/Wima/Geometry/WimaCorridor.cc similarity index 100% rename from src/Wima/WimaCorridor.cc rename to src/Wima/Geometry/WimaCorridor.cc diff --git a/src/Wima/WimaCorridor.h b/src/Wima/Geometry/WimaCorridor.h similarity index 100% rename from src/Wima/WimaCorridor.h rename to src/Wima/Geometry/WimaCorridor.h diff --git a/src/Wima/WimaCorridorData.cpp b/src/Wima/Geometry/WimaCorridorData.cpp similarity index 100% rename from src/Wima/WimaCorridorData.cpp rename to src/Wima/Geometry/WimaCorridorData.cpp diff --git a/src/Wima/WimaCorridorData.h b/src/Wima/Geometry/WimaCorridorData.h similarity index 100% rename from src/Wima/WimaCorridorData.h rename to src/Wima/Geometry/WimaCorridorData.h diff --git a/src/Wima/WimaJoinedArea.cc b/src/Wima/Geometry/WimaJoinedArea.cc similarity index 100% rename from src/Wima/WimaJoinedArea.cc rename to src/Wima/Geometry/WimaJoinedArea.cc diff --git a/src/Wima/WimaJoinedArea.h b/src/Wima/Geometry/WimaJoinedArea.h similarity index 100% rename from src/Wima/WimaJoinedArea.h rename to src/Wima/Geometry/WimaJoinedArea.h diff --git a/src/Wima/WimaJoinedAreaData.cc b/src/Wima/Geometry/WimaJoinedAreaData.cc similarity index 100% rename from src/Wima/WimaJoinedAreaData.cc rename to src/Wima/Geometry/WimaJoinedAreaData.cc diff --git a/src/Wima/WimaJoinedAreaData.h b/src/Wima/Geometry/WimaJoinedAreaData.h similarity index 100% rename from src/Wima/WimaJoinedAreaData.h rename to src/Wima/Geometry/WimaJoinedAreaData.h diff --git a/src/Wima/WimaMeasurementArea.cc b/src/Wima/Geometry/WimaMeasurementArea.cc similarity index 100% rename from src/Wima/WimaMeasurementArea.cc rename to src/Wima/Geometry/WimaMeasurementArea.cc diff --git a/src/Wima/WimaMeasurementArea.h b/src/Wima/Geometry/WimaMeasurementArea.h similarity index 100% rename from src/Wima/WimaMeasurementArea.h rename to src/Wima/Geometry/WimaMeasurementArea.h diff --git a/src/Wima/WimaMeasurementAreaData.cc b/src/Wima/Geometry/WimaMeasurementAreaData.cc similarity index 100% rename from src/Wima/WimaMeasurementAreaData.cc rename to src/Wima/Geometry/WimaMeasurementAreaData.cc diff --git a/src/Wima/WimaMeasurementAreaData.h b/src/Wima/Geometry/WimaMeasurementAreaData.h similarity index 100% rename from src/Wima/WimaMeasurementAreaData.h rename to src/Wima/Geometry/WimaMeasurementAreaData.h diff --git a/src/Wima/WimaPolygonArray.h b/src/Wima/Geometry/WimaPolygonArray.h similarity index 100% rename from src/Wima/WimaPolygonArray.h rename to src/Wima/Geometry/WimaPolygonArray.h diff --git a/src/Wima/WimaServiceArea.cc b/src/Wima/Geometry/WimaServiceArea.cc similarity index 100% rename from src/Wima/WimaServiceArea.cc rename to src/Wima/Geometry/WimaServiceArea.cc diff --git a/src/Wima/WimaServiceArea.h b/src/Wima/Geometry/WimaServiceArea.h similarity index 100% rename from src/Wima/WimaServiceArea.h rename to src/Wima/Geometry/WimaServiceArea.h diff --git a/src/Wima/WimaServiceAreaData.cc b/src/Wima/Geometry/WimaServiceAreaData.cc similarity index 100% rename from src/Wima/WimaServiceAreaData.cc rename to src/Wima/Geometry/WimaServiceAreaData.cc diff --git a/src/Wima/WimaServiceAreaData.h b/src/Wima/Geometry/WimaServiceAreaData.h similarity index 100% rename from src/Wima/WimaServiceAreaData.h rename to src/Wima/Geometry/WimaServiceAreaData.h diff --git a/src/Wima/WimaTrackerPolyline.cc b/src/Wima/Geometry/WimaTrackerPolyline.cc similarity index 100% rename from src/Wima/WimaTrackerPolyline.cc rename to src/Wima/Geometry/WimaTrackerPolyline.cc diff --git a/src/Wima/WimaTrackerPolyline.h b/src/Wima/Geometry/WimaTrackerPolyline.h similarity index 100% rename from src/Wima/WimaTrackerPolyline.h rename to src/Wima/Geometry/WimaTrackerPolyline.h diff --git a/src/Wima/WimaArea.SettingsGroup.json b/src/Wima/Geometry/json/WimaArea.SettingsGroup.json similarity index 100% rename from src/Wima/WimaArea.SettingsGroup.json rename to src/Wima/Geometry/json/WimaArea.SettingsGroup.json diff --git a/src/Wima/WimaMeasurementArea.SettingsGroup.json b/src/Wima/Geometry/json/WimaMeasurementArea.SettingsGroup.json similarity index 100% rename from src/Wima/WimaMeasurementArea.SettingsGroup.json rename to src/Wima/Geometry/json/WimaMeasurementArea.SettingsGroup.json diff --git a/src/Wima/testplanimetrycalculus.cpp b/src/Wima/Geometry/testplanimetrycalculus.cpp similarity index 100% rename from src/Wima/testplanimetrycalculus.cpp rename to src/Wima/Geometry/testplanimetrycalculus.cpp diff --git a/src/Wima/testplanimetrycalculus.h b/src/Wima/Geometry/testplanimetrycalculus.h similarity index 100% rename from src/Wima/testplanimetrycalculus.h rename to src/Wima/Geometry/testplanimetrycalculus.h diff --git a/src/Wima/QNemoProgress.cc b/src/Wima/Snake/QNemoProgress.cc similarity index 100% rename from src/Wima/QNemoProgress.cc rename to src/Wima/Snake/QNemoProgress.cc diff --git a/src/Wima/QNemoProgress.h b/src/Wima/Snake/QNemoProgress.h similarity index 100% rename from src/Wima/QNemoProgress.h rename to src/Wima/Snake/QNemoProgress.h diff --git a/src/Wima/QtROSJsonFactory.h b/src/Wima/Snake/QtROSJsonFactory.h similarity index 100% rename from src/Wima/QtROSJsonFactory.h rename to src/Wima/Snake/QtROSJsonFactory.h diff --git a/src/Wima/QtROSTypeFactory.h b/src/Wima/Snake/QtROSTypeFactory.h similarity index 100% rename from src/Wima/QtROSTypeFactory.h rename to src/Wima/Snake/QtROSTypeFactory.h diff --git a/src/Wima/SnakeTiles.h b/src/Wima/Snake/SnakeTiles.h similarity index 100% rename from src/Wima/SnakeTiles.h rename to src/Wima/Snake/SnakeTiles.h diff --git a/src/Wima/SnakeTilesLocal.h b/src/Wima/Snake/SnakeTilesLocal.h similarity index 100% rename from src/Wima/SnakeTilesLocal.h rename to src/Wima/Snake/SnakeTilesLocal.h diff --git a/src/Wima/SnakeWorker.cc b/src/Wima/Snake/SnakeWorker.cc similarity index 100% rename from src/Wima/SnakeWorker.cc rename to src/Wima/Snake/SnakeWorker.cc diff --git a/src/Wima/SnakeWorker.h b/src/Wima/Snake/SnakeWorker.h similarity index 100% rename from src/Wima/SnakeWorker.h rename to src/Wima/Snake/SnakeWorker.h diff --git a/src/Wima/snaketile.cpp b/src/Wima/Snake/snaketile.cpp similarity index 100% rename from src/Wima/snaketile.cpp rename to src/Wima/Snake/snaketile.cpp diff --git a/src/Wima/snaketile.h b/src/Wima/Snake/snaketile.h similarity index 100% rename from src/Wima/snaketile.h rename to src/Wima/Snake/snaketile.h diff --git a/src/Wima/WimaController.cc b/src/Wima/WimaController.cc index ab73af92df3010d6473d56c78c6a9ce325c01121..f0735756145ca70486c6b191b6078fdb27d72698 100644 --- a/src/Wima/WimaController.cc +++ b/src/Wima/WimaController.cc @@ -111,6 +111,14 @@ WimaController::WimaController(QObject *parent) _startStopRosBridge(); } +QVariantList WimaController::waypointPath() const +{ + QVariantList list; + for ( auto wp : _waypoints) + list.append(QVariant::fromValue(wp)); + return list; +} + //QStringList WimaController::loadNameFilters() const //{ // QStringList filters; @@ -376,66 +384,6 @@ bool WimaController::calcShortestPath(const QGeoCoordinate &start, const QGeoCoo return retVal; } -bool WimaController::extractCoordinateList(QmlObjectListModel &missionItems, QVector &coordinateList) -{ - return extractCoordinateList(missionItems, coordinateList, 0, missionItems.count()-1); -} - -bool WimaController::extractCoordinateList(QmlObjectListModel &missionItems, QVector &coordinateList, int startIndex, int endIndex) -{ - if ( startIndex >= 0 - && startIndex < missionItems.count() - && endIndex >= 0 - && endIndex < missionItems.count()) { - if (startIndex > endIndex) { - if (!extractCoordinateList(missionItems, coordinateList, startIndex, missionItems.count()-1)) - return false; - if (!extractCoordinateList(missionItems, coordinateList, 0, endIndex)) - return false; - } else { - for (int i = startIndex; i <= endIndex; i++) { - SimpleMissionItem *mItem = missionItems.value(i); - - if (mItem == nullptr) { - coordinateList.clear(); - return false; - } - coordinateList.append(mItem->coordinate()); - } - } - } else - return false; - - return true; -} - -bool WimaController::extractCoordinateList(QmlObjectListModel &missionItems, QVariantList &coordinateList) -{ - return extractCoordinateList(missionItems, coordinateList, 0 , missionItems.count()-1); -} - -bool WimaController::extractCoordinateList(QmlObjectListModel &missionItems, QVariantList &coordinateList, int startIndex, int endIndex) -{ - QVector geoCoordintateList; - - bool retValue = extractCoordinateList(missionItems, geoCoordintateList, startIndex, endIndex); - - if (!retValue) - return false; - - for (int i = 0; i < geoCoordintateList.size(); i++) { - QGeoCoordinate vertex = geoCoordintateList[i]; - if ( (qFuzzyIsNull(vertex.latitude()) && qFuzzyIsNull(vertex.longitude())) - || !vertex.isValid()) - geoCoordintateList.removeAt(i); - } - - for (auto coordinate : geoCoordintateList) - coordinateList.append(QVariant::fromValue(coordinate)); - - return true; -} - /*! * \fn void WimaController::containerDataValidChanged(bool valid) * Pulls plan data generated by \c WimaPlaner from the \c _container if the data is valid (\a valid equals true). @@ -451,7 +399,7 @@ bool WimaController::_fetchContainerData() _visualItems.clear(); _missionItems.clearAndDeleteContents(); _currentMissionItems.clearAndDeleteContents(); - _waypointPath.clear(); + _waypoints.clear(); _currentWaypointPath.clear(); _snakeTiles.polygons().clear(); _snakeTilesLocal.polygons().clear(); @@ -675,12 +623,12 @@ bool WimaController::_calcNextPhase() QVector CSWpList; // list with potential waypoints (from _missionItems), for _currentMissionItems if (!reverse) { - if (!extractCoordinateList(_missionItems, CSWpList, _startWaypointIndex, _endWaypointIndex)) { + if (!getCoordinates(_missionItems, CSWpList, _startWaypointIndex, _endWaypointIndex)) { qWarning("WimaController::calcNextPhase(): error on waypoint extraction."); return false; } } else { - if (!extractCoordinateList(_missionItems, CSWpList, _endWaypointIndex, _startWaypointIndex)) { + if (!getCoordinates(_missionItems, CSWpList, _endWaypointIndex, _startWaypointIndex)) { qWarning("WimaController::calcNextPhase(): error on waypoint extraction."); return false; } @@ -859,15 +807,19 @@ bool WimaController::_calcNextPhase() void WimaController::_updateWaypointPath() { - _waypointPath.clear(); - extractCoordinateList(_missionItems, _waypointPath, 0, _missionItems.count()-1); + _waypoints.clear(); + getCoordinates(_missionItems, + _waypoints, + 0, + std::size_t( std::max(_missionItems.count()-1,0) ) + ); emit waypointPathChanged(); } void WimaController::_updateCurrentPath() { _currentWaypointPath.clear(); - extractCoordinateList(_currentMissionItems, _currentWaypointPath, 0, _currentMissionItems.count()-1); + getCoordinates(_currentMissionItems, _currentWaypointPath, 0, _currentMissionItems.count()-1); emit currentWaypointPathChanged(); } @@ -1408,7 +1360,7 @@ void WimaController::_saveCurrentMissionItemsToBuffer() } void WimaController::_progressFromJson(JsonDocUPtr pDoc, - QNemoProgress &progress) + QNemoProgress &progress) { int requiredSize = _snakeTilesLocal.polygons().size(); if ( !_pRosBridge->casePacker()->unpack(pDoc, progress) @@ -1418,3 +1370,10 @@ void WimaController::_progressFromJson(JsonDocUPtr pDoc, emit WimaController::nemoProgressChanged(); } + +template<> +QVariant getCoordinate(const SimpleMissionItem* item) +{ + return QVariant::fromValue(item->coordinate()); +} + diff --git a/src/Wima/WimaController.h b/src/Wima/WimaController.h index e99b2dc2ff41f194c32daf2948ac12c82cc8523e..54b1ec832e02dc6387cd8f0b63757e2a8fcf0dce 100644 --- a/src/Wima/WimaController.h +++ b/src/Wima/WimaController.h @@ -116,7 +116,7 @@ public: WimaDataContainer* dataContainer (void) { return _container; } QmlObjectListModel* missionItems (void) { return &_missionItems; } QmlObjectListModel* currentMissionItems (void) { return &_currentMissionItems; } - QVariantList waypointPath (void) { return _waypointPath; } + QVariantList waypointPath (void) const; QVariantList currentWaypointPath (void) { return _currentWaypointPath; } Fact* enableWimaController (void) { return &_enableWimaController; } Fact* overlapWaypoints (void) { return &_overlapWaypoints; } @@ -200,14 +200,6 @@ public: QJsonDocument saveToJson(FileType fileType); bool calcShortestPath(const QGeoCoordinate &start, const QGeoCoordinate &destination, QVector &path); - /// extracts the coordinates stored in missionItems (list of MissionItems) and stores them in coordinateList - bool extractCoordinateList(QmlObjectListModel &missionItems, QVector &coordinateList); - /// extracts the coordinates (between startIndex and endIndex) stored in missionItems (list of MissionItems) and stores them in coordinateList. - bool extractCoordinateList(QmlObjectListModel &missionItems, QVector &coordinateList, int startIndex, int endIndex); - /// extracts the coordinates stored in missionItems (list of MissionItems) and stores them in coordinateList - bool extractCoordinateList(QmlObjectListModel &missionItems, QVariantList &coordinateList); - /// extracts the coordinates (between startIndex and endIndex) stored in missionItems (list of MissionItems) and stores them in coordinateList. - bool extractCoordinateList(QmlObjectListModel &missionItems, QVariantList &coordinateList, int startIndex, int endIndex); signals: void masterControllerChanged (void); @@ -285,7 +277,7 @@ private: QmlObjectListModel _currentMissionItems; // contains the current mission items, which are a sub set of _missionItems, // _currentMissionItems contains a number of mission items which can be worked off with a single battery chrage QmlObjectListModel _missionItemsBuffer; // Buffer to store mission items, e.g. for storing _currentMissionItems when smartRTL() is invoked - QVariantList _waypointPath; // path connecting the items in _missionItems + QVector _waypoints; // path connecting the items in _missionItems QVariantList _currentWaypointPath; // path connecting the items in _currentMissionItems QGeoCoordinate _takeoffLandPostion; @@ -376,3 +368,53 @@ private: */ + +template +CoordinateType getCoordinate(const SimpleMissionItem* item){ + return item->coordinate(); +} + +template<> +QVariant getCoordinate(const SimpleMissionItem* item); + + +/// extracts the coordinates stored in missionItems (list of MissionItems) and stores them in coordinateList. +template class ContainerType> +bool getCoordinates(QmlObjectListModel &missionItems, + ContainerType &coordinateList, + std::size_t startIndex, + std::size_t endIndex){ + + if ( startIndex < std::size_t(missionItems.count()) + && endIndex < std::size_t(missionItems.count()) ) { + if (startIndex > endIndex) { + if (!getCoordinates(missionItems, coordinateList, startIndex, missionItems.count()-1)) + return false; + if (!getCoordinates(missionItems, coordinateList, 0, endIndex)) + return false; + } else { + for (std::size_t i = startIndex; i <= endIndex; i++) { + SimpleMissionItem *mItem = missionItems.value(int(i)); + + if (mItem == nullptr) { + coordinateList.clear(); + return false; + } + coordinateList.append(getCoordinate(mItem)); + } + } + } else + return false; + + return true; +} + +/// extracts the coordinates stored in missionItems (list of MissionItems) and stores them in coordinateList. +template class ContainerType> +bool getCoordinates(QmlObjectListModel &missionItems, + ContainerType &coordinateList){ + + return getCoordinates(missionItems, coordinateList, 0, missionItems.count()); +} + + diff --git a/src/Wima/WimaVehicle.cc b/src/Wima/WimaVehicle.cc deleted file mode 100644 index 24bdee7c5d99497f4720d59a39cd99757fb53aa1..0000000000000000000000000000000000000000 --- a/src/Wima/WimaVehicle.cc +++ /dev/null @@ -1,49 +0,0 @@ -#include "WimaVehicle.h" - - - -WimaVehicle::WimaVehicle(QObject *parent): - QObject (parent) - ,_vehicle (nullptr) - ,_serviceArea (nullptr) - ,_vehicleCorridor (nullptr) - ,_operationArea (nullptr) -{ - -} - -void WimaVehicle::setVehicle(Vehicle *vehicle) -{ - if(vehicle != nullptr){ - _vehicle = vehicle; - }else { - qWarning("Not a valid vehicle!"); - } -} - -void WimaVehicle::setServiceArea(WimaServiceArea *servicePolygon) -{ - if(servicePolygon != nullptr){ - _serviceArea = servicePolygon; - }else{ - qWarning("Not a valid service Polygon!"); - } -} - -void WimaVehicle::setVCorridor(WimaVCorridor *vehicleCorridor) -{ - if(vehicleCorridor != nullptr){ - _vehicleCorridor = vehicleCorridor; - }else{ - qWarning("Not a valid vehicle Corridor!"); - } -} - -void WimaVehicle::setOperationArea(WimaGOperationArea *operationArea) -{ - if(operationArea != nullptr){ - _operationArea = operationArea; - }else{ - qWarning("Not a valid measurementPolygon!"); - } -} diff --git a/src/Wima/WimaVehicle.h b/src/Wima/WimaVehicle.h deleted file mode 100644 index 942fd45a7e3a4978a4387daf089351886533269f..0000000000000000000000000000000000000000 --- a/src/Wima/WimaVehicle.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once - -#include -#include "Vehicle.h" - -class WimaServiceArea; -class WimaVCorridor; -class WimaGOperationArea; - -class WimaVehicle : public QObject -{ - Q_OBJECT -public: - WimaVehicle(QObject* parent = nullptr); - - WimaServiceArea* serviceArea (void) const { return _serviceArea;} - WimaVCorridor* vehicleCorridor (void) const { return _vehicleCorridor;} - WimaGOperationArea* operationArea (void) const { return _operationArea;} - - void setVehicle (Vehicle* vehicle); - void setServiceArea (WimaServiceArea* serviceArea); - void setVCorridor (WimaVCorridor* vehicleCorridor); - void setOperationArea (WimaGOperationArea* operationArea); - -private: - Vehicle* _vehicle; - WimaServiceArea* _serviceArea; - WimaVCorridor* _vehicleCorridor; - WimaGOperationArea* _operationArea; - -}; - - diff --git a/src/Wima/doc/SkriptDO.pdf b/src/Wima/doc/SkriptDO.pdf deleted file mode 100644 index e1cc81107455b7743d262425f39f9ec454c76976..0000000000000000000000000000000000000000 Binary files a/src/Wima/doc/SkriptDO.pdf and /dev/null differ diff --git a/src/Wima/doc/Skriptum_ADM_II_130704.pdf b/src/Wima/doc/Skriptum_ADM_II_130704.pdf deleted file mode 100644 index 8e6ad6208a763357b08186141db01ca355c2a3ea..0000000000000000000000000000000000000000 Binary files a/src/Wima/doc/Skriptum_ADM_II_130704.pdf and /dev/null differ diff --git a/src/Wima/doc/doc/QDoc/html/.index b/src/Wima/doc/doc/QDoc/html/.index deleted file mode 100644 index 6dd1d508fd03c795c0d1ffed4afa906266c873e7..0000000000000000000000000000000000000000 --- a/src/Wima/doc/doc/QDoc/html/.index +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/src/Wima/doc/doc/QDoc/html/wima/wima.index b/src/Wima/doc/doc/QDoc/html/wima/wima.index deleted file mode 100644 index db43d71c7da4a890fc0adc7a76efb8ecc6f51351..0000000000000000000000000000000000000000 --- a/src/Wima/doc/doc/QDoc/html/wima/wima.index +++ /dev/null @@ -1,692 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Wima/doc/wima.qdocconf b/src/Wima/doc/wima.qdocconf deleted file mode 100644 index fd40910d9e70d6412e5e9919bb62a2d649c27a7c..0000000000000000000000000000000000000000 --- a/src/Wima/doc/wima.qdocconf +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/src/Wima/CircularSurvey.SettingsGroup.json b/src/Wima/json/CircularSurvey.SettingsGroup.json similarity index 100% rename from src/Wima/CircularSurvey.SettingsGroup.json rename to src/Wima/json/CircularSurvey.SettingsGroup.json diff --git a/src/Wima/WimaController.SettingsGroup.json b/src/Wima/json/WimaController.SettingsGroup.json similarity index 100% rename from src/Wima/WimaController.SettingsGroup.json rename to src/Wima/json/WimaController.SettingsGroup.json diff --git a/src/Wima/notesOnWpExchange.txt b/src/Wima/notesOnWpExchange.txt deleted file mode 100644 index 10c055277f0a369204e07e8f9004275ae33e52ab..0000000000000000000000000000000000000000 --- a/src/Wima/notesOnWpExchange.txt +++ /dev/null @@ -1,11 +0,0 @@ -How to exchange mission between WimaPlaner and WimaController. - -1) convert mission into waypoints -2) send waypoints to WimaController -3) upload desired subset of waypoints to vehicle -4) start/continue mission -5) return vehicle on battery low -6) go to 4) or quit if last waypoint reached - - -investigate load, loadFromVehicle, syncInProgress, _newMissionItemsAvailableFromVehicle