Commit 85ad87bb authored by Thomas Gubler's avatar Thomas Gubler Committed by Thomas Gubler

[Survey transects generation] move some of the logic handling out of function...

[Survey transects generation] move some of the logic handling out of function that handles only one polygon
parent 1fde998d
......@@ -1067,11 +1067,6 @@ void SurveyComplexItem::_rebuildTransectsPhase1(void)
}
void SurveyComplexItem::_rebuildTransectsPhase1Worker(bool refly)
{
_rebuildTranscetsFromPolygon(refly);
}
void SurveyComplexItem::_rebuildTranscetsFromPolygon(bool refly)
{
if (_ignoreRecalc) {
return;
......@@ -1112,6 +1107,19 @@ void SurveyComplexItem::_rebuildTranscetsFromPolygon(bool refly)
qCDebug(SurveyComplexItemLog) << "_rebuildTransectsPhase1 vertex:x:y" << vertex << polygonPoints.last().x() << polygonPoints.last().y();
}
// convert into QPolygonF
QPolygonF polygon;
for (int i=0; i<polygonPoints.count(); i++) {
qCDebug(SurveyComplexItemLog) << "Vertex" << polygonPoints[i];
polygon << polygonPoints[i];
}
polygon << polygonPoints[0];
_rebuildTranscetsFromPolygon(refly, polygon, tangentOrigin);
}
void SurveyComplexItem::_rebuildTranscetsFromPolygon(bool refly, const QPolygonF& polygon, const QGeoCoordinate& tangentOrigin)
{
// Generate transects
double gridAngle = _gridAngleFact.rawValue().toDouble();
......@@ -1126,12 +1134,6 @@ void SurveyComplexItem::_rebuildTranscetsFromPolygon(bool refly)
// Convert polygon to bounding rect
qCDebug(SurveyComplexItemLog) << "_rebuildTransectsPhase1 Polygon";
QPolygonF polygon;
for (int i=0; i<polygonPoints.count(); i++) {
qCDebug(SurveyComplexItemLog) << "Vertex" << polygonPoints[i];
polygon << polygonPoints[i];
}
polygon << polygonPoints[0];
QRectF boundingRect = polygon.boundingRect();
QPointF boundingCenter = boundingRect.center();
qCDebug(SurveyComplexItemLog) << "Bounding rect" << boundingRect.topLeft().x() << boundingRect.topLeft().y() << boundingRect.bottomRight().x() << boundingRect.bottomRight().y();
......
......@@ -111,7 +111,8 @@ private:
bool _loadV3(const QJsonObject& complexObject, int sequenceNumber, QString& errorString);
bool _loadV4(const QJsonObject& complexObject, int sequenceNumber, QString& errorString);
void _rebuildTransectsPhase1Worker(bool refly);
void _rebuildTranscetsFromPolygon(bool refly); ///< Adds to the _transects array from one polygon
/// Adds to the _transects array from one polygon
void _rebuildTranscetsFromPolygon(bool refly, const QPolygonF& polygon, const QGeoCoordinate& tangentOrigin);
QMap<QString, FactMetaData*> _metaDataMap;
......
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