Commit d29b8b03 authored by Valentin Platzgummer's avatar Valentin Platzgummer

doc added to WimaArea, renaming areas

parent b37dda84
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;
}
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
......@@ -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)
......
This diff is collapsed.
......@@ -37,7 +37,7 @@ public:
QGeoCoordinate getClosestVertex (const QGeoCoordinate& coordinate) const;
QGCMapPolygon toQGCPolygon () const;
void join (QList<WimaArea*>* polyList, WimaArea* joinedPoly);// change to & notation
bool join (WimaArea &poly);
bool join (WimaArea &area);
bool isDisjunct (QList<WimaArea*>* 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<QGeoCoordinate>& intersectionList,
QList<QPair<int, int>>& 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<QGeoCoordinate>& dijkstraPath);
const WimaArea& area, QList<QGeoCoordinate>& 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:
};
......@@ -136,3 +136,5 @@ void WimaController::setReadyForSaveSend(bool ready)
......@@ -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"
......
#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<const WimaArea&>(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);
}
#include "WimaMeasurementArea.h"
WimaMeasurementArea::WimaMeasurementArea()
{
}
#ifndef WIMAMEASUREMENTAREA_H
#define WIMAMEASUREMENTAREA_H
class WimaMeasurementArea
{
public:
WimaMeasurementArea();
};
#endif // WIMAMEASUREMENTAREA_H
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QDOCINDEX>
<INDEX url="" title="" version="" project="">
<namespace threadsafety="unspecified" name="" status="active" access="public"/>
</INDEX>
This source diff could not be displayed because it is too large. You can view the blob instead.
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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment