void CalculateLaylines::startCalc(){ if (!this->calculationOnGoing){ this->calculationOnGoing = true; this->obstacleFound = false; QVector<QPointF> layLines; QVector<QPointF> rightpath; QVector<QPointF> leftpath; if ( this->pathPoints.size() > 0 ){ this->openPostgreConnection(); this->ACCU_OFFSET = 1; this->MAX_TURNING_POINTS = 5; this->geoBoatPos = this->startPoint; this->pathPoints = this->pathPoints; //Start process of calculating laylines. First get the the destination point on long term route (no obstacles between baot and long term route point). this->updateCheckPoint(); //then calculate the laylines that takes the boat to that destination point this->updateLayLines(); rightpath = *pRightPath; leftpath = *pLeftPath; for(int i = 0; i < rightpath.size(); i++){ layLines.append(rightpath.at(i)); } for(int i = 0; i < leftpath.size(); i++){ layLines.append(leftpath.at(i)); } this->layLines = layLines; } this->calculationOnGoing = false; this->closepostgreConnection(); emit emitLaylines(this->layLines); }else{ this->calculationOnGoing = false; } }
void CalculateLaylines::calculationComplete(){ emit emitLaylines(this->layLines); }
void CalculateLaylines::startCalc(){ if (!this->calculationOnGoing){ this->calculationOnGoing = true; this->obstacleFound = false; QVector<QPointF> layLines; QVector<QPointF> rightpath; QVector<QPointF> leftpath; QElapsedTimer timer; if ( this->pathPoints.size() > 0 ){ timer.start(); qDebug() << "##########################################################"; this->openPostgreConnection(); qDebug() << "Time to open database connection "<< timer.elapsed() << "miliseconds"; this->ACCU_OFFSET = 1; this->MAX_TURNING_POINTS = 5; this->geoBoatPos = this->startPoint; qDebug() << "- Start points in startCalc function are:" << this->startPoint.rx() << ", " << this->startPoint.ry(); this->pathPoints = this->pathPoints; //Start process of calculating laylines. First get the the destination point on long term route (no obstacles between baot and long term route point). qDebug() << "- Start process of calculating laylines"; qDebug() << "- Getting the destination point on long term route"; timer.start(); this->updateCheckPoint(); qDebug() << "- Time of updateCheckPoint "<< timer.elapsed()/1000 << " seconds"; //then calculate the laylines that takes the boat to that destination point timer.start(); this->updateLayLines(); qDebug() << "- Time of calculating laylines "<< timer.elapsed()/1000 << " seconds"; rightpath = *pRightPath; leftpath = *pLeftPath; qDebug() << "Starting first for loop"; for(int i = 0; i < rightpath.size(); i++){ layLines.append(rightpath.at(i)); } qDebug() << "Starting second for loop"; for(int i = 0; i < leftpath.size(); i++){ layLines.append(leftpath.at(i)); } this->layLines = layLines; } this->calculationOnGoing = false; timer.start(); this->closepostgreConnection(); qDebug() << "- Time of closinf database "<< timer.elapsed(); emit emitLaylines(this->layLines); qDebug() << "- Laylines emited"; qDebug() << "########################################################"; }else{ this->calculationOnGoing = false; } }