classe step

This commit is contained in:
p2405951 2025-06-18 14:48:58 +02:00
parent cb03e1f91f
commit fd004988d6
3 changed files with 48 additions and 2 deletions

View File

@ -10,10 +10,12 @@ CONFIG += c++17
SOURCES += \ SOURCES += \
main.cpp \ main.cpp \
mainwindow.cpp mainwindow.cpp \
step.cpp
HEADERS += \ HEADERS += \
mainwindow.h mainwindow.h \
step.h
FORMS += \ FORMS += \
mainwindow.ui mainwindow.ui

22
step.cpp Normal file
View File

@ -0,0 +1,22 @@
#include "step.h"
Step::Step() {
latitude = 0.0;
longitude = 0.0;
response = 0;
}
Step::Step(QTextStream &in)
{}
void Step::setLatitude(int degree, float minute, QChar NS)
{
latitude = degree + minute / 60.0;
if (NS.toUpper() == 'S')
latitude = -latitude;
}
void Step::setLongitude(int degree, float minute, QChar EW)
{
longitude = degree + minute / 60.0;
if (EW.toUpper() == 'W')
longitude = -longitude;
}

22
step.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef STEP_H
#define STEP_H
#include <QString>
#include <QTextStream>
class Step
{
private:
QString title;
float latitude;
float longitude;
QString text;
int response;
public:
Step();
Step(QTextStream &in);
void setLatitude(int degree,float minute,QChar NS);
void setLongitude(int degree,float minute,QChar EW);
};
#endif // STEP_H