void sendPath(NODE *rgnNodes, int chNode){ if ((rgnNodes+chNode)->iPrev != NONE){ sendPath(rgnNodes, (rgnNodes+chNode)->iPrev); } resultSend[paths] = chNode+1; paths++; }
//! Start maneuver function //! @param[in] maneuver rows maneuver message void start(const IMC::Rows* maneuver) { Memory::clear(m_parser); m_parser = new Maneuvers::RowsStages(maneuver, m_task); // Get it started m_task->setControl(IMC::CL_PATH); m_path.speed = maneuver->speed; m_path.speed_units = maneuver->speed_units; m_path.end_z = maneuver->z; m_path.end_z_units = maneuver->z_units; double lat; double lon; if (m_parser->getFirstPoint(&lat, &lon)) { m_task->signalCompletion(); return; } sendPath(lat, lon); }
void FileController::openFromPath(QString p) { if(!p.isEmpty()) { clear(); path = p; file = new QFile(path); if(file->open(QIODevice::ReadWrite)) { copyDataFromFile(); } emit opennedFile(src, line); emit sendPath(path); } }
void FileController::openDialogEnable() { QString pathTmp = QFileDialog::getOpenFileName(0, "Открыть файл...", "", "*.stur"); if(!pathTmp.isEmpty()) { clear(); path = pathTmp; file = new QFile(path); if(file->open(QIODevice::ReadWrite)) { copyDataFromFile(); } emit opennedFile(src, line); emit sendPath(path); } }
void sendResult(int myID,int chStart, int chEnd){ paths = 3; int k; for(k=0; k<33; k++) resultSend[k] = 0; resultSend[0] = chStart; resultSend[1] = chEnd; resultSend[2] = rgnNodes[myID][chEnd].iDist; sendPath(rgnNodes[myID], chEnd); Message msg; msg.length = 33; msg.msg[0] = -1; for(k=0; k<33; k++) msg.msg[k] = resultSend[k]; Send(&msg, print); }
void FileController::saveDialogEnable() { QFileDialog sDialog; QString pathTmp = sDialog.getSaveFileName(0, tr("Сохранить файл как..."), "", tr("STuring files (*.stur)")); if(!pathTmp.isEmpty()) { lines.clear(); path = pathTmp; emit saveFileSign(); file = new QFile(path); QFileInfo info(*file); if(info.suffix().isEmpty()) { info.suffix() = ".stur"; } file->open(QIODevice::ReadWrite); emit sendPath(path); } }
//! On PathControlState message //! @param[in] pcs pointer to PathControlState message void onPathControlState(const IMC::PathControlState* pcs) { std::stringstream ss; ss << "waypoint=" << m_parser->getIndex(); m_task->signalProgress(pcs->eta, ss.str()); if (!(pcs->flags & IMC::PathControlState::FL_NEAR)) return; double lat; double lon; if (m_parser->getNextPoint(&lat, &lon)) { m_task->signalCompletion(); return; } sendPath(lat, lon); }
void FileController::createNewFile() { clear(); emit opennedFile(src, line); emit sendPath("Новый"); }