diff --git a/classic.css b/classic.css new file mode 100644 index 0000000000000000000000000000000000000000..911354035cf97843eb95138c303dd915f542f76a --- /dev/null +++ b/classic.css @@ -0,0 +1,92 @@ +h3.fn,span.fn +{ + margin-left: 1cm; + text-indent: -1cm; +} + +a:link +{ + color: #004faf; + text-decoration: none +} + +a:visited +{ + color: #672967; + text-decoration: none +} + +td.postheader +{ + font-family: sans-serif +} + +tr.address +{ + font-family: sans-serif +} + +body +{ + background: #ffffff; + color: black +} + +table tr.odd { + background: #f0f0f0; + color: black; +} + +table tr.even { + background: #e4e4e4; + color: black; +} + +table.annotated th { + padding: 3px; + text-align: left +} + +table.annotated td { + padding: 3px; +} + +table tr pre +{ + padding-top: none; + padding-bottom: none; + padding-left: none; + padding-right: none; + border: none; + background: none +} + +tr.qt-style +{ + background: #a2c511; + color: black +} + +body pre +{ + padding: 0.2em; + border: #e7e7e7 1px solid; + background: #f1f1f1; + color: black +} + +span.preprocessor, span.preprocessor a +{ + color: darkblue; +} + +span.comment +{ + color: darkred; + font-style: italic +} + +span.string,span.char +{ + color: darkgreen; +} diff --git a/master.qdocconf b/master.qdocconf new file mode 100644 index 0000000000000000000000000000000000000000..254ca02c03b8e30680a79cd4e5b32baa08cfde3b --- /dev/null +++ b/master.qdocconf @@ -0,0 +1,15 @@ +project = wima +description = Wireless Measurement Application (Wima) + +headerdirs = ./src/Wima +sourcedirs = ./src/Wima +headers = ./src/Wima/WimaArea.h +sources = ./src/Wima/WimaArea.cc + +sources.fileextensions = "*.cpp *.cc *.qdoc *.mm *.qml" +headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx" + +outputdir = ./doc/QDoc/html +outputformats = HTML + + diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 78514a88d23b43c20dd6fa781a3525ef10400e36..4ad8519690c2b358407219f944f57911c99ab1aa 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -416,7 +416,8 @@ HEADERS += \ src/Wima/WimaVehicle.h \ src/Wima/WimaDataContainer.h \ src/Wima/WimaPlaner.h \ - src/Wima/WimaPlaner.h + src/Wima/WimaPlaner.h \ + src/Wima/WimaMeasurementArea.h SOURCES += \ src/api/QGCCorePlugin.cc \ src/api/QGCOptions.cc \ @@ -424,14 +425,14 @@ SOURCES += \ src/api/QmlComponentInfo.cc \ src/comm/MavlinkMessagesTimer.cc \ src/Wima/WimaArea.cc \ - src/Wima/WimaGOperationArea.cc \ src/Wima/WimaServiceArea.cc \ src/Wima/WimaVCorridor.cc \ src/Wima/WimaTrackerPolyline.cc \ src/Wima/WimaController.cc \ src/Wima/WimaVehicle.cc \ src/Wima/WimaDataContainer.cc \ - src/Wima/WimaPlaner.cc + src/Wima/WimaPlaner.cc \ + src/Wima/WimaMeasurementArea.cc # # Unit Test specific configuration goes here (requires full debug build with all plugins) diff --git a/src/Wima/WimaArea.cc b/src/Wima/WimaArea.cc index 571a9fb12c6bee67015e0919ca2611959c40e994..20f7505f13bc6e5b24516c71771e752a2a968578 100644 --- a/src/Wima/WimaArea.cc +++ b/src/Wima/WimaArea.cc @@ -1,8 +1,24 @@ #include "WimaArea.h" +/*! + * \variable WimaArea::numericalAccuracy + * \brief The accuracy used for calculations. + */ const double WimaArea::numericalAccuracy = 1e-3; // meters +/*! + * \variable WimaArea::maxAltitudeName + * \brief A string containing the name of the \c _maxAltitude member. Among other used for storing. + */ const char* WimaArea::maxAltitudeName = "maxAltitude"; +/*! + * \variable WimaArea::wimaAreaName + * \brief A string containing the name of this \c WimaArea member. Among other used for storing. + */ const char* WimaArea::wimaAreaName = "WimaArea"; +/*! + * \variable WimaArea::areaTypeName + * \brief A string containing \c {"AreaType"}. Among other used for stroing. + */ const char* WimaArea::areaTypeName = "AreaType"; @@ -26,14 +42,27 @@ WimaArea::WimaArea(const WimaArea &other, QObject *parent) _maxAltitude = other.maxAltitude(); } -void WimaArea::setMaxAltitude(double alt) +/*! + \fn void WimaArea::setMaxAltitude(double altitude) + + Sets the \c _maxAltitude member to \a altitude and emits the signal \c maxAltitudeChanged() + if \c _maxAltitude is not equal to altitude. + */ +void WimaArea::setMaxAltitude(double altitude) { - if ( alt > 0 && qFuzzyCompare(alt, _maxAltitude) ) { - _maxAltitude = alt; + if ( altitude > 0 && qFuzzyCompare(altitude, _maxAltitude) ) { + _maxAltitude = altitude; emit maxAltitudeChanged(); } } +/*! + * \fn int WimaArea::getClosestVertexIndex(const QGeoCoordinate &coordinate) const + * Returns the index of the vertex (element of the polygon path) + * which has the least distance to \a coordinate. + * + * \sa QGeoCoordinate + */ int WimaArea::getClosestVertexIndex(const QGeoCoordinate &coordinate) const { if (this->count() == 0) { @@ -56,44 +85,69 @@ int WimaArea::getClosestVertexIndex(const QGeoCoordinate &coordinate) const } } +/*! + * \fn QGeoCoordinate WimaArea::getClosestVertex(const QGeoCoordinate& coordinate) const + * Returns the vertex of the polygon path with the least distance to \a coordinate. + * + * \sa QGeoCoordinate + */ QGeoCoordinate WimaArea::getClosestVertex(const QGeoCoordinate& coordinate) const { return this->vertexCoordinate(getClosestVertexIndex(coordinate)); } -QGCMapPolygon WimaArea::toQGCPolygon(const WimaArea &poly) +/*! + * \fn QGCMapPolygon WimaArea::toQGCPolygon(const WimaArea &area) + * Converts the \c WimaArea \a area to \c QGCMapPolygon by copying the path only. + */ +QGCMapPolygon WimaArea::toQGCPolygon(const WimaArea &area) { QGCMapPolygon qgcPoly; - qgcPoly.setPath(poly.path()); - qgcPoly.setCenter(poly.center()); - qgcPoly.setCenterDrag(poly.centerDrag()); - qgcPoly.setInteractive(poly.interactive()); + qgcPoly.setPath(area.path()); return QGCMapPolygon(qgcPoly); } +/*! + * \fn QGCMapPolygon WimaArea::toQGCPolygon() const + * Converts the calling \c WimaArea to \c QGCMapPolygon by copying the path only. + */ QGCMapPolygon WimaArea::toQGCPolygon() const { return toQGCPolygon(*this); } +/*! + * \fn void WimaArea::join(QList* polyList, WimaArea* joinedPoly) + * Not yet implemented \a polyList, \a joinedPoly. + * + * \sa QList + */ void WimaArea::join(QList* polyList, WimaArea* joinedPoly) { return; } -bool WimaArea::join(WimaArea &poly1, WimaArea &poly2, WimaArea &joinedPoly) +/*! + * \fn bool WimaArea::join(WimaArea &area1, WimaArea &area2, WimaArea &joinedArea) + * Joins the areas \a area1 and \a area2 such that a \l {Simple Polygon} is created. + * Stores the result inside \a joinedArea. + * Returns \c true if the algorithm was able to join the areas; false else. + * The algorithm will be able to join the areas, if either their edges intersect with each other, + * or one area contains the other. + */ +bool WimaArea::join(WimaArea &area1, WimaArea &area2, WimaArea &joinedArea) { - if (poly1.count() >= 3 && poly2.count() >= 3) { + if (area1.count() >= 3 && area2.count() >= 3) { - joinedPoly.clear(); + joinedArea.clear(); - poly1.verifyClockwiseWinding(); - poly2.verifyClockwiseWinding(); + area1.verifyClockwiseWinding(); + area2.verifyClockwiseWinding(); - WimaArea* walkerPoly = &poly1; // "walk" on this polygon towards higher indices - WimaArea* crossPoly = &poly2; // check for crossings with this polygon while "walking" + WimaArea* walkerPoly = &area1; // "walk" on this polygon towards higher indices + WimaArea* crossPoly = &area2; // check for crossings with this polygon while "walking" // and swicht to this polygon on a intersection, // continue to walk towards higher indices @@ -110,7 +164,7 @@ bool WimaArea::join(WimaArea &poly1, WimaArea &poly2, WimaArea &joinedPoly) if ( crossContainsWalker == true) { - joinedPoly.appendVertices(crossPoly->coordinateList()); + joinedArea.appendVertices(crossPoly->coordinateList()); return true; } @@ -123,7 +177,7 @@ bool WimaArea::join(WimaArea &poly1, WimaArea &poly2, WimaArea &joinedPoly) int nextVertexIndex = walkerPoly->nextVertexIndex(startIndex); while (1) { //qDebug("nextVertexIndex: %i", nextVertexIndex); - joinedPoly.appendVertex(currentVertex); + joinedArea.appendVertex(currentVertex); QGCMapPolyline walkerPolySegment; walkerPolySegment.appendVertex(currentVertex); @@ -177,7 +231,7 @@ bool WimaArea::join(WimaArea &poly1, WimaArea &poly2, WimaArea &joinedPoly) } if (currentVertex == startVertex) { - if (poly1.count() == joinedPoly.count()) { // is the case if poly1 and poly2 don't intersect + if (area1.count() == joinedArea.count()) { // is the case if poly1 and poly2 don't intersect return false; } else { return true; @@ -190,10 +244,18 @@ bool WimaArea::join(WimaArea &poly1, WimaArea &poly2, WimaArea &joinedPoly) } } -bool WimaArea::join(WimaArea &poly) +/*! + * \fn bool WimaArea::join(WimaArea &area) + * Joins the calling \c WimaArea and the \a area such that a \l {Simple Polygon} is created. + * Overwrites the calling \c WimaArea with the result, if the algorithm was successful. + * Returns \c true if the algorithm was able to join the areas; false else. + * The algorithm will be able to join the areas, if either their edges intersect with each other, + * or one area contains the other. + */ +bool WimaArea::join(WimaArea &area) { WimaArea joinedArea; - if ( join(*this, poly, joinedArea) ) { + if ( join(*this, area, joinedArea) ) { this->setPath(joinedArea.path()); return true; } else { @@ -201,6 +263,12 @@ bool WimaArea::join(WimaArea &poly) } } +/*! + * \fn bool WimaArea::isDisjunct(QList* polyList) + * Not yet implemented. + * + * \sa QList + */ bool WimaArea::isDisjunct(QList* polyList) { // needs improvement @@ -220,6 +288,10 @@ bool WimaArea::isDisjunct(QList* polyList) } } +/*! + * \fn bool WimaArea::isDisjunct(WimaArea *poly1, WimaArea *poly2) + * Not yet implemented. + */ bool WimaArea::isDisjunct(WimaArea *poly1, WimaArea *poly2) { if (poly1 != nullptr && poly2 != nullptr) { @@ -238,6 +310,12 @@ bool WimaArea::isDisjunct(WimaArea *poly1, WimaArea *poly2) } } +/*! + * \fn int WimaArea::nextVertexIndex(int index) const + * Returns the index of the next vertex (of the areas path), which is \a index + 1 if \a index is smaller than \c {area.count() - 1}, + * or 0 if \a index equals \c {area.count() - 1}, or -1 if the \a index is out of bounds. + * \note The function \c {area.count()} (derived from \c QGCMapPolygon) returns the number of vertices defining the area. + */ int WimaArea::nextVertexIndex(int index) const { if (index >= 0 && index < count()-1) { @@ -250,6 +328,12 @@ int WimaArea::nextVertexIndex(int index) const } } +/*! + * \fn int WimaArea::previousVertexIndex(int index) const + * Returns the index of the previous vertex (of the areas path), which is \a index - 1 if \a index is larger 0, + * or \c {area.count() - 1} if \a index equals 0, or -1 if the \a index is out of bounds. + * \note The function \c {area.count()} (derived from \c QGCMapPolygon) returns the number of vertices defining the area. + */ int WimaArea::previousVertexIndex(int index) const { if (index > 0 && index < count()) { @@ -262,6 +346,13 @@ int WimaArea::previousVertexIndex(int index) const } } +/*! + * \fn bool WimaArea::intersects(const QGCMapPolyline &line1, const QGCMapPolyline &line2, QGeoCoordinate &intersectionPt) + * Returns \c true if \a line1 and \a line2 intersect with each other. + * Stores the intersection point in \a intersectionPt + * + * \sa QGeoCoordinate + */ bool WimaArea::intersects(const QGCMapPolyline &line1, const QGCMapPolyline &line2, QGeoCoordinate &intersectionPt) { @@ -288,7 +379,8 @@ bool WimaArea::intersects(const QGCMapPolyline &line1, const QGCMapPolyline &lin if (kartLine1.intersect(kartLine2, &intersectionPoint) == QLineF::BoundedIntersection) { convertNedToGeo(intersectionPoint.x(), intersectionPoint.y(), origin.altitude(), origin, &intersectionPt); return true; - } else { + } + else { return false; } @@ -299,28 +391,33 @@ bool WimaArea::intersects(const QGCMapPolyline &line1, const QGCMapPolyline &lin } } -bool WimaArea::intersects(const QGCMapPolyline &line, - const WimaArea &poly, - QList &intersectionList, - QList > &neighbourList) +/*! + * \fn bool WimaArea::intersects(const QGCMapPolyline &line, const WimaArea &area, QList &intersectionList, QList> &neighbourList) + * Returns \c true if \a line and \a area intersect with each other at least once.bool WimaArea::intersects(const QGCMapPolyline &line, const WimaArea &area, QList &intersectionList, QList> &neighbourList) + * Stores the intersection points in \a intersectionList. + * Stores the indices of the closest two \a area vetices for each of coorespoinding intersection points in \a neighbourList. + * + * For example if an intersection point is found between the first and the second vertex of the \a area the intersection point will + * be stored in \a intersectionList and the indices 1 and 2 will be stored in \a neighbourList. + * \a neighbourList has entries of type \c {QPair}, where \c{pair.first} would contain 1 and \c{pair.second} would contain 2, when + * relating to the above example. + * + * \sa QPair, QList + */ +bool WimaArea::intersects(const QGCMapPolyline &line, const WimaArea &area, QList &intersectionList, QList> &neighbourList) { - // ================ Brief Explanation ================ - // This function checks whether line intersects with the border line of poly - // Returns true if at least one intersection occurs, false else. - // Stores the intersection points inside intersectionList. - // Stores the indices of the cloest two polygon vetices for each of coorespoinding intersection points in neighbourList intersectionList.clear(); neighbourList.clear(); - if (line.count() == 2 && poly.count() >= 3) { // are line a proper line and poly a proper poly? + if (line.count() == 2 && area.count() >= 3) { // are line a proper line and poly a proper poly? // Asseble a line form each tow consecutive polygon vertices and check whether it intersects with line - for (int i = 0; i < poly.count(); i++) { + for (int i = 0; i < area.count(); i++) { QGCMapPolyline interatorLine; - QGeoCoordinate currentVertex = poly.vertexCoordinate(i); - QGeoCoordinate nextVertex = poly.vertexCoordinate(poly.nextVertexIndex(i)); + QGeoCoordinate currentVertex = area.vertexCoordinate(i); + QGeoCoordinate nextVertex = area.vertexCoordinate(area.nextVertexIndex(i)); interatorLine.appendVertex(currentVertex); interatorLine.appendVertex(nextVertex); @@ -330,7 +427,7 @@ bool WimaArea::intersects(const QGCMapPolyline &line, QPair neighbours; neighbours.first = i; - neighbours.second = poly.nextVertexIndex(i); + neighbours.second = area.nextVertexIndex(i); neighbourList.append(neighbours); } } @@ -346,19 +443,27 @@ bool WimaArea::intersects(const QGCMapPolyline &line, } } -double WimaArea::distInsidePoly(const QGeoCoordinate &c1, const QGeoCoordinate &c2, WimaArea poly) +/*! + * \fn double WimaArea::distInsidePoly(const QGeoCoordinate &c1, const QGeoCoordinate &c2, WimaArea area) + * Returns the distance between the coordinate \a c1 and coordinate \a c2, or infinity if the shortest path between + * the two coordinates is not fully inside the \a area. + * \note Both coordinates must lie inside the \a area. + * + * \sa QGeoCoordinate + */ +double WimaArea::distInsidePoly(const QGeoCoordinate &c1, const QGeoCoordinate &c2, WimaArea area) { - poly.offset(0.1); // hack to compensate for numerical issues, migh be replaced in the future... - if ( poly.containsCoordinate(c1) && poly.containsCoordinate(c2)) { + area.offset(0.1); // hack to compensate for numerical issues, migh be replaced in the future... + if ( area.containsCoordinate(c1) && area.containsCoordinate(c2)) { QList intersectionList; QList> neighbourlist; QGCMapPolyline line; line.appendVertex(c1); line.appendVertex(c2); - intersects(line, poly, intersectionList, neighbourlist); + intersects(line, area, intersectionList, neighbourlist); - if ( intersectionList.size() == 0 ){ + if ( intersectionList.size() == 0 ){ // if an intersection was found the path between c1 and c2 is not fully inside area. return c1.distanceTo(c2); } else { return std::numeric_limits::infinity(); @@ -369,17 +474,22 @@ double WimaArea::distInsidePoly(const QGeoCoordinate &c1, const QGeoCoordinate & } } +/*! + * \fn bool WimaArea::dijkstraPath(const QGeoCoordinate &start, const QGeoCoordinate &end, const WimaArea &area, QList &dijkstraPath) + * Calculates the shortest path (inside \a area) between \a start and \a end. + * The \l {Dijkstra Algorithm} is used to find the shorest path. + * Stores the result inside \a dijkstraPath when sucessfull. + * Returns \c true if successful, \c false else. + * + * \sa QList + */ bool WimaArea::dijkstraPath(const QGeoCoordinate &start, const QGeoCoordinate &end, - const WimaArea &poly, + const WimaArea &area, QList &dijkstraPath) { - // ================ Brief Explanation ================ - // This function calculates the shortes Path between two GeoCoordinates (start, end) using the Dijkstra Algorithm. - // The path will be inside the polygon poly if possible. - // Stores the result inside dijkstraPath // Returns true if a valid path was found. - if ( isSelfIntersecting(poly) ) { + if ( isSelfIntersecting(area) ) { return false; } @@ -397,7 +507,7 @@ bool WimaArea::dijkstraPath(const QGeoCoordinate &start, // Elements will be successively remove during the execution of the Dijkstra Algorithm. QList workingSet; - // initialize nodeList + // initialize nodeList_maxAltitude // start cooridnate Node startNode; startNode.coordinate = start; @@ -405,9 +515,9 @@ bool WimaArea::dijkstraPath(const QGeoCoordinate &start, nodeList.append(startNode); //poly cooridnates - for (int i = 0; i < poly.count(); i++) { + for (int i = 0; i < area.count(); i++) { Node node; - node.coordinate = poly.vertexCoordinate(i); + node.coordinate = area.vertexCoordinate(i); nodeList.append(node); } @@ -445,7 +555,7 @@ bool WimaArea::dijkstraPath(const QGeoCoordinate &start, Node* v = workingSet[i]; // is neighbour? dist == infinity if no neihbour - double dist = distInsidePoly(u->coordinate, v->coordinate, poly); + double dist = distInsidePoly(u->coordinate, v->coordinate, area); // is ther a alternative path which is shorter? double alternative = u->distance + dist; if (alternative < v->distance) { @@ -479,20 +589,26 @@ bool WimaArea::dijkstraPath(const QGeoCoordinate &start, return true; } -bool WimaArea::isSelfIntersecting(const WimaArea &poly) +/*! + * \fn bool WimaArea::isSelfIntersecting(const WimaArea &area) + * Returns \c true if the \a area is self intersecting, \c false else. + * \note If the \a area is self intersecting, it's not a \l {Simple Polygon}. + */ +bool WimaArea::isSelfIntersecting(const WimaArea &area) { int i = 0; - if (poly.count() > 3) { - while(i < poly.count()-1) { + if (area.count() > 3) { + // check if any edge of the area (formed by two adjacent vertices) intersects with any other edge of the area + while(i < area.count()-1) { QGCMapPolyline refLine; - refLine.appendVertex(poly.vertexCoordinate(i)); - refLine.appendVertex(poly.vertexCoordinate(poly.nextVertexIndex(i))); - int j = poly.nextVertexIndex(i); - while(j < poly.count()) { + refLine.appendVertex(area.vertexCoordinate(i)); + refLine.appendVertex(area.vertexCoordinate(area.nextVertexIndex(i))); + int j = area.nextVertexIndex(i); + while(j < area.count()) { QGeoCoordinate dummy; QGCMapPolyline iteratorLine; - iteratorLine.appendVertex(poly.vertexCoordinate(j)); - iteratorLine.appendVertex(poly.vertexCoordinate(poly.nextVertexIndex(j))); + iteratorLine.appendVertex(area.vertexCoordinate(j)); + iteratorLine.appendVertex(area.vertexCoordinate(area.nextVertexIndex(j))); if ( intersects(refLine, iteratorLine, dummy) ) return true; @@ -506,11 +622,22 @@ bool WimaArea::isSelfIntersecting(const WimaArea &poly) return false; } +/*! + * \fn bool WimaArea::isSelfIntersecting() + * Returns \c true if the calling area is self intersecting, \c false else. + * \note If the calling area is self intersecting, it's not a \l {Simple Polygon}. + */ bool WimaArea::isSelfIntersecting() { return isSelfIntersecting(*this); } +/*! + * \fn void WimaArea::saveToJson(QJsonObject &json) + * Saves the calling area to \c QJsonObject object and stores it inside \a json. + * + * \sa QJsonObject + */ void WimaArea::saveToJson(QJsonObject &json) { this->QGCMapPolygon::saveToJson(json); @@ -519,6 +646,14 @@ void WimaArea::saveToJson(QJsonObject &json) // add WimaVehicle if necessary.. } +/*! + * \fn bool WimaArea::loadFromJson(const QJsonObject &json, QString& errorString) + * Loads data from \a json and stores it inside the calling area. + * Returns \c true if loading was successful, \c false else. + * Stores error messages inside \a errorString. + * + * \sa QJsonObject + */ bool WimaArea::loadFromJson(const QJsonObject &json, QString& errorString) { if ( this->QGCMapPolygon::loadFromJson(json, false /*no poly required*/, errorString) ) { @@ -535,17 +670,29 @@ bool WimaArea::loadFromJson(const QJsonObject &json, QString& errorString) } } +/*! + * \fn void WimaArea::update(const WimaArea &area) + * Not yet implemented. + */ void WimaArea::update(const WimaArea &area) { this->QGCMapPolygon::update(area); - this->setMaxAltitude(area.maxAltitude()); + this->setMaxAltitude(area.maxAltitude());displays } +/*! + * \fn void WimaArea::init() + * Funtion to be called during construction. + */ void WimaArea::init() { this->setObjectName(wimaAreaName); } +/*! + * \fn void print(const WimaArea &area) + * Prints the data contained in \a area to the console. + */ void print(const WimaArea &area) { QString message; @@ -553,6 +700,10 @@ void print(const WimaArea &area) qWarning() << message; } +/*! + * \fn void print(const WimaArea &area) + * Prints the data contained in \a area to the \a outputString. + */ void print(const WimaArea &area, QString &outputString) { outputString.append(QString("Type: %1").arg(area.objectName())); @@ -560,3 +711,58 @@ void print(const WimaArea &area, QString &outputString) outputString.append(QString("Maximum Altitude: %1").arg(area._maxAltitude)); } + +// QDoc Documentation + +/*! + \group WimaAreaGroup + \title Group of WimaAreas + + Every \c WimaArea of the equally named group uses a \l {Simple Polygon} derived from \c {QGCMapPolygon} + to define areas inside which certain taskts are performed. +*/ + +/*! + \class WimaArea + \inmodule Wima + \ingroup WimaArea + + \brief The \c WimaArea class provides the a base class for + all areas used within the Wima extension. + + \c WimaArea uses a \l {Simple Polygon} derived from \c {QGCMapPolygon} + to define areas inside which certain taskts are performed. The polygon (often refered to as the path) can + be displayed visually on a map. +*/ + +/*! + \variable WimaArea::_maxAltitude + \brief The maximum altitude vehicles are allowed to fly inside this area. +*/ + +/*! + \property WimaArea::maxAltitude + \brief The maximum altitude at which vehicles are allowed to fly. +*/ + +/*! + \property WimaArea::mapVisualQML + \brief A string containing the name of the QML file used to displays this area on a map. +*/ + +/*! + \property WimaArea::editorQML + \brief A string containing the name of the QML file allowing to edit the area's properties. +*/ + +/*! + \externalpage https://en.wikipedia.org/wiki/Simple_polygon + \title Simple Polygon +*/ + +/*! + \externalpage https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm + \title Dijkstra Algorithm +*/ + + diff --git a/src/Wima/WimaArea.h b/src/Wima/WimaArea.h index b8a02d1d23226a08807bd03e17e0778af28e62a6..2a554d7be2e9a0579bf16a5819ada13246965136 100644 --- a/src/Wima/WimaArea.h +++ b/src/Wima/WimaArea.h @@ -37,7 +37,7 @@ public: QGeoCoordinate getClosestVertex (const QGeoCoordinate& coordinate) const; QGCMapPolygon toQGCPolygon () const; void join (QList* polyList, WimaArea* joinedPoly);// change to & notation - bool join (WimaArea &poly); + bool join (WimaArea &area); bool isDisjunct (QList* polyList);// change to & notation, if necessary bool isDisjunct (WimaArea* poly1, WimaArea* poly2);// change to & notation, if necessary /// calculates the next polygon vertex index @@ -52,11 +52,11 @@ public: bool loadFromJson (const QJsonObject &jsonObject, QString& errorString); // static Methodes - static QGCMapPolygon toQGCPolygon (const WimaArea& poly); + static QGCMapPolygon toQGCPolygon (const WimaArea& area); /// joins the poly1 and poly2 if possible, joins the polygons to form a simple polygon (no holes) /// see https://en.wikipedia.org/wiki/Simple_polygon /// @return true if polygons have been joined, false else - static bool join (WimaArea &poly1, WimaArea &poly2, WimaArea& joinedPoly); + static bool join (WimaArea &area1, WimaArea &area2, WimaArea& joinedArea); /// checks if line1 and line2 intersect with each other, takes latitude and longitute into account only (height neglected) /// @param line1 line containing two coordinates, height not taken into account /// @param line2 line containing two coordinates, height not taken into account @@ -69,18 +69,18 @@ public: /// @param intersectionList Empty list to store intersection points in. /// @param neighbourList Empty list to store the indices of the neighbours (the two Vertices of poly with the smallest distance to the intersection pt.) /// @return false on error or no intersection, true else - static bool intersects (const QGCMapPolyline& line, const WimaArea& poly, + static bool intersects (const QGCMapPolyline& line, const WimaArea& area, QList& intersectionList, QList>& neighbourList); /// calculates the distance between to geo coordinates, returns the distance if the path lies within the polygon and inf. else. /// @return the distance if the path lies within the polygon and inf. else. - static double distInsidePoly (const QGeoCoordinate& c1, const QGeoCoordinate& c2, WimaArea poly); + static double distInsidePoly (const QGeoCoordinate& c1, const QGeoCoordinate& c2, WimaArea area); /// calculates the shortes path between two geo coordinates inside a polygon using the Dijkstra Algorithm /// @return true if path was found, false else static bool dijkstraPath (const QGeoCoordinate& c1, const QGeoCoordinate& c2, - const WimaArea& poly, QList& dijkstraPath); + const WimaArea& area, QList& dijkstraPath); /// @return true if the polygon is self intersecting - static bool isSelfIntersecting (const WimaArea& poly); + static bool isSelfIntersecting (const WimaArea& area); bool isSelfIntersecting (); // Friends @@ -98,10 +98,9 @@ public: signals: void maxAltitudeChanged (void); - void vehicleChanged (void); public slots: - void setMaxAltitude (double alt); + void setMaxAltitude (double altitude); /// Updates this with data from area void update(const WimaArea& area); @@ -113,3 +112,6 @@ private: }; + + + diff --git a/src/Wima/WimaController.cc b/src/Wima/WimaController.cc index 370b1ef1fcab8122c29f3eac2a823faa81939e64..340a92634f34d2e3a617e080ed5dfaf1d70c1455 100644 --- a/src/Wima/WimaController.cc +++ b/src/Wima/WimaController.cc @@ -136,3 +136,5 @@ void WimaController::setReadyForSaveSend(bool ready) + + diff --git a/src/Wima/WimaController.h b/src/Wima/WimaController.h index 3c8af8af87f4c04594c6125eda65de7fcd280181..e0fc9ef035a35192cedfe68561a1080ffcd99b26 100644 --- a/src/Wima/WimaController.h +++ b/src/Wima/WimaController.h @@ -5,7 +5,7 @@ #include "QmlObjectListModel.h" #include "WimaArea.h" -#include "WimaGOperationArea.h" +#include "WimaMeasurementArea.h" #include "WimaServiceArea.h" #include "WimaVCorridor.h" #include "WimaDataContainer.h" diff --git a/src/Wima/WimaGOperationArea.cc b/src/Wima/WimaGOperationArea.cc deleted file mode 100644 index b600f72662b4f97b0b26e40f1f1fc514e3bff93e..0000000000000000000000000000000000000000 --- a/src/Wima/WimaGOperationArea.cc +++ /dev/null @@ -1,138 +0,0 @@ -#include "WimaGOperationArea.h" - - -const char* WimaGOperationArea::settingsGroup = "OperationArea"; -const char* WimaGOperationArea::bottomLayerAltitudeName = "BottomLayerAltitude"; -const char* WimaGOperationArea::numberOfLayersName = "NumberOfLayers"; -const char* WimaGOperationArea::layerDistanceName = "LayerDistance"; -const char* WimaGOperationArea::borderPolygonOffsetName = "BorderPolygonOffset"; -const char* WimaGOperationArea::wimaGOperationAreaName = "Operation Area"; - - -WimaGOperationArea::WimaGOperationArea(QObject *parent) - : WimaArea (parent) -{ - init(); -} - -WimaGOperationArea::WimaGOperationArea(const WimaGOperationArea &other, QObject *parent) - : WimaArea(other, parent) -{ - init(); -} - -void WimaGOperationArea::saveToJson(QJsonObject &json) -{ - this->WimaArea::saveToJson(json); - json[bottomLayerAltitudeName] = _bottomLayerAltitude.rawValue().toDouble(); - json[numberOfLayersName] = _numberOfLayers.rawValue().toInt(); - json[layerDistanceName] = _layerDistance.rawValue().toDouble(); - json[borderPolygonOffsetName] = _borderPolygonOffset.rawValue().toDouble(); - json[areaTypeName] = wimaGOperationAreaName; -} - -bool WimaGOperationArea::loadFromJson(const QJsonObject &json, QString& errorString) -{ - if (this->WimaArea::loadFromJson(json, errorString)) { - bool retVal = true; - - if ( json.contains(bottomLayerAltitudeName) && json[bottomLayerAltitudeName].isDouble() ) { - _bottomLayerAltitude.setRawValue(json[bottomLayerAltitudeName].toDouble()); - } else { - errorString.append(tr("Could not load Bottom Layer Altitude!\n")); - retVal = false; - } - - if ( json.contains(numberOfLayersName) && json[numberOfLayersName].isDouble() ) { - _numberOfLayers.setRawValue(json[numberOfLayersName].toInt()); - } else { - errorString.append(tr("Could not load Number of Layers!\n")); - retVal = false; - } - - if ( json.contains(layerDistanceName) && json[layerDistanceName].isDouble() ) { - _layerDistance.setRawValue(json[layerDistanceName].toDouble()); - } else { - errorString.append(tr("Could not load Layer Distance!\n")); - retVal = false; - } - - if ( json.contains(borderPolygonOffsetName) && json[borderPolygonOffsetName].isDouble() ) { - _borderPolygonOffset.setRawValue(json[borderPolygonOffsetName].toDouble()); - } else { - errorString.append(tr("Could not load Border Polygon Offset!\n")); - retVal = false; - } - - return retVal; - } else { - return false; - } -} - -void WimaGOperationArea::update(const WimaGOperationArea &area) -{ - this->WimaArea::update(area); - - this->setBottomLayerAltitude(area.bottomLayerAltitude()); - this->setNumberOfLayers(area.numberOfLayers()); - this->setLayerDistance(area.layerDistance()); - this->setBorderPolygonOffset(area.borderPolygonOffset()); - - recalcBorderPolygon(); -} - -void WimaGOperationArea::setBottomLayerAltitude(double altitude) -{ - -} - -void print(const WimaGOperationArea &area) -{ - QString message; - print(area, message); - qWarning() << message; -} - -void print(const WimaGOperationArea &area, QString outputStr) -{ - print(static_cast(area), outputStr); - outputStr.append(QString("Bottom Layer Altitude: %1\n").arg(area._bottomLayerAltitude.rawValue().toDouble())); - outputStr.append(QString("Number of Layers: %1\n").arg(area._numberOfLayers.rawValue().toInt())); - outputStr.append(QString("Layer Distance: %1\n").arg(area._layerDistance.rawValue().toDouble())); - outputStr.append(QString("Border Polygon Offset: %1\n").arg(area._borderPolygonOffset.rawValue().toDouble())); - - outputStr.append(QString("Border Polygon Coordinates\n").arg(area._borderPolygonOffset.rawValue().toDouble())); - for (int i = 0; i < area._borderPolygon.count(); i++) { - QGeoCoordinate coordinate = area._borderPolygon.vertexCoordinate(i); - outputStr.append(QString("%1\n").arg(coordinate.toString(QGeoCoordinate::Degrees))); - } -} - -void WimaGOperationArea::recalcBorderPolygon() -{ - //qWarning("WimaGOperationArea::recalcBorderPolygon() %f", _borderPolygonOffset.rawValue().toDouble()); - QGCMapPolygon polyCopy = this->toQGCPolygon(*this); - polyCopy.offset(_borderPolygonOffset.rawValue().toDouble()); - _borderPolygon.setPath(polyCopy.path()); - polyCopy.deleteLater(); - - emit borderPolygonChanged(); -} - -void WimaGOperationArea::init() -{ - - _metaDataMap = FactMetaData::createMapFromJsonFile(QStringLiteral(":/json/WimaGOperationArea.SettingsGroup.json"), this /* QObject parent */); - _bottomLayerAltitude = SettingsFact(settingsGroup, _metaDataMap[bottomLayerAltitudeName], this /* QObject parent */); - _numberOfLayers = SettingsFact(settingsGroup, _metaDataMap[numberOfLayersName], this /* QObject parent */); - _layerDistance = SettingsFact(settingsGroup, _metaDataMap[layerDistanceName], this /* QObject parent */); - _borderPolygonOffset = SettingsFact(settingsGroup, _metaDataMap[borderPolygonOffsetName], this /* QObject parent */); - _borderPolygon = new QGCMapPolygon(this); - - this->setObjectName(wimaGOperationAreaName); - connect(this, &WimaGOperationArea::pathChanged, this, &WimaGOperationArea::recalcBorderPolygon); - connect(&_borderPolygonOffset, &SettingsFact::rawValueChanged, this, &WimaGOperationArea::recalcBorderPolygon); -} - - diff --git a/src/Wima/WimaMeasurementArea.cc b/src/Wima/WimaMeasurementArea.cc new file mode 100644 index 0000000000000000000000000000000000000000..45d9aa91f2fb177f5c7f363f33e06b7d51291bb3 --- /dev/null +++ b/src/Wima/WimaMeasurementArea.cc @@ -0,0 +1,6 @@ +#include "WimaMeasurementArea.h" + +WimaMeasurementArea::WimaMeasurementArea() +{ + +} diff --git a/src/Wima/WimaMeasurementArea.h b/src/Wima/WimaMeasurementArea.h new file mode 100644 index 0000000000000000000000000000000000000000..acf362c756983231890a52d2500a07e667faf564 --- /dev/null +++ b/src/Wima/WimaMeasurementArea.h @@ -0,0 +1,11 @@ +#ifndef WIMAMEASUREMENTAREA_H +#define WIMAMEASUREMENTAREA_H + + +class WimaMeasurementArea +{ +public: + WimaMeasurementArea(); +}; + +#endif // WIMAMEASUREMENTAREA_H \ No newline at end of file diff --git a/src/Wima/doc/doc/QDoc/html/.index b/src/Wima/doc/doc/QDoc/html/.index new file mode 100644 index 0000000000000000000000000000000000000000..6dd1d508fd03c795c0d1ffed4afa906266c873e7 --- /dev/null +++ b/src/Wima/doc/doc/QDoc/html/.index @@ -0,0 +1,5 @@ + + + + + diff --git a/src/Wima/doc/doc/QDoc/html/wima/wima.index b/src/Wima/doc/doc/QDoc/html/wima/wima.index new file mode 100644 index 0000000000000000000000000000000000000000..db43d71c7da4a890fc0adc7a76efb8ecc6f51351 --- /dev/null +++ b/src/Wima/doc/doc/QDoc/html/wima/wima.index @@ -0,0 +1,692 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Wima/doc/wima.qdocconf b/src/Wima/doc/wima.qdocconf new file mode 100644 index 0000000000000000000000000000000000000000..9e8341083c90de6d7956dad489f11c6f6e717dc1 --- /dev/null +++ b/src/Wima/doc/wima.qdocconf @@ -0,0 +1,16 @@ +project = Wima + +headerdirs = ../ +sourcedirs = ../ + +sources.fileextensions = "*.cpp *.cc *.qdoc *.mm *.qml" +headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx" +examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" +examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng" + +outputdir = ./doc/QDoc/html +outputformats = HTML + + + +