-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainconsole.cpp
45 lines (40 loc) · 1.61 KB
/
mainconsole.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "mainconsole.h"
#include <QFile>
#include <QCoreApplication>
MainConsole::MainConsole(QStringList options, QObject *parent) :
QObject(parent),
converter(new FultonCountyConverter(parent))
{
while (!options.isEmpty()) {
QString option = options.takeFirst();
QStringList params = option.remove("--").split('=');
if (params.size() == 2) {
QString variable = params.at(0);
if (variable == "address") {
converter->setAddresses(params.at(1));
} else if (variable == "building") {
converter->setBuildings(params.at(1));
} else if (variable == "output") {
output = params.at(1);
} else if (variable == "zip-code") {
converter->setZipCodes(params.at(1));
} else if (variable == "tax-parcel") {
converter->setTaxParcels(params.at(1));
} else if (variable == "bbox") {
QStringList coords = params.at(1).split(",");
double top = coords.at(0).toDouble();
double left = coords.at(1).toDouble();
double bottom = coords.at(2).toDouble();
double right = coords.at(3).toDouble();
converter->setBoundingBox(top, left, bottom, right);
}
}
}
converter->setLogOptions(FultonCountyConverter::All);
converter->convert();
connect(converter, SIGNAL(conversionFinished()), this, SLOT(onConversionCompleted()));
}
void MainConsole::onConversionCompleted() {
converter->writeChangeFile(output);
QCoreApplication::quit();
}