Skip to content

Commit

Permalink
Adding RMV.de for southern/central Hesse, Germany
Browse files Browse the repository at this point in the history
Adding support for Rhein-Main-Verkehrsverbund (RMV), the transport
network serving the Frankfurt metropolitan area in southern and
central Hesse, Germany.

The implementation is actually quite simple, as RMV uses HAFAS,
inheriting and specializing the existing ParserHafasXml class.
  • Loading branch information
thfi committed Aug 28, 2016
1 parent c46dd81 commit 7c55711
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fahrplan2.pro
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ HEADERS += \
src/parser/parser_salzburg_efa.h \
src/parser/parser_resrobot.h \
src/parser/parser_finland_matka.h \
src/parser/parser_xmlrmvde.h \
src/models/backends.h
SOURCES += src/main.cpp \
src/parser/parser_hafasxml.cpp \
Expand Down Expand Up @@ -157,6 +158,7 @@ SOURCES += src/main.cpp \
src/parser/parser_salzburg_efa.cpp \
src/parser/parser_resrobot.cpp \
src/parser/parser_finland_matka.cpp \
src/parser/parser_xmlrmvde.cpp \
src/models/backends.cpp

LIBS += $$PWD/3rdparty/gauss-kruger-cpp/gausskruger.cpp
Expand Down
1 change: 1 addition & 0 deletions src/fahrplan_backend_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ QStringList FahrplanBackendManager::getParserList()
result.append(ParserSalzburgEFA::getName());
result.append(ParserResRobot::getName());
result.append(ParserFinlandMatka::getName());
result.append(ParserXmlRMVde::getName());

// Make sure the index is in bounds
if (currentParserIndex > (result.count() - 1) || currentParserIndex < 0) {
Expand Down
3 changes: 3 additions & 0 deletions src/fahrplan_parser_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ void FahrplanParserThread::run()
case 15:
m_parser = new ParserFinlandMatka();
break;
case 16:
m_parser = new ParserXmlRMVde();
break;
}

m_name = m_parser->name();
Expand Down
1 change: 1 addition & 0 deletions src/fahrplan_parser_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "parser/parser_salzburg_efa.h"
#include "parser/parser_resrobot.h"
#include "parser/parser_finland_matka.h"
#include "parser/parser_xmlrmvde.h"

class FahrplanParserThread : public QThread
{
Expand Down
31 changes: 31 additions & 0 deletions src/parser/parser_xmlrmvde.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "parser_xmlrmvde.h"

#include <QNetworkReply>

ParserXmlRMVde::ParserXmlRMVde(QObject *parent) :
ParserHafasXml(parent)
{
baseXmlUrl = QLatin1String("http://www.rmv.de/auskunft/bin/jp/query.exe");
baseUrl = QLatin1String("http://www.rmv.de/auskunft/bin/jp/query.exe");
}

void ParserXmlRMVde::parseStationsByName(QNetworkReply *networkReply)
{
const QString data = QString::fromUtf8(networkReply->readAll());
const StationsList result = internalParseStationsByName(data);
emit stationsResult(result);
}

QString ParserXmlRMVde::getTrainRestrictionsCodes(int trainrestrictions)
{
Q_UNUSED(trainrestrictions)
// TODO should something else get returned?
return "1111111111111111";
}

QStringList ParserXmlRMVde::getTrainRestrictions()
{
QStringList result;
result.append(tr("All"));
return result;
}
41 changes: 41 additions & 0 deletions src/parser/parser_xmlrmvde.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/****************************************************************************
**
** This file is a part of Fahrplan.
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License along
** with this program. If not, see <http://www.gnu.org/licenses/>.
**
****************************************************************************/

#ifndef PARSER_XMLRMVDE_H
#define PARSER_XMLRMVDE_H

#include "parser_hafasxml.h"

class ParserXmlRMVde : public ParserHafasXml
{
Q_OBJECT

public:
explicit ParserXmlRMVde(QObject *parent = 0);
static QString getName() { return QString(QLatin1String("%1 (rmv.de)")).arg(tr("Germany, Hesse")); }
virtual QString name() { return getName(); }
virtual QString shortName() { return QLatin1String("rmv.de"); }

protected:
void parseStationsByName(QNetworkReply *networkReply);
QStringList getTrainRestrictions();
QString getTrainRestrictionsCodes(int trainrestrictions);
};

#endif // PARSER_XMLRMVDE_H

0 comments on commit 7c55711

Please sign in to comment.