QFile routeTempFile("routetemp.xml");//Temp xml.
- //If first round
- if (roundCounter == 0)
+ //If GPS find 4 or more satellite and signal stregth is 30 or more.
+ if (location->getSatellitesInUse() >= 4 && location->getSignalStrength() >= 30)
{
- if (!routeTempFile.open(QIODevice::WriteOnly | QIODevice::Text))
- return;
- writeRouteXml(&routeTempFile, 0);
- routeTempFile.close();
- roundCounter ++;
- }
-
- //Points writing round.
- else
- {
- sLatitudeNow.sprintf("%.4f", latitude); //Latitude now to string
- sLongitudeNow.sprintf("%.4f", longitude);//Longitude now to string
- sLatitudePrevious.sprintf("%.4f", latitudePrevious); //Previous latitude to string
- sLongitudePrevious.sprintf("%.4f", longitudePrevious); //Previous longitude to string
-
- //If latitude or longitude change
- if ( sLatitudeNow != sLatitudePrevious || sLongitudeNow != sLongitudePrevious )
+ //If first round
+ if (roundCounter == 0)
{
- if (!routeTempFile.open(QIODevice::Append | QIODevice::Text))
+ if (!routeTempFile.open(QIODevice::WriteOnly | QIODevice::Text))
return;
-
writeRouteXml(&routeTempFile, 0);
- roundCounter ++;
routeTempFile.close();
+ roundCounter ++;
+ }
+
+ //Points writing round.
+ else
+ {
+ sLatitudeNow.sprintf("%.4f", latitude); //Latitude now to string
+ sLongitudeNow.sprintf("%.4f", longitude);//Longitude now to string
+ sLatitudePrevious.sprintf("%.4f", latitudePrevious); //Previous latitude to string
+ sLongitudePrevious.sprintf("%.4f", longitudePrevious); //Previous longitude to string
+
+ //If latitude or longitude change
+ if ( sLatitudeNow != sLatitudePrevious || sLongitudeNow != sLongitudePrevious )
+ {
+ if (!routeTempFile.open(QIODevice::Append | QIODevice::Text))
+ return;
+
+ writeRouteXml(&routeTempFile, 0);
+ roundCounter ++;
+ routeTempFile.close();
+ }
}
}
}
helpDialog = NULL;
}
}
-
+/**
+ *
+ */
void MainWindow::setUsernameToMainPanel()
{
if (loginSaved())
/**
*
*/
-void drawFlag( RouteDialog *rD, QPainter *p, int x, int y)
+void drawFlag( RouteDialog *rD, QPainter *p, int x, int y, QString startFinish)
{
/*QPolygon pg;
p->drawLine( x, y-25, x+10, y-20);
p->drawLine( x+10, y-20, x, y-15);
p->drawLine( x, y-15, x, y-25);
+
+ // Draw start or finish
+ p->drawText(x+10, y, startFinish);
}
else
{
p->drawLine( x, y-25, x-10, y-20);
p->drawLine( x-10, y-20, x, y-15);
p->drawLine( x, y-15, x, y-25);
- }
+ // Draw start or finish
+ p->drawText(x+10, y, startFinish);
+ }
}
else if (y <= (rD->getTop() + 25))
{
p->drawLine( x, y+25, x+10, y+20);
p->drawLine( x+10, y+20, x, y+15);
p->drawLine( x, y+15, x, y+25);
+
+ // Draw start or finish
+ p->drawText(x+10, y+15, startFinish);
}
else
{
p->drawLine( x, y+25, x-10, y+20);
p->drawLine( x-10, y+20, x, y+15);
p->drawLine( x, y+15, x, y+25);
+
+ // Draw start or finish
+ p->drawText(x+10, y+15, startFinish);
}
}
//p->drawPolygon();
int x1Screen, y1Screen, x2Screen, y2Screen;
Vector v1, v2;
QPainter painter(this);
+ int startStop = 0;
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen((Qt::white),2));
// Starting point
startx = x1Screen; starty = y1Screen;
// painter.drawEllipse( x1Screen-5, y1Screen-5, 10, 10);
- drawFlag( this, &painter, x1Screen , y1Screen);
-
- // Draw star text
- painter.drawText(x1Screen+10, y1Screen, "Start");
+ drawFlag( this, &painter, x1Screen, y1Screen, "Start" );
}
painter.drawLine( x1Screen, y1Screen, x2Screen, y2Screen);
}
if (x2Screen != startx || y2Screen != starty)
{
//painter.drawEllipse( x2Screen-5, y2Screen-5, 10, 10);
- drawFlag( this, &painter,x2Screen, y2Screen );
-
- // Draw finish text
- painter.drawText(x2Screen+10, y2Screen, "Finish");
+ drawFlag( this, &painter, x2Screen, y2Screen, "Finish" );
}
{
timerSatellitePicture = new QTimer();
timerSatellitePicture->setInterval(400);
connect(timerSatellitePicture, SIGNAL(timeout()),this, SLOT(timerSatellitePictureTimeout()));
+ ui->labelUserInfo->setText("Push start button"); //User info label
//Invisible or clear labels
ui->labelRouteStatus->setVisible(0);
ui->labelRoutePicture->setVisible(0);
ui->labelGpsSpeed->setVisible(0); //GPS speed label
- ui->labelUserInfo->setText(""); //User info label
+ ui->labelSignalStrength->setText(""); //GPS signal strength label
timerRoutePicture = new QTimer();
timerRoutePicture->setInterval(400);
connect(timerRoutePicture, SIGNAL(timeout()),this, SLOT(timerRoutePictureTimeout()));
//Stop route recording
gpsData->stopRouteRecording();
+
+ //User info label
+ ui->labelUserInfo->setText("Push start button");
}
}
//IF GPS start button clicked
if (buttonStatus == false)
{
- //If GPS find 4 satellite.
- if (location->getSatellitesInUse() >= 4)
+ //ui->labelSignalStrength->setText(QString::number(location->getSignalStrength())); //Returns average signal strength of satellites which are in use.
+
+ //If GPS find 4 or more satellite and signal stregth is 30 or more.
+ if (location->getSatellitesInUse() >= 4 && location->getSignalStrength() >= 30)
{
//Satellite picture and label
ui->labelRouteSatelliteStatus->setText("GPS Ready");
//Route picture and label
ui->labelRouteStatus->setText("Recorded " + QString::number(gpsData->roundCounter) + " route point");
+ ui->labelUserInfo->setText("Recorded " + QString::number(gpsData->roundCounter) + " route point");
ui->labelRouteStatus->setVisible(1);
ui->labelRoutePicture->setVisible(1);
timerRoutePicture->start();
//Start route recording
gpsData->startRouteRecording();
}
-
- //If GPS find less than 4 satellite.
- else
+ else //If GPS find less than 4 satellite or signal strength is poor.
{
//Satellite picture and label
ui->labelRouteSatelliteStatus->setText("Searching satellite");
+ ui->labelUserInfo->setText("Searching satellite");
ui->labelRouteSatelliteStatus->setVisible(1);
ui->labelRouteSatellitePicture->setVisible(1);
timerSatellitePicture->start();
ui->labelGpsSpeed->setVisible(0);
}
}
- else
+ else //If stop button clicked
{
//Satellite picture and label
ui->labelRouteSatelliteStatus->setText("Searching satellite");
+ ui->labelUserInfo->setText("Push start button");
ui->labelRouteSatelliteStatus->setVisible(0);
ui->labelRouteSatellitePicture->setVisible(0);
timerSatellitePicture->stop();
<string>User info label</string>
</property>
</widget>
+ <widget class="QLabel" name="labelSignalStrength">
+ <property name="geometry">
+ <rect>
+ <x>550</x>
+ <y>120</y>
+ <width>151</width>
+ <height>51</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>labelSignalStrength</string>
+ </property>
+ </widget>
</widget>
<resources>
<include location="graphics.qrc"/>